Posts

Showing posts from June, 2015

android - How to maintain the state of the activity? -

i trying save state of activity in android.basic scenario there 2 activities , b.activity contains 2 edittext fields.user enters value , moves activity b via intent.when user comes activity (by intent have provided button) need display values in 2 edittext fields user had entered (i.e maintain state of activity a).also not want use shared preferences or make fields static. have used following code not help: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.manual_entry); edittext1=(edittext)findviewbyid(r.id.edittext1); } @override protected void onsaveinstancestate(bundle savedinstancestate) { super.onsaveinstancestate(savedinstancestate); savedinstancestate.putstring("cardvalue_saved_inst", value_card_manuallyentered); } @override public void onrestoreinstancestate(bundle savedinstancestate) { super.onrestoreinstancest

scala - What is the future of playframework 2 in terms of web-templating and MV* -

i have heard play framework 2 go use spray instead of netty . spray believes "the recent trend of moving web application logic more , more away server , (js-based) browser client increasing availability of sbt-plugins things spray not provide (like view-templating or less- , coffeescript-support) " does mean playframework using javascript mv* default instead of scala template ? the philosophic point of scala - provide scalable (unique) language big range of use-cases - web-services, logic, web. web goes close javascript , html , frameworks around it. people tend save processors time (money) on cloud boxes, , choose use client-side computation vs server side, when it's possible. that's background of question - play framework goes it? should use scala compile javascript (for example)?

php - apache (httpd) load balancing -

i have reached state in research understood database-driven web app (portal) can optimised replication / scaling (even sharding huge db) , employing solution mysql replication or clustering (percona). the following question came in head thinking... "ok, database can safely distributed users. happens if powerful machine 4 x xeon cpus + 16gb ram (max avail in pack i'm getting) cannot survive http requests?" how can 1 tackle apache / httpd load-balancing ? there solutions ? maybe it's simple, don't see 1 right now. no, there no "simple" solutions @ level. although if it's research, not live site reaching point - there no point in theoretical musings. every application has it's own bottleneck have optimized, , there no way predict off head. and http daemon though seldom being bottleneck. matter of fact, http daemon being load balancer itself, distributing requests between several application backends , serving static files of t

authentication - How can I check if it is the same user in ASP.NET? -

this question not related asp.net specifically, more web applications in general. i building web application wherein registering user. of taking in basic credentials first name, last name, etc of user. in website giving information free user has registered user finds website authentic , not fake website. after that, more information, user has pay. the information site provides obsolete after sometime. so, when new user registers, he/she new information gets updated; old users have pay same new information. my problem here once information gets obsolete same person can re-register different set of credentials , new information. want avoid happening. so question here this: information should request user, or extract user, check same user not re-registering? or other way make possible. i thinking of getting ip address of machine person registering , use check. user can use different machine re-register. i lost here , not getting solution. checked on internet not find answ

c# - How to stop Entity framework from inserting associated entities? -

i having problems when trying insert entity null associated entities.. i doing : puser.doganduser = null //doganduser relationship between dog , user context.user.add(puser) but here getting error saying foreign key iddog not exist in table dog. , well..of course not..i giving null association..then confirmed trying insert associated entities inserting row in dog , passing value in doganduser relationship..which did not throw error , did insert row in relationship..but why? did not explicitly told so..how can stop happening? thanks! you need check couple of thing correct problem. is foreign key column set nullable in database? in model, property of foreign key field nullable on association, end multiplicity of doguanduser set 0..1 according description, should correct problem.

php - how to get all global variable -

instead of using $_post['var'] globals name. also example have <input type='text' name='surname'> when submit form use get('surname') instead of $_post['surname'] tried function 1 not work function get($var){ $global = $globals["$var"] ; return $global; } i not understand why. i return me notice: undefined index: nom in c:\wamp\www\cyb.fr\lib_php\librairie.php on line 23 anykind of appreciated you can use below function: function post_value($key=''){ if($key!='') { if(!is_array($_post[$key])) return trim($_post[$key]); else return $_post[$key]; } else return; }

jquery - JqueryUI Spinner issue -

hi having problems inserting spinner jquery ui. below code, can me, grateful. cant appear makes work disappear :s <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> //this creates spinner each of weighting boxes user have easier way of selecting desired values $(function() { var spinner = $( "x" ).spinner({ min:0}); var spinner = $( "y" ).spinner({ min:0}); var spinner = $( "z" ).spinner({ min:0}); }); $(document).ready(function() { var x ='x'; var y = 'y'; var z = 'z'; // user variables declared $('<tr><td>'+x+'</td>' + '<td&

android - google maps ane: RuntimeException: Attempting to create multiple DataRequestDispatchers -

i'm creating native extension shows native google map flex-based air application. can watch lee brimelow's demo idea: https://plus.google.com/110495278155587072613/posts/degsyvx8423 i got working demo of native extension, show activity buttons, got stuck when tried show map. here exception i'm getting on setcontentview(layoutid): 05-08 11:48:40.624: i/system.out(27917): webviewactivity.oncreate failed error: 05-08 11:48:40.634: i/system.out(27917): "android.view.inflateexception: binary xml file line #9: error inflating class fragment" 05-08 11:48:40.644: w/dalvikvm(27917): threadid=1: thread exiting uncaught exception (group=0x40fd8468) 05-08 11:48:40.654: e/androidruntime(27917): fatal exception: main 05-08 11:48:40.654: e/androidruntime(27917): java.lang.runtimeexception: unable start activity componentinfo{air.googlemapsapp.debug/com.trasys.googlemaps.webviewactivity}: java.lang.runtimeexception: attempting create multiple datarequ

c# 4.0 - How "where" operates in Linq-to-Entities -

i have products , images table in sql server, along many-to-many productimages link table , have entity framework (vs2012, .net4.5) model generated against structure. i have wcf service method, getimagelist , lists images associated product. speed, want return couple of columns images table, notably excluding imagebinary , imagethumbnailbinary columns can quite large store high-resolution images in there. to prove point of query, decided try , images filename of fred.jpg . to begin with, started off getting product , using navigation properties: product p = ctx.products.singleordefault(x => x.code == productcode); if (p != null) { var images = p.images.where(x => (x.filename == "fred.jpg") && (!imagetypeid.hasvalue || x.imagetypeid == imagetypeid)) .select(x => new { x.id, x.filename, x.maxavailableheight, x.maxavailablewidth,

spring - java.lang.ClassNotFoundException: org.springframework.web.context.support.AnnotationConfigApplicationContext -

org.springframework.spring-webmvc includes spring-context i'm not sure why i'm not seeing org.springframework.web.context.support.annotationconfigapplicationcontext in may application. what missing? <dependency> <groupid>org.springframework</groupid> <artifactid>spring-webmvc</artifactid> <version>${org.springframework-version}</version> <exclusions> <exclusion> <groupid>commons-logging</groupid> <artifactid>commons-logging</artifactid> </exclusion> </exclusions> </dependency> make sure maven dependencies included in deployment assembly. see: servlet packages not importing after converting project maven project in eclipse

Using PHP/MySQL with Google Maps - Dont work for me -

good morning, i have been doing tutorial , not show me markers https://developers.google.com/maps/articles/phpsqlajax_v3?hl=es attached file in case can me http://pastebin.com/d7xhrzst archivo.html the php same same article thank you javascript case-sensitive. have var telefono = markers1[i].getattribute("type"); then refer + "<br/><b>telefono:</b>" + telefono notice difference between telefono , telefono - javascript treats these 2 separate variables, 1 of doesn't exist.

delphi - sorting a file of records error -

i need sort file of records not quite sure of how it. have file of records , have attempted sort them using simple bubble sort stuck , need help. me? list code below. highscorefile = file of highscorerecord; var frmenterdetails: tfrmenterdetails; highscoremasterfile: highscorefile; highscore:highscorerecord; filearray:array[1..20] of highscorerecord; i:integer; procedure sort var i,j,temp:integer; assignfile(highscoremasterfile, 'highscores.dat'); reset(highscoremasterfile); while not eof(highscoremasterfile) begin i:=i+1; read(highscoremasterfile, highscore); filearray[i].name:=highscore.name; filearray[i].date:=highscore.date; filearray[i].finalscore:=highscore.finalscore; i:=0 19 j:=0 18 if filearray[j].score > filearray[j+1].score begin filearray[temp]:=filearray[j]; filearray[j]:=filearray[j+1]; filearray[j+1]:=filearray[temp]; end; end; any great. it possible not correct 100

java - Error with custom annotation -

i have made custom annotation in java takes 1 value (string[]); @retention(value = retentionpolicy.runtime) public @interface myannotation{ string[] value (); } however, want values-when use myannotation-to this: aclassname.anattribute aclassname name of class in application anattribute 1 of it's attributes string: public static string anattribute1="astringxxx"; but error: the value annotation attribute myannotation.value must constant expression have idea please? if make attribute final work fine. public class someclass { public static final string myattribute = "abc"; } @retention(value = retentionpolicy.runtime) public @interface myannotation { string[] value(); } public class someotherclass { @myannotation({someclass.myattribute}) private int someint; }

wpf - How to switch between 2 data sources for ListBox.ItemsSource -

what best/elegant way bind itemscontrol.itemssource 2 different sources best on given property? the binding should done 1 of 2 collection, selection collection itemscontrol bound should based on property. i have view bound viewmodel. collections want bind located in different hierarchy path under viewmodel. i've solution based on multibinding think there should more elegant solution. <collectionviewsource x:key="cvs"> <collectionviewsource.source > <multibinding converter="{staticresource mymultibindingconverter}"> <binding path="xxxx.yyyy.observablecollection1" /> <binding path="xxxx.observablecollection2" /> </multibinding> </collectionviewsource.source> </collectionviewsource> <listbox x:name="mylistbox" items

java - Is it possible to remotely debug a single and specific WAR deployment on Tomcat? -

i have access remote tomcat server number of different deployed wars. can't thoroughly test wars locally because of remote system dependencies , therefore remotely debug them. because production tomcat server , don't have access setup additional remote servers (e.g. stage testing), reduce as possible security , performance issues of remote debugging via java platform debugger architecture. understanding of using jpda tomcat reveals deployed wars debugging. because of wars in production use, scenario requires debugging new deployments. possible exclusively limit deployments should accessible? obviously, short , sweet answers acceptable (yes/no). haven't found documentation otherwise, assume it's not possible. possible or not think should not debug in production environment since production environment. the recommendation check log files generated application can see behavior (if raise exceptions in class/process/method or if working expected). looking

Validating length of ngrams in varchar field in mySQL -

i have column in table in mysql contains ngrams, , want validate each ngram of correct length. for e.g. if ngram 'sophisticated hacking scheme' number of blanks should two. is there in mysql count blanks? or can suggest quick sql fix? one i've used in sql server, adapted using mysql functions is: char_length(column) - char_length(replace(column,' ','') that - what's length of column, vs length of column if of spaces removed? should give number of spaces present.

c# - Call a generic extension method on another generic extension method's parameter -

i'm doing asp.net mvc 3, , i'm setting couple extension methods working enums. 1 of them fancy tostring() looks [description] attribute, , other builds selectlist enum use html.dropdownlist(). both of these methods in same static class. public static selectlist toselectlist<tenum>(this tenum? enumval) tenum : struct { var values = tenum e in enum.getvalues(typeof(tenum)) select new { id = e, name = e.getdescription() }; selectlist list = new selectlist(values, "id", "name", enumval); return list; } public static string getdescription<tenum>(this tenum? enumval) tenum : struct { //some reflection fetches [description] attribute, or returns enumval.tostring() if isn't defined. } but compiler squawks name = e.getdescription() , stating that... 'tenum' not contain definition 'getdescription' , no extension method 'getdescription' accepting first argument of type 'tenum' found (are miss

java - how to get 1 attribut from groupcollection? -

hi have sample example users , groups join manytomany . dont know how attribute of collectiongroup in users code : <p:datatable var="user" value="#{usergestion.tableusers}" editable="true" > <p:column headertext="username" filtermatchmode="contains" filterby="#{user.username}"> <p:commandlink value="#{user.username}" action="#{usergestion.insertaaa()}"/> </p:column> <p:column headertext="nom" filtermatchmode="contains" filterby="#{user.nom}"> <h:outputtext value="#{user.nom}" /> </p:column> <p:column headertext="groupe"> <h:outputtext value="#{user.groupscol

ruby - Rails: Delete request in capybara, bug or my mistake? -

in michael hartl's rails tutorial (rails 3.2) , in listing 9.52: describe "when signing in again" before delete signout_path print page.html <---- insert here visit signin_path print page.html <---- insert here again fill_in "email", with: user.email fill_in "password", with: user.password click_button "sign in" end "should render default (profile) page" page.should have_selector('title', text: user.name) end end i inserted 2 prints. and, surprisingly got printout of same page (which shouldn't be, supposed bring root url after sending delete request). after happens, since visit signin_path takes me sign in page, sign in procedure succeeds , test case. however, second print page.html gave me header of user whom still signed in. when changed delete signout_path click_link &quo

Warnings when compiling Boost libraries in C++ Builder -

i getting warnings when trying include <boost/thread.hpp> in c++ builder. every unit including it, c++ builder shows these 2 lines: thread_heap_alloc.hpp(59): w8128 can't import function being defined thread_heap_alloc.hpp(69): w8128 can't import function being defined already tried things, nothing worked though. it compiles correctly, however, it's getting on nerves. why message being shown? the lines are: #include <boost/config/abi_prefix.hpp> namespace boost { namespace detail { inline boost_thread_decl void* allocate_raw_heap_memory(unsigned size) { void* const eap_memory=detail::win32::heapalloc(detail::win32::getprocessheap(),0,size); if(!heap_memory) { throw std::bad_alloc(); } return heap_memory; } inline boost_thread_decl void free_raw_heap_memory(void* heap_memory) { boost_verify(detail::win32::heapfree(detail::win32::ge

reflection - Getting relative inner class name in Java -

package u.v; class x { static class xx { static class xxx { } } } while can canonical ("absolute") name of inner class public class a{ public static void main(string[] args) { system.out.println(x.xx.xxx.class.getcanonicalname()); //u.v.x.xx.xxx } } and can last component of class name public static void main(string[] args) { system.out.println(x.xx.xxx.class.getsimplename()); //xxx } how go around elegantly getting relative class name? utils.relativeclassname(x.xx.xxx.class, x.class); //xx.xxx you can use function. +1 . public static string getrelativeclassname(class<?> inner, class<?> outer) { int length = outer.getcanonicalname().length(); return inner.getcanonicalname().substring(length+1); }

android - Screen capture causing heap to grow -

i trying take screenshot using code below: final view rootview = getrootview(); rootview.setdrawingcacheenabled(true); bitmap bmp = bitmap.createbitmap(rootview.getdrawingcache()); rootview.setdrawingcacheenabled(false); once captured, storing screenshot in arraylist<bitmap> . mreporter.addbitmap(bmp); the problem is, every time whole process performed heap grows large amount. how can avoid heap growing large? my log showing info might helpful: 05-08 20:11:48.443: i/dalvikvm-heap(18497): grow heap (frag case) 31.288mb 6819856-byte allocation edit: am storing max of 3 images in arraylist you can not. everytime store new bitmap inside arraylist . can either downsampling bitmap s or can keep few bitmaps in arraylist

javascript - How can i check if my DOM already contains an element by id? -

i know if possible check if dom contains element id. dynamically load templates (kendo templates) , append them in body. <body> ... <script type="text/x-kendo-template" id="test-view"> ... </script> </body> at moment loading script //creates gloabl object called templateloader single method "loadexttemplate" var templateloader = (function ($, host) { //loads external templates path , injects in page dom return { //method: loadexttemplate //params: (string) path: relative path file contains template definition(s) loadexttemplate: function (path) { //use jquery ajax fetch template file var tmplloader = $.get(path) .success(function (result) { //on success, add templates dom (assumes file has template definitions) var regsplit = new regexp("[/\]+", "g"); v

Getting points from html table with php -

so have automate process bunch of notes new version of product taken main page , put them somewhere else. can connect page have from, don't know how pick list of notes , preferably put them in array or list can use them somewhere else. html page looks like(the part matters anyway): <!-- start summary --> <ul> <li>point 1</li> <li>point 2</li> <li>point 3</li> </ul> <!-- end summary --> it starts "start summary" comment , ends "end summary" comment well. , number of points anything. lot ok, mean have "text": <!-- start summary --> <ul> <li>point 1</li> <li>point 2</li> <li>point 3</li> </ul> <!-- end summary --> and have "parse" php in order view if on webpage new point has been added right? in php it's helpful function preg_split , iterate on returned array: foreach(preg_

qt - LNK2019: Portability from Windows to OSX -

i've been looking @ past couple of days no success. i've been trying create graphics application qt. seems lnk2019 should arise from unimplemented constructor: main.obj:-1: error: lnk2019: unresolved external symbol "public: __cdecl arbobject::arbobject(class table *,int *,int,int,int,int,int)" (?? 0arbobject@@qeaa@peavtable@@peahhhhhh@z) referenced in function "class std::vector<class arbobject *,class std::allocator<class arbobject *> > __cdecl createarbobjects(class qlist<class qstringlist> &,class table *,int &)" (?createarbobjects@@ya?av?$vector@peavarbobject@@v?$allocator@peavarbobject@@@std@@@std@@aeav? $qlist@vqstringlist@@@@peavtable@@aeah@z) however, constructor there , implemented in appropriate .cpp file. .h file has this: arbobject(table* tr, int* rgb, int t, int xpos, int ypos, int w, int h); .cpp file has this: arbobject::arbobject(table* tr, int* rgb, int t, int xpos, int ypos, int w, int h

Creating an anonymous post with disqus API fails -

i trying use disqus api post anonymous commment, without success. using fiddler composer following settings: post http://disqus.com/api/3.0/posts/create.json host: disqus.com referer: http://www.domain.com thread=1271948405&message=test0xyanonnn&api_key=mypublickey&author_email=xxx@xxx.xd&author_name=xxx the response getting is {"code": 12, "response": "this application cannot create posts on chosen forum i have added domain.com (my domain here) trusted domains in api , website pages in disqus admin. any ideas welcome! i've founded solution. if want post guest must replace api_secret api_key in request " e8uh5l5fhz6gd8u3kycjaiak46f68zw7c6ew8wsjzvclxebz7p0r1yrydrlilk2f " , comments post.

php - get the current user in the controller symfony2 -

i want user connected session. mean since can role : $this->get('security.context')->isgranted('role_admin') could user?? you can current user this $securitycontext = $this->get('security.context'); $user = $securitycontext->gettoken()->getuser();

sql - MySQL - turning data points into ranges -

i have database of measurements indicate sensor, reading, , timestamp reading taken. measurements recorded when there's change. want generate result set shows range each sensor reading particular measurement. the timestamps in milliseconds i'm outputting result in seconds. here's table: create table `raw_metric` ( `row_id` bigint not null auto_increment, `sensor_id` binary(6) not null, `timestamp` bigint not null, `angle` float not null, primary key (`row_id`) ) right i'm getting results want using subquery, it's slow when there's lot of datapoints: select row_id, hex(sensor_id), angle, ( coalesce(( select min(`timestamp`) raw_metric rm2 rm2.`timestamp` > rm1.`timestamp` , rm2.sensor_id = rm1.sensor_id ), unix_timestamp() * 1000) - `timestamp` ) / 1000 duration raw_metric rm1 essentially, range, need next read

c++ - How do I format a variable argument TCHAR -

void logwriter::writelog(lpctstr log, const char ending, lptstr args, ...) { tchar str[128] = {0}; int len = (sizeof(log)/sizeof(tchar)); len += sizeof(ending)/sizeof(char); //might switch ending tchar..might have _stprintf_s(str, len+4, "%s()%c", log, ending); myoutput.push(str); //used output console testing //if (args != null) //{ // va_list argptr; // va_start(argptr, args); // vfprintf(stdout, args, argptr); // va_end(argptr); //} } so cool way print log console.. want able choose put log. decided redirect wcout either file, or console. when outputing console super easy because had void logwriter::writelog(const char* log, const char ending, char* args, ...) { std::wcout << log << "("; if (args != null) { va_list argptr; va_start(argptr, args); vfprintf(stdout, args, argptr); va_end(argptr); } std::wcout << ")"

javascript - jquery $.post() getting canceled -

this question has answer here: xhr request denoted being cancelled although seems successful [closed] 2 answers i'm getting "canceled" status whenever jquery $.post(). seems asynchronous problem? access local project http://127.0.0.1:8933/myproject/default/index.html index.html: <script> $(document).ready(function() { $('#mybutton').click(function() { var post_url = get_url(); // resolves "/myproject/default/process_func" var data = ...; do_action(post_url, data); }); }); </script> <a href="" id="mybutton"> click me! </a> util.js: function dopost(url, data) { $.post(url, data).then(dosuccess, dofail): function dosuccess(data) { alert('successful!'); } function dofail(data)

java - Why do I get the "Selection does not contain a main type" when my class has a main? -

Image
i above error msg class have main method: package adventure; import com.jme3.system.appsettings; import java.applet.applet; import java.applet.audioclip; import java.awt.image; import java.io.file; import java.net.malformedurlexception; import java.net.url; import com.jme3.renderer.queue.renderqueue.shadowmode; import com.jme3.animation.animchannel; import com.jme3.animation.animcontrol; import com.jme3.animation.animeventlistener; import com.jme3.animation.loopmode; import com.jme3.app.simpleapplication; import com.jme3.asset.blenderkey; import com.jme3.asset.plugins.httpziplocator; import com.jme3.asset.plugins.ziplocator; import com.jme3.bullet.bulletappstate; import com.jme3.bullet.physicsspace; import com.jme3.bullet.collision.shapes.capsulecollisionshape; import com.jme3.bullet.control.charactercontrol; import com.jme3.bullet.control.rigidbodycontrol; import com.jme3.input.chasecamera; import com.jme3.input.keyinput; import com.jme3.input.controls.actionlistener; import c

onchange - JQuery Toggle .click function -

i'm using jquery mobile. have toggle button need launch confirm dialog when user clicks. html <div data-role="fieldcontain"> <div class='ui-grid-a' > <div class='ui-block-a'> <h4 rel='tooltip' title='feature automatically solves other values type in inputs' style='color:#cc0000;'>auto-solve</h4> </div> <div class='ui-block-b'> <select name="togswitch" id="autosolve" data-theme="" data-role="slider" data-mini="true"> <option value="off">off</option> <option selected value="on">on</option> </select> </div> </div> </div> jquery $(document).ready(function() { $('#autosolve').toggle(function() { var answer = confirm('this erase curre

database - How to import millions of records from SQL Server 2000 to Microsoft Excel 2010 -

i have around 3.5 million records want import excel 2010 file. have tried using sql servers import/export data wizard , worked problem copied 65,000 out of 3,500,000 records need. due limit on excel. i have tried install powerpivot try increase amount of records inserted excel no luck. know how this? i able jsobo's comment above. i first created blank .csv file. able use sql servers dts import/export wizard add fields straight database .csv file

python - Why is mmap returning a size of zero? -

i'm working on beaglebone (running angstrom linux) , trying use python's mmap module gain read , write access /dev/mem file. however, reason, code below prints value of zero. i'm new mmap , i'm not sure if there obvious missing. from mmap import mmap mmap_offset=0x44c00000 mmap_size=0x48ffffff-mmap_offset open("/dev/mem", "r+b") f: testmap=mmap(f.fileno(),mmap_size,offset=mmap_offset) print testmap.size() print testmap[0] returns: 0 8 because device inodes /dev/mem report apparent size of 0 when queried stat() . how special device nodes implemented, it's not useful ask device node how large is. (consider /dev/zero , /dev/kbd , /dev/urandom , , device node used communication , not data storage, such device nodes representing photo scanners or input devices.) you should still able retrieve data mmap handle.

R- How to read from multiple directories and apply function on same file names contained within different directories -

i have 2 directories contain (share) files same name, e. g."file1","file2" , "file3", can found in dir1 dir2. now, read "file1" dir1 , "file1" dir2 in first iteration , processing on both. in second iteration, "dir1/file2" , "dir2/file2", , forth. i used following code read files 1 directory: setwd("dir1") file_list <- list.files() process.files <- function(file) { myfile <- read.table(file, header=true, sep="") #process(myfile) return(somedataframe) } dataset <- do.call("cbind",lapply(file_list, fun=function(files){ process.files(files) })) now, need like: file_list1 <- list.files("dir1/") file_list2 <- list.files("dir2/") compare.files <- function(filex,filey) { myfilex <- read.table(filex, header=true, sep="") myfiley <- read.table(filey, header=true, sep="") #compare(myfilex,myfiley) return(somedatafr

python - Display png template in Matplotlib graphs -

i producing 300+ graphs, 1 per page. when displaying these graphs include border template office uses our figures (ie single line border information block in bottom right corner). have template in .png. hoping draw onto each figure , draw graphs on template: draw template: fig = plt.figure(cnt_fig) ax2 = fig.add_subplot(111) im = plt.imread('test.png') ax2.imdraw(im) then plot graphs: ax = fig.add_subplot(111) ax.plot(x,y) the issue having of graphs have "non-linear axes" , error: warnings.warn("images not supported on non-linear axes.") any ideas?

backbone.js - How does the AngularJS router work for wildcards and pushstate? -

we investigating migration backbone angular. because of our design, need migrate router. i'd understand how wildcard routing works angular. here example of wildcard routing in backbone: app.router = backbone.router.extend({ routes: { '*filter' : 'setfilter' }, setfilter: function(params) { //all traffic ends here. can grab url , go. var url = this.cdn + "templates/" + params + ".html"; ... } }); app.router = new app.router(); backbone.history.start({pushstate: true}); what angular equivalent wildcard routing? how angular handle push state? specifically, have way utilize /pushstate urls when browser supports pushstate , automatically roll #pushstate hash urls ie9- thanks. 1) there not current support regex in angular routing 2)angular automatically handle pushstate if not available in browser automatically fallback hash mode# use below lines $locationpro

node.js - How do you set colors using either rgb or hex representation using the very popular colors module? -

how set colors using either rgb or hex representation using popular colors module ? https://npmjs.org/package/colors i read ove documentation , don't see option, however, seems such popular module give control, no? var colors = require('colors'); colors.settheme({ my_green: '#5a9664', // doesn't work output: 'green', }); console.log("a string wants color.".my_green); update, putting 1 of comments in question it's not burried: colors module supports browser mode, opens door #hex colors within html tags. settheme doesn't support ansi input array, , takes first half. (the module have smarter wrap string in ansi.) thanks. the color format of console cant accept these hex color value: #xxxxxx need check these file: https://github.com/marak/colors.js/blob/master/colors.js , pass ansi color format value . as developer describes: 'bold' : ['\x1b[1m', '\x1b[22m'], 'italic&#

debugging - Is it possible to enable JavaScript source maps in Safari 6? -

i working minified javascript code , benefit having source maps debugging. in chrome, had no problem enabling source maps , working me. i'm forced use safari dev tools work on this, , can't life of me figure out enable source maps in safari. have had no luck googling it. has had success enabling source maps javascript in safari? using latest version 6.0.4. it turns out can't of safari 6.0.4. however solution working me instead use webkit nightlies . i've been enjoying debug tools in there far, , support source maps.

ios - Customize uiswitch image properly? -

Image
i have uiswitch in ios 6 app, that's on , off image customised. self.testswitch.onimage = [uiimage imagenamed:@"on"]; self.testswitch.offimage = [uiimage imagenamed:@"off"]; i use 77 points wide , 22 points tall image purpose (154x44 in retina), stated in documentation. image not fit uiswitch, seems ugly, default style hides one, on attached image. what should set make work in proper way? apple doesn't have appearance api uiswitch . can set tint color property ( ontintcolor ). that's not want, guess. problem customizing uiswitch there's opportunity apple reject app. but there apis custom switch such rcswitch ( https://github.com/robertchin/rcswitch ) or ttswitch . tutorial , example of how use rcswitch can found here: http://www.raywenderlich.com/23424/photoshop-for-developers-creating-a-custom-uiswitch .

How can I add objects to a class array in Java? -

i'm hoping can me this, i've been puzzling on few hours , can't figure out. seems real easy thing do. ok, here goes... i have class, class a. 1 of class a’s (private) instance variables array of objects of another, related class (class b). in static method of class have created several objects of class b. need add these objects class a’s instance variable array. i cannot use this directly access instance variable trapped in static class. how can add newly created objects of class b class a’s instance variable array, in formal sense of course. hope makes sense , thanks! you're there. say, array instance variable of class a . means it's accessible when have instance of class a . need this: a = new a(); // object system.out.println(a.arrayofb.length); // access a's array (but see note) note : code above simplest way this. however, shouldn't access array a.arrayofb directly. instead, should define method in class called getarray()

jquery - Change placeholder color in Javascript for Chrome -

as said here : change html5 input's placeholder color css , chrome doesn't support css property color input placeholders. but there property named -webkit-input-placeholder . if put on css : #myinput::-webkit-input-placeholder { color: blue; } it works. how can javascript (or jquery) ? define in css have it, make #myinput.blue-placeholder::-webkit-input-placeholder , add/remove "blue-placeholder" class jquery. #myinput.blue-placeholder::-webkit-input-placeholder { color: #0000ff; } demo: http://jsfiddle.net/ay3j6/

Zurb Foundation top bar menu on iPhone issue -

i have zurb foundation 3 navigation menu. when page on phone, correctly shows phone version of menu system. however, way activate menu tap down=arrow triangle on right. want have title active. edit: added this link simple working version of home page. notice, tapping bar or word "menu" highlights bar, arrow makes menu appear. i hiding name ("menu") on desktop , showing on phone so: <div class="row"> <div class="contain-to-grid"> <nav class="top-bar"> <ul> <!-- title area --> <li class="name show-for-small"> <h1><a href="#">menu</a></h1> </li> <li class="toggle-topbar"><a href="#"></a></li> </ul> <section> <!-- left nav section --> <ul class="left"> etc. sinc