Posts

Showing posts from August, 2013

html - How to check class name exist in child div; of parent div using jquery? -

how check whether div class within div class exist or not? in following example; want check whether "showonload" div class exist inside; parent div class "hideunhidepanel"? <div id="lodadiv" hidden="true" class="hideunhidepanel"> <div class="showonload"> </div> <div class="showonload"> </div> <div class="showonload"> </div> </div> <div id="load2div" hidden="true" class="hideunhidepanel"> //nothing exist </div> jquery code: $('.hideunhidepanel').each(function() { alert('yo'); if($(this).children('showonload')) alert('child exist'); }); fiddle: https://jsfiddle.net/5h49x7qe/ update : note -> in fiddle, displaying alert thrice; in actual should show 2 times only; third showhidepanel not have "showonload" class. .children() return jquery ...

html - PHP Encoding iso -

Image
i working on university website have access body of page, cant change encoding of pages. pages use encoding: <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> i want include file called content.php include('content.php'); when happen the problem can not find text editor convert content.php iso-8859-1 encoding. tried different types encoding content.php iso-8859-6 nothing works. someone please suggest solution encoding problem. in advance. you try using notepad ++

how to convert this C# code snippet to Javascript -

this question has answer here: repeat string - javascript 29 answers i need understand how javascript handles new string object in c# code below var upperbound = 14; (int = 0; < upperbound; i++) { console.writeline(new string('*', i)); } console.readline(); this how did in javascript: var upperbound = 14; for(var i=0;i<upperbound;i++){ console.log(new string("*", i)); } am newbie in programming , started off javascript if appear dumb asking question pls pardon , assist me explaining.. thanks there no equivalent new string("*", i) in js. need repetition yourself. a handy hack array(i + 1).join("*") , not efficient don't think, needs construct array. best way loop , concatenate.

c# - How to retrieve my shipments from FedEx using order number or reference number or invoice number -

i stuck fedex api integration in asp.net website, cannot find proper documentation api on website. what trying is: our client has tool create shipment using fedex api. now need show tracking detail on our website (which diff client's software). so, need update track number of shipment in database. how can shipment detail along tracking number fedex using order number or reference number or invoice number ? post request like: https://www.fedex.com/trackingcal/track?action=trackpackages&location=en_us&version=1&format=json&data= {"trackpackagesrequest":{"apptype":"wtrk","uniquekey":"","processingparameters":{},"trackinginfolist":[{"tracknumberinfo":{"trackingnumber":"trcking_number","trackingqualifier":"","trackingcarrier":""}}]}} replace tracking_number . have queried tracking number , should minor ...

angularjs - Injecting $state (ui-router) causes circular dependency -

when put $state there error...how can fix it? i want use $state navigate page dont know how ? suggestion ? there other way navigate user page ? app.factory('mainauthinterceptorservice', ['$q','$state', '$injector', '$location', 'localstorageservice', function ($q,$state, $injector, $location, localstorageservice) {....} im using authservice.logout(); and need redirect user page ... one simple fix use $injector service reference $state service, so: app.factory('mainauthinterceptorservice', ['$q', '$injector', '$location', 'localstorageservice', function($q, $injector, $location, localstorageservice) { var $state = $injector.get('$state'); // inject state manually ... // interceptor logic } you can use $state object usual. there similar question created user great answer explains issue in depth: injecting $state (ui-router) $htt...

Facebook Login using scribe -

i'm using scribe user id, error: oauthconnectionexception: there problem while creating connection remote service. i follow example enhanced javax filters (to parameter code correctly) https://github.com/fernandezpablo85/scribe-java/blob/master/src/test/java/org/scribe/examples/facebookexample.java i tried doing things manually , got access token looks somehow ( changed bit ) caahzcfe7yllgbaazaenkbvzbrmzazbkdggydu2vaekwsm1v0stpzaghxukeywidspc5zcxc4lb6sufeapagcpj2ju6ayvagrxyttvcqg9i7zadcf2zcvhmnqtddsduknq1c1cx47u9kwuts5t6xpbv0crabavpgzczao4zctetgckfmmajsb3zywth9lefkj3cgcj39ld2x1yroxyads0lkarmhzc and while asking user id this: https://graph.facebook.com/me?access_token=caahzcfe7yllgbaazaenkbvzbrmzazbkdggydu2vaekwsm1v0stpzaghxukeywidspc5zcxc4lb6sufeapagcsj2ju6ayvygrxyttvcqg9i7zadcf2zcvhmnqtddsduknq1c1cx47u9kwuts5t6xpbv0crabavpgzczao4zctetgckfmmajsb3zywth7lefkj3cycj39ld2x1yroxyads0lwlrmhzc%20,%20458856e03b909f426ec5d3791f0af466?fields=id,name i malformed access token. have ...

ios - Can I change (unsigned) to (NSUInteger) or will it create problems? -

i jr software developer, can change (unsigned) (nsuinteger) or create problems later? - (unsigned)retaincount { return uint_max; //denotes object cannot released } warning said mkstoremanager.m:88:1: conflicting return type in implementation of 'retaincount': 'nsuinteger' (aka 'unsigned long') vs 'unsigned int' i found previous definition - (nsuinteger)retaincount objc_arc_unavailable; your method must return nsuinteger because how retaincount method defined in nsobject . the error being caused value trying return. instead of returning uint_max , should return nsuintegermax . the underlying type nsuinteger changes depending on whether building 32 or 64 bit. accordingly, value of nsuintegermax changes match type. - (nsuinteger)retaincount { return nsuintegermax; //denotes object cannot released }

c# Help making values global -

so understand how make global values , fact 1. shouldn't , 2. cannot use value created in different "context" however, i'm not sure how correct problem in case. think make sense if read code //read in load query testcsv var sourcepath = @"d:\\load query test.csv"; //what inital csv var delimiter = ","; var firstlinecontainsheaders = true; //csv has headers //creates temp file takes less time loading memory var temppath = path.combine(@"d:", path.getrandomfilename()); var linenumber = 0; var splitexpression = new regex(@"(" + delimiter + @")(?=(?:[^""]|""[^""]*"")*$)"); using (var writer = new streamwriter(temppath)) using (var reader = new streamreader(sourcepath)) { string line = null; string[] headers = null; if (firstlinecontainsheaders) ...

javascript - Zooming on hover -

i have image color overlay , want add zooming on image when user hover on image. i'm trying achieve without jquery result don't mind using jquery. thanks in advance jsfiddle html: <div class="rss-output"> <div class="body"> <a target="_blank" href="#"> <div class="overlay-feed"></div> <div class="imagefix zooming" style="float:none;"> <img src="http://www.gettyimages.co.uk/cms/staticcontent/1391099215267_hero2.jpg" alt="" height="337" width="600"/></a> </div> </div> </div> css: div.rss-output { float: left; width: 33.333%; position: relative; padding: 15px !important; overflow: hidden; } .rss-output .body { width: 100%; position: relative; } .rss-output .overlay-feed { background: #000 none repeat scroll 0% 0%; z-index: 2; position: absolute; width: 100%; height: 200px; opacity: 0...

Git uncommited changes not commitable -

i have weird file after last pull marked not committed , cannot commit it. seems file renamed contactnamefilter.ts -> contactnamefilter.ts on remote. $ git status on branch <<...>> branch up-to-date 'origin/<<...>>'. changes not staged commit: (use "git add <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) modified: app/scripts/filters/contactnamefilter.ts no changes added commit (use "git add" and/or "git commit -a") $ git commit -a on branch <<...>> branch up-to-date 'origin/<<...>>'. changes not staged commit: modified: app/scripts/filters/contactnamefilter.ts no changes added commit $ git add -a $ git commit on branch <<...>> branch up-to-date 'origin/<<...>>'. changes not staged commit: modified: app/scripts/filters/contactnamefilter.ts no change...

c# - Updating dynamically generated assembly -

i have following code dynamically generates assembly , classes based on edmmodel. working fine, bit confused on how can update assembly when model changes. here current thoughts, either: update current classes, adding/removing properties. adding new classes when needed. create version of assembly, allowing me have 2 versions running @ same time (this approach preferable allow user access different versions of model, , mean current version still used while new 1 being generated) is possible run 2 versions of same assembly way? possible update type has been created? doing right? public class dynamicassembygenerator { private idictionary<string, assemblybuilder> _assemblybuilders; private idictionary<string, modulebuilder> _modulebuilders; private idictionary<string, typebuilder> _typebuilders; private idictionary<string, enumbuilder> _enumbuilders; private idictionary<string, type> _types; public void create(iedmmodel ...

c# - how to call a method in a windows from another method in asp.net web-api -

i have c# solution has 2 projects: windows forms project (desktop) , asp.net web-api project (rest service). trying call method enablemachine() in form1.cs post() method in valuescontroller.cs , though referenced namespace shows errors. if define enablemachine() static works, cannot because need instantiate object within method. ideas on how solve problem ? in advance ! using system; using system.collections.generic; using system.linq; using system.net; using system.net.http; using system.web.http; using restlayer.models; using validatorconnector; namespace restlayer.controllers { public class valuescontroller : apicontroller { // post api/values public void post() { ... } } } using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.text; using system.windows.forms; using log4net; namespace validatorconnector { pub...

ruby - Rails performance loading entire table -

i have table has thousands of entries. putting each entry "datatable" shown here: http://learning.aws.ipv4.ro/html/essential-tables.html basically when page loads controller saying @query = table.all can each entry. okay? should concerned performance issues when table large? yes, should concerned loading data @ once. for situations makes sense (probably most), consider adding pagination. kaminari gem favorite such purposes.

model view controller - MVC Set Selected Value of @Html.DropDownListFor to Querystring value -

i think i'm there, reason dropdown defaulting first item in list instead of value i'm passing (defaultchoice). ideas? @{ var defaultchoice = request.querystring["id"]; var choices = new selectlist(viewbag.choices, "myitemid", "myproductname", defaultchoice); } @html.dropdownlistfor(m =>m.myitemidprimary, choices) final code generates , error: string defaultchoice = request.querystring["id"]; int idval = int.parse(defaultchoice); var choices = new selectlist(viewbag.choices, "myitemid", "myproductname", idval); model.myitemidprimary = idval; i error: value cannot null (on int idval = int.parse(defualtchoice) line) you can assign value model. like this @{ var defaultchoice = request.querystring["id"]; var choices = new selectlist(viewbag.choices, "myitemid", "myproductname", defaultchoice); model.myitemidprimary=defaultchoice; }

javascript - split and create an array from a json object in js -

i have given exif of image split each key of json object , create sorted array it. output i'm expecting { "app14":[ {"app14flags0": 16384}, {"app14flags1": 0}, {"colortransform": 1} ], "composite":[ {"aperture": 2.8} {"circleofconfusion": 0.0309526315549036} {"datetimecreated": "2013:08:04 13:15:03+00:00"} {"focallength35efl": 97.0717484087605} {"..."} ], "sourcefile": "c.jpg", "xmp":[ {"alreadyapplied": true}, {"approximatefocusdistance": 1.17}, {"autolateralca": 0}, {"blacks2012": 0} ] } my last console.log({key:values}); giving me same array. js fiddle var the_keys =[]; _.foreach(data, function(n, key) { //creating array of uniq keys if(key.indexof(':')> -1) { if (_.includes(the_keys, key.split(':')[0] ...

cygwin - How to abort the sequence of git commits being reverted -

i started git revert on long sequence of commits, not knowing -no-edit option. each commit being reverted pops editor. quitting editor without saving "aborts" revert, particular commit being reverted - exits git pops edit window next commit in sequence being reverted. the man page on web shows option --abort want, tried using (in different window), , usage message: $ git revert --abort live-20121111..v2.1-master usage: git revert [options] <commit-ish> i'm using cygwin git version 1.7.5.1, presumably --abort option introduced in newer version. how can cleanly stop whole sequence start on --no-edit option? don't want have quit hundreds of editor sessions. the manual revert --abort can replaced git reset --hard . have effect of stopping loop albeit errors complaining refs/heads branch not @ commit expected when quit editor. do git log (to check commit generated git revert), , select sha1 of commit want reset to. that being said, us...

travis ci - Why could curl and wget timeout every now and then -

every , (<5%) travis builds stall because wget calling php page times out. example: https://travis-ci.org/marcelstoer/nodemcu-custom-build/builds/69239694 using curl first several weeks tried wget because of issue. curl curl -m 60 url wget wget -qo- url &> /dev/null the server serves php page doesn't report errors , in apache access log request php page reported returning http 200. what further analyze?

R scientific notation in plots -

Image
i have simple plot: #!/usr/bin/rscript png('plot.png') y <- c(102, 258, 2314) x <- c(482563, 922167, 4462665) plot(x,y) dev.off() r uses 500, 1000, 1500, etc y axis. there way can use scientific notation y axis , put * 10^3 on top of axis figure below? this sort of hacky way, there's nothing wrong it: plot(x,y/1e3, ylab="y /10^3")

ember.js - Debugging Rails 3.2 failing to precompile ember-rails 0.19 -

looking way determine in code or in ember-rails/ember-rails-source error coming from. using rails 3.2 , latest ember-rails 0.19. when precompile assets failure: unexpected token: operator (!) (line: 16, col: 178179, pos: 178546) error @ new js_parse_error (<eval>:3096:22) @ js_error (<eval>:3104:15) @ croak (<eval>:3557:17) @ token_error (<eval>:3564:17) @ unexpected (<eval>:3570:17) @ object.semicolon [as 1] (<eval>:3590:51) @ prog1 (<eval>:4133:29) @ simple_statement (<eval>:3726:35) @ <eval>:3634:35 @ block_ (<eval>:3822:32) (in /users/sjustin/development/my-app/app/assets/javascripts/application.js.coffee) i've been able destructively assets precompile removing ember sprockets reference, #= require ember in application.js.coffee : #= require jquery #= require jquery_ujs #= require ember #= require ember-data #= require_self #= require my-app window.myapp = ember.ap...

Referencing a nuget package create by an asp.net 5 class library from a Win Forms app targeting .Net 4.0 Client Profile -

i have asp.net 5 class library containing object model need share winforms application targeting .net framework 4.0 client profile. i have created nuget package asp.net 5 class library , tried referencing nuget package winforms application. when adding referece following error: could not install package 'package name 1.0.0'. trying install package project targets '.netframework,version=v4.0', package not contain assembly references or content files compatible framework. more information, contact package author. i tried adding dnx40 target framework in "frameworks" section of project.json file shown below. { "authors": [ "author" ], "dependencies": { }, "description": "shared object models", "frameworks": { "dnx40": { }, "dnx451": { }, "dnxcore50": { "dependencies": { "system.collections": "4.0.10...

mysql - Conditional SQL report -

suppose have table contains: serial# colorcount bwcount ============================== 12345 23 56 80023 0 459 22903 1 999 and want generate report looks like: sn description value ============================== 12345 "bwcount" 56 12345 "colourcount" 23 80023 "bwcount" 459 22903 "bwcount" 999 22903 "colourcount" 1 so that... the bwcount , colourcount values output different rows, and if colourcount value device (sn) 0 not output is possible raw sql? , if yes, please show me how or point me in right direction. i've done work mysql simple queries. have never seen done before. you union 2 queries return data need, example: select serial, 'bwcount' description, bwcount value serial union select serial, 'colourcount' description, colourcount value serial colourcount > 0 demo: http://sqlfiddle.com/#!9...

import - Why am I getting this error with BCP? -

i want import table while keeping identity column. in cmd, enter: bcp database.edg.hello in c:\users\tech\downloads\p.csv -c -e - s349024ijfpok.windows.net\mssqlserver -t which returns: a valid table name required in, out or format options is issue syntax? you need brackets database information. use colon " path sure. complete command: bcp [database].[edg].[hello] in "c:\users\tech\downloads\p.csv" -c -e -s 349024ijfpok.windows.net\mssqlserver -t

bash - Write to a file from a shell script -

i have file myfile has text this: self.server('10.0.0.1', '00:00:00:00:00:01', 1) self.server('10.0.0.2', '00:00:00:00:00:01', 2) i have written shell script write myfile . script has variables defined: hosts=100 servers=20 ...... i want modify line self.server('10.0.0.x', '00:00:00:00:00:0x', x) in myfile , write many times value of variable servers , x ranges 1 value of servers(20 in case). note: myfile might have of entries. example if previous value of servers 4 , new value 6, 2 entries need added. also, if previous value 6 , new value 3, first 3 entries need removed. can please guide how can achieve it? thanks. #!/bin/bash servers=20 ((i=1; i<=servers; i++));; printf "%s%02d%s\n" "self.server('10.0.0.$i', '00:00:00:00:00:" "$i" "', $i)" >> myfile done run result: self.server('10.0.0.1', '00:00:00:00:00:01', 1) sel...

android - Get the list of all the device connected in same network -

how can list of device connected in same wifi network. did find couple of applications working available on google play "who on wifi" , "wifi inspector". want implement same functionality in application. i find out code show connected ips same wi-fi: private int loopcurrentip = 0; string ad ; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //arraylist<inetaddress> ar = getconnecteddevices( ); } public arraylist<inetaddress> getconnecteddevices(string yourphoneipaddress) { arraylist<inetaddress> ret = new arraylist<inetaddress>(); loopcurrentip = 0; string ipaddress = ""; string[] myiparray = yourphoneipaddress.split("\\."); inetaddress currentpingaddr; (int = 0; <= 255; i++) { try { // build next ip address ...

ios - Facebook Login integration into Parse.com App -

Image
i trying implement facebook login option in app. followed instructions on parse website , on facebook developer page. added frameworks, modified plist file , added proper code when launch app exception: 2015-07-14 17:50:08.939 ########[35815:2144465] -[parsemanager coremanager]: unrecognized selector sent instance 0x7f9cdadad720 2015-07-14 17:50:08.953 ########[35815:2144465] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[parsemanager coremanager]: unrecognized selector sent instance 0x7f9cdadad720' *** first throw call stack: ( 0 corefoundation 0x000000010a3cdc65 __exceptionpreprocess + 165 1 libobjc.a.dylib 0x000000010a066bb7 objc_exception_throw + 45 2 corefoundation 0x000000010a3d50ad -[nsobject(nsobject) doesnotrecognizeselector:] + 205 3 corefoundation 0x000000010a32b13c ___forwarding___ + 988 4 corefoundation ...

android - Memory used by pushing a lot of pages on Xamarin.Forms' NavigationPage -

i have xamarin.forms navigationpage , noticed after pushing quite lot of pages (say 20), app starts being laggy , might freeze @ point. i'm guessing must using lot of memory (i should check in android's monitoring tools thought it). is there way can provide history functionality (so, user can press go reading before) doesn't eat memory? know it's possible because it's done in other apps. for solutions multiple pages , large navigation stack use pagesfactory: public static class pagesfactory { static readonly dictionary<type, page> pages = new dictionary<type, page>(); static navigationpage navigation; public static navigationpage getnavigation() { if (navigation == null) { navigation = new navigationpage(pagesfactory.getpage<views.mainmenuview>()); } return navigation; } public static t getpage<t>(bool cachepages = true) t : page { type pagetype...

Error in importing Bond Framework in iOS app -

Image
i hope can me problem. i'm trying use dynamic uiimage in program supported bond framework. so, getting error (no such module 'bond') while importing bond framework. installed third party library cocoapods , integrated project.yet have same problem. here sample of program code import foundation import parse import bond // 1 class post : pfobject, pfsubclassing { var image: dynamic<uiimage?> = dynamic(nil) // dynamic image property var photouploadtask: uibackgroundtaskidentifier? // 2 @nsmanaged var imagefile: pffile? @nsmanaged var user: pfuser? //mark: pfsubclassing protocol // 3 static func parseclassname() -> string { return "post" } // 4 override init () { super.init() } override class func initialize() { var oncetoken : dispatch_once_t = 0; dispatch_once(&oncetoken) { // inform parse subclass self.registersubclass() } } did follow cocoapods instructions? https://cocoapods.org/#get_st...

php c extension: list of api functions available? -

maybe i've not understood well, i'm wondering why there no defined list of functions can call when writing php extensions in c. there doesn't appear list of functions, such php_printf() or zend_parse_arguments. rag tag collection of websites explaining or that. i'm looking complete list of functions, i'm allowed call inside c extension, reference manual, or @ least, form of documentation i apologise if question super easy , i've overlooked something, if know can find list, i'd happy hear it!

mingw w64 - Static Linking of Emacs for Windows using win-builds -

background: i'm trying compile emacs 25 windows desktop. @ moment i'm using win-builds (mingw-w64-based). i passed in -static flag in ldflags (to configure), , crash on error c:/win_builds/msys/1.0/opt/windows_64/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.2/ ../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldbus-1. i'm interpreting absence of static lib (archive) link with. can link using dlls, have dump ton of dlls emacs directory. there mechanism statically linking executable in environment? win-builds won't enable achieve static linking since ships shared libraries except few specific cases. that said need see little use in static linking typically since applications nowadays come files resources , therefore need several files, making ease of deployment of single-file binaries moot point.

bundles not working in debug mode Asp.net MVC -

while in debug mode bundling not working, unlike release mode. error: "failed load resource: server responded status of 500 (internal server error)" ideas? code in registerbundles: bundles.add(new scriptbundle("~/bundles/jquery").include( "~/scripts/jquery-{version}.js")); add in bundle.config file.. bundletable.enableoptimizations = false;

vb.net - Loop through array and insert items -

i'm working on project read vb.net solutions code files list(of file) (file being custom class) , loop through code (code being list(of string) ) property of each file. what want in loop add random code, i'm having quite bit of trouble figuring out how make work correctly. the problem code inserted in places don't want inserted. i have tried couple of different ways of doing this: simply looping through code property , adding lines if conditions right. adding property: public indices list(of integer) , looping through , inserting lines code property using new properties values. adding property: public insertionloopcode list(of string) , assigning code property , looping through new property , adding lines code property what code looks like: for each folder folder in folders each file file in folder.files = 0 file.insertionloopcode.count - 1 if file.insertionloopcode(i).contains(" sub ") andalso not file.insertionloopco...

python - close Universe in MDAnalysis module -

is possible close or unload universe in mdanalysis module? didn't find such function on mdanalysis pages want modify trajectory module , load again in mdanalysis, following: file "/home/eh22/local/lib/python2.7/site-packages/lsdmap/util/metric.py", line 231, in get_distance_matrix ts in u.trajectory: file "/home/eh22/local/lib/python2.7/site-packages/mdanalysis-0.8.1-py2.7-linux-ppc64.egg/mdanalysis/coordinates/xdrfile/core.py", line 602, in __iter__ ts = self._read_next_timestep() file "/home/eh22/local/lib/python2.7/site-packages/mdanalysis-0.8.1-py2.7-linux-ppc64.egg/mdanalysis/coordinates/xdrfile/core.py", line 651, in _read_next_timestep (self.format, statno.errorcode[ts.status]), self.filename) ioerror: [errno 14] problem xtc file, status exdrmagic: 'traj1.xtc'

Splitting and Merging large files (size in GB) in Java -

suppose, i splitting 2590400 kb (approx 2.5 gb) file in 30 parts. it produce 30 files size of 86347 kb . seems correct, 2590400/30 = 86346.66666667 now if merge parts (30) again producing file of 3453873 kb file, should 2590410 kb . can me why difference there? using below code merge , split files. splitfile.java import java.io.bufferedoutputstream; import java.io.bufferedreader; import java.io.bufferedwriter; import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.filewriter; import java.io.ioexception; import java.io.inputstreamreader; import java.io.randomaccessfile; /** * @author vishal.zanzrukia * */ public class splitfile { public static final string input_file = "d:\\me\\projects\\input\\file\\path.txt"; public static final int number_of_output_files = 30; public static final string file_suffix = ".txt"; /** * split file * * @throws exception */ sta...

python - Issues with sending large JSON file over socket -

i'm @ point in network learning have realized things aren't perfect , network packets can out of sync , might not send in 1 packet. my program works small data being sent on socket, not large file. keep getting valueerror: expecting ',' or expecting ':' whenever trying send big file , think it's because receiving function not good. i've read lot on how have implement own protocol reading information socket still have found no information on how implement that. my program serializes information on computer , sends on json computer. heard somewhere json automatically deals sending packet information or that, i'm not clear meant. in case, receiving function: def recieve(node, s, timeout=2): s.setblocking(false) #array of data all_data = [] begin = time.time() while true: #if data received, break after timeout if all_data , time.time()-begin > timeout: break #if no data received ...

Plot in matlab xlabel with variables -

i m trying give images no axis xlabel variabels. there trick? figure(678) subplot(3,3,1) imagesc(image{1,1}) title(' image of images') axis image; axis off; str = sprintf('ssim = %f, number of bins = %f',variabel1, size(images{1,1},3)); xlabel('str'); subplot(3,3,2) ... 1) there easy way? 2) know if can produce many different subplots in easy way? have 10*10 images , not 3*3. 3) can change size between images? know can manually after compiling size of images changes too.

python - TypeError : 'Tk' Object is not callable -

i'm writing program supposed connect server, check dbs , specific table (and how items in these tables), , i'm using tkinter gui. problem whenever try use it, have error "typeerror : 'tk' object not callable". program used work, doesn't anymore, have got idea this? (don't worry strange names, made i'm sure there no problems, variable having same name function or so) import pyodbc import sys tkinter import * #wrote down variables here remembered them username = '' password = '' server_name = '' database = '' table = 'véhicules' nom_instance = '' total = '' nb_vehic = '' master = tk() label(master,text="what username ?").pack() yzx = entry(master) yzx.pack() username = yzx.get() yzx.delete(0, end) label(master,text="what user's password?").pack() yxz = entry(master) yxz.pack() password = yxz.get() yxz.delete(0, end) label(master, text="what server...

python - How can I get my Django admin styles to load? -

i'm using django 1.8 static files , using django-offsite-storage. when browse django admin in browser on local machine it's requesting css file /admin/css/base.css s3 bucket without hashed version. want use hashed file name version because that's get's uploaded s3 bucket. i've tried switching debug = true or false, neither trick. how can on local machine? the reason admin styles weren't loading because had debug = true in different settings file main settings file (which had debug = false).

post - PHP: Add video tag to youtube link fron content -

i have variable $post->post_content return me detail of post , video url youtube. i need remove text $post->post_content else youtube link, , add youtube likn tag <video>youtube_url</video> the content :- at instant, while daggoo, on summit of head, clearing whip—which had somehow got foul of great cutting tackles—a sharp cracking noise heard; , unspeakable horror of all, 1 of 2 enormous hooks suspending head tore out, , vast vibration enormous mass sideways swung, till drunk ship reeled , shook if smitten iceberg. 1 remaining hook, upon entire strain depended, seemed every instant on point of giving way; event still more violent motions of head. https://www.youtube.com/watch?v=jerem0zky18 and time :- أسر شعار اسبوعين الدولارات من, شرسة أعلنت اندلاع إذ هذا. وبعد الثالث أوكيناوا ما بين, الحصار الأمامية بـ عدد. ذات بقعة فمرّ إذ, أخذ كل بالحرب وسمّيت المانيا. و فصل بمباركة المقيتة, أملاً الحصار المتاخمة من عدد. بزمام أثره، التبرعات تم بعد, الجيش خصوصا...

looping through arguments in a macros in sas -

i have developed sas code has macro 2 arguments. macro looks this %macro compare(country,attributes) the problem have 10 countries , example india, u.s.a, australia, pakistan etc , 15 attributes such language, area, currency, life_expec, malefemaleratio etc. so have call macro 150 times. %compare(india,language); %compare(india,area); %compare(india,currency); * ; /* have same other attributes */ * ; %compare(u.s.a,language) %compare(u.s.a,area) /* have same other countries */ *; *; *; is there way take take these attributes , country names array , loop through them same result? new sas. in advance helping me i suggest 1. put country , attributes sas table 'country_attr', variable 'country' , 'attributes'. 2. call execute: data _null_; set country_attr; call execute ('%compare('||country||','||attributes')'); run;

android - ListView How to clear selection -

so have selector on list view, each row has 2 text views , each text view has selector in sync(different drawables same states: activated , pressed ) 1 on list. logic when detect fling on item in list view, temporarily change background color of view , after 500ms set transparent. but, when resets child view has pressed state set true , not either ways view has correct bg inner text views correspond activated drawables when pressed state false. i can't seem figure out how correct behavior. appreciated, thing driving me nuts. i've tried clearing choices doesn't help, i've tried explicitly force child view set false activated state , pressed state doesn't goo either. i've run out of options this. so after spending time analyzing going on behind scenes in abslistview found workaround problem. first more on problem causing this, abslistview has got 8 states motion detection namely - touch_mode_rest (-1) touch_mode_down (0) touch_mode_ta...

javascript - Dealing with search results and bootstrap modal -

i have php file searches keyword in mysql database table. script builds page lot of products organized brands… when click product shows bootstrap modal more info (calling php file looks particular id of product). modal has 2 buttons , needs able go previous , next product of brand , buttons should disable when reaching first or last product. this i’ve been doing: while inserting data products in page generate xml file brands , inside each brand, ids of divs corresponding product. have build arrays in javascript handle data. code getting messy i’ve been wondering: what’s best way link products can go , forward in modal? i ended building this: <div id='231' data-brand='somebrand' data-brand-index='3'> then can id jquery: var x = $("div[data-brand='somebrand'][data-brand-index='2']"); alert(x.attr("id")); //shows 231

sql server 2008 - I need help in sql query to get this o/p -

Image
i have table structure follows.. and here sample data... tblteam ---------------------------------- name teamid royal challengers bangalore 1 chennai super kings 2 delhi daredevils 3 sunrisers hyderabad 4 kolkata knight riders 5 mumbai indians 6 kings xi punjab 7 rajasthan royals 8 deccan chargers 9 kochi tuskers kerala 10 pune warriors 11 ------------------------------------------------ tblschedule ------------------------------------------------ scheduleid datetime team_1 team_2 venuid 1 4/18/08 8:00 pm 1 5 6 2 4/19/08 5:00 pm 2 7 9 3 4/19/08 8:30 pm 3 8 4 4 4/20/08 4:30 pm 5 9 1 5 4/20/08 8:00 pm 1 6 5 6 4/21/08 8:00 pm 8 7 ...

c++ - how to pinvoke SLGetWindowsInformation from c# -

i know how pinvoke data structure given in function giving me more troubles figure out on own function name slgetwindowsinformation exists @ slc.dll hresult winapi slgetwindowsinformation( _in_ pcwstr pwszvaluename, _out_opt_ sldatatype *pedatatype, _out_ uint *pcbvalue, _out_ pbyte *ppbvalue ); for full reference here thanks in advance , have wonderful day like this: enum sldatatype { sl_data_none = reg_none, sl_data_sz = reg_sz, sl_data_dword = reg_dword, sl_data_binary = reg_binary, sl_data_multi_sz = reg_multi_sz, sl_data_sum = 100 }; // can values of reg_xxx constants windows header files [dllimport("slc.dll", charset = charset.unicode)] static extern uint slgetwindowsinformation( string valuename, out sldatatype datatype, out uint cbvalue, out intptr value ); call function this: sldatatype datatype; uint cbvalue; intptr valueptr; uin...

arrays - Import XML objects in batches -

i'm working on powershell script deals large dataset. have found runs until memory available consumed. because of how large dataset is, , script does, has 2 arrays become large. original array around half gig, , final object 6 or 7 gigs en-memory. idea should work better if i'm able release rows done , run script in increments. i able split imported xml using function i've found , tweaked, i'm not able change data contained in array. this script i'm using split array batches currently: https://gallery.technet.microsoft.com/scriptcenter/split-an-array-into-parts-4357dcc1 and code used import , split results. # import object should have been prepared beforehand query # script. (queryforcombos.ps1) $saveobj = "\\server\share$\me\global\scripts\resultant sets\latestquery.xml" $result_table_import = import-clixml $saveobj if ($result_tables.count > 100000) { $result_tables = split-array -inarray $result_table_import -size 30000; } else { $re...

Reading headers from fits files in python -

i'm trying read headers specific fits files in directory. don't want obtain headers every file, specify. here code have far: import os astropy.io import fits pyfits def mycode(files): fits = [] headers = [] in files: fits.append(i) j in fits: if 'rf' in j: hdulist = pyfits.open(j) header = hdulist[0].header['headername'] headers.append(header) return headers pathway = 'the directory' dirs = os.listdir(pathway) print mycode(dirs) however, when run that, says "no such file or directory" , gives name of 1 of files trying access. appreciate help! when use pyfits.open(j) , python understands file in current directory (the 1 script is). since names of files directory, python doesn`t find them. 1 solution attach directory beginning of every file.