Posts

Showing posts from May, 2013

OpenGL (libgdx) - blending alpha map -

i trying blend white texture varying alpha values colored background. expecting result retain colors background, , have alpha values replaced ones blended texture. so, background use: gdx.gl.glenable(gl20.gl_blend); gdx.gl.glblendequationseparate(gl20.gl_func_add, gl20.gl_func_add); gdx.gl.glblendfuncseparate(gl20.gl_one, gl20.gl_zero, gl20.gl_one, gl20.gl_zero); i expect background triangles mesh override destination, both color , alpha. question 1 - why blendfunc parameters, alpha value being ignored? if set blendfunc gl_one, gl_one, gl_zero, gl_zero filled mesh rendered proper alpha level - both source , dest alpha supposed multiplied 0 - why work? ==== now blend alpha map use: gdx.gl.glblendequationseparate(gl20.gl_func_add, gl20.gl_func_add); gdx.gl.glblendfuncseparate(gl20.gl_zero, gl20.gl_one, gl20.gl_one, gl20.gl_zero); question 2 - supposed keep destination color , replace alpha. however, when render texture blendfunc params, no change output @ all... i...

java - Recover username and password with spring security -

i using spring security web application. in phase of recovering username , password . the use case: when user forgets password , can't login. how send request spring through spring security ? the problem spring security doesn't let pass unless logged in , authenticated . i using following in config: @override public void configure(websecurity web) throws exception { web.ignoring().antmatchers("/loginrecover/**"); } which think totally outside security , vulnerable. is there other way achieve this? i use: @override protected void configure(httpsecurity http) throws exception { http.authorizerequests().antmatchers("/loginrecover").permitall() ...} with permitall not disabling security filters. spring security related functionality still available. with ignoring() disable security filter chain request path. spring security features not available. java configuration security "none". this shoul...

css - Accessing less properties -

i'm sorry, think it's been asked, don't know keywords should use, i'm new less. i need : .class1 { top: 10%; height: 20% } .class2 { top: .class1->top + .class1->height + 10%; height: class1->height; } is possible without defining variables such @class1top , @class1height ? thanks answers, or redirection question if can find one have day :)

c++ - What does a compiler check for uninstantiated template code? -

for example, following code piece compiles gcc-4.9 , clang-602 class base { public: static void foo() {} void badfoo(int i) {} }; template <typename t> class derived : public base { public: void bar() { base::foo(); } void badbar() { base::badfoo(...

javascript - How to drop photo -

i making puzzle jquery. use drag , drop. there better way? want link pieces place drop them. specific puzzle piece linked specific drop place. don't know how have that. problem when drop piece , take drop another, doesn't work. have refresh page can drop again, there solution this? <script> $(document).ready(function() { $("button").button({icons: { primary: "ui-icon-gear" }}); $("img").draggable() }); $(function() { $( "#droppable" ).droppable({ drop: function( event, ui ) { $( ) .addclass( "ui-state-highlight" ) .find( "img" ) ; } }); }); </script> <body> <img class="puz1.1"src="images/1.1.1.png"> </img> <img class="puz1.1"src="images/1.1.2.png"> </img> <img class=...

javascript - Using React's shouldComponentUpdate with Immutable.js cursors -

i'm having trouble figuring out how short circuit rendering branch of tree of react components using immutable.js cursors. take following example: import react 'react'; import immutable 'immutable'; import cursor 'immutable/contrib/cursor'; let data = immutable.fromjs({ things: [ {title: '', key: 1}, {title: '', key: 2} ] }); class thing extends react.component { shouldcomponentupdate(nextprops) { return this.props.thing.deref() !== nextprops.thing.deref(); } handlechangetitle(e) { this.props.thing.set('title', e.target.value); } render() { return <div> <input value={this.props.thing.get('title')} onchange={this.handlechangetitle.bind(this)} /> </div>; } } class container extends react.component { render() { const cursor = cursor.from(this.props.data, 'things', newthings => { data.set('things', newthings); ...

php - ZF2 Dependency Injection onto Controller objects without the Service Locator -

i have been doing read on zf2 service locator component , understand how being used. have, however, question think silly wouldn't hurt ask. i want have namespace inside module called component can put generic code in functionscomponent.php, mailercomponent.php or excelcomponent.php. allow me stuff inside controllers. what tryout have ability have controllers define components interested use (see below): class salescontroller extends abstractcontroller { protected $components = ['excel']; //in action public function exportaction() { $data = ['data exported']; /** $data : data exported boolean : whether force download or save file in dedicated location */ $this->excel->export($data, true); } } the idea create componentcollection perhaps implements factoryinterface or servicelocatorinterface , let check each controller when mvcevent has been triggered inside module class , have componentcollection inject controll...

javascript - Adding grid when the button clicked -

$("#add").click(function () { debugger; $('#save2').show();`c#` $.ajax({ type: "post", url: "branch_audit_summary.aspx/addempdetails", data: "", contenttype: "application/json; charset=utf-8", cache: false, success: function (jsondata) { if (jsondata == undefined) { return; } var data = json.parse(jsondata.d); var m = data.length; (var = 0; < m; i++) { var rowid = jquery("#list4").getdataids().length; jquery("#list4").addrowdata(rowid + 1, data[i]); } } }); }); the grid not adding when click. what jsondata returning...? sending server..? looks nothing. data: "", you should send error response instead have if (jsondata == undefined) { return; }

C RbPi UART Remote Control Sockets -

i want remote control sockets in room manual without library on raspberry pi. want use uart interface in c. socket has 433 mhz receiver , use 433 mhz transmitter. in other librarys type this: send 11111 1 1. (socket code, socket number, condition). how format command in c write() function? 10 number of characters. use code below. tested output via minicom, works fine. how receiver knows adressed? #include <stdio.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <termios.h> int main(int argc, char ** argv) { int fd; // open port. want read/write, no "controlling tty" status, , open i$ fd = open("/dev/ttyama0", o_rdwr | o_noctty | o_ndelay); if (fd == -1) { perror("open_port: unable open /dev/ttyama0 - "); return(-1); } // turn off blocking reads, use (fd, f_setfl, fndelay) if want fcntl(fd, f_setfl, 0); // write port int n = write(fd,"11111 1 1...

php - How to get records from the table which is not available in other table? -

i have 2 tables namely roominfo , guestrecordtransac...roominfo containd room_id,room_no , roomtype fields whereas guestrecordtransac contains id,roomtype,roomno ,checkindate ,checkoutdate fields i tried this select room_no roominfo room_no not in (select roomno guestrocordtransac roomtype='".$roomtype."' between '".$check_in."' , '".$check_out."' ) , roomtype='".$roomtype."' i want room_no roominfo of particular type , not between date of checkin andd checkout (your question not clear, try give information more clearly) i think require/asking : select room_no roominfo room_no not in (select roomno guestrocordtransac roomtype='".$roomtype."' , curdate() between '".$check_in."' , '".$check_out."`'

gwt - How can I localize the text used as tool tips of vaadin richtext area? -

in official documentation suggested use css localizing tool tips of vaadin richtext area , says: localizing richtextarea toolbars the rich text area 1 of few components in vaadin contain textual labels. selection boxes in toolbar in english , can not localized in other way inheriting or reimplementing client-side vrichtexttoolbar widget. buttons can localized css downloading copy of toolbar background image, editing it, , replacing default toolbar. toolbar single image file individual button icons picked, order of icons different rendered. image file depends on client-side implementation of toolbar. .v-richtextarea-richtextexample .gwt-togglebutton .gwt-image { background-image: url(img/richtextarea-toolbar-fi.png) !important; } i've downloaded toolbar background image. question how can localize string used tool-tips of rich text area tool bar? or there vaadin add-ons can used replacement of rich text area language local...

Can i create multiple Today extensions for the same containing app in ios -

can create multiple today extensions same containing app in ios? apple allows multiple today extensions shown single app in today view as turns out can create multiple extensions single containing app ,even 2 today extensions same app.

c# - How to set a One-Time only event using DDay iCal -

i trying setup one-time event using dday ical library. the frequencytype lists following: public enum frequencytype { none = 0, secondly = 1, minutely = 2, hourly = 3, daily = 4, weekly = 5, monthly = 6, yearly = 7, } currently in application user given options creating one-time or daily events. for daily job: frequencytype.daily and code: event evt = ical.create<event>(); recurrencepattern rp = new recurrencepattern(frequencytype); evt.recurrencerules.add(rp); i have removed other details brevity. how go setting one-time event?

postgresql - rake db:create ignores database.yml content -

i using napa framework. rake db:create gives me following error: pg::connectionbad: fe_sendauth: no password supplied investigating problem found rake tries create database using system user rather 1 specified within database.yml removing database.yml gives 'file not found', looks read properly. my database.yml content: defaults: &defaults encoding: unicode adapter: postgresql host: localhost username: pushnote password: secret123 production: <<: *defaults database: pushnote_production development: <<: *defaults database: pushnote_development test: <<: *defaults database: pushnote_test staging: <<: *defaults database: pushnote_production anyone can that? use newest napa code git instead of relaying on what's inside gem :) for example, in gemfile add this: gem 'napa', :git => 'https://github.com/bellycard/napa.git'

ios - Table Header View Auto Size when hide sub view -

Image
i have placed attached view inside tableheaderview. when there change in template based on sms view 1 and/or email view 2 hide un hide. want should resize tableheaderview based on visible view. have set constraints not resizing headerview. can guide me wrong?

How to create a dymanic function in ASP.NET MVC with Web API and EF -

sorry , english isn't , try use code tell need.in format situations,i create 2 controller when have 2 models**(ex: users/product)** , following var serializer = new javascriptserializer(); var users= new users() { id = 1}; var jsontext = serializer.serialize(users); var client = new httpclient(); client.baseaddress = new uri("http://localhost:65370/"); client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json")); stringcontent content = new stringcontent(jsontext, encoding.utf8, "application/json"); /////////////// var = client.postasync("api/users", users, new jsonmediatypeformatter()).result; (client) var b = client.postasync("api/product", product, new jsonmediatypeformatter()).result; (client) and when users , product controllers created post code should following public ihttpactionresult postusers(users aa) {} (server) public ihttpactionresult postproduct(product ...

css - EM or Percentages for Responsive Website? -

currently have completed website isn't responsive of values things using pixels 1 or 2 using percentages , em. my question is, should convert pixel values percentages or em values? 1 or other make difference. first time making website responsive still sort of confused on subject following tutorial: http://www.techrepublic.com/blog/web-designer/how-to-get-started-with-responsive-web-design/ any appreciated thanks try use % can width use main container or div use min-width and max-width , keep font sizes on px or em don't change values % .

javascript - jQuery pagination next and previous buttons are not working -

please me custom dynamic pagination next , previous. here work available in example. have given in static page. actually, trying dynamic page. please guide me pagination <table id="mytable"> <thead> <tr> <th>s.no</th> <th>category</th> <th>product</th> <th>price</th> <th>status</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>clothing</td> <td>north jacket</td> <td>$189.99</td> <td>in-stock</td> </tr> <tr> <td>2</td> <td>shoes</td> <td>nike</td> <td>$59.99</td> <td>in-stock</td> </tr> <tr> <td>3</td> <td>electronics</td> <...

php - MYSQL query with session variable -

the following query returns records of clients, session $_session['client_id'] value 3 . query works fine returns records of clients . want apply session value on select clauses . select mrk_lat,client_id,mrk_lng ,engine_status ,created_date,live_fuel, (select count(driver_id) we_drivers) total_drivers, (select count(veh_id) we_vehicles) total_veh, (select count(veh_status) we_vehicles veh_status=1) run_veh, (select count(veh_status) we_vehicles veh_status=0) stop_veh, (select client_id we_clients client_id =" . $_session['client_id'] . ") `we_vehicles_coordinates`

Sorting multidimensional vectors -

if have set of k vectors of n dimensions, how can sort these such distance between each consecutive pair of vectors minimal possible? distance can calculated using euclidian distance, how "sorting" implemented in effective manner? i'm thinking 1 approach select vector @ random, calculate distance other vectors, pick vector minimizes distance next vector , repeat until vectors have been "sorted". however, greedy search render different results depending on vector start with. any ideas on how this? if want 'that distance between each consecutive pair of vectors minimal possible' without randomness, can firstly find 2 closest points (by o(n log n) algo this ) - let's say, p , q, search closest points p (let's say, r) , q (let's say, s), compare distance (p,r) , (q,s) , if first smaller, start q,p,r , use greedy algo (in other case, obviously, start p,q,s). however, if goal arrange points sum of paired distances smallest, shou...

python - Loading all images using imread from a given folder -

loading , saving images in opencv quite limited, so... preferred ways load images given folder? should search files in folder .png or .jpg extensions, store names , use imread every file? or there better way? why not try loading files in folder? if opencv can't open it, oh well. move on next. cv2.imread() returns none if image can't opened. kind of weird doesn't raise exception. import cv2 import os def load_images_from_folder(folder): images = [] filename in os.listdir(folder): img = cv2.imread(os.path.join(folder,filename)) if img not none: images.append(img) return images

stdstring - C++ Multiple delimiters with more than one char -

in c++, i'm having trouble coding multiple delimiters single char delimiters , string delimiters (e.g. "<=" delimiter opposed '='). code below works single char delimiters (i've set delimiters space, comma, dot, plus , equal) , separates words in string line nicely. however, don't know how add string delimiters code. std::string delimiters = " ,.+=";//i want "<=" added single delimiter std::string line = "this+is,a.string=testing one"; std::size_t prev = 0, pos; while ((pos = line.find_first_of(delimiters, prev)) != std::string::npos) { if (pos > prev) { cout << line.substr(prev, pos-prev) << endl; prev = pos + 1; } } if (prev < line.length()){ cout << line.substr(prev, std::string::npos) << endl; } here 1 way erasing delimiters find line_copy string, having special if statement special delimiter. full example here : auto pos = find_first_...

c# - How to debug or break a hung thread in Visual studio 2012? -

one of threads got hung while running application , wanted break thread , move ahead execution. question may seem little confusing can please me out on ? visual studio : debug : attach process

mysql - ER Diagram based on multiple databases & tables which derive names from column values from other table -

so have learning management system. there total 5 databases. lms_data_db lms_course_db lms_test_db ..n 2 more now whenever row added under lms_data_db.course_data course_id=200 , table named course_200 created under lms_course_db . likewise when row added under lms_course_db.course_100 chapter_id=100 , table named chapter_200_100 created under lms_test_db . my question how put in erd!? deriving erd existing implementation reverse engineering. can term more reading. if agree doing reverse engineering, should pay attention commentary provided @pala_ on design of original db. i suggest entirely different approach, based on forward engineering. start subject matter. analyze subject matter entities , relationships between entities. discover attributes describe these entities , relationships means of data values. these data values database going store. the above process yields er model , erd depicts subject matter, rather proposed solution. then can proc...

VBScript - "\n" in file path -

Image
i want show "c:\project\ndev" message box result print "\n" new line, hence actual result "c:\project" + new line + "dev" know how treat case? i've spent time still have no solution. i have tried 2 variations on calling msgbox function on windows 8 box. option 1 - using sub procedure x=msgbox("c:\project\ndev",0,"your drive letter information") result option 2 - use plain msgbox call. msgbox("c:\project\ndev") result:

amazon s3 - Downloading object from S3 through rails not knowing the exact key -

i have simple rails application user can upload , download file s3. example: in /avatar/caid/uuid , there 1 file named uuid.png uploaded user. next, user must able download particular file s3, however, @ time, doesn't know exact name of file saved in s3. knows file save in /avatar/caid/uuid . question how can download file /avatar/caid/uuid folder? tried option below: resp = s3.get_object( bucket: "xxx", key: "avatar/123/456/pic.bmp", ) however, option above assumes have know exact name of file pic.bmp . may know how can download file pic.bmp knowing url" "avatar/123/456" ? thanks

r - Unlist data.frame column of individual lists and preserve each cell as a vector -

first time posting apologies if doesn't meet standards! i'm working on simulation in i'm using cut() create ordinal variables drawn multivariate normal distribution. i'm attempting create data.frame using expand.grid() containing of conditions , run mdply() 'sew together.' particular column in df df$k , contains vectors of cut points fed cut() : n <- c(25,50) p <- c(0,.1) k <- list(c(-inf,0,inf), c(-inf,-1,1,inf)) factors <- list(n=n, p=p, k=k) df <- expand.grid(factors) fx <- function(n, p, k){ data <- mvrnorm(n,c(0,0),matrix(c(1,p,p,1),2,2)) x <- cut(data[,1],k) y <- cut(data[,2],k) dat <- cbind(x,y) } my issue although table of conditions looks correct, df$k list of 8 lists, , when fed mdply() gives error: error: (list) object cannot coerced type 'integer' (i'm assuming that's why error popping up.) i'd unlist each cell each cell vector c(-inf, 0, inf) . df now, believe solve pr...

android - Genymotion: "The specified virtual device was not found in VirtualBox list" -

Image
one day tried launch genymotion virtual device , got: everything used work fine. haven't done update. use genymotion 2.3.1 , oracle virtualbox 4.3.12 on windows 7 sp1 x64 ultimate. have caused issue arise, , how fix it? my configuration: when tried launch vm virtualbox, get: failed open session virtual machine samsung galaxy s5 - 4.4.4 - api 19 - 1080x1920. vm session closed before attempt power on. result code: e_fail (0x80004005) component: sessionmachine interface: isession {12f4dcdb-12b2-4ec1-b7cd-ddd9f6c5bf4d} @frank, your vm in saved stated. need turn powered off state or discard saved state via virtual box app. for more info, refer geny motion not start

hadoop - How can we pass List<Text> as Mapper output? -

i working on problem of map-reduce. stuck @ 1 point how can pass list<text> mapper output ? possible or not? if yes, how can tell configuration mapper output class ? you may use arraywritable class value object mapper class. please refer below code snippet mapper class, arraywritable arraywritable = new arraywritable(text.class); text [] textvalues = new text[2]; textvalues[0] = new text("value1"); textvalues[1] = new text("value1"); arraywritable.set(textvalues ); context.write(key , arraywritable ); set value class following in driver class, job.setmapoutputvalueclass(arraywritable.class);

ssl - Encrypt data with using public key file in C language -

i need pass data server2.c through server1.c in middle. before calling ssl_write() want encrypt data using public key file pubkey.pem of server2.c server1.c cannot understand data , writes server2.c what system call should use takes data , public key file arguments? what system call should use takes data , public key file arguments? in c language openssl, there no arguments in program argc , argv . there functions , parameters. in openssl, use evp functions it. in particular, evp_seal encrypt , evp_open decrypt using public key cryptography. see evp(3) man pages more details. or see openssl's evp wiki page details. there evp_encrypt , evp_decrypt functions, used symmetric key encryption, , not public key encryption.

oracle - Incrementing a sequence by 1000 each persist of a new Entity -

we have jdbc legacy code converting jpa, used ids oracle using select business_object_seq.nextval dual; sequence specified create sequence business_object_seq increment 1000 start x; x being integer less 1000 matching node id of system. ie node 3, calls next id 1003, 2003, 3003, etc my converted entity follows @entity @table(name="business_object") @sequencegenerator(name="business_object_seq", allocationsize = 1000) public class businessobject implements serializable { private int id; @id @generatedvalue(strategy=generationtype.sequence, generator="business_object_seq") public int getid() { return id; } public void setid(int id) { this.id = id; } // other methods } but entities(on node 3) created ids 3, 4, 5. without creating custom sequence generator ( link -> customsequence ) possible have sequencegenerator behave way? cheers adam if specify allocation size of 1000, telli...

How to stream records from a web service in a spring batch like JDBCCursorItemReader -

use case read large set of data rest web service, list of million objects, process them , write them somewhere. issue not want read data web service in 1 go. read subset of total results web service,a few records/objects @ time, not run risk of running out of memory reading data in 1 go spring batch reader. there way this? spring batch provides itemreaderadapter reading external service (as opposed database or flat file) nothing special except giving support delegating calls. jdbccursoritemreader reads, or rather streams db instead of reading @ once. http://forum.spring.io/forum/spring-projects/batch/73040-default-webservice-reader-implementation here talk lack of reader web services. https://stackoverflow.com/a/25025898/153940 mentions how spring batch doesn't have web service itemreader you correct in spring batch not provide web service itemreader implementation. reason definition of "web service" bit vague able standardize reader around. that ...

javascript - Angular JS Parameter is undefined -

hello having trouble when passing parameter function called addtohistory(param). when try write console says undefined, when try pass number gets correctly displayed on console. $scope.addtohistory = function(title) { console.log(" " + title); //<-- undefined $scope.taskshistory.push({ info: title, measured: "measured", total: "total", done: 0, id: 2 }); }; <ion-item ng-repeat="task in taskscollection" ng-controller="historyctrl" ng-click="addtohistory({{task.info}})" href="#/app/history/{{task.id}}"> {{task.info}} <!-- <i class="icon ion-plus icon-right" ></i> --> </ion-item> ng-click="addtohistory(task.info)" remove brackets in function call

android batch uninstall apps -

1.i want uninstall multiple apps once . 2.so this,the code try: intent = new intent(intent.action_delete, uri.parse(new stringbuilder(32).append("package:").append(packagename).tostring())); i.addflags(intent.flag_activity_new_task); context.startactivity(i); i make cycle execute code. can uninstall 1 app ,the others not work.

Using jQuery and JavaScript to create rows and cells in an HTML table -

i've been browsing around google , stack overflow find answer, i'd direct answer question, post. so, i'm new javascript , jquery, pardon ridiculousness haha. $(document).ready(function(){ getgridsize(); }); function getgridsize() { sizewidth = parseint(prompt("width?")); sizeheight = parseint(prompt("height?")); fillgrid(sizewidth, sizeheight); } function fillgrid(width, height) { (i = 0; < height; i++) { $('table').append("<tr></tr>"); (j = 0; j < width; j++) { $('tr').append("<td><div></div></td>") }; }; } the above have in .js file currently. i'm using skeleton html file empty <table> </table> in body. what i'm trying create "width" , "height" of table , fill in <div> in each cell. have css file change <div> files small squares black borders. i saw tutorial helping develop...

Custom table sort using jquery or Javascript -

i have following table 3 columns (id, date, , source). want sort table based on source column . i don't want sort either alphabetic or numeric. want them sorted rows on sources appear first in table, after rows mb source, , on using either javascript or jquery . searched threads related sorting. failed solve problem. new please me done. appreciated. <table> <tr> <th>id</th> <th>date</th> <th>source</th> </tr> <tr> <td>50</td> <td>2012-01-01</td> <td>on</td> </tr> <tr> <td>94</td> <td>2013-06-05</td> <td>mb</td> </tr> <tr> <td>80</td> <td>2011-07-08</td> <td>ab</td> </tr> <tr> <td>50</td> <td>2012-01-01</td> <td>on</td> </tr> <tr> <td>50...

actionscript 3 - SQLite and Adobe AIR - no utf-8 characters -

i have problem data want fetch sqlite database in adobe air application. use javascript. in sqlite3 cli when use query: select * notes; result: cześć|8 boa noite|12 até logo|13 but when want data in air using: dbquery = new air.sqlstatement(); dbquery.sqlconnection = db; dbquery.text = "select hello, id sometable"; i have that: cze|8 boa noite|12 @ logo|13 all specific characters removed. where problem , how can resolve it? i discovered problem. i added new entities using sqlite3 cli , values inserted in wrong encoding, because when inserted values "łąśćźóż" using air adobe application or importing data database: sqlite3 test.db < test.sql values saved in correct encoding , when them application, displayed in correct encoding.

Removing all whitespace from a string in Ruby -

how can remove newlines , spaces string in ruby? for example, if have string: "123\n12312313\n\n123 1231 1231 1" it should become this: "12312312313123123112311" that is, whitespaces should removed. you can use like: var_name.gsub!(/\s+/, '') or, if want return changed string, instead of modifying variable, var_name.gsub(/\s+/, '') this let chain other methods (i.e. something_else = var_name.gsub(...).to_i strip whitespace convert integer). gsub! edit in place, you'd have write var_name.gsub!(...); something_else = var_name.to_i . gsub works replacing matches of first argument contents second argument. in case, matches sequence of consecutive whitespace characters (or single one) regex /\s+/ , replaces empty string. there's block form if want processing on matched part, rather replacing directly; see string#gsub more information that. the ruby docs class regexp starting point learn more regular expressi...

javascript - How to update current values inside an angular.forEach()? -

i trying convert portion of object's values integer values 1 or 0 boolean values true or false. the structure follows: angular.foreach(a.b.c, function (options) { ... angular.foreach(options, function (value, option) { if (value == 0) { option = false; } else { option = true; } console.log(option + " = " + value); // shows correct results; } } console.log(a.b.c) // when navigating options, options have not changed integer values. what missing? you changing value of local variable false/true, not changing value of object. var array = [{ key: 1 }, { key: 0 }]; angular.foreach(array, function(options) { angular.foreach(options, function(value, option) { if (value == 0) { options[option] = false; } else { options[option] = true; } //the if else can simplified //options[option] = value != 0; console.log(option + " = " +...

javascript - vertically centring relative position + unknown height -

i have 2 columns in wp site. 1 has text/content other background image. both relatively positioned , heights unknown. html (using twitter - bootstrap 3 markup ) <article> <div id="...removed php code "> <div class="row"> <div class="col-md-8 indx-img" style="background-image:url('...');"> </div> <div class="col-md-4 text-cell"> <h1><?php the_title(); ?></h1> <h3><?php the_category(' '); ?></h3> </div> </div><!-- /row --> </article> css .indx-img { position: relative; padding: 16% 0; background-repeat: no-repeat; background-size: cover; background-position: center center; } .text-cell { position: relative; padding: 0 25px; margin: 0; } i want text-cell div vertically centered in column. height of column set adjac...

angularjs - http.jsonp coming back with cached data until manual page refresh -

my data supposed current time i've found when load new data in via $http.jsonp data comes in cached data every time. how can change unchached data every time? here's logic test: $http.jsonp("mydataurl?_jsonp=json_callback").success(function(data){ console.log(data); // logs 0.76608400 1431562002 (only updates when manually refresh page) }); php <?php echo $_get['_jsonp'] . "(" . microtime() . ")"; ?> edit the solution below helper did not solve issue. found code elsewhere specific application causing issue. regardless hope info else out. you can append random string @ end of url avoid caching. $http.jsonp("mydataurl?_jsonp=json_callback&random=123").success(function(data){ console.log(data); // logs 0.76608400 1431562002 (only updates when manually refresh page) }); just make sure random has different value everytime. can use date on query "mydataurl?_jsonp=json_callback&rand...

java - "int cannot be dereferenced" in some calculation methods -

so, had spent while writing calculation methods import numbers in preview battle window in rpg i'm trying out make(anyone remember fire emblem? it's sort of simplified version of that). here try form jtable these c public static jtable getbattledatatable(rpgchar attacker, rpgchar defender){ string[] top={attacker.getcharactername(), "", defender.getcharactername()}; string[][] battledata=new string[3][3]; battledata[0][0]="health"; battledata[0][1]=attacker.gethealth(); battledata[0][2]=defender.gethealth(); battledata[1][0]="hit chance"; battledata[1][1]=calculatechanceofhitting(attacker, defender).tostring(); battledata[1][2]=calculatechanceofhitting(defender, attacker).tostring(); battledata[2][0]="damage"; battledata[2][1]=calculatepotentialdamage(attacker, defender).tostring(); battledata[2][2]=calculatepotentialdamage(defender, attacker).tostring(); jtable battletable=new jtable(batt...

How to use Azure service bus topics & Subscriptions to load balance messages -

in reading many msdn pages azure service bus, alludes ability set "load balancing" pattern "topic/subscription" model, never says how done. my question is, possible. essentially, looking create topics have possible n number of subscribers dynamically ramped , down, based upon incoming load. so, not using traditional "multicast" pattern round robining messages subscribers. reason want use pattern want take advantage of rules , filtering reside in topics , subscriptions, while allowing dynamic scaling. any ideas?

Android navigation drawer shadow on inside -

is there quick way render shadow navigation drawer creates on inside of draw, rather on main content? kinda make drawer under main content, rather over. i thought there might easy way using setdrawershadow() don't know. use slidingmenu or implementing custom sliding menu.

Generic wildcards in java. Compile error. -

i have following java code: box<? extends integer> = new box<integer>(); i.set(10); . why not compile? because box<? extends integer> can box<somesubtypeofintegernotincluding10> . want box<integer> instead.

d3.js - Data labels on the bars -

i have been trying data labels appear on bars of d3 chart have built. no joy. have tried svg.selectall("text")... no error , no labels. i have created codepen example function arbbymonthdashboard2(targetdiv, monthtoreport) { var color_hash = { 1 : ["january", "green"], 2 : ["february", "orange"], 3 : ["march", "aquamarine"], 4 : ["april", "blue"], 5 : ["may", "yellow"], 6 : ["june", "silver"], 7 : ["july", "antiquewhite"], 8 : ["august", "cyan"], 9 : ["september", "blueviolet"], 10 : ["october", "black"], 11 : ["november", "cadetblue"], 12 : ["december", "re...

java - Maven share sources in modules with custom resources -

i have maven project should output 3 jar files. of them share same sources have different resources. my project structure this: project/ +-- src/main/java - sources folder +-- src/main/resources - shared resources (some images) +-- pom.xml +-- modulea/ | +-- src/main/java - empty folder | +-- src/main/resources - custom resources | +-- pom.xml +-- moduleb/ | +-- src/main/java - 1 additional java class | +-- src/main/resources - custom resources | +-- pom.xml +-- c & d ... how make maven generate 4 jar files custom resources , merged java files? if resources override, possible make custom priority? i've tried using <build> <sourcedirectory>${parent.basedir}/src/main/java</sourcedirectory> </build> in child pom.xml didn't work update 1 so i've changed structure to: project/ +-- src/main/java - empty +-- src/main/resources - empty +-- pom.xml +-- coremodule/ | +-- src/main/java/ - shared sources | +-- src/m...

multithreading - Python websocket client send in run loop -

i'm piping stdin websocket using websocket-client . i'm connecting websocket this: ws = websocketapp('ws://example.com/websocket') ws.run_forever(ping_interval=15) run_forever starts infinite loop. i'd simultaneously read sys.stdin this: while true: try: line = sys.stdin.readline() ws.send(line) except keyboardinterrupt: break if not line: break is there way alternate between 2 loops threading? or approaching wrong way? this done tornado or twisted, i'd rather keep dependencies @ minimum if there's way standard lib.

c# - Is this a bug in the Oracle ODP.NET -

i'm curious if bug in oracle odp.net provider. created parameterized insert statement. named 1 of parameters ':empno' , when testing gave value of '8000'. in database empno column defined varchar2(4 byte). however, insert gave error message of ora-12899: value large column "hr"."hr_departure"."empno" (actual: 6, maximum: 4) here code snipets: "insert hr.hr_departure (empno) ':empno'" i add parameter new oracleparameter(":empno", oracledbtype.varchar2) {value = empno ?? convert.dbnull} create command , add parameter (there multiple parameters array) dbcommand cmd = connection.createcommand(); cmd.parameters.addrange(sqlparams.toarray()); i did research , considered things encoding , fact oracle defaults bind position (instead of bindbyname). however, none of these resolved issue. took shot in dark , changed parameter name ":empn" , got following error message: ora-1...

struct - C++ add up all bytes in a structure -

given packed struct this: struct rsdpdescriptor { char signature[8]; uint8_t checksum; char oemid[6]; uint8_t revision; uint32_t rsdtaddress; } __attribute__ ((packed)); how can sum of individual bytes in it? here code shows 2 ways it. the first way easier , more efficient, give wrong result struct doesn't have packed attribute (since incorrectly include padding bytes in tally). the second approach work on struct, padded or packed. #include <stdio.h> #include <stdlib.h> template<typename t> int countbytes(const t & t) { int count = 0; const unsigned char * p = reinterpret_cast<const unsigned char *>(&t); (int i=0; i<sizeof(t); i++) count += p[i]; return count; } struct rsdpdescriptor { char signature[8]; unsigned char checksum; char oemid[6]; unsigned char revision; unsigned int rsdtaddress; } __attribute__ ((packed)); int main(int, char **) { struct rsdpdescriptor x;...

elisp - emacs call-interactively and key simulation -

i want write small function saves cursor's current position, mark whole buffer, indents , goes previous cursor position. understand there might easier way achieve same result i'd understand how these principles work in elisp. here's tried : (defun indent-whole-buffer () (interactive) (call-interactively 'point-to-register) (call-interactively (kbd "ret")) (mark-whole-buffer) ...

pthreads - Correctly waiting for a thread to terminate in C -

this code plays sound clip creating thread it. when bleep() runs, sets global variable bleep_playing true. in main loop, if notices bleep_playing has been set false, terminates loop, cleans (closing files, freeing buffers), , exits. don't know correct way wait detached thread finish. pthread_join() doesn't job. while loop here continually checks bleep_id see if it's valid. when isn't, execution continues. correct , portable way tell thread clean , terminate before next thread allowed created? if (bleep_playing) { bleep_playing = false; while (pthread_kill(bleep_id, 0) == 0) { /* nothing */ } } err = pthread_create(&bleep_id, &attr, (void *) &bleep, &effect); i hmm... pthread_join should job. far remember thread has call pthread_exit ...? /* bleep thread */ void *bleep(void *) { /* bleeping */ pthread_exit(null); } /* main thread */ if (pthread_create(&thread, ..., ...

java - The Preview Doesn't Displayed At The Launching (Android Studio) -

i started learning android sdk , have problem. launched studio , android screen didn't show (yes, know preview tool bar , how switch). quote: "rendering problems following classes not found: - android.support.v7.internal.widget.actionbaroverlaylayout (fix build path, edit xml, create class) tip: try build project." *sometimes there rendering problem , showed : "rendering problems following classes not instantiated: - android.support.v7.internal.widget.actionbaroverlaylayout (open class, show exception, clear cache)" i'm pretty sure "appcompat_v7", automatically generated in eclipse when setting android project. imports unnecessary features , causes bunch of build errors. delete "appcompat_v7" folder go mainactivity delete import "android.support.v7.app.actionbaractivity"; change "mainactivity extends actionbaractivity" "mainactivity extends activity" add import android.app.acti...

octopus deploy - Get branch name from TeamCity build -

Image
i deploying nuget package result of teamcity feature branch build. build number format use includes branch name: 1.0.0.%build.counter%-%vcsroot.branch%. i need branch name @ octopus deploy side customize deploy. right way have branch name variable? we should able parse out package name , set octopus variable using this create variable create step extract nuget (no features) , powershell step use powershell set variable parsing version number of package hope helps

javascript - How to make user to paste only digits into a text area box? -

i have requirement make textarea field allow digits , enter keys can checked with, function validate(key) { // getting key code of pressed key var keycode = (key.which) ? key.which : key.keycode; var phn = document.getelementbyid('textarea'); // comparing pressed keycodes if ((keycode < 48 || keycode > 57) && keycode !== 13) { return false; } } <div> <textarea id="textarea" rows="4" cols="50" onkeypress="return validate(event)" /> </div> but functionality breaks if user copy-paste text area field . how can make user paste if has copied digits only, i.e 13131331 - should pasted 2wewewe12 - should not pasted i don't javascript. kindly suggest something? jquery reading input of pasted string: $input = $("textarea"); $input.on("input", function(){ var value = $(this).val(); if ( ! isnan(parsei...

How to access chrome developer tools for an android device connected to a remote machine? -

i have android device connected server in lab , want access chrome developer tools device laptop. how can ? went through https://developer.chrome.com/devtools/docs/remote-debugging seems work if device directly connected laptop. thanks in advance ! well, technically device has connected adb. can use app adb konnect , or open port via console , connect through network.

javascript - Dynamic content nullifying flexslider -

i'm using jquerydynamiccontent.js changes content dynamically , when calling page contains flexslider not. not appear. if put direct flexslider on index page works normal. can ? thank you. index.php <!doctype html> <html> <head> <title>epinox</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta charset="utf-8"> <meta name="keywords" content="ino, corrimão, guarda-corpo, suporte de mangueira, churrasqueira"> <meta name="description" content="confecções de peças sob medida em aço inox."> <link rel="shortcut icon" href="ico/favicon.ico" /> <script src="http://code.jquery.com/jquery.js"></script> <!-- le fav , touch icons --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-...

swift - Tableview estimated row height in ios 8 -

i using following code scrolldown tableview bottom: let numberofsections = tableview.numberofsections() let numberofrows = tableview.numberofrowsinsection(numberofsections-1) let indexpath = nsindexpath(forrow: numberofrows-1, insection: 0) tableview.scrolltorowatindexpath(indexpath, atscrollposition: .bottom, animated: true) it works unless use following line, code not working properly. tableview.estimatedrowheight = 44 how can solve problem ? it looks need set row height automatic dimensions. check out article http://natashatherobot.com/ios-8-self-sizing-table-view-cells-with-dynamic-type/ to set self-sizing cell, add autolayout cell, specify tableview’s estimatedrowheight, , set tableview’s rowheight uitableviewautomaticdimension (this default setting in future xcode6 versions). tableview.estimatedrowheight = 89 tableview.rowheight = uitableviewautomaticdimension

c# - How can I use Delay method and await? -

i want sequence in program take break while before going ahead next operation. this: string s = hd.text; if (s.contains("php")||s.contains("echo")) { hd.text = "this okay ?"; messagebox.show("its php ?","gus"); } i tried this: if (s.contains("php")||s.contains("echo")) { hd.text = "this php ?"; task.delay(timespan.fromseconds(10)); messagebox.show("its php ?","guss"); } but doesn't work. it's throwing exception below: cannot find type system.resources.resourceset in module mscorlib.dll as servy saying, need await task this: solution 1: public async task do() { if (s.contains("php")||s.contains("echo")) { hd.text = "this php ?"; await task.delay(timespan.fromseconds(10)); messagebox.show("its php ?","guss"); } } or wait task this. soluti...