Posts

Showing posts from September, 2014

visual studio 2010 - knockoutjs function is not invoke when button clicked -

i have 1 knockout view model function not invoke when clicking button. missing something. running code vs2010 ide. test same code in jsfiddle , working there when try run same code vs2010 ide not working. appreciated. thanks <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> #dash { max-height: 128px; overflow: hidden; } #dash div { border: 1px solid #de2345; padding: 4px; margin: 2px; line-height: 20px; box-sizing: border-box; } #dash div:before { content: '--> '; } </style> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-3.3.0.js"/> <script type="text/javascript"> function tabl...

javascript - Angularjs fastest way to find next td vertically in a big table -

i have special grid directive has lots of rows , can't paginated. each td has text input, on "enter key press" input below should focused(the input in td in next row same column). this using right : if (e.keycode == 13) {//enter input.blur(); var row = td.parent(); var nextrow = row.next(); if (nextrow.length) nextrow.children().eq(td.index()).find('input').focus(); else { row.parent()//tbody .children().eq(0)//first row .children().eq(td.index() + 1)//next column .find('input').focus(); } } is there faster way this? maybe pure js or full jquery ?

javascript - Responding to resize events in jQuery -

this i've tried: if (jquery(document).width() < 1024) { jquery('.anywhere_div').insertafter('#a_fixed_position_div'); } i don't know how write else because take div placed randomly on page , position under fixed div . i don't know put if resize window again. also how can add timer http://alvarotrigo.com/blog/firing-resize-event-only-once-when-resizing-is-finished/ wont use resources. thank in advance. well can use below: demo here , full screen demo here html <div id="a_fixed_position_div"> fixed div </div> <div class='originalplace'> original place <div class='anywhere_div'>anywhere div</div> </div> js $(window).on('resize',function(){ if ($(window).width() < 1024) { jquery('.anywhere_div').detach().insertafter('#a_fixed_position_div'); } else { jquery(".anywhere_div").detach().appendto('.ori...

ios - Unable to upload new build on iTunes Connect -

Image
i have gone through various similar questions asked here on stack overflow , on other blogs. unfortunately, none of solutions resolving issue. after doing lot of search & when not able solve issue, decided ask all. i explain scenario briefly. have uploaded ios application beta testing on itunes connect. app's current status in itunes connect "expired" 30 days testing period over. did few source code modifications , want make updated application available testers. therefore, tried upload new build version app. what did - app version (bundle versions string.short) - not modified (1.0) bundle version - modified "1.1" "1.1.1" build application submitted application - window -> organizer -> submit even though did properly, getting error in below - can of please me understand might doing mistake? appreciated. edit 1: i tried use build version 1.2/ 1.2.1 well. tried upload complete new app record in itunes connect app v...

php - mysql left join and return joined and unjoind -

i have 2 tables , want join b , eace join unjoind results table pixel +----+------------+------------+-------------------+--------+------+------------+ | id | account_id | project_id | uuid | name | type | date | +----+------------+------------+-------------------+--------+------+------------+ | 10 | 2 | 3 | e03aa~f86a1~7c661 | test 1 | 0 | 1420553362 | | 11 | 2 | 3 | a3e3b~b4182~da556 | test 2 | 1 | 1420553933 | | 9 | 1 | 1 | 57eae~e633c~b929f | test 3 | 1 | 1420041387 | +----+------------+------------+-------------------+--------+------+------------+ table pixel_tags +----+------------+-------------------+--------------+--------------+------------+ | id | project_id | pixel | tag | name | date | +----+------------+-------------------+--------------+--------------+------------+ | 6 | 0 | 57eae~e633c~b929f | facebook-cpc | facebook-cpc | 14200416...

javascript - jQuery Cookie not being set when followed by redirect -

this common question has more common answer, problem is, isn't working me. i'm using jquery.cookie.js plugin, , noticed there iss bug hindered setting cookies , redirect @ same time i'll point out i'm using local wamp server build this. i set cookie variable , redirect page per below code: $.cookie("test", "hola!", { expires: 1, path: '/' }); if ($.cookie("test")) { window.location.href = "./test.cfm"; } however, attempt redirect cookie not set. when remove redirect cookie set. i've tried multiple variations on theme, i've set ajax call server , set cookie there has same effect. i've used different methods of redirecting page same effect well. my issue seems stem including both setting of cookie , redirect together. extra info i'm using firebug see if cookies being set or not , sure i've set on redirect page (in coldfusion): <cfoutput> #cookie.test#...

Java Exception throw object and get object from catch -

i want pass object while getting exception , getting catch. have userdataexception extend exception throw new userdataexception("media uploaded failed",mediado, dupkexp); mediado object. if possible mediado object catch statement catch (userdataexception uexp) { } userdataexception calss : public class userdataexception extends exception { private static final string error = "database transaction error: "; private static final string dkerror = "duplicate key error"; /** * */ private static final long serialversionuid = 6209976874559850953l; /** * */ public userdataexception(string message, throwable throwable) { super(message, throwable); } public userdataexception(string message) { super(message); } /** * <code>userdataexception</code> thrown message , throwable object * * @param schdulerdata * @param message * @param throwable */ public userdataexception(string message, schedulerdata schdule...

c# - How to split elements of the group in many lists? -

i have a list (originallist) elements of type mytype. type is: mytype { long idreferenceelement; long idelement; string value; } so separate in lists each group of elements, each group has elements same idreferenceelement. for example, list of lists, each list of main list has elements of same group. list<list<mytype>> an example, have original list elements: item1(1,1,1); item2(1,2,2); item3(1,3,3); item4(2,4,4); item5(2,5,5); item6(2,6,6); item7(3,7,7); item8(3,8,8); item9(3,9,9); i 3 lists: list1 items: - item1(1,1,1); - item2(1,2,2); - item3(1,3,3); list2: - item4(2,4,4); - item5(2,5,5); - item6(2,6,6); list3: - item7(3,7,7); - item8(3,8,8); - item9(3,9,9); to it, trying that: list<list>> myresultlist = myoriginallist.groupby(x=>x.idreferenceelement).tolist(); it not work, because group element not list. know how access each group of grouping , covert list. thanks much. list<list<mytype>...

How to access Oracle database over network? -

i trying accessing oracle database on network. have google lot , found many solutions, doesn't work me. the problem that, want access oracle database 1 computer computer on local network. what did is.... i found solution modify listener.ora file (description=(address=(protocol=tcp)(host=dbp.devproject.com)(port=1521))) when modify file , tried run , access database nothing happens, , throws error, port number have specified used listener, have changed port number not able access database. 2. have configure new listener of oracle's tool net manager , made listener me, not make accessible database on network. here required results. lsnrctl status : listener using listener name listener has been started. connection string : jdbc:oracle:thin:@dbp.devproject.com:4541:mydb database version : oracle database 11g enterprise edition release 11.2.0.1.0 - 64bit production pl/sql release 11.2.0.1.0 - production core 11.2.0.1.0 production...

hadoop - Streaming HDFS data to Storm (aka HDFS spout) -

i know if there spout implementation streaming data hdfs storm (something similar spark streaming hdfs). know there bolt implementation write data hdfs ( https://github.com/ptgoetz/storm-hdfs , http://docs.hortonworks.com/hdpdocuments/hdp2/hdp-2.1.3/bk_user-guide/content/ch_storm-using-hdfs-connector.html ), other way around not find. appreciate suggestions , hints. an option use hadoop hdfs java api. assuming using maven, include hadoop-common in pom.xml: <dependency> <groupid>org.apache.hadoop</groupid> <artifactid>hadoop-common</artifactid> <version>2.6.0.2.2.0.0-2041</version> </dependency> then, in spout implementation use hdfs filesystem object. example, here pseudo code emitting each line in file string: @override public void nexttuple() { try { path pt=new path("hdfs://servername:8020/user/hdfs/file.txt"); filesystem fs = filesystem.get(new configuration()); bufferedrea...

javascript - Using CryptoJS for decryption after OpenSSL encryption -

i using openssl encrypt txt file, "hello world" inside, using following command @ terminal: openssl enc -aes-128-ctr -in file.txt -out file-out-64.txt -base64 -a -k 0123456789abcdef0123456789abcdef -iv 00000000000000000000000000000000` so, using aes-128 (ctr mode) dummy key , iv , generating base64 @ end, producing following output: mc6prldi+uuh5ko= i want decrypt cryptojs , using following code: cryptojs.aes.decrypt( "mc6prldi+uuh5ko=", cryptojs.enc.hex.parse("0123456789abcdef0123456789abcdef"), { iv : cryptojs.enc.hex.parse("00000000000000000000000000000000"), mode : cryptojs.mode.ctr } ); i expecting "hello world" output it's producing empty string result. can help? i found solution. in options parameter had add padding nopadding var decoded = cryptojs.aes.decrypt("mc6prldi+uuh5ko=", cryptojs.enc.hex.parse("0123456789abcdef0123456789abcdef"), { iv: cryptojs.enc.he...

php - Pre process file before file_get_contents -

i wondering, in php, if there way php pre-process file before writing string. example: have index.php, instantiates class calls file_get_contents depending on parameter has been passed in via .htaccess. i have variables in index.php such $error = 'this error'; in 1 of files i'm bringing file_get_contents , have: <?php if ($error): echo $error; endif; ?> of course not processed due file_get_contents literally writing content string. anyone got idea on how process php before bringing file, or bringing file php still in place? please not tell me use function include need write file string able perform str_replace on words. thanks. not sure why question got downvoted crazy... worked out after lot of searching. code needed was: ob_start(); include $this->templatedir . $this->theme . '/' . $page . '.php'; $pagecontent = ob_get_contents(); ob_end_clean(); thanks downvotes , attempts solve problem. appre...

angularjs - Lifecycle of angular controller -

i have angular controller angular.module('partherapp') .controller('myctrl', function ($scope) { $scope.logtoconsole = function() { console.log('here am.'); }; }); and view: <div ng-controller="myctrl"> {{logtoconsole()}} </div> when application get's opened in browser can see tree times 'here am.' . i'd expected once. ideas why happens? it expected behaviour in angularjs, {{}} (interpolation) directive call on each digest cycle , evaluates there expression. interpolation directive of angular directive gets evaluated when digest cycle run eg. ng-bind , ng-show , ng-class , ng-if , etc. if want execute binding code once need use bindonce directive :: & code be <div ng-controller="myctrl"> {{::logtoconsole()}} </div> detailed explaination how binding work in angularjs?

mobile - Reactjs with flexbox or bootstrap -

i'm learning reactjs , friend of mine highly suggested drop using bootstrap , go 100% flexbox. i've looked , flexbox seems worth learning , appears react native uses version flexbox mobile applications. feel though dropping bootstrap means drop cool multiple screen size re-sizing benefits , lot of outbox stuff navbar,panels, buttons ect , flexbox i'll have custom build of stuff. will worth going 100% flexbox if intent make nice mobile friendly web applications , possible convert on stuff react native. or easier stick know web application possible less overall hassle , make switch flexbox later? thx in advance advice noob. :) i wouldn't try use same patterns building web app , react native app. might want use different interface patterns. react native uses flexbox because trying forward thinking , doesn't have worry browser support, because app being converted native application. if you're building web app might want consider browser support ...

timezone - Weblogic Server time change -

we're having weblogic server on tried changing time zone current gmt ist(gmt+5:30). change led log file storing right time zone. however, data displayed in application moved gmt+5:30. the application expected display data time zone in stored. are missing while changing time zone of server? no, application dependent, may have configure application well. in general though, it's not bad idea keep servers in gmt no matter located.

Android Scroll to bottom finish event -

i have simple class extends scrollview , want call listener when scroll finish on bottom, code when scroll finish on top , bottom call interface listener, call on bottom finish @override protected void onscrollchanged(int x, int y, int oldx, int oldy) { super.onscrollchanged(x, y, oldx, oldy); (onscrollchangedlistener oscl : onscrollchangedlisteners) { oscl.onverticalscrollchanged(y); } if (mscrollstoppedlistener != null && y != oldy) { checkifstopped(); } } how detect scrolling on bottom in method ? wroted if not correct , not detect correctly scrolling down solved problem code. view view = (view) getchildat(getchildcount()-1); int diff = (view.getbottom()-(getheight()+getscrolly()+view.gettop())); if( diff == 0 ){ log.i("scrollview: ", " finished on bottom of screen"); }

java - Smart gwt grid grouping doesn't work when records are over 1000 -

smart gwt grid grouping doesn't work when records on 1000. below 1000 grouping works fine. it's multi-field grouping. any idea why's happening? have used method setgroupbymaxrecords(int groupbymaxrecords) on grid? it's default value 1000 belive might cause of problem. try setting number bigger 1000, example: listgrid.setgroupbymaxrecords(2500);

asp.net mvc - how to add checkbox inside GridMVC below my code -

i need check box inside fields module_view , module_edit , module_delete . using gridmvc, can tell me how add check box inside gridmvc? here code @html.grid(model).columns(columns => { columns.add() .encoded(false) .sanitized(false) .setwidth(30) .rendervalueas(d => @<b> @html.actionlink("edit", "edit", new { id = d.pk_module_id }) </b>); columns.add(c => c.tblmaster_modulename.modulename).titled("module name"); columns.add(c => c.tblmaster_clientorganizationdetails.organization_code).titled("organization code").filterable(true); columns.add(c => c.module_view).titled("view"); columns.add(c => c.module_edit).titled("edit"); columns.add(c => c.module_delete).titled("delete"); }).sortable()....

Windows Phone Reserve App name -

i need release app on windows phone store. when add app name , click on reserve app name . shows 'you can reserve name app use in language or change name'. can still use same name application . need use same name application. reserve app name changes associate app in case. possible have multiple apps same name in windows phone store.please solve issue. your question seems bit unclear. name referring when so can still use same name application i'll make points clear name reservations in windows phone store. windows store can not have multiple apps same name now. possible till windows phone 8 not possible now. you reserve name application should match application name use in application manifest. you can reserve multiple names application. example: can reserve name "hello" english version of application , "hola" spanish version of application. multiple names can used when want change name in future. example: start developing applicatio...

actionscript 3 - As3 Error 1046 on KeyboardEvent after creating document class? -

i created document class allow variables public across symbol definitions , layers platformer flash game. upon doing encountered error 1046: 'type not found or not compile-time constant: keyboardevent.' confusion in need put imports document class package, copied across of imports, including 'import flash.events.event' package looked this: package { import flash.events.event; import flash.display.*; import flash.utils.timer; import flash.sampler.newobjectsample; import flash.ui.keyboard; //i added out of confusion import publicvariables; //and public class publicvariables extends movieclip { i've spent hour researching solutions , commenting out bits of code , adding suggested things in, i'm getting driven crazy. program broken , cannot see @ fault here.

c# - Timer in asp.net works perfectly in localhost but not online -

timer in asp.net works when run application in localhost , when upload , check online timer don't work. i have condition when user click on "request item" button, in label message should show "submitted successfully" else "some error message". so, did was, created update panel , inside placed submit button 2 labels 1 successful message , error message. , timer control, i've setted 2 seconds in order show message 2 seconds , hide them. here sorce code: <asp:updatepanel id="updatepanel2" runat="server"> <contenttemplate> <asp:button id="btnadd" runat="server" text="request item" width="128px" onclick="btnadd_click1" height="38px" /> <asp:label id="lblsuccess" runat="server" font-bold="true" forecolor="#00cc00"></asp:label> <asp:...

Stored Procedure in elasticsearch -

is possible register query , call them name execute them. building application let user save search query associated label. save query generated filter in es. search template answer question. can register queries , pass parameters using mechanism.

php - Out of memory error in symfony -

i'm working on symfony project (const version ='2.5.10') , using xampp. php version 5.5.19. my problem everytime run dev environment error : outofmemoryexception: error: allowed memory size of 1073741824 bytes exhausted (tried allocate 3358976 bytes) in c:\xampp\htdocs\editracker\vendor\symfony\symfony\src\symfony\component\httpkernel\profiler\fileprofilerstorage.php line 153 and everytime refresh page gives different memory size. think reason why dev environment takes lont time before refreshes page. your appreciated. php.ini memory_limit= '256m' i tried increase memory limit,still gives error memory limit the eager component in symfony profiler. if don't need profiler in particular actions can disable via code: if ($this->container->has('profiler')) { $this->container->get('profiler')->disable(); } you can set global parameter in config: framework: profiler: collect: false ...

How to force Node.js Transform stream to finish? -

consider following scenario. have 2 node transform streams: transform stream 1 function t1(options) { if (! (this instanceof t1)) { return new t1(options); } transform.call(this, options); } util.inherits(t1, transform); t1.prototype._transform = function(chunk, encoding, done) { console.log("### transforming in t1"); this.push(chunk); done(); }; t1.prototype._flush = function(done) { console.log("### done in t1"); done(); }; transform stream 2 function t2(options) { if (! (this instanceof t2)) { return new t2(options); } transform.call(this, options); } util.inherits(t2, transform); t2.prototype._transform = function(chunk, encoding, done) { console.log("### transforming in t2"); this.push(chunk); done(); }; t2.prototype._flush = function(done) { console.log("### done in t2"); done(); }; and, i'm wanting apply these transform streams before returning response. have simple http serv...

android - Return and access java object/class from jni -

i have java method returns instance of object/class 'readcommpacket'. call java method initiated ndk/jni side(c++ -> java-> return-> java object-> c++). how complete this, i'm struggling proper jni calls/signatures complete this. appreciated. java object/class used return. public class readcommpacket { public byte[] rcpbtyeread; public int rcpbytecount; public readcommpacket(byte[] btyeread, int bytecount){ this.rcpbtyeread = btyeread; this.rcpbytecount = bytecount; } } java method called jni public readcommpacket btmsgtondkcomm(){ if(bluetoothconnectedrunnable != null){ return bluetoothconnectedrunnable.readbt();//returns readcommpacket obj } return new readcommpacket(null, -1); } jni/ndk c/c++ code void recvfrombluetooth(char * recvdbyte){ jnimethodinfo methodinfo; if (! getmethodinfo(&methodinfo, "btmsgtondkcomm", "v"))//what signature use? { log...

rest - AngularJS cross-domain requests using $http service -

i'm trying learn angularjs making simple web app using twitch api ( https://github.com/justintv/twitch-api ) i'm having trouble performing request since it's cross-domain request. have tried angular.module('streamplaylisterappservices', []).factory('twitchservice', ['$http', function($http) { return function(usercode){ console.log("usercode inside service is: " + usercode) var authheader = 'oauth' + usercode; return $http({ method: 'get', url: ' https://api.twitch.tv/kraken', cache: false, headers:{ 'accept': 'application/vnd.twitchtv.v3+json', 'authorization': 'oauth ' + usercode } }) }; }]); but error: xmlhttprequest cannot load https://api.twitch.tv/kraken . request redirected ' http://www.twitch.tv/kraken ', disallowed cross-origin requests require preflight. ...

java - Avoiding memory leaks in jni code -

i'm writing jni code in have convert std::string jstring , vice versa, i'm using following functions //std::string jstring const char *cons_ref = any_std_string.c_str(); jstring jref = env->newstringutf(cons_ref); //jstring std::string const char *cons_ref = env->getstringutfchars(any_jstring, 0); std::string any_std_string = cons_ref but leading creation of lot of const char* read , cannot deleted, causing memory leaks. is there better technique these conversions avoid memory leaks. in advance. whenever you're dealing returns pointer, should @ documentation function. ideally should tell whether or not you're responsible deallocating/releasing memory. , if should tell how. i don't know jni, little googling found http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html on page says: const char * getstringutfchars(jnienv *env, jstring string, jboolean *iscopy); returns pointer array of bytes represent...

Is it possible to install Rust on Linux without admin privileges? -

version: 1.0.0 beta 5 i have gotten as far running install.sh script argument "--prefix=$home/local" (installing home directory) and works fine, ldconfig (part of install.sh process) fails because of lack of root privileges, , rustc unable find libraries rustc: error while loading shared libraries: librustc_driver-4e7c5e5c.so: cannot open shared object file: no such file or directory if specify different prefix, need set ld_library_path environment variable. colon-separated list (like path ) typically not set. you’ll want in shell config: export ld_library_path="$ld_library_path:~/local/lib"

c++ - Vector<Custom> Access Violation -

i submitted final project ended working, not way hoping. basically, created custom class book loaded vector<book> . book has function deserialize() call like: book tempbook; tempbook.setserialized(stringbook); tempbook.deserialize(); but if tried call: std::vector<book> book_vec; book tempbook; tempbook.setserialized(stringbook); book_vec.push_back(tempbook); book_vec.front().deserialize(); i access violation error (assume book_vec has 1 item) setserialized puts flat string representation of book tempbook deserialize tokenizes flat string, , loads tokens vectors of strings why can't call deserialize book_vec ???????

CSS animate Javascript -

i trying install javacript make animation run more once. i have been given script off animate site have no idea include element want apply animation to. i wish apply animation 'animated zoomin' both h2 , h3 headings in div class of thumbtitle-box. here html div class="imagethumbnailleft"> <div class="thumbtitle-box"><h2>artful dodger trading company</h2><h3>- illustrated playing card series -</h3></div> here css .animated { -webkit-animation-duration: 1s; animation-duration: 1s; -webkit-animation-fill-mode: both; animation-fill-mode: both; } @-webkit-keyframes zoomin { 0% { opacity: 0; -webkit-transform: scale3d(.3, .3, .3); transform: scale3d(.3, .3, .3); } 50% { opacity: 1; } } @keyframes zoomin { 0% { opacity: 0; -webkit-transform: scale3d(.3, .3, .3); transform: scale3d(.3, .3, .3); } 50% { opacity: 1; ...

.htaccess - Redirect a specific url but only on mobile or certain screen sizes -

ok here issue. use cms run ecommerce website. uses mobile site addon when user on phone or ipad. want redirect specific url, when in mobile. keep url same desktop. example: redirect /desktop-categories/ site.com/mobile-categories how do , specify redirect when user on mobile? first you'll need determine if browser web browser on mobile device or not. because mobile phones typically have small screen width, can redirect visitors mobile site if have screen width of less or equal 800 pixels. javascript window.location method 1 <script type="text/javascript"> if (screen.width <= 800) { window.location = "http://m.domain.com"; } </script> you can use .htaccess redirect transfer visitors based upon mime types browser supports. example, if user's browser accepts mime types include wml (wireless markup language), mobile device. .htaccess url rewrite redirects 1 rewriteengine on # check mime types commonly a...

How do I pass in variables into python import path -

i'm trying find out how can parameterize package path not figure out. here example: if following, works, a, b directory names, __init__.py in them, last directory b contains c.py file, contains 'd' class name a.b.c import d (python takes without issue) i'm trying make directory 'b' variable can pass in dynamically. something like: b = 'y' <-- name figured out somehow dynamically a.b.c import d the above identifier b string, python won't take it, looks might need: eval(), lambda, getattr() etc convert string 'y' module identifier, can't make working. could please me out, lot in advance! bruce wim@wim-imac:/tmp$ find a/__init__.py a/b a/b/__init__.py a/b/c a/b/c/__init__.py a/y a/y/__init__.py a/y/c a/y/c/__init__.py wim@wim-imac:/tmp$ cat a/b/c/__init__.py d = 'd in b' wim@wim-imac:/tmp$ cat a/y/c/__init__.py d = 'd in y' now importlib has need: wim@wim-imac:/tmp$ python -i -c "...

cloudfoundry - Bluemix : cf logs command taking 10-15 mins to load -

this started today seems consistent across of bluemix apps, running cf logs <appname> --recent taking 10+ minutes load, making debugging grueling experience. is known issue? sometimes logergator service responds slower normal. can try again in couple of hours?

javascript - How to loop through a JSON array using jQuery -

i trying loop through json array. here example output { "calls": [ [ { "interactionid": "2002766591", "account_id": "", "mid": "", "eic_calldirection": "o", "eic_remoteaddress": "5462223378", "eic_localaddress": "1062", "eic_state": "i" } ] ], "status": [ { "statusid": "available", "userid": "su", "loggedin": false } ] } here jquery code. <script> $(function(){ function isset(a, b){ if(typeof !== "undefined" && a){ return } return b; } setinterval(function() { $.getjso...

swing - Popupmenu wont work in java? -

i constructing word processor program assignment java class in school , having hard time getting popupmenu work when right click on text area. have constructed popup menu , have textarea listening popuplistener , have overridden mouse pressed , mouse released functions class popupframe extends jframe{ jmenuitem copy; jmenuitem paste; jtextarea textarea = new jtextarea(); jpopupmenu pop; popupframe(){ container cpane = getcontentpane(); setsize(300 , 300); setlocation(300, 300); settitle("test"); jpopupmenu pop = new jpopupmenu(); copy = new jmenuitem("copy"); paste = new jmenuitem("paste"); textarea = new jtextarea("something goes here", 5, 5); pop.add(copy); pop.add(paste); popuplistener popuplistener = new popuplistener(); textarea.addmouselistener(popuplistener); } class popuplistener extends mouseadapter{ public void mousepressed(mouseevent e){ popit(e); } public void mousereleased(mouseevent e){ popit(e); ...

php - CSS Icons are working locally in the app, but are not showing on Heroku? -

so have app, deployed on heroku: http://jobsboardd.herokuapp.com/ and can see, instead of fancy icons there strange symbols(rectangle)? know it's common thing ruby apps, , couldn't find related php. and according html code, every css file loaded should. can causing , how can fix it? as i've check in site's code, using html kickstart toolkit. icons looking belongs plugin called font-awesome . see if files in css , fonts accessible , mapped correctly. i've noticed when check in browser's developer console image missing possible others not accessible well.

How to get the version of an installed program in windows using chef. -

i'm trying version of program installed on windows server , want variable inside recipe. basically i'm trying find version , if not want removed , correct version of program installed. i can't figure out way version though. the program want version datadog agent. before implementing code, need around in widows "registry" using "regedit" , find exact registry key value software. below example shows, how fetch version number of "internet explorer". also recommended have basic knowledge on ruby array , hash, understand code i've used registry_key_xxxxx chef methods. if registry_key_exists?('hkey_local_machine\\software\\microsoft\\internet explorer') subkey_array = registry_get_values('hkey_local_machine\\software\\microsoft\\internet explorer') chef::log.info("#{subkey_array}") reg_key_hash = subkey_array.at(-3) ver = reg_key_hash.values_at(:data) ie_version = ver.to_s[2, 2] che...

Does gcc (or any other compiler) change (n%2==1) for (n&1==1)? -

to test if number odd or even, understanding test using (n%2==1) is same thing as (n&1==1) i assume first test faster (please correct me if i'm wrong), compiler recognize , "correct" it? makes difference in performance? void main() { int n = 5; int = n & 1; } call __main movl $5, -4(%rbp) movl -4(%rbp), %eax andl $1, %eax movl %eax, -8(%rbp) addq $48, %rsp popq %rbp ret void main() { int n = 5; int = n % 2; } call __main movl $5, -4(%rbp) movl -4(%rbp), %eax cltd shrl $31, %edx addl %edx, %eax andl $1, %eax subl %edx, %eax movl %eax, -8(%rbp) addq $48, %rsp popq %rbp ret tried gcc.exe (gcc) 4.9.2 using -s -o0 seams & 1 check parity better.

php - Get the value from many radiobuttons inside a table -

first create table n number of rows , each 1 of them contains 2 radio buttons. need id table row selected , option selected. mean if user selected yes or no. <table border='1' style='width:100%'> <tr> <th>date</th> <th>time</th> <th>confirm order?</th> </tr> <tr id='56'> <td>".$date." </td> <td>".time." </td> <td>".$prog." </td> <td> <input type='radio' name='prog1' />no <input type='radio' name='prog1' />si</td> </tr> </table> now got far getting ids rows checked. this: var idss = []; $(':radio:checked').each(function(index) { var closesttr = $(this).closest('tr').attr('id'); idss.push($(this).closest('tr').attr('id'));...

php - catalogProductUpdate multiple category IDs -

i'm trying update website , category ids number of products in magento , i'm having issues. here's code: $client = new soapclient('http://magentohost/api/v2_soap/?wsdl'); $session = $client->login('apiuser', 'apikey'); $productarray = array("12345" => "1,2,3", "67890" => "1,5,6"); foreach ($productarray $product_id => $cats) { $update = array( 'websites' => array(1,2,3), 'categories' => array($cats) ); $updatewebsite = $client->catalogproductupdate($session,$product_id,$update); } when run code, it's changing products have new website ids it's updating category ids first 1 in $cats. for example, "12345" have category id 1 , not 2 or 3 should have. when print out $cats each product, it's showing me info correctly (as "1,2,3" , "1,5,6" examples above). i'm not sur...

ffmpeg - Time stamped video to time stamped images -

i have time stamped avi video file. i want create images frames of video need them have time associated them well. i can create images video through ffmpeg using: ffmpeg -i video.avi -r 0.1 image_%05.jpeg however images not have time embedded. possible take time associated each frame in video? my end goal sync time stamp gps track geotag images (from video frames.) stackoverflow related programming - question more suited superuser. to answer question though, if trying include timestamp overlay present in original video files, can call stream , maintain overlay on output files. if instead trying generate own onscreen text relative pts, try: ffmpeg -i video.avi -vf "drawtext=fontfile='c\:\\windows\\fonts\\arialbd.ttf':'%{pts\:hms}':x=0:y=0:fontcolor=white:fontsize=10:box=1:boxcolor=black" / -f image2 image_%05d.bmp chang values @ x=0 , y=0 pixel coordinates want text being. cahnge value after fontsize= change size of text. .....

box2d - c++ - raw pointer to shared_ptr -

i'm using box2d , may know, holds void* object can use reference when collisions occur between different entities. problem original item saved inside shared_ptr since ownership unknown , different classes (example player class) can 'equip' class (weapon). i'm wondering if possible put pointer inside shared_ptr , refer same object original one? this example: std::vector<std::shared_ptr<environment>> listenvironment; listenvironment.push_back(std::make_shared(new weapon())); //takes void pointer box2d->userid = listenvironment.back().get(); //some shit happens somewhere else , collision occurs , pointer box2d's callback: environment* envptr = static_cast<environment*>(box2d->userid); as can see envptr going cause trouble. there way refer old smart-pointer , increase reference value? ps: in actuality every class creates box2d body holds 'this' pointer don't have address smart-pointer either. example above kind narr...

c# - Wait for DownloadFileAsync to finish downloading and then do something -

so downloadfile is: public void downloadfile() { settings_btn.enabled = false; label1.text = "checking updates..."; //defines server's update directory string server = "http://downloadurl/update/"; //defines application root string root = appdomain.currentdomain.basedirectory; //make sure version file exists filestream fs = null; if (!file.exists("pversion")) { using (fs = file.create("pversion")){} using (streamwriter sw = new streamwriter("pversion")){sw.write("1.0");} } //checks client version string lclversion; using (streamreader reader = new streamreader("pversion")) { lclversion = reader.readline(); } decimal localversion = decimal.parse(lclversion); //server's list of updates xdocument serverxml = xdocument.load(@server + "pupdates.xml"); //the update process foreach (xelemen...

azure - HDinsight hive output to blob -

i using hive on hdinsight, , want store output of job in azure storage (blob). tried insert overwrite directory 'wasb://mycontainer@myaccount.blob.core.windows.net/' select name, count(*) count test group name order count desc but returned error "error: java.lang.runtimeexception: error in configuring object". can please me redirect output of job azure blob storage? to point azure blob storage, need use wasb:// or wasbs:// uri prefix, like: insert overwrite directory 'wasb://mycontainer@myaccount.blob.core.windows.net/output' ... this article has lots of examples: http://azure.microsoft.com/en-us/documentation/articles/hdinsight-hadoop-use-blob-storage/ i think need provide directory in path. looks insert overwrite expects able operate on directory in way not allowed @ root. can try: insert overwrite directory 'wasb://mycontainer@myaccount.blob.core.windows.net/output' select name, count(*) count test group name o...

Using Rails Associations in Javascript -

im trying create feed using ajax , rails gets activities of admins , alerts. when first created view used rails only, decided wanted have feed updates every time there new activity in database using ajax. ajax function works , everything, realized had alot of associations couldnt call because javascript not rails. wondering how use join replace id of query username of person created alert activity.alert.username action: "has created alert" admin_id: null alert_id: 17 category: "alert" created_at: "2015-05-13t04:12:47.862z" id: 6 school_id: 1 updated_at: "2015-05-13t04:12:47.862z" class activitiescontroller < applicationcontroller before_filter :authenticate_admin! def index @activities = activity.where(:school_id => current_admin.school.id).order("created_at desc").limit(20) respond_to |format| format.json { render json: @activities} format.html end end end old...

javascript - Assign nested object to object JS -

this might have been asked before, didn't see question: is there way declare object in javascript such can directly assign values in multiple levels of nesting (without declaring each level along way)? example: var obj = {}; obj["key1"]["key2"]["key3"] = "value"; obj["key1"]["key4"]["key5"] = "value2; the above doesn't work me, since i'm creating object dynamically, creating each level along way each key costly i'd have check existence first.. ie: if (!obj["key1"]) obj["key1"] = {}; elseif (!obj["key1"]["key2"]) !obj["key1"]["key2"] = {}; ... etc i hope makes sense. it doesn't make sense way. i sure need in special case, recommend review purposes , use helper function instead. for example, setproperty(targetobj, path, value) path plain list ['key1', 'key2'] , can check existence there...

python - for loop iterate tuples -

i'm beginner in python (and going coding after 20 years...) i'm doing small script in order learn irregular english verbs. create dict (it's in french) verbes = { "abide":["abode","abode","respecter / se conformer à"], "arise":["arisen","arisen","survenir"], } if want iterate verbes i'm doing exemple: for verb, (pret, past, trad) in verbes.items(): print "le verbe %s se conjugue au prétérit par %s, au participe passé par %s et se traduit par %s" % (verb, pret, past, trad) ok works. found out can import random pick 1 random key , value in dictionnary rand = random.choice(verbes.items()) if print rand have key, value if iterate again have traceback: traceback (most recent call last): file ".\exverbe1.py", line 209, in <module> verb, (pret, past, trad) in rand.items(): attributeerror: 'tuple' object has no attribute 'items'...

javascript - how to highlight only one table td on click -

hello have table , want highlight table td when click it. managed make work on half. change's td when select on row, want select 1 td. here js code <script> $(".table").on("click", "td", function() { $(this).closest("td").siblings().removeclass("td_select"); $(this).toggleclass("td_select"); $("#basicmodal").modal("show"); }); </script> jsfiddle if got correctly, need this: $(this).closest("table").find('td').removeclass("td_select"); //in current table, find cells, , remove highlight demo: https://jsfiddle.net/d3umm7w8/2/

mongodb - Mongo malformed geo-query with MultiPolygon -

i'm using $geowithin on large list of geographic regions, defined in geojson . of these regions polygons , , multipolygons . multipolygons fail, non-descript malformed geo query error. after experimenting repl , found can't mongo take multipolygon . this minimal example: { "type" : "multipolygon", "coordinates" : [ [ [ [ 9.560016, 42.152492 ], [ 8.746009, 42.628122 ], [ 9.390001, 43.009985 ], [ 9.560016, 42.152492 ] ] ] ] } geojsonlint says it's fine, , shows me triangle in map, mongo won't take it. how malformed?

wpf - How to access ShowMessageAsync method of MetroWindow from ViewModel -

i using mahapps.metro wpf library mvvm. have viewmodel need display dialog. metrowindow has showmessageasync. proper way access viewmodel? understand need view instance passing viewmodel doesn't seem approach. use following approach: take action<t> showmessageasync in viewmodel binding window. now create behaviour window , use following code in behaviour protected override void onattached() { base.onattached(); this.associatedobject.loaded += associatedobject_loaded; } void associatedobject_loaded(object sender, routedeventargs e) { if (this.associatedobject.datacontext windowviewmodel) { windowviewmodel vm = this.associatedobject.datacontext windowviewmodel; vm.showmessageasync = onshowmessageasync; } } private void onshowmessageasync(t param) { //write logic call showmessageasync method. } now in way, viewmodel of mainwindow have ability open child window.

android - Bluetooth LE Java byte array size on characteristic setValue -

i trying send value using bluetooth le on android phone following line of code. i getting error exceeds size of array, 127 because of 0xea byte. converted byte around 234. there way send byte using following line of code? private void writecharacteristic(bluetoothgatt gatt) {bluetoothgattcharacteristic characteristic; log.d(tag, "writing data"); characteristic = gatt.getservice(service).getcharacteristic(data_in); characteristic.setvalue(new byte[]{0x08, 0x01, 0x03, 0x04, 0x52, 0x00, 0x02, 0x62, 0xea}); gatt.writecharacteristic(characteristic); } to able use byte values above 127 in java, use (byte)0xea .

Python dictionary iteration order is unexpectedly sorted. Why? -

this question has answer here: will python dict integers keys naturally sorted? 5 answers a dictionary populated consecutive integer keys, this: d = dict() in range(0, 10): d[i] = 100-i later, dictionary items iterated this: for k, v in d.items(): print k, v the result shows items iterated in numerical order: 0 100 1 99 2 98 3 97 4 96 5 95 6 94 7 93 8 92 9 91 it turns out, behavior want, not expected. expected dictionary iteration in random order. what's going on here, , can depend on behavior in code released publicly? dictionaries not in random order. in arbitrary order. in case, got lucky , sorted. tomorrow, might not be. if need randomness, use random . if need sorted order, use sorted() . @benjaminwohlwend mentions in comments, can use collections.ordereddict keep track of insertion order. in case, guess dictionary do...

javascript - Positioning text and the form on the parallel to each other (side by side) - HTML -

i trying position form , paragraph texts on left side side parallel each other how ever dont understand how can this currently trying float form right, social icons move bottom , position on left of screen i want position ids: "myform" , class "info" side side code: <!doctype html> <html lang="en"> <head> <title>arshdeep soni</title> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, inital-scale=1"> <link rel="stylesheet" type="text/css" href="reset.css"/> <link rel="icon" type="image/png" href="images/ace.png"/> <link rel="stylesheet" type="text/css" href="style.css"/> <script type="text/javascript" src="js/jquery.js"></script> <script type=...