Posts

Showing posts from March, 2012

Java primitive data types size -

hi learning java basics. need check size of primitive data types using sizeof(); in c language. example code: int i; system.out.print(sizeof(i)); there's no need such thing in java since sizes of primitives set jvms (unlike c can vary). char 16 bit (actually unsigned quantity), int 32 bit, long 64 bit. boolean ugly sister in this. internally manipulated 32 bit int , arrays of boolean s use 1 byte per element.

Searching the youTube V3 API via channel name not username? -

youtube allows username , channel name. can different each other. youtube api allows me search via username can't see or how search channel name. channel name displayed under videos. shed light onto how can search via channel name/title , not username? thanks if channel search api didn't return result call search api https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&maxresults=1&q=( <# potential channel name #>) so runs standard search entered value "potential channel name". google docs first returned result channel need 1 result why set maxresults=1. if returns nothing assume channel not exists , display error user

java - on my second class called next class, last line of public array list search for price the .indexOf double cant be dereferenced? -

i started looking result , getting title of book. when user enter keyword locate book , display author, price, , title of book. main issue value price trying indexof, , lower result down 1 book. advice appreciated. public arraylist<test> searchfortitle( string searchstring ) { arraylist<test> searchresult = new arraylist<test>(); ( book currentbook : library ) { if ( ( currentbook.gettitle() ).indexof( searchstring ) != -1 ) searchresult.add( currentbook ); } searchresult.trimtosize(); return searchresult; } public arraylist<test> searchforauthor( string searchstring ) { arraylist<test> searchresult = new arraylist<test>(); ( test currentbook : library ) { if ( ( currentbook.getauthor() ).indexof( searchstring ) != -1 ) searchresult.add( currentbook ); } searchresult.trimtosize(); return searchresult; } next class: public static void main(string [] ar

Selenium: how to wait for AngularJS to finish updating the DOM after AJAX? -

[related philosophical debate sleeping out @ programmers.se ] angualr not guaranteed update dom in event handler ajax completion (especially if third-party directives involved), of solutions floating online using $http interceptors incomplete. the answer similar question "wait angular finish updating dom", suggests using $timeout . however, source suggests uses $browser.defer mechanism can executed in order other deferred dom manipulation. i found $browser.notifywhennooutstandingrequests internal method happens after deferred stuff, test still unstable after waiting that. guess should wait ajax complete first or there else i've missed? this how it: function waitfordisplayed(element) { var d = protractor.promise.defer(); // result of being fulfilled returned browser.wait(element.isdisplayed). then(function(isdisplayed) { d.fulfill(); }); return d.promise; }

php - Multiple Update Query -

i have written 2 different codes in php , want merge 1 code because both codes same, update query different. can 1 me? , second problem if condition does'nt work why that? code1: <?php include("database/connection.php"); $sql = "select * registration,billing_month"; $result = $link->query($sql); while ($row = $result->fetch_assoc()) { $regid = $row['reg_id']; $duedate = $row['bill_due_date']; $currentbill = $row['current_bill']; $arrears = $row['arrears']; $updatearrears = $arrears + $currentbill; if (date('y-m-d') > $duedate) { $sql_update = "update registration set arrears= $updatearrears reg_id = $regid"; if (mysqli_query($link, $sql_update)) { // echo "updated"; } else { // echo "could not updated"; } } } ?> code2: <?php include("database/connection.php

java - Class creating by copying doesnt work -

i following exmaple in asm 4.0 manual, in section explains visitor there exmaple of copying class using code similar this: inputstream in=asmhelloworld.class.getresourceasstream("test.class"); classwriter cw = new classwriter(0); classreader cr = new classreader(in); cr.accept(cw, 0); byte[] b2 = cw.tobytearray(); // b2 represents same class b1 the difference in book define input data byte array dont know how read class byte array, instead used example found online read class inputstream. i save class using following code: dataoutputstream os = new dataoutputstream(new fileoutputstream("test2.class")); os.write(b2); os.flush(); os.close(); the thing when try run test2 following error: error: not find or load main class test2 the size of test.class , test2.class same in copy have test1.class file test class name. generated class must have same name file name before .class

postgresql - Error: java.lang.SecurityException: execute on /home/<user>/test.sh JAR file trying to read shell file (Pljava) -

i trying call pl/sql function calls java class , reads shell file , execute same. placed shell file in home directory. i created jar using class , installed in postgresql. however, when trying execute in pljava, returns following error: error: java.lang.securityexception: execute on /home//test.sh ********** error ********** error: java.lang.securityexception: execute on /home//test.sh sql state: xx000 how solve this? you cannot read , execute files trusted pl/java. have use untrusted language (i.e. javau ), , have create function under superuser

java - writing and reading input to xml -

i new android development , have been struggling problem. have been trying learn how save user inputs file. have asked similar answer , ended figuring out solution although didn't work out way want. have been searching high , low how write files xml. have user able save, add, retreive, , able remove items xml file. think problem having far learning i'm not sure processes call solution. isn't school work, i'm not looking write code me. hoping proper terminology, maybe link helpful information , such. believe process called parsing, , can add xml through appending, not sure after this. thank in advance can offer assistance. to have xml available app should put in "assets" folder. should copy-paste xml file modify it, ensure file won't corrupted afterwards. first have copy xml sdcard (preferably folder app name folder name), can use this learn how copy file. after have done can use jdom parser modify xml file. put xml after modific

Meteor custom oauth package -

i'm need create custom package using oauth external service, have no idea how make it. i'm tryed clone accounts-github package project , modyfy it, not working. code here. //test.html <template name = 'test'> <a href="#" class=".gitlogin">login</a> </test> //test.js template.test.events({ 'click .gitlogin': function() { return meteor.loginwithgithub(); } }); error here: meteor.loginwithgithub not function my steps installing accounts-github package: —clone repo app/packages directory —modifyed name of package in package.js file —meteor add my:package —donewithout errors but can see not working. main question: how create or modify existing package use oauth provider? provider wargaming.net not providing secret code facebook or google. p.s. , i'm using windows there 2 packages each oauth service. other 1 has of logic related service. check out github package https://githu

web services - ms crm JumpBarAlphabetOverride -

to customize gridjumpbar, believe need use command : microsoft.crm.se.orgdborgsettingstool.exe update myorganization jumpbaralphabetoverride "newalphabetbardefinition" but cannot 'orgdborgsettingstool.exe' work, have 'ms crm 2015 on prem' , cannot set config settings, think, i error : error occurred in orgdborgsettings , error details metadata contains reference cannot resolved: 'mycrm.crm.com/.../disc overy.svc?wsdl&sdkversion=7.1'.unable connect remote server this address, browse crm, , account system admin on server machine: http://localhost/test/ how should overcome this, can give me direction on customizing config file could not figure out problem, when managed fill .config file, got stock authentication, though doing job administrator account on crm server, anywho i found ms. crm 3rd party soloution , works charm

java - BlazeDS binary latest version download location -

i trying download blazeds integrate future adobe flex application java web app links found come this site , point adobe's website in turn point former. were can binary blazeds jar/war? don't whant th source-files adobe dropped development of flex luckly framework updated apache fundation: http://flex.apache.org/download-blazeds.html you can download executable version (old version) here https://drive.google.com/file/d/0b6l2ngantvfnt20wnddvuhnqekk/view?usp=sharing

excel - Get data from a website based on content in worksheet -

sub try() dim ie object dim myhtml_element ihtmlelement dim myurl string dim myurlser string set ie = createobject("internetexplorer.application") on error goto err_clear myurl = "[http://test.com/login][1]" set mybrowser = new internetexplorer mybrowser.silent = true mybrowser.navigate myurl mybrowser.visible = true loop until mybrowser.readystate = readystate_complete set htmldoc = mybrowser.document htmldoc.all.j_username.value = "user" 'enter email id here htmldoc.all.j_password.value = password'enter password here each myhtml_element in htmldoc.getelementsbytagname("input") if myhtml_element.type = "button" myhtml_element.click: exit next on error goto err_clear myurl = "http://test.com/home" set mybrowser = new internetexplorer mybrowser.silent = true mybrowser.navigate myurl mybrowser.visible = true err_clear: if err <> 0

Search partial textstring and replace with corresponding cell -

formanswer: a(email) | b(name) students: a(name) | b(uid) what want if 1234@domain.com registered on page formanswer: a(email) @ students "1234" in b(uid) , grab value of a(name) , write in formanswer: b(name) this works - first row if( isnumber( find( (left(f1:f;len(f1:f)-10)) ; (elever!c1:c) ) ) ; (elever!b1:b) ; "elevens navn mangler" ) what want, vol ii code looking through entire column accordingly new signups. any ideas? this guess based on information @ hand: =arrayformula(iferror(vlookup(regexextract(f:f;"^(.+?)@");{elever!c:c&""\elever!b:b};2;0);"elevens navn mangler"))

How to handle invalid passed arguments in Ansi C -

i new c , come ground of newer languages (like java , c++) , i'm not sure how handle runtime errors incorrect arguments sent function. for example want write function manipulate string (assuming valid int acceptable return value): int foo (char s[]) { if ( strlen(s) < 1) // error .... .... return someint; } how handle scenario in ansi c if want function stop immediately? in c++ or java throw exception caught caller. you can use return value : if( /* bad parameters */ ) return -1; and : int value = foo( ); if( value == -1 ) // error else // no error or pass parameters : int foo( char s[], int* value ) { if( /* error */ ) return 1;// error code 1 // ... *value = something; return 0; } then when call function can verify if executed correctly : if( foo( "something", &result ) ) { //ok } else { // not ok } both of these method implies caller verify manually if the

c# - textBox is not assigning values to my properties -

i have textbox , combobox in code, write data on them, , idea keep data in properties classes initialized. combobox works fine, , data sent database withh no problem, textbox no :( i show part of code ctlcrpvhcprs.clvcrp = convert.toint32(combobox4.selectedvalue); ctlcrpvhcprs.clvvhc = convert.toint32(combobox1.selectedvalue); ctlcrpvhcprs.clvprs = convert.toint32(combobox2.selectedvalue); ctlcrpvhcprs.clvmnc = convert.toint32(combobox3.selectedvalue); ctlcrpvhcprs.rgnzna = textbox2.text; ctlcrpvhcprs.clvzna = textbox3.text; ctlcrpvhcprs.clvsct = textbox4.text; ctlcrpvhcprs.estvhc = textbox5.text; if debug code, when reach textbox3, example, check value textbox2.text , "somedata", , ctlcrpvhcprs.rgnzna "" ideas, please? i need more detail of code. try these ways: ctlcrpvhcprs.rgnzna = textbox2.text.tostring(); //or string str=textbox2.text; ctlcrpvhcprs.rgnzna = str;

javascript - jQuery replace only the text of a node, ignoring current internal nodes -

i have html: <label>search: <input id="search-box" type="text"/> </label> if want change words "search:" "quick search:", how can select "search:" text using jquery/js? i have tried html() , text() , , other various jquery methods. goal not have copy input box , append after. possible? p.s. know can use prepend() function, goal here replace text entirely, , i'd know how in future well. thanks bunch. if have access html i'd wrap text in span can address easily. however, have far can iterate on nodes in element , change textcontent of first text node ( nodetype==3 ): $(function(){ $("label").contents().each(function() { if(this.nodetype == 3){ this.textcontent = "quick search: "; return false; } }) }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js&q

logic - Don't really understand the notation -

i don't understand how or i'm supposed prove. i've researched each, still unclear me expected. which of following statements true? prove answers. n² ∈ o(n³) n² ∈ Ω(n³) 2ⁿ ∈ Θ(2 n+1 ) n! ∈ Θ((n+1)!) any appreciated! since (probably homework) questions days old, think can answer question in short. the wikipedia page (and textbook and/or notes too) says f(n) ∈ o(g(n)) ⇔ lim sup |f(n)/g(n)| < ∞ f(n) ∈ Ω(g(n)) ⇔ lim sup |f(n)/g(n)| > 0 f(n) ∈ Θ(g(n)) ⇔ f(n) ∈ o(g(n)) , f(n) ∈ Ω(g(n)) to prove left side can prove right side. n² ∈ o(n³) true, due to lim sup |n²/n³| = lim (n²/n³) = lim (1/n) = 0 < ∞ n² ∈ Ω(n³) false, due to lim sup |n²/n³| = lim (n²/n³) = lim (1/n) = 0 2ⁿ ∈ Θ(2 n+1 ) true, due to 0 < lim sup |2ⁿ/2<sup>n+1</sup>| = lim (2ⁿ/(2⋅2ⁿ) = lim (1/2) = 1/2 < ∞ n! ∈ Θ((n+1)!) false, due to lim sup |n!/(n+1)!| = lim (n!/((n+1)⋅n!) = lim (1/(n+1)) = 0 notice:

java - Cleaning up a soap request using SOAPConnectionFactory -

i'm new soap , found example of how request here: working soap client example using chrome plugin i've managed find soap query string works is: <envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <body> <getmyprojectcharges xmlns="http://company.iwweb.data.service.projectcharges"> <employee>26270</employee> <fiscalyear>2015</fiscalyear> <apikey>apikey</apikey> <appname>appname</appname> </getmyprojectcharges> </body> </envelope> so trying code posted stack post wrote: private static soapmessage createsoaprequest() throws exception { messagefactory messagefactory = messagefactory.newinstance(); soapmessage soapmessage = messagefactory.createmessage(); soappart soappart = soapmessage.getsoappart(); string serveruri = "http://schemas.xmlsoap.org/soap/envelope/"; // soap envelope

vba - How to copy table rows without knowing it's containing sheet -

i want copy data 1 table another, 1 workbook another. know table names, identical. source table has unknown number of data rows plus unknown number of empty rows. destination table (same name, same sheet) has empty rows, not same overall number of rows origin. i know can sourcebook.activate activesheet.listobjects(knowntablename).databodyrange.select selection.copy destinationbook.activate activesheet.listobjects(knowntablename).databodyrange.select activesheet.paste however there number of problems: the table not on activesheet. how find sheet table on? or there better way reference (ideally without having find sheet first)? i know .activate , selection.copy slow , bad. how can better? how find "used" data range of both tables without looping through table rows? is possible copy data row row (so non empty rows copied)? ideally, insert non-empty source rows destination table , subsequently delete empty rows in destination table to answer question

python - undefined symbol: _ZN2cv3Mat10deallocateEv -

i've been trying extend python script c++ code. able simple libraries of c++ (print "hello world"). followed tutorial available in link below: http://www.tutorialspoint.com/python/python_further_extensions.htm when tried add c++ code opencv libraries encountered following problem: importerror: /usr/local/lib/python2.7/dist-packages/kalman.so: undefined symbol: _zn2cv3mat10deallocateev i searched many solutions on internet, , found 1 common answer didn't workout me: "i able solve going /usr/lib64/pkgconfig , modified opencv.pc explicitly have libraries. had move plugins /usr/lib/gstreamer-0.10 /usr/lib64/gstreamer-0.10" please note using ubuntu 14.04 lts 64-bit , planning run code later on on raspberry pi model b running raspbian os. thank you. nj check shared library kalman.so ldd so: $ ldd kalman.so and see missing libraries. means have provide correct path 1 of libraries use in code @ linkage stage. like $ ...the way link

ios - NSFetchedResultsController not calling delegate methods on changes using NSPredicate with subquery -

i have nsfetchedresultscontroller created follows: let fetchrequest = nsfetchrequest(entityname: "friendship") fetchrequest.sortdescriptors = [ nssortdescriptor(key: "friendtocurrentuser.displayname", ascending: true) ] fetchrequest.predicate = nspredicate(format: "subquery(friendtocurrentuser.trackingsessions, $x, $x.dataisstale == false , $x.enddate == nil).@count != 0") let fetchedresultscontroller = nsfetchedresultscontroller(fetchrequest: fetchrequest, managedobjectcontext: coredatamanager.instance.mainmanagedobjectcontext, sectionnamekeypath: nil, cachename: nil) fetchedresultscontroller.delegate = self var error: nserror? if !fetchedresultscontroller.performfetch(&error) { println(error) } when initial fetch completes controller:didchangeobject:atindexpath:forchangetype: called, when object should added/removed due subquery method not called. if simple delegate methods aren't called when predicate contains subquery tha

haskell - No instance for Database.SQLite.Simple.FromField.FromField Char -

this code gives me error: 67: isfileinstalled f = 68: dbcon <- open "/var/lib/beaver/pkgs.db" 69: res <- querynamed dbcon "select * files path = :path" [":path" := ("/usr/bin/getpkg" :: string)] 70: mapm_ putstrln res 71: -- when (null res) (return ()) 72: -- putstrln ("file " ++ res ++ " installed , comes " ++ res ++ ".") -- first res `owner` , second `path` 73: close dbcon 74: exit i error: no instance (database.sqlite.simple.fromfield.fromfield char) arising use of `querynamed' in stmt of 'do' block: res <- querynamed dbcon "select * files path = :path" [":path" := ("/usr/bin/getpkg" :: string)] in expression: { dbcon <- open "/var/lib/beaver/pkgs.db"; res <- q

c# - Enable intranet web application to all signed Windows users -

i have asp.net app. needs available signed windows user on local network. @ moment user enters site identify him windows name. anonymous users not allowed. what have: in web.config: <system.web> <authentication mode="windows" /> <authorization> <allow users="*"/> <deny users="?"/> </authorization> </system.web> in applicationhost.config iis express: <authentication> <anonymousauthentication enabled="false" username="" /> <windowsauthentication enabled="true"> <providers> <add value="ntlm" /> </providers> </windowsauthentication> </authentication> currently having issue if getting "authorization required" form in browser instead of getting app. suggestions? there guess, problem more iis version/settings project its

wordpress - Woocommerce getting custom field values in cart and checkout -

i trying custom field value of woocommerce product display on different pages of shop system. succeeded single product page, same code doesn't work cart. for single product used code within functions.php, works fine: global $post; echo '<p>' . get_post_meta($post->id, 'my-custom-field', true) . '</p>'; i tried same code cart, time values don't show on page. referred thread ( woocommerce getting custom attributes ), changing $post $product, still no output... any suggestions? <?php echo get_post_meta( get_the_id(), 'slug/id', true ); ?> you can try this, works me well.

contextmenu - need help in jquery context menu -

i have jquery context menu plugin. there array of items displayed when user right clicks. if user clicks on item of save page, whole page must saved. <script type="text/javascript" class="showcase"> $(function(){ $.contextmenu({ selector: '.context-menu-one', callback: function(key, options) { var m = "clicked: " + key; window.console && console.log(m) || alert(m); }, items: { "edit": {name: "edit", icon: "edit"}, "cut": {name: "cut", icon: "cut"}, "copy": {name: "copy", icon: "copy"}, "paste": {name: "paste", icon: "paste"}, "delete": {name: "delete", icon: "delete"}, "sep1": "---------", "quit": {name: &quo

ios - Looking for a suggestion for building an APN Server that stores data (token) in SQL -

i used http://www.easyapns.com/ guide building backend , sending push notifications. realized no longer works, , i'd love find solution works similar. essentially need store device , tokens on backend, , send out push notifications devices in db. any appreciated thanks if it's requirement, there many services without creating specific backend, pusher, push robot, google push notification service, etc.... take care of registration of token. if need create specific backend, depends of others requirements, web , github full of examples on topic.

javascript - using moment js to pass in time zone and get hours offset? -

i want pass three-digit time zone string "gmt" or "est" , offset "-05:00" string it. moment seems handle couldn't find way... this capability asking has been deprecated. tim wood in this thread says: the problem date.prototype.tostring returns such different results. place timezone name (pst, cst, est, etc). if method not returning timezone information (as case ff10 , ie9, there no way it. in same thread there mentions people how able abbreviated time zone , consequently pass moment in browsers.

html - Get Element by Name/ID -

i trying automate logging website run report our ticking system. i able login , system. having issue clicking report button. i have tried many many many variations no success. this html code report button. <td class="navigation" nowrap="" valign="bottom"><span id="tab_view4" class="off" onmouseover="this.classname='on'" onmouseout="if(iviewtype!=4) this.classname='off'"><a href="/swiseweb/null.html" target="spider2" onclick="return changeview(4);"> report bananna i have tried $ie.document.getelementsbyname("tab_view4").submit() $ie.document.getelementsbyname("tab_view4").submit() $ie.document.getelementsbyname("tab_view4").click() $ie.document.getelementsbyid("tab_view4").click() id , name different attributes. element id="tab_view4" use $ie.document.getelementbyid("tab_

c# - Custom error pages in ASP.NET MVC -

trying implement own error pages in mvc 5. found 1 interesting post -> source . in author advice add .aspx page. so questions should add .aspx page or .cshtml page (cause work razor ) ? thanks. i use static files, if want use dynamic file in way blog entry point shows, need use aspx file.

node.js - trouble installing less with npm -

so installed node , npm. cmdprompt recognizes both when test node -v , npm -v . however, cannot install (less or bower) using npm. npm -install -g less yields: c:\users\user>npm install -g less c:\users\user\appdata\roaming\npm;npm\npm\lessc -> c:\users\user\appdata \roaming\npm;npm\npm\node_modules\less\bin\lessc less@2.5.1 c:\users\user\appdata\roaming\npm;npm\npm\node_modules\less ├── graceful-fs@3.0.8 ├── mime@1.3.4 ├── image-size@0.3.5 ├── errno@0.1.4 (prr@0.0.0) ├── promise@6.1.0 (asap@1.0.0) ├── mkdirp@0.5.1 (minimist@0.0.8) ├── source-map@0.4.4 (amdefine@1.0.0) └── request@2.60.0 (aws-sign2@0.5.0, forever-agent@0.6.1, stringstream@0.0.4, ca seless@0.11.0, tunnel-agent@0.4.1, oauth-sign@0.8.0, isstream@0.1.2, json-string ify-safe@5.0.1, extend@3.0.0, node-uuid@1.4.3, qs@4.0.0, combined-stream@1.0.5, mime-types@2.1.4, form-data@1.0.0-rc3, tough-cookie@2.0.0, http-signature@0.11.0 , bl@1.0.0, hawk@3.1.0, har-validator@1.8.0) i've looked around stackover f

javascript - Alternative to nth-child approach in automatic css selector generation -

i facing problem while making logic automatic generation of css path of element in web page. use-case: when user clicks on element on web page, css selector generated automatically using css selector concepts id-name, class-name, tag-name, , nth-child. for ex: lets click on price element on e-commerce product description page, body > ul:nth-child(27) > li:nth-child(1) . biggest bane here nth-child(1) , because page price 1st child, other pages 4th or 5th or 23rd child. moreover, bigger problem html of price element <html> .... <body> <div>abc</div> <div>def <span>ghi</span> <ul> <li> price: $32.23 </div> <li> weight: 100 lbs </div> </ul> </div> </body> </html> without classname or id-name. current selector generation logic generates lot of combinatio

Making open-source CSS class/id names unique -

i'm trying make class/id names in stylesheet unique, example bootstrap or other open-source css framework. i've found list of class names in bootstrap 3, ex: .col-sm-1 .col-sm-2 .col-sm-3 ... i'm going building form using bootstrap css used on websites (think stripe's modal paste website , maintains styles). however, if leave bootstrap css classes , ids untouched there sorts of problems conflicting styles other's websites. is there way preface or append company's name or random string every single style in stylesheet there won't problems conflicting styles? ex: .col-sm-1-abc123 .col-sm-2-abc123 ... having styles above not cause problems conflicting styles. but, require appending "-abc123" every style. is there way this? if so, how? if not, what's alternative accomplish i'm trying do? if need prevend name problems, should use namespaces. can easy less, example: .your_namespace_name { // here less/css c

javascript - SignalR Asp.NET MVC5 User Info -

i trying create chat application, want display firstname of user. username email, using var username = httpcontext.current.user.identity.name.tostring(); returns email. how can access firstname property model has , db has. when register have put in first name, , db stores it, don't know how display in chat chathub if somewhere in ui need user's name , display it, can take there , send parameter server method. if don't retrieve anywhere in client, take database inside hub. note: stop using httpcontext global static property. inside signalr hubs have access context, 1 should use. hope helps! best of luck!

java - No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? - maven build -

Image
when compiling maven project, shows below error (in image). instead of jre, have mapped jdk compilation. any suggestion regarding how fix great make sure java_home (in windows) variable points installation of jdk, make sure version of jdk matches 1 specified in pom.xml

Which function is implicitly called in Python when setting a class variable via a class name? -

let's i've got class 'private' class variable , instance of class. want prevent setting variable outside of class or execute specific function when class variable being changed. class someclass (object): __classvar = 5 def getclassvar(): return someclass.__classvar instance = someclass() the __classvar variable not directly readable outside of class (e.g. can't = someclass.__classvar or b = instance.__classvar) fact variable private doesn't stop me doing this: someclass.__classvar = 6 instance.__classvar = 10 even though doesn't assign value variable. e.g. code below still output 5. class someclass (object): __classvar = 5 def getclassvar(): return someclass.__classvar instance = someclass() someclass.__classvar = 6 instance.__classvar = 10 print (getclassvar()) #outputs 5 i know statement instance.__classvar = 10 is implicitly calling __setattr__ function, therefore can overload in

How the architecture should be for a Java command line app integrating with shopify -

in company have custom point of sale built in house, , assigned integrate pos shopify. mvp, have decided go simple java app, run command line. have done following 1) went www.shopify.com/app-developers , got private store bla.myshopify.com . 2) went apps -> private apps. got api key, password , shared secret. have mentioned, doing simple java app can run command line. app read keys local file. now should doing oauth? have mentioned redirect web page in here https://docs.shopify.com/api/authentication/oauth . since have don't have webpage, should redirect user to? , there wrong doing? kindly correct me if there better architecture basic authentication works shopify: whatever package using http connection should have tools let set authorization header. pre-emptive authorization package , use api key:password (from private app) base 64 encrypted credential token

objective c - How to close window fired up from NSWindowController -

very nob question: want close window programmatically after sent http post body data. read documentation , implemented method - (void) performclose : ( id ) sender; , - ( bool ) windowshouldclose : ( id ) sender; never called. please can put me in right direction code provided below achieve mi target? thank gold time. my code: #import <cocoa/cocoa.h> #import <appkit/appkit.h> //.h @interface postinoclass : nswindowcontroller <nsurlsessiondatadelegate, nsurlconnectiondelegate,nsurlsessiontaskdelegate,nsurlconnectiondatadelegate> { nswindowcontroller *controllerwindow; } //.m - (void)openwindow { // nslog(@"openwindow"); controllerwindow = [[nswindowcontroller alloc]initwithwindownibname:@"sendemailwindow"]; [controllerwindow showwindow:self]; } //ok can open cool window, need close after dirty work... - (void)closewindow:(id)sender { // nslog(@"closewindow"); // [controllerwindow close]; // not work &

javascript - Nodejs exec mongodb command in Bluebird Promise -

i want run mongod command in node.js using promises, database operations can run after mongodb process started. tried hands following, failed: var promise = require("bluebird"); var execasync = promise.promisify(require('child_process').exec); execasync("~/mongodb/bin/mongod").then(function(result){ console.log("started mongodb..."); }).catch(function(error){ console.log("error in starting mongodb..."+json.stringify(error)); }); any suggestions? you shouldn't start mongod process in node, should doing other way. can check whether it's running, not whether has started properly.

mysql - How to select all the unique gmail emails from a set of emails? -

i noticed gmail doesn't care if . exists in email or not, means ex.ample@gmail.com equivalent exam.ple@gmail.com , nice feature google, pita developers trying maintain list of unique email addresses. i have table list of emails. exact rules gmail uses detect unique email, , given set of emails, how find actual unique emails? here's schema: sql> select * subscribers; id | email ------------------------- 1 | user.name1@gmail.com 2 | username.1@gmail.com 3 | user3@example.net ... the expected output set of unique (and valid!) emails: id | email ------------------------- 1 | user.name1@gmail.com 3 | user3@example.net fiddle. select em, count(*) ( select replace(email, '.','') em subscribers email '%@gmail.com%') t group em having count(*) = 1; is trying do? edit: select distinct emails select distinct concat(replace(substring(email,1,instr(email,'@')-1),'.',''),

c++ - Debugging Python when both PyDev and CDT natures in same Eclipse project -

eclipse 4.5 (mars) / windows 7 i have eclipse c/c++ makefile project has both python , c/c++ code. source code checked-out svn repository. build environment via msys shell using project specific configuration script create makefiles in top/sub-directories , 'make', 'make install' build. my .project file has both pydev , cdt natures configured. i can switch between pydev , c/c++ perspectives , browse code including right-clicking on symbol , 'open declaration'. the 'debug' perspective appears specific c/c++ perspective. do have experience configuring eclipse project allows debug both python , c/c++ code? after 'googling' around internet, here appears working particular situation: create c/c++ project (empty makefile project). produces following 3 files in top-level local svn check-out directory: .settings .cproject .project note: keep eclipse workspace separate eclipse project. create separate python project outsi

javascript - Referencing and Populating Fields of Type 'Model' in AJAX Post -

how 1 use jquery reference field(s) of model serving variable of parent model, retrieve fields different entries of inner model? for example, there's accountownermodel , accountmodel, latter containing variable of accountownermodel type. accountowner model: public class accountownermodel { public int accountownerid {get; set;} public string accountownername {get; set;} public string accountowneremail {get; set;} public string accountownerphonenumber {get; set;} } account model: public class accountmodel { public int accountid {get; set;} public int accountownerid {get; set;} public accountownermodel accountowner {get; set;} } in controller, there action retrieve accountowner fields should different accountowner selected: [httppost] public actionresult getaccountownerinfo(string ownerid) { int64 accountownerid = 0; int64.tryparse(ownerid, out accountownerid); dbentities projectdb = new dbentities(); var owner = projectd

php - Is it safe to add ob_start(); in WordPress' wp-config? -

this question has answer here: what's use of ob_start() in php? 8 answers a developer hired told me in order plugin work. is safe? this function turn output buffering on. while output buffering active no output sent script (other headers), instead output stored in internal buffer. the contents of internal buffer may copied string variable using ob_get_contents(). output stored in internal buffer, use ob_end_flush(). alternatively, ob_end_clean() silently discard buffer contents. http://php.net/manual/en/function.ob-start.php yes, "safe". won't compromise data or anything, , if (at worst) need revert back, have remove line, no problems whatsoever.

c - How to call in main a link list with argc and argv? -

how call in main function see if works ? don't know how call in main linked lists arguments seems more difficult .. please me ? #include "ft_list.h" t_list *add_link(t_list *list, void *data) { t_list *aux; aux = malloc(sizeof(t_list)); if (aux) { aux->data = data; aux->next = list; } return (aux); } t_list *ft_list_push_params(int ac, char **av) { int i; t_list *list; = 2; if (ac == 1) return (null); list = ft_create_elem(av[1]); while (i < ac) { list = add_link(list, av[1]); i++; } return (list); } int main(int argc, char**argv) { t_list *list; list = ft_list_push_params(argc, argv); return 0; } the line list = add_link(list, av[1]); should be list = add_link(list, av[i]); optional: ft_create_elem() not needed. add_link() can used push first node on empty list (list == null). i'm wondering if there should function disp

javascript - Ajax error value return null -

i have function in ajax : $.ajax({ type: "post", url: "@url.action("filtralevatamento", "consulta")", data: json.stringify(jsn), contenttype: "application/json", datatype: "json", async: true, success: function (data) { result(data); $("#modalboxprocessa").modal("hide"); }, error: function (xmlhttprequest, txtstatus, errorthrown) { $("#modalboxprocessa").modal("hide"); $("#modalboxerro2").modal("show"); } }); in local machine works when publish in server error in ajax . can tell me problem ? have pretty same ajax returning me othe

mysql - Can't use "HAVING" "OR" "WHERE" together -

i want write query selects rows if last timestamp newer 2 days or there 200 children. trying combine where having , this: ... parent.timestamp < date_sub(current_date, interval 2 day_hour) or having count(parentid) > 199 group parent.tid order parent.lastchildid desc limit 200 but gives me syntax error. how can use or between these 2 conditions? since having applies aggregate , where applies rowset, can't blend them that. instead, use subquery turn having where condition on count: select ... parent parent.timestamp < date_sub(current_date, interval 2 day_hour) or (select count(*) mytable tid = parent.tid) > 199 order parent.lastchildid desc limit 200

Using git to transfer data via usb stick between Windows and Linux -

i trying use git first time in order transport bachelor thesis writing between windows computer @ work , linux computer @ home. because don't have server use usb stick store shared repository. question understand should possible. on windows system have created working repository , remote repository on usb stick , pushed working directory usb stick. seems working fine. on linux system have cloned repository, made changes, added them , committed them. far seems working fine. when try push changes usb stick following error message: counting objects: 3, done. delta compression using 4 threads. compressing objects: 100% (2/2), done. writing objects: 100% (3/3), 264 bytes | 0 bytes/s, done. total 3 (delta 1), reused 0 (delta 0) remote: error: unable create temporary file: operation not permitted remote: fatal: failed write object error: unpack failed: unpack-objects abnormal exit /media/usb-stick-sta/git/bachelor ! [remote rejected] master -> master (unpacker error) error:

java - How can I move My ResultSet to a specific record -

i´m having troubles moving resultset current record. i´m learning jdbc , came clipper , delphi. used have kind of "reference" record number or reference "tagged" record, can save reference , move position later. while trying same jdbc , mysql, tried use select / statement record want. thats ok. when try line of record, happens theres 1 line in resultset (i realised happen before write code, had test, cause it´s how learn. :)). so, make things short. need way "find" record value primary key (with select/where maybe) , "save" position. can move database same record large collection of data (not filtered data). while (next()) or work arround sql codes make form work in diferent way. it´s not goal. so. got tips on how that? thats dao class. want method "findcod" move resultset same record in rsconsulta. dao class: package control; import java.sql.connection; import java.sql.drivermanager; import java.sql.prep

java - Best way to implement Socket.io in android -

i planning implement socket.io in android this library chat based application. far understood library seems pretty good. want know how maintain single socket connection throughout app time? here have listed out ways achieve, in need best , stable way. three ways mainapplication class extends application by have scope socket connection maintained in main thread ( or application's life cycle) , whenever socket instance needed activity can easily. it's main thread problem. might block main thread. boundservice by way can bind service activities , can use it. doing in separate thread way achieve io/network calls. cross processing transfer more expensive directly accessing in same process. singleton maintaining connection in singleton makes sense. don't know when instance killed process, because doesn't work in activity life cycle. if makes sense please me out. if not comment out. edit i have given answer more suitable me.

java - Finding specific value inside an Array (not List) -

i learning arrays , did quiet few experiments, of them went well, i'm stuck. want archive is, find if specific value (string, int or whatever), exists inside array , if does, use value i.e code below count how many times value present inside array: package arraysonly; import java.util.*; public class arraycontainsstring { public static void main(string[]args) { scanner sc = new scanner(system.in); int arraysize = 0; int wordcount = 0; system.out.println("how many words gonna type?: "); arraysize = sc.nextint(); string[] words = new string[arraysize]; // simple array, size of decided user-input for(int count = 0; count < arraysize; count++) { system.out.println("enter " + (count+1) + ": "); words[count] = sc.next(); } //basically part i'm having troubles

recursion - Python recursively appending list function -

having issues recursive function should relatively simple do, can`t seem right. i have folder structure folders can contain other folders, images or files. associated each folder there permissions. want have function recursively build list of permissions associated each folder. i have function has_read_permission(request) returns true if folder has permissions , false if not i have built function so: def get_child_perms(self, folder, request, perm_list): # folder contains other folders if folder.get_children(): # every sub-folder subfolder in folder.get_children(): return perm_list.append(self.get_child_perms(subfolder, request, perm_list)) else: # if folder doesn't have sub-folders containing folders return [folder.has_read_permission(request)] i keep getting none given folders so: folder (allowed) - wont check 1 |_first folder (allowed) | |_first sub folder (restricted) |

ionic transition issue iOS -

i have form angular validation, using $dirty when accessing page, validation appear sec. bad transition, on ios, android working fine. i tried search anywhere , cant find solution, can help? thank you. example code : <div class="error-container text-left" ng-show="form.firstname.$invalid && form.firstname.$dirty"> <p ng-show="form.firstname.$error.required">first name can not empty</p> </div> but @ first time load page, still appear @ first load couple sec. you can add ng-hide in div class. <div class="error-container text-left ng-hide" ng-show="form.firstname.$invalid && form.firstname.$dirty"> <p ng-show="form.firstname.$error.required">first name can not empty</p> </div>

Decision tree for continues target variable -

i trying build decision tree in have mixed independent variables , continuous dependent variable in r.which decision tree can apply? don't want use cart want more 2 splits. you can use c4.5 algorithm build decision tree, applies use independent variables , continuous dependent variable, , can split more 2 splits.

c# - Forcing EF ApplicationUser To Load Navigation Properties -

Image
i using ef6/.net 4.5.1 retrieve data listview in usercontrol on webform. have modified applicationuser include navigation property [1:1] using fk attribute has been working great. public class applicationuser : identityuser { public applicationuser() { createdate = datetime.now; :\\ deleted stuff } public int taxid { get; set; } public system.guid applicationid { get; set; } :\\ deleted stuff [foreignkey("taxid")] public virtual personnel personnel { get; set; } } the model migrated , tested storing , retrieving. everything works fine full postback. however added button on webpage opens , closes div holds usercontrol responsible creating new member. usercontrol throws event consumed container. container closes div containing uc, reopens div listview, calls listview databind() calls getallusers(). the code: public iqueryable<applicationuser> getallusers() { var manager = httpcontext.current.getowincont

angularjs - Protractor not working with Firefox 40.0.2 -

Image
protractor not working firefox 40.0.2. earlier working fine firefox 33.0. have updated ff 40.0 , facing issue.any work around issue? following error: {unknownerror: unable connect host 127.0.0.1 on port 7055 after 45000 ms. firefox console output: angularjs node.js automation protractor share | improve question asked aug 19 '15 @ 18:13 manoj soundarrajan 141 4 17