Posts

Showing posts from June, 2010

extjs Save component view state before removing it from parent component -

let me explain scenario. using extjs5. have got view component (let name viewone) contain 2 combo boxes, button search , action button, on click of search button grid populated. viewone in parent view component (viewparent). need load second view (viewtwo) on selecting grid row , clicking action button new view loaded (viewtwo) in parentview. when come viewtwo viewone need old values of combo boxes re perform search. currently storing values of combo boxes in store , set when after view render , call search. have discarded card layout implementation. i wanted know how can done via ext.state , cannot find example on same close solution problem. other way of doing ? state seems reasonable that. first of must set stateprovider (by calling ext.state.manager.setprovider ) instance of class extends ext.state.provider . state should work you. thing must remember set stateful property true , set stateid of component. usually don't need save state yourself. built-in

asp.net - C# - Genereic List copy one row add Another row -

am having list of students , on condition need copy 1 row , add row minor change for example: class student having follwing properties public class student { public int id { get; set; } public string name { get; set; } public string section { get; set; } public int marks { get; set; } } so while looping through list if marks = 90 need copy row , add row updating section foreach (var item in studentdata) { if(item.section == 90) { //i need add logic , update section , copy item //add modified item new item studentdata } } if student class had 3 items initially 1 "sam" "a" 48 1 "john" "b" 68 1 "broad" "a" 90 my expected output be 1 "sam" "a" 48 1 "john" "b" 68 1 "broad" "a" 90 1 "broad" "c" 90 //where added 1 more row modifying section what easiest way without loopi

javascript - How to add text on D3JS Map inside svg path? -

Image
i working on d3js map got us.json file on internet using made following graph, facing 1 issue don't have state name json want put florida name on florida state, i added tooltip cant add name "florida" on map . i want this: anybody knows how add text inside path location share code: <!doctype html> <meta charset="utf-8"> <style> .background { fill: none; pointer-events: all; } .subunit-label { fill: #777; fill-opacity: .5; font-size: 20px; font-weight: 300; text-anchor: middle; } .state-boundary.active { fill: none; stroke: #000; stroke-width: 0.4; } path { fill: none; stroke: #fff; stroke-width: .3px; } .onhvr{cursor:pointer; stroke: #000; } .state-boundary{ stroke-width:.4px; stroke: #222; cursor:pointer; } path#florida { opacity: 1; stroke-width: 1px; stroke: rgb(0, 0, 0); } .land-boundary { stroke-width: .5px; storke:#000; } .county-boundary { stroke: #1a1a1a; opacity:0.6; } .mesh

sql - SELECT fixed number of rows by evenly skipping rows -

i trying write query returns arbitrary sized representative sample of data. selecting n th rows n such entire result set close possible arbitrary size. i want work in cases result set less arbitrary size. in such case, entire result set should returned. i found this question shows how select every n th row. here have far: select * ( select *, ((row_number() on (order "time")) % ceil(count(*)::float / 500::float)::bigint) rn data_raw) sa sa.rn=0; this results in following error: error: column "data_raw.serial" must appear in group clause or used in aggregate function position: 23 removing calculation n works: select * ( select *, (row_number() on (order "time")) % 50 rn data_raw) sa limit 500; tried moving calculation clause: select * ( select *, (row_number() on (order "time")) rn data_raw) sa (sa.rn % ceil(count(*)::float / 500::float)::bigint)=0; that results in er

ember.js - Mocking models for testing Ember.easyForms input component inside another ember component -

i using ember-cli qunit testing using moduleforcomponent . have following select element inside ember component have created. {{input site as="select" collection="sites" selection="site" optionlabelpath="content.sitelabel" optionvaluepath="content.id" prompt="please select" label=" " }} the actual sites collection found using store . sites : function() { return this.get('store').find('site'); }.property() i using jsmockito mock out store . var sitemock = mock(ds.model); when(sitemock).get('id').thenreturn(1); when(sitemock).get('sitelabel').thenreturn('qunit'); var storemock = mock(ds.store); when(storemock).find('site').thenreturn([sitemock]); i pass components parameter in test. var component = this.subject({ store : storemock }); the generated html

java - Mockito verify method call with generic collection argument -

i have method: public void mymethod(set<item> items); when try call: mockito.verify(instance.mymethod(mockito.anyset()); i compilation error: the method verify(t) in type mockito not applicable arguments (void) i same error when define argument captor. how can fix this? i figured out. has this: mockito.verify(instance).mymethod(mockito.anyset()); the parentheses wrongly placed.

java - Ormlite join foreign columns -

i have following datatable: @databasetable public class table_name { ... @databasefield(foreign = true, foreignautorefresh = true) private user createduser; @databasefield(foreign = true, foreignautorefresh = true) private user updateduser; .... } and how can write following join query ormlite? select t.* table_name t left join user cu on (cu.id=t.createduser.id) left join user uu on (uu.id=t.updateduser.id) cu.username="xxyy" thanks in advance.

haskell - Can fusion see through newtype wrappers? -

given: newtype myvec = myvec { unvec :: data.vector } deriving (functor, etc) this create (something like) this: instance functor myvec fmap f = myvec . data.vector.fmap f . unvec will vectors fusion rules fire , rewrite fmap f . fmap g $ myvec fmap (f . g) myvec ? are there pitfalls should aware of? afaik problem "pay" new types in containers solved in ghc 7.8, it? fusion rules operate on functions, not on types. functions on myvec won't have fusion rules, unless write them reuse underlying ones. e.g. map :: (a -> b) -> myvec -> myvec b map f = myvec . vector.map f . unvec {-# inline map #-} then we'd have uses: map f . map g which inline to: myvec . vector.map f . unvec . myvec . vector.map g . unvec ghc should erase newtype constructor, yielding regular stream, suitable fusion: myvec . vector.map f . vector.map g . unvec you can confirm running ghc , looking @ rewrite rules firing. alternatively, can add own

How to rotate an array in degree of 20,40,60,...200 using Python? -

in python, how can rotate array 20,40,60,..200 degree? actually, array contains fits image , want rotate fits image. know can rotate image, image in form of array. thanks in advance! cheers, -viral did try this? scipy.ndimage.interpolation.rotate()

android - Full screen pull down disabling -

i'm developing full screen application it's possible user pull down status bar, , after, access wifi, bluetooth... features. have watched applications have complete full screen , don't allow pull down status bar. aproximation collapse solution allow user access these features. aproximation isn't valid me: if (build.version.sdk_int > 16) { collapsestatusbar = statusbarmanager .getmethod("collapsepanels"); } else { collapsestatusbar = statusbarmanager .getmethod("collapse"); } check it this.requestwindowfeature(window.feature_no_title); // remove title bar this.getwindow().setflags(windowmanager.layoutparams.flag_fullscreen,windowmanager.layoutparams.flag_fullscreen);// remove notification bar setcontentview(r.layout.activity_home);

c# - IComparer classes for custom class -

i have bunch cards in list, , want sort them ascending or descending: private list<card> cards = new list<card>(); ascending/descending mean have compare values of cards, simply. what do? icomparable interface seems not enough because can sort 1 "default" way. trying implement icomparer , fail. in same class file card, try add comparing class descending order: public class cardcompdesc : icomparer<card> { int icomparer.compare(object a, object b) // return 0, -1, or -1 later return 0 { } but here compiler complains cannot find icomparer in current context. if remove <card> definition, class compiles. in order able sort cards above, this: this.cards.sort(new cardcompdesc()); looks have use icomparer<> on icomparer. doing wrong? i grabbed compare use works.. here gist of it... using system; using system.collections.generic; using system.linq; using system.text; namespace mynamespace { public c

paypal - php express checkout recurring created profile successfully but recurring not working -

we have implemented express checkout well. ipn response each transaction. done these thing in sandbox. now making recurring payment express checkout. here recurring profile creating proper, not getting ipn notification transaction , not transaction done profile. can suggest me solution issue. help highly appreciated. thanks vijay recurring payments transactions send ipn's fine, guess ipn script must not handling them correctly or maybe "doing nothing" them. example, if you're handling specific txn_type, might missing out on other stuff. log in paypal account , check ipn history , should see list of ipn's it's been sending. can see if it's returning success or fail, there, because possibility ipn script failing when txn_type hits it. your own web server logs can big when troubleshooting sort of thing, too. if getting ipn's, though, sending them all, must going on make think they're not sending when are.

"your location could not be determined" google maps for mobile with android 4.2.2 -

i have mobile phone samsung android os 4.2.2 , when accept share , display current location in google maps message displayed on mobile screen "your location not determined".. have done updates software , of course have activated location settings in mobile. is known issue-bug? how can resolve issue? noticed last time faced same issue performed return factory setting , issue resolved.

Nginx rewrite rules single url not working and confusing -

after reading lot of stuff i'm confused nginx rewrite rules. my url looks actual that: http://example.com/video.php?id=thevideoid&video=.mp4 but want make accessible through http://example.com/video/thevideoid/video.mp4 my rewrite rule is rewrite "(video).php?id=([a-u0-9a-z]+)&(video)=([.a-z0-9]{3,5})$" $1/$2/$3/$4? last; but isn't working. i'm confused syntax. part behind "rewrite" regex searched , last part whats replaced with, or other way around? do have advices, suggestions, or other information me? appriciate :)

sync downloaded git repository with bitbucket -

i have large repository on bit bucket (1gb+). when try clone repository connection breaks between 80% 95%. since git not have resume option, have start scratch each time. i have tried cloning repository 8-10 times , each time connection broke. able download repository in .zip format bitbucket. i have repository on local machine unable sync remote repository (bitbucket). .zip repository not have hidden .git folder , therefore had initialize git following have done git init git remote add origin git add . can me in figuring out how push changes remote repository , pull recent commits?

java - How to make my trigger available in classpath (h2 database) -

when invoke query: st.execute("create trigger mytrigger after insert on newpopulation each row call "\newpopulationtrigger\" "); the console write: class newpopulationtrigger not found how should follow sentence "the trigger class must available in classpath of database engine" - how can implement it? my research: the example of issue / adding classpath in scala the package must given on left of class name. in h2 example. package org.h2.samples , class triggersample create trigger inv_ins after insert on invoice each row call "org.h2.samples.triggersample" the clean way in case ask full name in java: st.execute("create trigger mytrigger after insert on newpopulation each row call \""+newpopulationtrigger.class.getname()+"\"");

c# - Routing to a hard-coded Controller -

this route mapping doesn't work: configuration.routes.maphttproute( "environmenttargetsview", "api/environmenttargetsview/{id}/{userguid}", new { id = routeparameter.optional, userguid = routeparameter.optional, }); i error: "no route providing controller name found match request uri" however, route mapping work: configuration.routes.maphttproute( "environmenttargetsview", "api/{controller}/{id}/{userguid}", new { controller = "environmenttargetsview", id = routeparameter.optional, userguid = routeparameter.optional, }); i curious why , have surfed answers on here, can't figure out. want hard-code value because specific route want api take. worry having tokenised in routetemplate can not use route similar pattern. it's because specified: controller = "environmenttargetsview" in second code block. if add first code blo

java - how to get object into jsp from arraylist which is added into modelAndView inside controller -

currently iam working on spring mvc. going transfer data controller view. have arraylist contain objects.it has been added modelandview inside controller can use jsp page. model.addobject("results",results); i want use values print table form not able so. doing this ${results.get(0).getparametername() } but shows error the function must used prefix when default namespace not specified everything working fine. can me solve problem. servlet.service() servlet spring-dispatcher threw exception org.apache.jasper.jasperexception: /web-inf/configureapplication.jsp(45,86) function must used prefix when default namespace not specified @ org.apache.jasper.compiler.defaulterrorhandler.jsperror(defaulterrorhandler.java:39) @ org.apache.jasper.compiler.errordispatcher.dispatch(errordispatcher.java:405) @ org.apache.jasper.compiler.errordispatcher.jsperror(errordispatcher.java:146) @ org.apache.jasper.compiler.validator$1fvvisitor.visit(validator.java:124

exception - Handling error 500 by Interceptor in Spring MVC -

i have created interceptor class , have overridden aftercompletion method. when ever system throws error ( 500, 404 ), system breaks , not reach aftercompletion method of interceptor. there way request can reach aftercompletion method exception occured. interceptor class public class classname extends handlerinterceptoradapter { @override public void aftercompletion(httpservletrequest request,httpservletresponse response, object handler, exception ex) throws exception { if (ex != null) { //do somthing here } } } interceptor declaration <mvc:interceptors> <bean class="x.y.z.classname" /> </mvc:interceptors> can guide me 1 this. i using swf + mvc , realized different ways of registering interceptors , <bean class="org.springframework.webflow.mvc.servlet.flowhandlermapping"> <property name="flowregistry" ref="datacollectorflowregistry" /> <propert

xcode - Location Dot in Google Maps iOS SDK showing as a Square -

Image
in image, location dot has white circle around it. anyone knows can cause ? i using normal self.gmap.mylocationenabled = yes; thank you i have same issue , foud this in bug trackin of sdk. in real device works fine without square.

javascript - Traverse DOM tree of Polymer element -

is possible traverse dom subtree when using polymer element custom-element like <polymer-element name="custom-element" attributes="something"> <template> </template> <script> // access ul , li actual dom here. </script> </polymer-element> <body> <custom-element something="foo"> <ul> <li>bar</li> <li>hello</li> </ul> </custom-element> </body> i want able parameterize polymer element using markup that's wrapped it. actually, this.children allows access them. <polymer-element name="custom-element" attributes="something"> <template> </template> <script> polymer({ created: function() { console.log(this.children); } }); </script> </polymer-element>

Android selecting top microphone -

how select top microphone audio source recording audio in android. now using mediarecorder.audiosource.camcorder audio source not taking top mic recording. the developer documentation lists supported audio sources. unsure mean "top microphone" think should use mediarecorder.audiosource.mic .

Can't I reach Amazon EC2 instance via my public IP -

the server works fine in amazon instance. but, when use browser can't,reach amazon ec2 instance via public ip. ping not work. any reason that? check ports open destination check service if started check internet connectivity- nat or external ip address check internet gateways...ping 4.2.2.2

javascript - How can one append a div exactly in the position where the mouse is over? jQuery -

i want leave colored div trail without generating divs when page loads. want them appended when mouse on parent div , position them mouse within it. edit : think need more precise posted code want rewrite. want same thing without generating divs become colored on mouseover when page loads create colored div when mouse on $(".container") @ current position of mouse. thanks! mention: script generates lots of divs - might take while page load. $(document).ready( function() { var csize = $(".container").width() * $(".container").height(); var space = $(window).width() * $(window).height(); while ( csize * $(".container").length < space) { $("#space").append("<div class='container'></div>"); }; $(document).on("mousemove", function() { window.color = math.floor(math.random()*16777215).tostring(16); }); $(".container").on("mous

mysql - Fast rand() order search -

we have table of 50k items , display @ search page random sort , 10 items per page. need apply filters. rand() or without seed slow. note items have 3 categories. first category should displayed first random order, , second category, random order. generating random number between 0 , max_id s not working because of pages , mentioned constraints randomizing records php makes items display @ same page is there better solution speed random search? here few tip hopes works put indexes on main field on filtering reduce number of column in select query (only use needed columns) recheck joins recheck conditions recheck group/having/order clause

angularjs - How to digest changes in method outside angular and outside scope -

so realized doing changes outside angular-bounds, in async ajax callback, not make angular call $apply on scope. far have solved these issues calling $scope.$apply() after changes have been made, time function not located in same scope. method lies in factory, , called controller. i have tried sending scope parameter controller factory, in fact work, not pretty expect have many methods this, , sending additional parameter each time seems ugly. any ideas?

Iterating over every two elements in a list in Python -

this question has answer here: how possible combinations of list’s elements? 18 answers how iterate on pair combination in list, like: list = [1,2,3,4] output: 1,2 1,3 1,4 2,3 2,4 3,4 thanks! use itertools.combinations : >>> import itertools >>> lst = [1,2,3,4] >>> x in itertools.combinations(lst, 2): ... print(x) ... (1, 2) (1, 3) (1, 4) (2, 3) (2, 4) (3, 4) btw, don't use list variable name. shadows builtin function/type list .

PHP: SQL connection in File 1, SQL functions in File 2 not working -

i have file 1 called init.php holds sql details , sql connection: <?php $sql = array( 'user' => 'user', 'password' => 'pass', 'server' => '192.168.100.1', 'db' => 'xe' ); $conn = oci_connect($sql['user'], $sql['password'], $sql['server'].'/'.$sql['db']); if (!$conn) { $e = oci_error(); trigger_error( htmlentities($e['message'], ent_quotes), e_user_error ); } include("functions.php"); ?> i have file 2 called functions.php holds sql functions: <?php function is_accessible($a, $b) { $stid = oci_parse($conn, "select c1 t1 o1 = $a"); oci_execute($stid); $row = oci_fetch_array($stid, oci_num); if ($row['0'] == $b) { return true; } else { return false; } } function ... ?> the functions.php file not seem want use connection have in in

sql - Choosing the view query at runtime (postgres database) -

i want create view choose between 2 possible selects based on session variable (set_config) on runtime. today "union all" between 2 selects in following manner: create view my_view ( select * x cast(current_setting('first_select') int)=1 , ...; union select * y cast(current_setting('first_select') int)=0 , ...; ) the problem postgres optimizer takes bad decisions when target union. when run example: select * my_view id in (select id z field='value') it decides full scan on table x although has index on "id". there way define such view without using "union" clause? just or them where-clause. optimiser find invariant conditions. create view my_view ( select * x ( cast(current_setting('first_select') int)=1 , <condition1> ) or ( cast(current_setting('first_select') int)=0 , <condition2> ) ... ) ;

c# - Implementing Binding Paths -

trying implement field binding system , have following method: public void setvalue<tfield>(expression<func<tfield>> field, object value) { ((field.body memberexpression).member fieldinfo).setvalue(this, value); // check bindings etc. } that used this: myobj.setvalue(() => myobj.somestringfield, "somestring"); it works intended, value set , can other stuff want checking bindings etc. now i'm trying implement support of binding paths, i.e. allow like: myobj.setvalue(() => myobj.names[1].firstname, "john"); i got fieldinfo of firstname need (at least) reference object myobj.names[1] expression. ideas on how this? a general approach create expression assigns value expression: public static void setvalue<tfield>(expression<func<tfield>> field, tfield value) { var expression = expression.lambda<action>( expression.assign(field.body, expression

How can I "preview" MySQL transaction changes? -

for database interface i'm developing need preview feature allows me simulate mysql insert query ( start transaction ... rollback should do) , see list of changes. there badly documented mysql command or have - somehow - compare original temporary database via php? maybe posts you!! http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-transactions.html http://dev.mysql.com/doc/refman/5.0/en/commit.html http://dev.mysql.com/doc/refman/5.6/en/commit.html

javascript - jQuery next and prev button -

i'm new jquery , use jquery carousel. don't want use plugin.i try make next , prev button color on last , first slide. that's work. problem buttons stay "red" when not more on last , first slide here demo http://jsfiddle.net/rglsg/70/ $(function(){ var carousel = $('.carousel ul'); var carouselchild = carousel.find('li'); var clickcount = 0; var canclick = true; itemwidth = carousel.find('li:first').width()+1; //including margin //set carousel width won't wrap carousel.width(itemwidth*carouselchild.length); //place child elements original locations. refreshchildposition(); //set event handlers buttons. $('.btnnext').click(function(e){ if($(".carousel").find("li:eq(6)").text()!=14) { if(canclick) { canclick = false; clickcount++; //animate slider left item width c

android - Navigation drawer lag -

the navigation drawer lags every time open new activity. looked on google solution , found out can solve delaying new activity handler. experimented little bit got nowhere. some code pieces mainactivity.java: public void selectitem(int possition) { fragment fragment = null; bundle args = new bundle(); switch (possition) { case 2: fragment = new fragmentzero(); break; case 3: fragment = new fragmentone(); break; case 4: fragment = new fragmenttwo(); break; case 5: fragment = new fragmentthree(); break; case 7: fragment = new fragmenttwo(); break; case 8: fragment = new fragmentzero(); break; case 9: fragment = new fragmentone(); break; ca

python - Move seaborn plot legend to a different position? -

i'm using factorplot(kind="bar") seaborn. the plot fine except legend misplaced: right, text goes out of plot's shaded area. how make seaborn place legend somewhere else, such in top-left instead of middle-right? building on @user308827's answer: can use legend=false in factorplot , specify legend through matplotlib: import seaborn sns import matplotlib.pyplot plt sns.set(style="whitegrid") titanic = sns.load_dataset("titanic") g = sns.factorplot("class", "survived", "sex", data=titanic, kind="bar", size=6, palette="muted", legend=false) g.despine(left=true) plt.legend(loc='upper left') g.set_ylabels("survival probability")

php - htaccess mod rewritten urls, 301 redirect on dynamic page? -

i utilizing mod-rewrite , htaccess file translate query string urls friendly ones. these products pull database , populate single dynamic php file - product1.php . i introduced rewrite function , have seen site traffic plummet. thinking because need add 301 redirects rewritten urls. (i have noticed massive spike in url errors, nonsensical, reason.) can use 301 redirects if it's 1 file ( product1.php ), url's different; and, if so, how write it? have searched specific question, no luck. fyi, here's have in htaccess utilizing mod-rewrite: rewriteengine on #redirect requests missing "www" rewritecond %{http_host} ^example\.com$ [nc] rewriterule ^ http://www.%{http_host}%{request_uri} [ne,l,r=301] #truncate extension ".php" requests rewritecond %{the_request} /index\.php [nc] rewriterule ^(.*?)index\.php$ /$1 [l,r=301,nc,ne] #look word "category" followed slash, product type, slash, model name , model id, slash, product id rewritecon

ios - Read local sqlite file -

i need read local sqlite file on ipad, not need queries how open it, starting point. downloaded file ftp server , located in app. opening , closing sqlite database not hard. need follow few steps: step 1 - copy database out of bundle app's documents folder. you don't want tinkering bundle version of database, want use specific instance this device. //******************************************* - (void)copydatabasetodocumentsfolder { nsstring *documentspath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]; nsstring *localdatabase = [documentspath stringbyappendingpathcomponent: @"yourdatabasefilename.sql"]; bool fileexists = [[nsfilemanager defaultmanager] fileexistsatpath: localdatabase]; if (fileexists == no) { nserror *err; // path database in application package nsstring *databaseinappbundle = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathc

ios - How can I guarantee unique entries in a Core Data store in a shared app container used by both the host app and an extension? -

to ask question effectively, let's first consider exact scenario i'm facing: general setup a host ios 8 app. one or more ios 8 extensions (watchkit, share, etc.) bundled host app. the host app , extensions share same core data sqlite store in shared app group container. each app/extension has own nspersistentstorecoordinator , nsmanagedobjectcontext. each persistent store coordinator uses persistent store shares same sqlite resources in group container other persistent stores. the app , extensions use common codebase syncing content remote api resource on internet. sequence of events leading problem the user launches host app. begins fetching data remote api resource. core data model objects created based on api response , "upserted" host app's managed object context. each api entity has uniqueid identifies in remote api backend. "upsert," mean each api entity, host app creates new entry in core data if existing entry given uniqueid c

visual studio 2013 - SSIS value does not fall within the expected range with OLE DB Datasource -

i'm using visual studio 2013 update 3 , collegue of mine update 4 installed each. using data dools sql server 2014. i've created few dts packages collegue updated far worked without problems. of sudden "value not fall within expected range" warning datasource , can't edit columns there,.. . needed recreate datasource message disappear again. my question here can appearance of additional columns in table datasource accesses cause of problem? (i've seen out of sync warnings datadestinations whenever destination table got new columns or lost columns, first time changed source table). or can problem have different cause? it has been long while since i've worked on ssis project, recall seeing error well. experience was caused metadata of input being out of date in way, , describe suspicion fits this. the solution found avoid specific on input components, selecting exact columns wanted rather selecting all. think in end changed them use hand

python - Drop row in pandas dataframe if any value in the row equals zero -

how drop row if of values in row equal zero? i use df.dropna() nan values not sure how "0" values. i think easiest way looking @ rows values not equal 0: df[(df != 0).all(1)]

javascript - Emacs flymake-jslint show all errors -

i want use jslint in emacs, installed package flymake-jslint , flymake-cursor . have simple javascript file: /*global desc, task, jake, fail, complete */ "use strict"; task("example", function() { var x = 5 console.log("asdf"); }); flymake highlights var x = 5 , unused 'x'. in mini buffer. however, when run jslint command line, get: $ jslint jakefile.js jakefile.js #1 expected 1 space between 'function' , '('. task("example", function() { // line 3, pos 25 #2 expected ';' , instead saw 'console'. var x = 5 // line 4, pos 14 #3 unused 'x'. var x = 5 // line 4, pos 9 is there way configure flymake-jslint show me non syntax error, "expected space"? i've found answer :) there config variable called flymake-jslint-args . when run describe-variable showed me this: flymake-jslint-args variable defined in `flymake-jslint.el'. valu

javascript - Using the JQuery Autotab plugin, is it possible to create a field that accepts exactly 6 digits? -

i'm working autotab jquery plugin here's example give in autotab documentation... regular expression (allows numbers , periods) $('#regex').autotab({ format: 'custom', pattern: '[^0-9\.]' }); the weird thing pattern set of characters negated caret (^). assume way works pattern specifies characters user isn't allowed enter. i trying create field left blank user, or accept 6 , 6 (no more, no less) digits. more complex autotab allows?

mysql - Error when using case with variables -

hey guys facing problem when use variable case in mysql. the code have used is declare vsite varchar(20); set vsite = case when id > 0 'sdfsdf' else 'asd' end name customers; when run code throws me error you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'declare vsite varchar(20)' @ line 1: declare vsite varchar(20) can point me going wrong..thanks valuable help you need declare variables inside begin end block. here simple example of stored procedure delimiter // create procedure blah(in customer_id int,out vsite varchar(20)) begin select case when id > 0 'blah' else 'mah' end vsite customers id=customer_id; end// delimiter ; call blah(3,@somevar); select @somevar;

javascript - Error: Uncaught SyntaxError: Unexpected identifier -

i'm making simple blackjack game in javascript, when try run it, gives me error. specifically, chrome tells me error on line: if y <= 17 here's code: var x = null; var y = null; var numsdeal = new array(); (i=0;i<2;i++){ ndeal = math.floor(math.random()*(11-1)+1)+1; numsdeal[i] = ndeal; y = numsdeal[0]+numsdeal[1]; } var nums = new array(); (i=0;i<2;i++){ n = math.floor(math.random()*(11-1)+1)+1; nums[i] = n; x = nums[0]+nums[1]; } function hit(){ hitc = math.floor(math.random()*(11-1)+1)+1; x = x + hitc; if y <= 17 hitd = math.floor(math.random()*(11-1)+1)+1; y = y + hitd y.tostring(); document.getelementbyid("demo2").innerhtml = y; x.tostring(); document.getelementbyid("demo").innerhtml = x; } x.tostring(); document.getelementbyid("demo").innerhtml = x; as can see, y declared. can me? i'm sure i'm being stupid. by way, have searched solutions, both

c# - Use user selected image as canvas background -

deleted old question make more specific one. using code http://www.c-sharpcorner.com/uploadfile/mahesh/image-viewer-in-wpf/ basis. lets user browse image file open , display. want display image , let user make marks on it. decided want use canvas this. right now, can't figure out how user selected image background. i'm getting error says "system.windows.shapes.path not contain definition 'background' , no extension method 'background' accepting first argument of type 'system.windows.shapes.path' found..." line says 'canvas1.background = brush;". i've looked ways set background of canvas, involving using xaml code, other errors. xaml: <window x:class="canvasstuff.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="main window" height="409" width="574"&

html - Is utf-8 a character set or an encoding? -

from understand, unicode character set containing possible characters in languages. utf-8 way represent each of characters in memory. if it's case, why put: <meta charset="utf-8"> and not <meta encoding="utf-8"> in html document indicate utf-8 encoding? <meta charset="foo"> mostly-compatible-by-luck abbreviation of original html 2.0 <meta http-equiv="content-type" content="text/html; charset=foo"> construct. meta http-equiv used (in limited way) smuggle http headers inside html document, construct equivalent setting charset=foo on content-type header of enclosing http response. the content-type http header taken mime standard used e-mail (rfc2045, rfc1341). standard called charset because predates unicode. in days, iso-8559-1, cp1251 et al considered separate character sets. when unicode came along reformulated them encoded subsets of 1 true character set. now web has standardi

Recurring Toasts with Windows 8.1 Store Apps build with JS -

i've been trying create notifications happen on weekly basis - example, every monday @ 8am. i've tried use recurring toast - http://msdn.microsoft.com/en-us/library/windows/apps/hh465417.aspx - realized recurrence parameters more designed snooze functionality, maximum delay of 60 minutes, , maximum repeat 3 times. is there suggested workaround this? is there best practice such use case? thanks! you're right recurrence on scheduled toasts designed snooze. unfortunately, api doesn't provide way show same toast multiple times on fixed schedule. you'll need manually create scheduledtoastnotification each time want shown. in example, might create , schedule out toast week each monday @ 8 am.

android - Use an Image for DrawerLayout background -

i've search on line , here, can not find usefull answer on : "how can set image background navigationdrawer's listview ?" the problem whenever listview's background isn't "solid" color (#aabbcc example), drawerlayout doesn't show. here's layout : <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/drawer_layout"> <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent"/> <!-- navigation drawer --> <listview android:id="@+id/left_drawer" android:layout_width="wrap_

objective c - Can you use the FBSnapshottestcase library with Swift? -

i've got fbsnapshottestcase library , subclassed fbsnapshottestcase in test file have in ios project. if try call fbsnapshotverifyview method not found error. i had same issue today new project started in swift. also, forked repo fix it. you'll find there : https://github.com/delannoyk/ios-snapshot-test-case you can add pod: target "tests" pod 'fbsnapshottestcase', :git => 'https://github.com/delannoyk/ios-snapshot-test-case' end

ASP.Net Dynamic Data - Show Columns from Two Tables as Single Entity -

i have created new c# asp.net dynamic data website provides crud functionality table entities in edmx file. the following tables in file : customers ----------- customerid customername documents ----------- documentid documentname documenttype customerid where customerid pk in customers , fk in documents. when dynamic web app displays rows in documents want display following columns in gridview: documents ----------- documentid documentname documenttype customerid customername its important when user sees list of documents can see customername associated each document. not want edit customername documents list. viewing. how can see customername document gridview in dynamic data web app? i used code first database vs2012, here entities generated ef : namespace docmappings { using system; using system.collections.generic; public partial class customers { public customers() { this.documents = new hashset<documents &g

c++ - Pointer to array Maintain counter of elements -

i have interface multiple classes inheritance. class someinterface { virtual void somemethod() = 0; } class : public someinterface { public: void somemethod() { //do } } class b : public someinterface { public: void somemethod() { //do } } class c : public someinterface { public: void somemethod() { //do } } for each of classes a, b, c have created array different sizes of actual type inside container class. class acontainer { public: as[10]; } class bcontainer { public: b bs[5]; } etc... furthermore have array of pointers "someinterface", want have pointer each of actual arrays this. #define someinterrface_size 3 someinterface *array[someinterrface_s

sql - Calculation within the subquery, substract an amount from a different table -

i have been working on query on day now. from total column in first query (calls) below, need add or subtract amount number second table (callsincrease) months within date range (from startdate enddate skill equals skill in query). i tried create field first amount subtract each month, use subtract total. i tried different versions of the sub-queries below: expr1: ( select amount ( select callsincrease.skill, sum(callsincrease.amount) amount callsincrease group callsincrease.skill ) [skill]=(select [skill] callsincrease) , [callmonth] between (select [startdate] callsincrease) , (select [enddate] callsincrease) ) expr1: ( select sum([%$##@_alias].amount) sumofamount ( select callsincrease.skill, sum(callsincrease.amount) amount callsincrease group callsincrease.skill) [%$##@_alias] group [%$##@_alias].skill having ((([%$##@_alias].skill)=forecast.skill)) ) the sql calls query: select cdate(dateserial(year([fore

javascript - IE 11 jumps to embedded Google map after page load -

we have embedded google map on site. works charm in every browser incl. ie<=10. on ie11, however, under unspecific circumstances, browser jumps (scrolls) after firing load event google map, happens below "fold". ("unspecific circumstances": homepage not exhibit peculiar problem, sub-pages , pages on subdomains reliably, although embedding code identical.) searching web brings this thread in google product forum, that, if nothing else, proves it's not exclusive problem of our site. i searching idea how debug , finding root cause jump. perhaps has found problem, or there (new) config option embedded maps, controls behavior? while don't have "root cause jump" have solution avoid this. can see on site developed , i've implemented lazy loading through use of wordpress plugin bj lazy load. google map iframe doesn't appear in dom till scroll region, "focus" issue never occurs. non-wp sites, can use vvo's jquery

c++ - Template specialization class function -

so have class use data structure, want 1 of functions in class behave differently if class storing pointers. want instead of returning pointer want return reference object when [] operator called. this class before template <typename t> class collectiontemplate { t ** obitems; //other code inline t& operator[](int iindex) { return * obitems[iindex]; } }; i add or this. code out side class template<> classa & collectiontemplate<classa*>::operator[](int iindex) { return *(*obitems[iindex]); } but error when run code e2428 templates must classes or functions from have read have seen people function templates not class templates idea on how awesome. you can delegate type detection (pointer/reference) function shown below. edit: static before access not matter since access functions inlined anyway. removed again. #include <vector> #include <iostream> template <class c> str

xml - If "match" else -

in xslt match nodes using following command <xsl:template match="*[local-name() = 'proposal']/*[local-name() = 'applicationdata']"> which nodes from <?xml version="1.0" encoding="utf-8"?><?xfa generator="xfa2_4" apiversion="2.8.9029.0"?> <xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timestamp="2013-03-01t09:48:58z" uuid="3e3468da-104d-4532-8077-0dc001ca166b"> <xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"> <xfa:data> <proposal xmlns="http://www.govtalk.gov.uk/planning/oneappproposal-2006" version=""> <oneapp:applicationdata xmlns:oneapp="http://www.govtalk.gov.uk/planning/oneappproposal-2006"> <oneapp:treeshedgeswales/> <oneapp:otherlowcarbonenergy/>

android - Design a round button over two colored layouts -

Image
i'm trying design : currently i'm having issue putting button @ "the middle" of 2 layouts reunion point. there way ? thanks. here way it <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightsum="1"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.5" android:background="#ff0000"> <!-- add content here --> </linearlayout> <linearlayout andr