Posts

Showing posts from August, 2014

windows phone 7 - Deserialise XML response from server -

i want deserialise object. saw following code in msdn.com: private void deserializeobject(string filename) { debug.writeline("reading xmlreader"); // create instance of xmlserializer specifying type , namespace. xmlserializer serializer = new xmlserializer(typeof(user)); // filestream needed read xml document. filestream fs = new filestream(filename, filemode.open); xmlreader reader = xmlreader.create(filename); // declare object variable of type deserialized. user i; // use deserialize method restore object's state. = (user)serializer.deserialize(reader); fs.close(); // write out properties of object. debug.writeline( i.field1+ "\t" + i.field2+ "\t" + i.field3+ "\t" + i.field4); } however, don't want deserialise file, rather xml stream server response, corresponding code shown here: httpwebrequest webrequest = (httpwebrequest)asynchronousresult.asy...

Can I evaluate two groups of items with a foreach loop in C# winforms? -

i have winforms tabcontrol , trying cycle through controls contained in each tab. there way add and in foreach loop or isn't possible evaluate more 1 group of items? example i'd do: foreach (control c in tb_invoices.controls , tb_statements.controls) { //do } or foreach (control c in tb_invoices.controls, tb_statements.controls) { //do } is possible, , if not, next best thing? need use for loop? foreach(tabpage page in yourtabcontrol.tabpages){ foreach(control c in page.controls){ loopthroughcontrols(c); } } private void loopthroughcontrols(control parent){ foreach(control c in parent.controls) loopthroughcontrols(c); }

How do I resolve a formula error in Homebrew for imagemagick? -

i'm running os x , trying homebrew, ruby , git work together. got installed , trying resolve gem errors. i came across issue imagemagick , rmagick not working together, tried solution described in " installing rmagick in mac os x mountain lion homebrew ". now getting following error when try anything. how can resolve this? $ brew doctor error: /usr/local/library/formula/imagemagick.rb:99: syntax error, unexpected $end, expecting kend please report bug: https://github.com/mxcl/homebrew/wiki/troubleshooting /usr/local/library/homebrew/formulary.rb:40:in `require' /usr/local/library/homebrew/formulary.rb:40:in `klass' /usr/local/library/homebrew/formulary.rb:90:in `get_formula' /usr/local/library/homebrew/formulary.rb:175:in `factory' /usr/local/library/homebrew/formula.rb:404:in `factory' /usr/local/library/homebrew/formula.rb:340:in `each' /usr/local/library/homebrew/formula.rb:338:in `each' /usr/local/library/homebrew/c...

ios - Am I correctly creating and passing this C array to Objective-C method and referencing it with a property? -

i created c array this: unsigned char colorcomps[] = {2, 3, 22, 55, 9, 1}; which want pass initializer of objective-c object. so think have put array on heap: size_t arraybytesize = numcolorcompvals * sizeof(unsigned char); unsigned char *colorcompsheap = (unsigned char*)malloc(arraybytesize); then have write first "stack memory array" heap array in loop: for (int = 0; < numcolorcompvals; i++) { colorcompsheap[i] = colorcomps[i]; } side question: there more elegant solution avoid for-loop step? and pass method: defined as - (id)initwithcolorcompsc:(unsigned char *)colorcompsheap; theobject *obj = [[theobject alloc] initwithcolorcompsc:colorcompsheap]; theobject has property hold c-array: @property (nonatomic, assign) unsigned char *colorcomps; and in -dealloc free it: free(_colorcomps); this in theory. use arc objective-c. am doing correct or there better way? if theobject going free array, init method should 1 make copy,...

windows 8 - How can I save a zip file to local storage in a win8 app using JSZip? -

i'm able create jszip object in code, i'm having trouble saving local storage in windows 8 app. examples i'm able find set browser's location.href trigger download, isn't option me. i've included code below. zip file end invalid , can't opened. appreciated. for reference: jszip function _ziptest() { var dbfile = null; var zipdata = null; windows.storage.storagefile.getfilefrompathasync(config.db.path) .then(function (file) { dbfile = file; return windows.storage.fileio.readbufferasync(file); }) .then(function (buffer) { //read database file byte array , create new zip file zipdata = new uint8array(buffer.length); var datareader = windows.storage.streams.datareader.frombuffer(buffer); datareader.readbytes(zipdata); datareader.close(); var localfolder = win...

Magento how do I override/alter template/payment/form/purchaseorder.phtml file -

Image
i need add text file [ template/payment/form/purchaseorder.phtml ], particular store within clients' magento site. when make change purchaseorder.phtml file, changes text on stores. need somehow customize 1 store in particular. i have read comments on several sites, mention changing local.xml, change config.xml, make changes in admin panel, such small change, don't want disrupt going overboard. i need extend functionality on backend change can made particular store or stores. sites has 5 stores built 1 install , need make above change 1 store. i think need somehow add po field heading , "additional text" option purchase order section in image two. correct, if how do this? could point me in right direction making type of change please. note : can't create directory structure, copy files, change needed files option this magento 1.7 copy purchaseorder.phtml file base/default directory paste in current template. can alter content of p...

r - Trouble with horizontal and vertical lines accepting class "Date" in ggplot? -

Image
i'm trying make gantt chart in ggplot based on generous code offered user didzis elferts. i'm trying add vertical line showing today's date, geom_vline layer in ggplot2 package returns error: discrete value supplied continuous scale . here code: today <- as.date(sys.date(), "%m/%d/%y") library(scales) ggplot(mdfr, aes(time,name, colour = is.critical)) + geom_line(size = 6) + xlab("") + ylab("")+ labs(title="sample project progress")+ theme_bw()+ scale_x_datetime(breaks=date_breaks("1 year"))+ geom_vline(aes(xintercept=today)) the plot without geom_vline command looks : any reason why geom_vline wouldn't work "date" character? edit: reproducible code used generate plot: ### gantt chart 1 ###############3 tasks <- c("meetings", "client calls", "design", "bidding", "construction") ...

angularjs - Setting $scope.$watch on each element in an array -

i trying figure out how set $scope.$watch on each element in array. care attributes of each element. in example, each rental_date object has 3 attributes: date , start_time , , stop_time . whenever start_time changed, want stop_time set 2 hours after start_time . the $ngresource call (using angular 1.1.5 ): agreement.show( id: 5 ).$then ((success) -> $scope.agreement = success.data.agreement # returns array of rental dates $scope.rental_dates = success.data.rental_dates # $watch goes here here 4 variations of $watch function tried: 1: angular.foreach $scope.rental_dates, (date, pos) -> $scope.$watch date.start_time, ((newval, oldval) -> $log.info 'watch changed' $log.info newval $log.info oldval ), true 2: angular.foreach $scope.rental_dates, (date, pos) -> $scope.$watch $scope.rental_dates[pos].start_time, ((newval, oldval) -> $log.info 'watch changed' $log.info newval $log.info oldval...

c# - No errors or results when executing simple query on SQL Server database -

this first approach sql server. have exported access db sql server , want use in application. have added new sql db c# project , replaced oledb sql . unable execute queries working local db in access. query: string query = @"select sessionid, semestera, semesterb, roomid, sessiondate, sessiontimestart, sessiontimeend" + " [session] " + " roomid = @roomid " + " , sessiondate = getdate() "; i have replaced date() getdate() instructed vs error, query not produce result (should return 1 record, access db does) my roomselect form code: using system; using system.collections.generic; using system.componentmodel; using system.data; using system.data.sqlclient; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace autoreg { public partial class roomselect : form { datatable queryresult = new datatable()...

java - Synchronizaton Object Lock Confusion -

i studying k&b threads chapter. reading synchronization. here example k&b. public class accountdanger implements runnable { private account account = new account(); public void run() { for(int x =0 ; x < 5 ; x++){ makewithdrawl(10); if(account.getbalance() < 0 ){ system.out.println("account overdrawn"); } } } public static void main(string[] args){ accountdanger accountdanger = new accountdanger(); thread 1 = new thread(accountdanger); thread 2 = new thread(accountdanger); one.setname("fred"); two.setname("lucy"); one.start(); two.start(); } private synchronized void makewithdrawl(int amt){ if(account.getbalance() >= amt){ system.out.println(thread.currentthread().getname() + " going withdraw"); try{ thread.sleep(500); } catch(interruptedexception e) { e.printstacktrace(); } account.withdraw(amt); system...

Convert Java Object to Json and Vice versa? -

i know json object nothing string . my question have map of object , want convert json format. example : java class -> class person{ private string name; private string password; private int number; } java list -> map<list<long>,list<person>> map=new hashmap<list<long>,list<person>>(); ..and map has data filled in it. i want convert list json format? how can achieve it? because want send on httpclient... if not other alternative way? as per knowledge there gson api available, dont know how use , or in other efficient way. thank you not sure problem gson is. the doc : bagofprimitives obj = new bagofprimitives(); gson gson = new gson(); string json = gson.tojson(obj); and bagofprimitives obj2 = gson.fromjson(json, bagofprimitives.class); that object (as name suggests) made of primitives. gson trivially handle objects, collections of objects etc. life gets little more complex when using generics etc...

css - Strange behaviour when using text-align justify/text-justify and right -

Image
i ran 1 ie-specific problem can't wrap head around. the following html , css can seen live in pen . :: html <div id="container"> <div class="dummy">dummy</div> <nav> <div id="right"> <ul> <li>lorem ipsum <img src="http://placehold.it/80x40"> dolor sit amet.</li> <li>anal natrach, ut vas petat, <img src="http://placehold.it/80x40"> doriel dienve.</li> </ul> <div class="dummy">dummy</div> <div class="dummy">dummy</div> </div> </nav> </div> :: css /* reset */ * { margin: 0; padding: 0; vertical-align: top; } ul { list-style: none; } /* markup */ #container { line-height: 0; font-size: 0rem; text-align: justify; text-justify: distribute-all-lines; } #container:...

callback - Ajax: Append data in input value instead of div -

this ajax function works fine, change place result needs shown <script type="text/javascript"> function submitform1() { var form1 = document.myform1; var datastring1 = $(form1).serialize(); $.ajax({ type:'get', url:'file.php', cache: false, data: datastring1, success: function(data){ $('#results').html(data); } }); </script> html <input type="hidden" name="place" id="place" value="//append data here"> <div id="result"><div> i need have result in value=" " after ajax call back. way this? try use $('#result').html(data); instead $('#results').html(data); , forget close function function submitform1() { var form1 = document.myform1; var datastring1 = $(form1).serialize(); $.ajax({ type: 'get', url: 'file.php', cache: false, data: datastring1, success: function(...

android - Attempted to access a cursor after it has been closed -

i'm using following code delete image. works first time, when try capture image , delete staledataexception : 08-07 14:57:24.156: e/androidruntime(789): java.lang.runtimeexception: unable resume activity {com.example.cap_im/com.example.cap_im.mainactivity}: android.database.staledataexception: attempted access cursor after has been closed. public void deleteimagefromgallery(string captureimageid) { uri u = mediastore.images.media.external_content_uri; getcontentresolver().delete( mediastore.images.media.external_content_uri, basecolumns._id + "=?", new string[] { captureimageid }); string[] projection = { mediastore.images.imagecolumns.size, mediastore.images.imagecolumns.display_name, mediastore.images.imagecolumns.data, basecolumns._id, }; log.i("infolog", "on activityresult uri u " + u.tostring()); try { if (u != null) ...

java - Methods for an interface with a variable number of parameters -

i'd ask if it's possible in java have declaration of method in interface but, want methods defined have variable number of input parameters (for example, of same type). thinking in this: public interface equalscriteria { public boolean isequal(string... paramstocheck); // not equals(object obj) !!! } and 1 class implements equal criteria like, example: public class commonequals implements equalscriteria { private string name; private string surname; .... @override public boolean isequal(string othername, string othersurname) { return name.equals(othername) && surname.equals(othersurname); } } but maybe, want other criteria in part of code, this public class specialequals implements equalscriteria { .... @override public boolean isequal(string othername, string othersurname, string passport) { return name.equals(othername) && surname.equals(othersurname) && passport.equals(pass...

android - Change color of background drawable of a button from widgetprovider -

in normal android code in activity, can control color of background drawable drawable d = findviewbyid(r.id.button_highlight).getbackground(); porterduffcolorfilter filter = new porterduffcolorfilter(color.red, porterduff.mode.src_atop); d.setcolorfilter(filter); i know how can utilize within widgetprovider dynamically change background color of background drawable of elements from instance of appwidgetprovider call like: int color2 = settings.getint("secondary_color", r.color.main_alt); // following won't work because <button> has no method "setcolorfilter" remoteviews.setint(r.id.button_highlight,"setcolorfilter",color2); the button_bg.xml drawable button id r.id.highlight looks this: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape> ...

asp.net error form cannot be nested within element form? -

i have content page in asp.net application uses form tag. there's 1 on page i'm confused why give me error: validation (html5): element 'form' must not nested within element 'form' heres code: <%@ page language="c#" autoeventwireup="true" masterpagefile="~/site.master" codebehind="default.aspx.cs" inherits="webapplication6._default" %> <asp:content id="content1" runat="server" contentplaceholderid="maincontent"> <div> <form id="form1"> <asp:gridview id="gridview1" runat="server" allowsorting="true" autogeneratecolumns="false" datakeynames="id" datasourceid="sqldatasource1" allowpaging="true" onselectedindexchanged="gridview1_selectedindexchanged"> <columns> <asp:boundfield datafield="id" headert...

java - Difference between thread's context class loader and normal classloader -

what difference between thread's context class loader , normal classloader? that is, if thread.currentthread().getcontextclassloader() , getclass().getclassloader() return different class loader objects, 1 used? each class use own classloader load other classes. if classa.class references classb.class classb needs on classpath of classloader of classa , or parents. the thread context classloader current classloader current thread. object can created class in classloaderc , passed thread owned classloaderd . in case object needs use thread.currentthread().getcontextclassloader() directly if wants load resources not available on own classloader.

Embedding Javascript in PDF to force links to open in new window -

we generating pdfs displayed on pages of our web app. pdfs displayed in iframes within page. if user clicks link inside 1 of pdfs on internet explorer acrobat installed, loads link in iframe, breaks user experience. what accomplish embed javascript in pdf links clicked in pdf opened in new window. tried embedding following code in pdf: /type /action /s /javascript /js (app.openinplace = false;) the resulting pdfs continue open links in place. using utility functions pypdf2 embed javascript inside pdfs. it occurred me might not possible open link pdf in new window within iframe.

Will RCpp speed up the evaluation of basic R functions? -

pardon me, not know rcpp, trying figure out if learn in order improve package writing. i have written r package (is supposed to) efficiently , randomly samples uniformly high-dimensional, constrained space mcmc algorithm. (unfinished and) located @ https://github.com/davidkane9/kmatching . the problem when run statistical test called gelman-rubin diagnostic see whether mcmc algorithm has converged stationary distribution, should r = 1 statistic, high numbers, tells me sampling bad , no 1 should use it. solution take more samples , skip more (taking 1 out of ever 1000 instead of every 100). takes lot of time. if want code run, here example: ##install package first data(lalonde) matchvars = c("age", "educ", "black") k = kmatch(x = lalonde, weight.var = "treat", match.var = matchvars, n = 1000, skiplength = 1000, chains = 2, verbose = true) looking @ rprof output of rnorm , %*% taking of time: total.time total....

networking - AR9485 Wireless Network Adapter with linux mint -

lately change vivobook 500ca linux. i installed latest mint cinnamon. have been having problems wireless card : description: wireless interface product: ar9485 wireless network adapter vendor: atheros communications inc. physical id: 0 when start pc works 10 minutes , disconnected wireless network. i tried install drivers ndiswrapper , inf files no way make works! : module not loaded. error was: fatal: module ndiswrapper not found. ndiswrapper module installed? any ideas why keep getting disconnected? sudo apt-get install ndiswrapper-dkms

plugins - JQuery Timepicker interfering with Datepicker -

i trying find way remove jquery plugin specific class/id. i have web form has several fields use date picker, form has fields use timepicker. timepicker input field ids targeted .timepicker() , works, because have same class datepicker fields, datepicker showing when click on time field inputs. is there way can remove plugin timepicker divs , not affect of other fields?

asp.net - redirect .aspx with query string to html page using htaccess -

we have migrated windows server linux server. trying redirect .aspx urls html urls. the static pages works fine if used redirect 301 /contact.aspx http://mysite.com/contact.html but when try add redirect like redirect 301 /products.aspx?cid=30&bid=5 http://mysite.com/category/books.html the redirect not working. any advice highly appreciated

android - DrawerLayout populating menus from other activity -

i'am creating menu 2 navigation drawers 1 in each side: left/right navigation drawers everything working should want separate populating tasks main activity left activity , right activity, on had separeted layouts (just better struture) this main layout: <!-- main content view --> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" tools:context=".mainactivity" > <listview android:id="@+id/main_list_viewer" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" android:divider="@android:color/darker_gray" android:dividerheight="1dp" android:footerdividersenabled=...

html - Why is this div dropping down to the next line on window zoom out? -

jsfiddle i have wrapper 4 divs inside floated left , in 1 line. when zoom out, 4th div drops bottom. possible problem can think of width of wrapper decreasing, causing not able contain 4th one, wrapper has fixed width i'm sure thats not problem. here's html: <div id="wrapper"> <div id="panel"> <div id="panel1" class="panelcell"></div> <div id="panel2" class="panelcell"></div> <div id="panel3" class="panelcell"></div> <div id="panel4" class="panelcell"></div> <div class="spacer" style="clear: both;"></div> </div> </div> and here's css: #wrapper{ width: 1280px; } #panel{ width:100%; } #panel .panelcell{ width: 318.75px; height: 213px; float: left; border-right: 1px solid white; } .pane...

Convert from double to long without Round Java -

i'm trying convert random double long without rounding or truncating it. first change double string, know how many decimal places there , change value long. problem number of last decimal place not correct , don't know reason , how can change it. here code: double z=(double) myrandom(1, 20); long test; string s = double.tostring(z); test=(long) (math.pow(10, s.length()-s.indexof(".")-1)*z); system.out.println("z: "+z); system.out.println("double converted long: "+test); and that's output: d: 19.625014811604743 double converted long: 19625014811604744 d: 9.143326452202839 double converted long: 9143326452202838 d: 5.8964228376511105 double converted long: 58964228376511104 d: 15.045936360299917 double converted long: 15045936360299918 d: 14.147950026532694 double converted long: 14147950026532694 editing current implementation: double z=(double) myrandom(1, 20); string s...

asp.net web api - SignalR and IIS recycle -

i want create server send notifications client using signalr - using groups suppose site recycled - happen groups not persist you need persist groups in external permanent storage. more details here: http://www.asp.net/signalr/overview/hubs-api/working-with-groups

foreign keys - Django ForeignKey null=True fails to drop not null from column -

the problem: here's class 2 foreignkey s ( dept , salary_range ). note null=true : class userprofile(models.model): user = models.onetoonefield(user, related_name='user_profile') avatar = models.charfield(max_length=300, default='/static/default.png') dept = models.foreignkey(department, null=true) salary_range = models.foreignkey(salaryrange, null=true) running python manage.py sqlall main seems show correct sql (no not null on dept_id , salary_range_id : create table "main_userprofile" ( "id" integer not null primary key, "user_id" integer not null unique references "auth_user" ("id"), "avatar" varchar(300) not null, "dept_id" integer references "main_department" ("id"), "salary_range_id" integer references "main_salaryrange" ("id"), but integrityerror occurs when creating userprofile : mai...

c# - Bubblesort printing out in reverse order -

i've written bubblesort, however, when print out array, it's sorted, starts off highest number, , ends lowest number. public int[] bubblesort(int[] unsortedarray) { for(int = 0; < unsortedarray.length; i++) for(int j = 0; j < unsortedarray.length; j++) if(unsortedarray[i] < unsortedarray[j]) { int temp = unsortedarray[i]; unsortedarray[i] = unsortedarray[j]; unsortedarray[j] = temp; } return unsortedarray; } could explain why list reversed. edit: sorry, pasted wrong code. when line reads if(unsortedarray[i] < unsortedarray[j]) list orderded lower higher, however, logically doesn't make sense. if lower j, swap them. probably better as: public int[] bubblesort(int[] unsortedarray) { return unsortedarray.orderby(x=>x).toarray(); } a few issues original, i , j iterating much, still work, it's doing unnecessary iterations won...

mysql - Choosing one row over another, but not based on the where clause -

not quite sure how ask properly, perhaps part of problem. there exists database many similar records differentiated column called 'priority'. i'd grab record higher priority has same 'type' & 'project' id. example, table looks this: id project_id type_id priority 1 66 14 0 2 66 14 10 3 66 16 0 currently program selects via project , type: select * table project_id = 66; and loops through results , discards lower priority record when there exists multiple records of same type_id . there way via select? the ideal result set be: id project_id type_id priority 2 66 14 10 3 66 16 0 where discarded lower priority type_id 14 record. there may more 2 items same type_id in table. select * table group project_id, type_id order priority desc

winapi - How do I get the dimensions (RECT) of all the screens in win32 API? -

i'm writing application testing team. application lets take screenshot of part of screen (and uploads testing team server comments). taking screenshot involves selecting region on screen take screenshot of. i'm creating semi-transparent window , overlaying on entire screen. i'm using getdesktopwindow() , getwindowrect() dimensions of screen doesn't work in multi-screen environments. how overlay window on possible screens? the screen configurations can pretty exotic, such as: [lcd] [lcd][lcd][lcd] (4 lcd screens - 1 @ top, 3 @ bottom) or [lcd] [lcd] [lcd][lcd][lcd] [lcd] [lcd] (7 lcd screens - 3 on right, 3 on left, 1 in middle). etc. does know how overlay 1 window screens? wonder dimensions in 1st exotic example, when there no screen on top-row left , right? perhaps should creating 1 overlay window per lcd screen? any ideas? you can use enumdisplaymonitors function this. here's little class automatically builds ve...

javascript - Filter Collection by Substring in Backbone.js -

if want autocomplete collection, best way? i'd see if search string in (or select few) attributes in model. i thinking like... this.collection.filter(function(model) { return model.values().contains($('input.search]').val()); }) edit i'm sorry, must not have explained enough. if have collection attributes... [ { first: 'john', last: 'doe'}, { first: 'mary', last: 'jane'} ] i want type in a search, catch keyup event, , filter out { first: 'mary', last: 'jane'} , neither john nor doe contains a . you can @ model's attributes this... var search = $('input.search]').val(); this.collection.filter(function(model) { return _.any(model.attributes, function(val, attr) { // comparison of value here, whatever need return ~val.indexof(search); });; });

python - Identifying if a Cell contains an equation in Word -

i have table in word filled different texts, , equations using microsoft equation 3.0. i trying read text table , create excel sheet same table. is there way of normalizing equations in word text? if not, know how can identify equation bypass it? my current code reading table this: word = win32.gencache.ensuredispatch('word.application') word.visible = false raw_files = glob('*.docx') xl = win32.gencache.ensuredispatch('excel.application') ss = xl.workbooks.add() f in raw_files: word.documents.open(f) doc = word.activedocument x in xrange(1, doc.paragraphs.count+1): otext = doc.paragraphs(x) if otext.range.tables.count >0 : ph = ss.activesheet r in xrange(1, otext.range.tables(1).rows.count): c in xrange(1, otext.range.tables(1).columns.count): if otext.range.tables(1).cell(r,c).range.text != none: ph.cells(r+2,c).value = otext.range.t...

html - Why this website fail under IE? -

i have big problem website: http://hiperteksty.org safari , firefox browser works under ie layout bad. before look, i'm going guess didn't start file with: <!doctype html> now @ it. know, right! well, sort of. do have doctype, it's invalid. try using 1 listed above.

http - content-type wasn send by setting it with header() in php -

i have problem setting content-type php function header(); complete code doesn't ever send output. response-object it. before every output send headers. depending on accept-header set content-type , right output, in easy way looks that: switch($aceptheader){ case 'text/html': #and othe stupid acept-headers of ie $this->setheader('content-type: text/html; charset=".."'); $this->sendheaders(); $this->senddefault(); break; case 'application/json': $this->setheader('content-type: application/json'); $this->sendjson(); break; case 'application/xml': $this->setheader('content-type: application/xml'); $this->sendxml(); break; } the method setheader fills array, wicht put foreach-loop header(); function. not important, cause tried in direct way changing $this->setheader() header('content-type..'); has got same result (later) output ist rend...

angular ui - AngularJS ui typehead not working with http -

i've been trying make angularjs ui typehead work backend had no success. in partial: <input type="text" ng-model="selected" typeahead="language.id language.name language in getlanguages($viewvalue) | filter:$viewvalue"/> in controller: $scope.getlanguages = function(search) { // works: return [{"id":"15","name":"norwegian (bokm\u00e5l)","short":"no"},{"id":"45","name":"norwegian (nynorsk)","short":"nn"}]; // doesn't work: return $http.get('/json/suggest/languages/' + search).success(function(response) { return response; }); } as can see works when define response statically in js not when it's retrieved backend. static response copy-pasted backend response. http request working, can see response in developer tools, format correct typehead doesn't appear. idea why happens? btw, i...

sublimetext2 - Sublime Text 2: Opening single window and ignoring all other windows -

i using sublime text 2 on linux. use primary programming editor. have several tabs opened throughout sessions. yet want open single file without opening other files previous session. the default behaviour on system new opened file becomes new tab besides opened files. want, however, open new file (some sort of incognito browsing) without opening other previous files. is, 1 tab in 1 window. does sublime text support file opening behaviour? you can change user settings hot_exit and remember_open_files false . { "hot_exit": false, "remember_open_files": false, }

image - ImageIO no suitable reader in Java web start -

i have java web start application shows png images loaded with: inputstream = aclass.class.getclassloader().getresourceasstream(“icon/tray.png”); imageio.read(is); while works eclipse doesn’t work when run application java web start. difference in both setups in java web start image loaded jar file while in eclipse images comes directly file system. what happens in java web start is, inputstream gets created expected (meaning resource can loaded) but, far can see it, within imageio.read() method no suitable reader can found image in stream , imageio.read() returns null. how can reader can found when starting eclipse not if started java web start? furthermore got more png’s loaded mechanisms javafx more precisely via css e.g. -fx-image: url('icon/settings_general_32x32.png'); i see same behavior here too. works eclipse not java web start although i’m not sure if because of same reason or reason guess because of missing reader too. so looked in code of pngimage...

php - Datepicker Unavailable dates (data retrieved from database) -

i'm trying dates database , put them in array stored in json. main.php $('#datepicker').focus(function(){ $.ajax({ url: 'getdates.php', data: "artist_name="+$('#name').html(), datatype: 'json', success: function(data) { } }); }) getdates.php $fullname = $_get['artist_name']; $result = mysql_query("select .... .... ... ='$fullname'") $arraydates = array(); while($details = mysql_fetch_assoc($result)) { array_push($arraydates, $details['event_date']); } echo json_encode($arraydates); i've managed put dates selected artist in "arraydates". i found on google: var unavailabledates = ["21-8-2013"]; function unavailable(date) { dmy = date.getdate() + "-" + (date.getmonth() + 1) + ...

matlab - Deleting rows with specific rules -

i got 20*3 cell array , need delete rows contains "137", "2" , "n:t" origin data: 't' '' '' 'np(*)' '' '' [ 137] '' '' [ 2] '' '' 'are' 'and' 'np(fcc_a1#1)' '' '' '1:t' [ 1200] [0.7052] '' [1.2051e+03] [0.7076] '' 'are' 'and' 'np(fcc_a1#3)' '' '' '2:t' [ 1200] [0.0673] '' [1.2051e+03] [0.0671] '' 'are' 'and' 'np(m23c6)' '' '' '3:t' [ 1200] [0.227...

conditional loop in jquery selector -

how can select first 3 div elements in following example using jquery? i want select div elements status = 0 until encounter other value. <div status='0'></div> <div status='0'></div> <div status='0'></div> <div status='1'></div> <div status='0'></div> the following example need first 2 elements <div status='0'></div> <div status='0'></div> <div status='1'></div> <div status='1'></div> <div status='0'></div> var divs = []; $('div[status]').each(function() { if ($(this).attr('status') === '0') { divs.push(this); } else { return false; } });

Imagemagick position and size of a sub-image -

Image
problem description: in imagemagick, easy diff 2 images using compare, produces image same size 2 images being diff'd, diff data. i use diff data , crop part original image, while maintaining image size filling rest of space alpha . the approach taking: i trying figure bounding box of diff, without luck. example, below script using produce diff image, see below. now, need find bounding box of red color part of image. bounding box demonstrated below, too. note numbers in image arbitrary , not actual values seeking. compare -density 300 -metric ae -fuzz 10% ${image} ${otherimage} -compose src ${output_dir}/diff${i}-${j}.png you asked quite while ago - found question today. since think answer might still of interest, propose following. the trim option of convert removes edges same color corner pixels. page or virtual canvas information of image preserved. therefore, if run convert -trim edpdf.png - | identify - it gives you: png 157x146 512x406+144+32 8...

html5 - Who are the primary users of Internet Explorer <= 8? -

tl; dr: making website biological researchers. these guys apt use ie8? i'm developing website act reference biology researchers. i'd implement loads of html5 , css3 if can. can't spend forever developing though, , fixing websites ie8 takes long, heavy reliance on svg elements have planned. such user base (researchers), safe drop support ie8 , below? i've heard it's banks , airline companies use ie <= 8, i've never come across actual statistic, other global usage of ie8 around 10%, bit high taste. the short answer is, of course, "it depends", things might consider: -who benefits people using site? if it's wants them use it, onus more on make lives easier supporting whatever browser use (most ecommerce sites fit category). if there's less value , you're genuinely trying helpful producing valuable tool particular research community, it'd more reasonable expect them update if care enough. -how effort support be? if ...

Extract nested dictionary values in Python -

i think i'm close spinning in circles on one. have dictionary in python has been imported json. raw data post here. code works want , prints want, except returns last value dictionary. how modify return values , print how shown here? want take data , add database 1 entry. code: text = json.loads(content) = {} def extract(dictin, dictout): key, value in dictin.iteritems(): if isinstance(value, dict): extract(value, dictout) elif isinstance(value, list): in value: extract(i, dictout) else: dictout[key] = value extract(text, a) k, v in a.iteritems(): print k, ":", v result should following, have other 40 or entries. code shows last entry: datetime : 2014-06-10t20:00:00-0600 date : 2014-06-10 href : http://xxxxxxxxxxxx.json lng : -94.5554 id : 17551289 createdat : 2013-07-30t12:18:56+0100 city : kansas city, mo, billing : headline totalentries : 37 type : concert billingindex ...

bluetooth lowenergy - BLE112 thermometer demo, source code of the BLE112 firmware -

we (will) have ble112, , want program cc debuger connected pc. http://www.bluegiga.com/ble112_bluetooth_smart_module http://www.ti.com/lit/ug/swru197f/swru197f.pdf we want test thermometer demo available at: https://techforum.bluegiga.com/ble112?downloads#3.1 -> bluetooth smart: v.1.0.3 software development kit -> ble-1.0.3-43.zip -> src/thermometer-demo this code "thermometer-demo" client pc application connects ble112 , asks read temperature. but, firmware source code ble112 thermometer-demo? there should .hex file in folder. want specify path in bg update utility. if hasn't been compiled yet, there won't .hex file. in case, point bg update utility project.xml file (could project.bgproj) , compile on fly you. also, if looking @ /src directory, that's ios examples. firmware, @ /examples in sdk.

php - Pass variable to template on redirect - Laravel4 -

i try pass variable template class, on redirect, if try access variable on template, give error: [2013-08-07 22:24:47] log.error: exception 'errorexception' message 'undefined variable: message' in this actual code: try { $loginresult = sentry::authenticate($datas, (input::get('remember') ? true : false)); if($loginresult) { return redirect::to('home')->with('message', array('successmessage' =>lang::get('account.login.success'), )); } } catch(exception $e) { log::getmonolog()->warning($e->getmessage()); } and template part: @if( $message->successmessage ) {{ $message->successmessage }} @endif what wrong? answers. from laravel documentation, http://four.laravel.com/docs/responses probably, 'message' going array flash data. so, in view can try : <?php $array = session::get('message'); echo $array['successmessage']; ?> and let...

css - Float box to the right and let it overlap elements below static elements -

i want add box html page , style in quite uncommon way. fail find right css rules or right search terms. how should like: this head might ,----------------------. quite long , | box has dynamic | should wrap | height , width , | next line | sticks right side | | | ===================| |=== === area ==| longer |=== === has full ==| headline , shall |=== === width , ==| overlap things below |=== === below ==`----------------------'=== === box ============================= ============================================== the box displays statistical data , shall have dynamic dimensions (no fixed height/width). how i'd style it: #box { float: right; z-index: 100; width: auto; /* default, inserted clarification */ height: auto; } the element below headline teaser image full page width. because it's image , box half-transparent it's no problem box overlaps image. expect imag...

cocos2d x - ChartboostX not loading more apps -

i using wrapper recommended ios cocos2dx game link . works when call showinterstitial() method, when try use showmoreapps dialog appears split second , disappears. in appdelegate::applicationdidfinishlaunching() this chartboostx::sharedchartboostx()->setappid("redacted"); chartboostx::sharedchartboostx()->setappsignature("redacted"); chartboostx::sharedchartboostx()->startsession(); chartboostx::sharedchartboostx()->cachemoreapps(); and when want call showmoreapps this chartboostx::sharedchartboostx()->showmoreapps(); have @ wrapper chartboost. has been updated use latest version of chartboost sdk , works in cocos2d-x game. have not finished android documentation yet can work out if need to. documentation ios finished , quite easy follow.(fyi class adelle chartboost delegate , objective c++ class can use c++ in mixed in objective c. same adwrapper.mm) check out , see if works you. https://github.com/lochlanna/chartboost-cocos2...

jquery - why is this if/else statement causing a div to not show up? -

i have if/else statement checks see if image displayed in dom smaller 600px wide, , if was, resizes said image different width. however, div class .tagmap not appear. happens when if/else statement present. idea why why happening? i've generated this jsfiddle . first image in step 2 , image in step 4 both supposed have .tagmap appended jquery if/else statement $('span.i_contact').each(function() { var imgwidth = $(this).data('img-width'); if (imgwidth < 600) { var newwidth = ((imgwidth / 600)*300); console.log(newwidth); $(this).css({ "width":newwidth }); } else{ var pos_width = ($(this).data('pos-width')) / 2.025; var pos_height = ($(this).data('pos-height')) / 2.025; var xpos = ($(this).data('pos-x')) / 2.025; var ypos = ($(this).data('pos-y')) / 2.025; var taggednode = $('<div class="tagged" />') taggednode.css({ ...