Posts

Showing posts from August, 2011

html - Javascript "onmousemove()" works in Chrome but not in Firefox -

i tried googling couldn't find solutions. the 4 towers @ bottom supposed display different images (less transparent) when mouse on them. works in google chrome not in firefox. here's website: http://cdelphinus.com/test/mormontowerdefense.html (you can right click->view source) entire code(app.js) here's problem code: in html: <canvas id="canvas_one" width="1160" height="580" style="border:2px solid yellow; background-color:black; padding-left:0;margin-left:0;" onmousemove="lolol(event)" onclick="haha(event)"></canvas> in app.js file: here's condensed version of problem, works in chrome not firefox: //function lolol(event) { // event = event || window.event; // alert(event.x); //} i have feeling once alert above shows in firefox rest fixed magically. here's more detailed version of stuff going on function lolol(event) { event = event || window.even

java - How to skip redirection to https for some http request? How to configure this in jboss web subsystem? -

i have requirement in application http request redirected https there code in java servlet create http request through code , send jobss server translating https request. servlet not have capability handle https response , not want change servlet code. there way configure in jboss web system skip redirection of http request https request? you can add security constraint in web.xml disable https few pages <security-constraint> <web-resource-collection> <web-resource-name>pageswithouthttps</web-resource-name> <description>no description</description> <url-pattern>/nohttps/*.jsp</url-pattern> </web-resource-collection> <user-data-constraint> <description>no description</description> <transport-guarantee>none</transport-guarantee> </user-data-constraint> </security-constraint> <security-constraint> <web-resource-collection> <web-r

node.js - How to do rpush operation in then-redis? -

how can rpush operation redis , retrieve data back? how hlist operations in then-redis? rpush operation api not available then-redis .you can write own code command.js in same. there no operation hlist can again write support lrange or rrange per requirement , use retrieve results.

c# - Serialization issue on custom type -

i have following classes: [serializable] public class tradebotsettings { public exchangeplatform exchange { get; set; } } [serializable] public enum exchangeplatform { [xmlenum("btc_e")] btc_e, [xmlenum("bitstamp")] bitstamp, [xmlenum("campbx")] campbx, [xmlenum("cryptsy")] cryptsy, [xmlenum("btcchina")] btcchina, } when try serialize gives error private void button2_click(object sender, eventargs e) { tradebotsettings tbsettings = new tradebotsettings(); tbsettings.exchange = exchangeplatform.btc_e; streamwriter sw = new streamwriter(@"d:\temp\trader\trader\trader\bin\x86\debug\configs\bots.xml", false); xmlserializertradebot = new xmlserializer(tbsettings.gettype()); xmlserializersettings.serialize(sw, tbsettings); sw.close();

ios - Why I'm unable to decrease the brightness using a UISlider? -

in app, i'm using uislider reduce/improve brightness of uiimage. slider's min value=0 , max value=1.slider's current value 1; when move slider 1 0.7 uiimage getting bright when move 0.7 1, uiimage isn't reducing brightness; here code uislider's action: -(ibaction)sliderbright:(uislider*)sender { float alphavalue; value2 = sender.value; if (value1>=value2) {//i fixed value1=1.0 in viewdidload(); nslog(@"the value of slider , alpha %f,", value2); alphavalue= value2; value2=value1; } else{ alphavalue= value2+0.2; value2=value1; } _displayimage.alpha=alphavalue; } how can fix it?alpha value uiimage control whiteness, there way control blackness of uiimage? just set uislider's value uiimage's alpha in method. _displayimage.alpha = sender.value;

android - Material Design backward compatibility -

from examples provided on android developer pages see new views, recyclerview , backward compatible ( android.support.v7.widget.recyclerview ). are new things introduced in material design backward compatible (to version)? updating answer lollipop os officially released support libraries, can use inside project provide compatibility older versions. support library: v7 appcompat library this library adds support action bar user interface design pattern. library includes support material design user interface implementations. if using android studio need include below dependency identifier: com.android.support:appcompat-v7:21.0.+

MySQL statement if number is less than php variable -

is there possibility make mysql statement select number if less value? lets have php variable: myvar = 123; and have records in database: 120 125 129 121 i want take possible database records, myvar , record difference less 5. in example, take 120, 125 , 121. possible this? if yes, maybe me out how? you can use mysql's between operator: $query = " select * `table` `record` between {$myvar}-5 , {$myvar}+5"; see mysql demo note: between match records between min , max , including min , max . keep in mind when developing logic application.

nlp - Sentence recognition using php based natural language processing -

i know can in python wondered if there way in php. i have split paragraph sentences of these sentences not sentences , 'reject' them. guess requires kind of sentence recognition. know 'punkt' can in nltk need able equivalent in php. example is 'i run tap water.' should accepted 'ewing j. r nat gen 133;324;pp123-456.' should rejected thanks

sql server - SQL full outer join -

i busy completing old examiniation paper one question reads follows: study following tables , answer questions below: create table cardholders( ch_id integer identity, ch_name varchar(50), ch_surname varchar(50), ch_idnumber char(13), ch_cardnumber char(13), ch_status char(2), ch_create_date datetime, ch_last_change_date datetime) cardholder_status //apologies if wrongly formatted chs_status chs_description 00 active 01 not active write query obtain following results cardholder status ashton, t active brown, c active crawford, c not active ellis, j active i assume have make use of full outer join since no colum matches in 2 tables. wrote piece of code, giving me syntax error. select ch_name, ch_surname cardholders full outer join on cardholder_status.chs_status, cardholder_status.chs_description am on right path or logic wrong? am right in using outer join, alternative join use? how can extract first letter ch_name use initial?

matrix - Access to submatrices in symbolic writing (matlab) -

considering matrix defining using symbolic toolbox : syms x y f(x,y)=[1 x x^2; 1 y y^2]; we obtain: >> f(x,y) ans = [ 1, x, x^2] [ 1, y, y^2] how can extract second row of matrix? indexing scheme different in case ( f(x,y)(2,:) )? you have defined (scalar 1x1) symfun returning matrix, there no indexing directly on symfun. extrat symbolic term first: %convert symfun sym f=f(x,y) %now can use indices f=f(1:2,3) %convert symfun f(x,y)=f

replace - visual basic copy file without asking -

in visual basic have program copies file , moves directory, if there no file name , extension, moves no problem. when same file in directory, asks if copy , replace or cancel, or copy , rename. how can have skip force replace file? this using moving code: dim directory = "c:\users\bryce\desktop\helloworld.txt" my.computer.filesystem.copyfile("helloworld.txt", directory, microsoft.visualbasic.fileio.uioption.alldialogs, microsoft.visualbasic.fileio.uicanceloption.donothing) any way avoid notification? thanks. :d the system.io namespace provides file.copy static method allows silent overwriting of destination file dim directory = "c:\users\bryce\desktop\helloworld.txt" system.io.file.copy("helloworld.txt", directory, true) of course removes interface provided my.computer method , user has no way stop copying process. if file not big there no sense provide such interface. preferences , requirements.

sql server - To NOLOCK or not to NOLOCK? -

i've worked in large organization had use nolock on queries - because data commonly updated via etl processes during day , locking application 40% of working day not option. out of habit, in next place went on automatically use nolock everywhere. since reading warnings , risks, i've been gradually undoing this, have no table hints specified , let sql server it's thing. however, i'm still not comfortable i'm doing right thing. in place used nolock , never once saw data doubled up, or corrupt data.. there many years. ever since removing nolock running obvious obstacle of rowlocks slowing / pausing queries gives illusion db slow or flakey. when in actuality it's running lengthy save somewhere (the ability them requirement of application). i interested hear has experienced data corruption or data duplication nolock in practise, rather people going they've read on internet. appreciative if can provide replication steps see happen. trying gauge how

About less loop, throw error -

.loop (@start, @end, @step, @classname,@propertyname) when (@start < @end) { .@{classname}-@{start} { @{propertyname}: @start * 1px; } .loop (@start + @step, @end, @step, @classname, @propertyname); } .loop(12,48,2,fs,font-size); i want loop css common class,but throw error,i don't error on. example: .fs-12{ font-size:12px; } .fs-13{ font-size:13px; } .mt-13{ margin-top:13px; } .loop (@start, @end, @step, @classname,@propertyname) when (@start < @end) { .@{classname}-@{start} { @{propertyname}: (@start * 1px); } .loop ((@start + @step), @end, @step, @classname, @propertyname); } .loop(12,48,2, fs, font-size);

notepad++ - Notepad ++ doesn't save document on exit? -

situation: open text file in n++, make modification, press alt-f4 or close program. n++ won't ask "do want save changes". instead quits , text file on hdd remains unchanged. but when open n++ again, modified file still in there. red tab indicating unsaved changes , can save ctrl-s. can save closing tab (n++ ask). i want save file automatically every time close n++. of other istallations this. not find settings in n++ options. idea? as answer question, in afore mentioned settings => preferences => backup window, uncheck " remember current session next launch " setting. prompted save modified files when exiting.

Apache mod_jk with jetty and tomcat together -

yes. apache connect tomcat , jetty together. have succeeded in either of them(apache + tomcat , apache + jetty). when together, no ideas. belowed part added in httpd.conf in tomcat # load mod_jk module loadmodule jk_module "c:\program files (x86)\apache group\apache24\manual\mod_jk.so" # find workers.properties jkworkersfile "c:/program files (x86)/apache group/apache24/conf/workers.properties" # put jk logs jklogfile "c:/program files (x86)/apache-tomcat-7.0.54/logs/mod_jk.log" # set jk log level [debug/error/info] jkloglevel info # select log format jklogstampformat "[%a %b %d %h:%m:%s %y] " # jkoptions indicate send ssl key size, jkoptions +forwardkeysize +forwarduricompat -forwarddirectories # jkrequestlogformat set request format jkrequestlogformat "%w %v %t" # send servlet context /examples worker named ajp13 #jkmount /servlet/* ajp13 # send jsps context /examples worker named ajp13 jkmount /*.jsp ajp13 jkmount /*.

Splitting a factor at a space in R -

i want split x (which factor) dd = data.frame(x = c("29-4-2014 06:00:00", "9-4-2014 12:00:00", "9-4-2014 00:00:00", "6-5-2014 00:00:00" ,"7-4-2014 00:00:00" , "29-5-2014 00:00:00")) x 29-4-2014 06:00:00 9-4-2014 12:00:00 9-4-2014 00:00:00 6-5-2014 00:00:00 7-4-2014 00:00:00 29-5-2014 00:00:00 at horizontal space , 2 columns as: x.date x.time 29-4-2014 06:00:00 9-4-2014 12:00:00 9-4-2014 00:00:00 6-5-2014 00:00:00 7-4-2014 00:00:00 29-5-2014 00:00:00 any suggestion appreciated! here approach using lubridate : dd = data.frame(x = c("29-4-2014 06:00:00", "9-4-2014 12:00:00", "9-4-2014 00:00:00", "6-5-2014 00:00:00" ,"7-4-2014 00:00:00" , "29-5-2014 00:00:00"), stringsasfactors = false) note use of stringsasfactors = false , prevents dates being read factors. library(lubridate) dd2 <- transform(dd,x2 =

html - change the background of this email template -

i wanted change blue , grey background of email template image can't seem change completely. please help this link html code i tried edit body tag doesn't change anything <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"> change background-color css id/class : #preheaderbackground , #templatepreheader , #headerbackground , #templateheader

python - File in folder created before folder itself -

i have got interesting behavior while reading folder , file in folder creation times. explain this? creating folder os.makedirs(version_dir+test_name) running sub-process in folder , create result file there err_code = common.run_proc(common.get_root_dir() + test_name, custom_path_str=version_dir+test_name) then there script read creation time of folder , result file using os.get.getmtime , apparently creation (as understood docs modification time) time of file within folder 1403197510.1 , folder 1403197510.19 . so basicly have created file in not existing folder. how work or why have such strange output? what believe seeing fact windows modify folders represent files within. so happens: os.makedirs() creates folder, gives time of modification (with os.path.getmtime). e.g. 1403197510.0 write file folder, gives time of modification (with os.path.getmtime). e.g. 1403197510.1 windows updates folder, gives modification time (with os.path.getmtime). e.g. 1

ruby on rails - Rspec for conditional filters -

i have 1 controller follow. class adminscontroller < applicationcontroller before_filter :authenticate_admin!, except: [:forgot_password] end what rspec before filters expect condition i did describe 'response of filters' describe 'there no authentication required ' "before forgot_password" controller.stub(:action_name){ :forgot_password } should_not use_before_filter(:authenticate_admin!) end end end end but got error below failure/error: should_not use_before_filter(:authenticate_admin!) expected adminscontroller not have :authenticate_admin! before_filter i checked documentation, , clear shoulda-matchers not support conditional before-filters. i not test before-filters that. have 2 approaches: or test can reach page when using specific user, , not another or test before-filter function called so in case like require 'spec_helper' describe adminscontroller { should use_b

c# - How can I avoid writing an empty template pattern hook method? -

i'm trying apply template pattern 'hook', that's activated boolean 'true' value virtual method defaults false. implementing classes can override activate hook. however, functionality within hook has virtual because not implementing classes need implement it. below implementation not aesthetically pleasing me - there better way, avoid default exception throw? // template pattern applied in function public virtual tobject compileentityfromdocument<tobject>(document document) { tobject dummyobject = createentity(); setattributesforentity(dummyobject, null, null); if (mustsetrelationsforentity()) { setrelationsforentity(dummyobject, null); } return (tobject)dummyobject; } public abstract void setattributesforentity(object entity, document maindocumenttocompilefrom, list<vfield> documentfieldrecords); public abstract tobject createentity<tobject>(); public vi

android - Unexpected pixel data layout when reading from GraphicBuffer -

i working on platform in native android framework use graphicbuffer allocate memory , create eglimage it. used texture in opengl render (with simple fullscreen quad). the problem when read rendered pixel data graphicbuffer, expect in linear rgba format in memory result texture contains 3 parallell smaller clones of image , overlapping pixels. maybe description doesn't point actual pixel data makes sense memory layout seems other linear rgba. assume because graphics drivers store pixels in internal format other linear rgba. if render standard opengl texture , read glreadpixels works fine, assume problem lies custom memory allocation graphicbuffer. if reason drivers' internal memory layout, there way of forcing layout linear rgba? have tried of usage flags supplied graphicbuffer constructor no success. if not, there way output data differently in shader "cancel out" memory layout? i building android 4.4.3 nexus 5. //allocate graphicbuffer outputbuffer = ne

objective c - Xcode Image Asset Catelogue -

Image
i use backgroundimage on uibutton little arrow @ bottom. in assest catalogue have slice image result not want. result is there anyway can add vertical line? use exact size button size changing @ different place. in end used excellent third party tool. paintcode http://www.paintcodeapp.com/

javascript - Lawnchair json store removing records -

i using lawnchair in app creating in cordova. having erattic problems when removing records ie, code remove first record second removed or uncaught typeerror: cannot set property 'key' of undefined. has had problem or doing wrong. if run script below , try remove records in different sequences problem manifest. appreciated. thanks. <!doctype html><html> <head> <title>lawnchair</title> <script type="text/javascript" src="js/lawnchair-0.6.1.js"></script> </head> <body> <script type="text/javascript"> var tmpstore1 = new array(); tmpstore1.push({ "isbn":9781565926998, "title":"jquery", "book":"pdf", "qty":3, "value":12.46 } ); var tmpstore2 = new array(); tmpstore2.push({ "isbn":123456789, "title":&qu

java - Suggestions on solving a JPA persistence issue -

i'm building persistence tester. project responsible creating , populating (with random values) other object might have. object (obj1) persisted in db , read , stored (obj2), i'll compare them (obj1 == obj2). test if data persisted correctly. (up point simple objects, working) however, since i'm populating objects random values have problem because id's random... makes impossible persist because fk's aren't corresponding id's. to fix this, thinking of building factory each object (and there lot of objects) , save id's later, when persisting id value , use accordingly. have no guarantee work, guys think so? have guys had kind of problem? how did solved it? have other suggestions? appreciated. thanks tl;dr: first approach process textual description of whatever dependency constraints need data conform testing script or script-driving data. generate data in required order. a "test" seems example persistence api client: has r

sapui5 - Allign label and TextArea in XML View -

Image
i have layout problem. want allineate label , text area form. don't output: how can it? there wrong definition of text area? my viwe this, problem? ... <content> <l:grid defaultspan="l12 m12 s12" hspacing="2" width="auto"> <l:content> <f:form id="formnewnomdog" minwidth="1024" maxcontainercols="2" editable="false" class="isreadonly"> <f:layout> <f:responsivegridlayout labelspanl="3" labelspanm="3" emptyspanl="4" emptyspanm="4" columnsl="1" column

PHP- associative array (structure) -

could explain how structure of array like? $result['results'][0]['geometry']['location'] it $result = array( 'results'=> array( array( 'geometry' => array( 'location' => 'some value' ) ) ) )

How to pass arguments to a shell script using java? -

i have written code calls shell script: processbuilder pb2=new processbuilder("/home/abhijeet/sample1.sh"); process script_exec = pb2.start(); pb2.redirecterror(); code works me , executes script. this script takes 2 arguements 1: input file 2: seqs , in pattern like: sample1.sh -ip=abc.txt --seqs=20 shell script interactive one, asks many parameters , have changed it's code , pass values arguements it. complete format should like: db=abc outformat=1 threads=10 sample1.sh --ip=abc.txt --seqs=20 so how can execute script using java? there other way call interactive script using java? you can try this: processbuilder pb2=new processbuilder("/home/abhijeet/sample1.sh --ip=abc.txt --seqs=20"); process script_exec = pb2.start(); outputstream in = script_exec.getoutputstream(); in.write("abc".getbytes()); in.write("1".getbytes()); in.write("10".getbytes()); in.flush(); in.close(); this code

Updating Android Studio to version 0.8 (beta) -

i current using android studio(preview) 0.6.1. can update beta version 0.8 directly? while trying update studio, says current version date! if configuration of as0.6.1 doesn't detect update, have manually. as explained on official page ( https://developer.android.com/sdk/installing/studio.html ) replace latest version, sure save sdk (you can know it's location in configure -> project defaults -> project structure) then once 0.8 isntalled, copy previous sdk new location (or change via settings) i suggest export settings safe. hope helps.

php - Whats the best way to create a HTML sitemap for a website with over 40,000 pages? -

i have got xml sitemap of pages, wanting html version users browse through (and seo guess, making sure every page link to). my php website has page every village / town / county / region in uk , ireland, im guessing 1 page every link in list wouldn't best approach. should i... a) have list of counties sub html sitemap page each listing towns , villages alphabetically? b) same option 'a' a-z bar along top, separate page each county , letter list of towns , villages? c) else?? any suggestions solution appreciated. as google suggests more , more websites have user-friendly pages, suppose sitemaps should follow same logic. if have structured data following village / town / state / country / continent, have sitemaps follow same structure. the first reason easiest implement in opinion, , it's best hierarchy find. villages should sorted alphabetical name or zipcode (depending if country has or not)

User is part of group that has select permissions but they get error when select the table in stored procedure -

i have created user called spuser , assigned them group has select permissions on database tables. when running select * mytable, query returns results expected. when spuser executes stored procedure using mytable, returns following message: an error occurred during implicit system action type "5". information returned error includes sqlcode "-551", sqlstate "42501" , message tokens "spuser|select|myschema.mytable".. sqlcode=-727, sqlstate=56098, driver=4.16.53 if grant select privileges directly user don't error table anymore although getting same error different table. i'm not sure whether need grant select privileges tables or whether affected. stored procedure has ran before not sure why i'm seeing now. does know causes error , can fix it? thanks help. privileges granted groups not apply in static context, e.g. stored procedures. either have grant required privileges individual user or create role

c# - “this” in function parameter in web api -

i developing web api, have created htmllhelper class, , see declarations like: public static string getcountrydomain(this system.web.mvc.htmlhelper htmlhelper, area area) { //body } in controller want call above function. expects 2 parameters. htmlhelper.getcountrydomain(area_id); can explain first parameter need pass in order call above function? this keyword marks extension method. there 2 ways of calling it: you can call if instance method on htmlhelper , or you can call normal static method passing 2 parameters. the first way more common (after all, that's point of making method extension) // prepare parameters htmlhelper helper = ... area area = ... // call function string countrydomain = helper.getcountrydomain(area);

PhantomJS failed to load URL on Jetty running on Jenkins -

i want use siesta testing framework phantomjs on local server , there no problem. worked in http://www.bryntum.com/forum/viewtopic.php?f=20&t=3068 , on machine, there nothing complain about, want combine jenkins. but using jenkins error 403 appears. what do: copy files of project in webapps folder of jetty (incl. framework ) start jetty server (so far no problems) use phantomjs of framwork on localhost:port/project/index.html and there problem starts: failed load url: localhost:port/project/index.html(status 403) i searched results didn't find solves problem. every hint welcome thanks to see i've done: my jenkins shell script jetty="jetty-distribution-9.2.0.v20140526" jettyweb="$jetty/webapps" dir="$workspace/$jettyweb/myproject/src/test" phantom="$dir/siesta_framework/bin" rm -r "$jettyweb/myproject/" mkdir "$jettyweb/myproject/" cp -pr "src/" "$jettyweb/myproject/"

java - error with google map v2 -

i trying display or see google maps on app. i have added library google_play_services_lib(no error). obtain google maps api key. follow code in http://www.vogella.com/tutorials/androidgooglemaps/article.html#overview_intro (no error). but run app in emulator, stopped. says "unfortunately showmapactivity has stopped ". i not getting error. think problem in xml file.fragment not working. should now. plz me or give me simple sample project using google map. beginner @ google map in android , trying badly fix but......:( here activity_main.xml file : <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity" > <fragment android:id="@+id/map" android:layout_width="match_

ios - Method signature return value "Class of type or subclass class" -

when have signature this: - (uiview *)fooview; you can return subclass of uiview * (e.g uiscrollview ) and when have: - (class)anyclass; you can return class (not instance, class itself) there way allow classes of class or subclass? e.g in psuedo code: - ([uiview class])bazclass; so here should able return class uiview of of subclasses. as specified other users, can't. if goal instruct other programmers return method in code (overriden or delegate method), can: write in comment (of course...) create typedef . typedef class classofkinduiview; -(classofkinduiview)class { return [super class]; } this won't block anything, can "talking method", escamotage, make programmers stop , think "what this??", cmd-click , read docs :-)

java - tomcat jdbc realm - j_security not redirecting -

<realm classname="org.apache.catalina.realm.jdbcrealm" drivername="com.mysql.jdbc.driver" connectionurl="jdbc:mysql://localhost/db" connectionname="user" connectionpassword="password" allrolesmode="authonly" digest="sha" usertable="app" usernamecol="login" usercredcol="login" userroletable="login" rolenamecol="group"/> <login-config> <auth-method>form</auth-method> <realm-name>realm</realm-name> <form-login-config> <form-login-page>/login.jsp</form-login-page> <form-error-page>/error.jsp</form-error-page> </form-login-config> </login-config> <form action="j_security_check" method="post"> <tr>username:<td><input type="text"

c# - Maintain selected radio button item on postback -

i want populate radiobuttonlist 5 values database in random order. so i've tried store 5 values in session objects , used following code add values radiobuttonlist (rblquestions) randomly: random ran = new random(); var numbers = enumerable.range(1, 5).orderby(i => ran.next()).tolist(); list<listitem> ans = new list<listitem>(); ans.add(new listitem(session["value1"].tostring(), "y")); ans.add(new listitem(session["value2"].tostring(), "n")); ans.add(new listitem(session["value3"].tostring(), "n")); ans.add(new listitem(session["value4"].tostring(), "n")); ans.add(new listitem(session["value5"].tostring(), "n")); foreach (int num in numbers) { rblquestions.items.add(ans[num - 1]); } this works great. however, when click on button on same form, selected item in list changes randomly. why , how can avoid t

android - Disable Logcat (DDMS) & Run Console automatically opening on any activity -

i monitor logcat outside android studio ( logcat-color open beside emulator on screen/workspace) , stop android ddms view opening within android studio automatically. takes screen real estate i'd prefer keep code. i know can remove view entirely i'd retain access times use linking directly problematic line of code quickly. can filter logcat output show 'error' level isn't great solution i'd changing filters @ surrounding log entries if there problem wanted trace. the same true of run console. i'd stop opening too. is there way have access these 2 views without them opening time there's activity? i've looked through settings can't find candidates modify. first, rid of logcat opening on run, go run -> edit configurations... on main menu (or via toolbar dropdown), uncheck show logcat automatically option in logcat tab. next, unfortunately there no way permanently prevent run window popping when run, there workaround job

downloading the file and cancel in python -

i'm working on python script download xml file server , write data in sqlite3 database in parallel. i need regarding how cancel connection server using urllib2 library. want database stop writing data away connection ahs been cancelled. allchannels_timer called when user hits 'enter' button, wait 1 second before connecting server download xml file. want download stop when hit backspace button currently, code continues if nothing happened. here current code: import urllib2 import stringio import sqlite3 import threading sqlite3 import dbapi2 database xml.etree import elementtree import xml.etree.elementtree et userdict import dictmixin #get actioncodes keyboard.xml action_enter = 7 action_backspace = 110 def csetvisible(window,id,v=true): window.getcontrol(id).setvisible(v) class myclass(xbmcgui.windowxml): def timer1_8percent(self): in range(1): time.sleep(1) self.getcontrol(4202).setlabel("8%") def time

How to read yaml properties using javascript -

mapmarker : source : d.marker_data type : mapmarker region: pune size : 4 fill_color : blue leader_name : leadername markers : - circlemarker : type: circle_marker latlong: 'abc' - connector_marker : type: icon_marker latlong: 'pqr' - icon_marker : type: connector_marker latlong: 'xyz' here yaml file able access property values config.color in javascript , getting color.but how property values latlong different markers ? have following code config = this.config; self = this; l=config.markers.length; for(var k=0;k<l;k++) { console.log(config.markers[k]); } and gives output like: object { circlemarker={...}} object { connector_marker={...}} object { icon_marker={...}} but want properties under individual object latlong value each marker. here code snippest

javascript - <object> tag 'WindowlessVideo' parameter doesn't work on some systems -

i having media player object tag , there dropdown immediatedly above in y web page. issue dropdown contents not overlapping video player. instead dropdown menu used hidden video player. here reference earlier question: dropdown contents not overlapping video player i able solve using param tag given below: <param name="windowlessvideo" value="-1"> this works fine in system on ie 9 . same thing doesn't work on machine has ie 9 too. there, plays audio , there no video. blank screen !! is issue plugin windows media player required? haven't done on system. the promblem maybe others system's media players codecs , not uptodate :| problem not code ,it maybe media player.

focus - WPF: Prevent RowDetailTemplate from being entered using down arrow key? -

i have datagrid displays rowdetailtemplate selected row. user can scroll through datagrid using , down arrow keys easily, when user reaches last row in datagrid odd happens: instead of keeping focus on last row enters rowdetailtemplate. wouldn't mind loosing focus in row selection, problem first usercontrol in rowdetailtemplate combobox reacts down arrow key changing selection. have few customers complained changed values in combobox unintentionally, because did not notice focus moved row combobox. the solution found far set istabstop false, means user cannot use tab key anymore reach said combobox. does have idea how prevent focus enter rowdetailtemplate via arrow key? it nice if guys read each other's questions because answered identical question 1 earlier today. take @ answer wpf c# how disbale focus changes arrow keys question more information. however, question different enough stop me closing duplicate. the principle remains same however... need set e.

node.js - Heroku Worker Dyno memcachem -

i have heroku app using 3 dynos: 1 web , 2 worker dynos. inter-dyno-communication choose memcachier, everthing implemented using nodejs. the web-dyno has no problems connecting memcacher service , works charme, trying connect worker dyno fails , tcp connection receives reset: memjs: server <mc5.dev.ec2.memcachier.com:11211> failed after (2) retries error - write econnreset the method connecting service same works in web-dyno.. where problem? this code: var memjs = require('memjs').client, memjs = memjs.create(); setinterval(function () { memjs.set('test', 'test'); memjs.get('test', function (err, buf) { if (err) console.log('error damn memcache service ' + err); else console.log('memcache service working: ' + buf.tostring()); }); }, 5000); works on web-dyno doesn't work on worker-dyno..

javascript - apply css rules on programmatically created div -

i have site creates new divs in real time (using js). class of each div "conv". problem is, css rules have written class doesn't apply new divs. conv.length length of xml file using. the js: for(i=0; i<conv.length;i++){ var div= document.createelement("div"); div.id="conv"+i; div.class= "conv"; div.innerhtml=conv[i].childnodes[0].nodevalue; div.style.height="50px"; div.style.overflow="hidden"; document.getelementbyid("conv").appendchild(div); } the css: .conv { background-color:#ccc; } the class property of html element special case, not class attribute. 1 accessible via classname : div.classname="conv";

AngularJS ng-show -

i want show , hide div ng-show directive. here html file: <body ng-app="my-app"> <div ng-controller="maincontroller"> <ul ng-show="isvisible" id="context-menu"> <li> menu item 1 </li> <li> menu item 2 </li> </ul> </div> </body> here coffeescript file: myapp = angular.module("myapp", []) myapp.controller "maincontroller", ["$scope", ($scope) -> $scope.isvisible = false ] here codepen it. what problem? can help? the issue code : <body ng-app="my-app"> it should be: <body ng-app="myapp"> don't confuse how define attributes values. http://codepen.io/anon/pen/ahxew

Asp.net Checkbox values not being retained in popup -

we have asp:checkbox within asp:datalist appears on popup window. problem - checked property values of asp:checkbox not being retained. (the checked property false.) note - on debugging, page_load method getting called. <div style="display: none;"> <div id="inline1"> <div class="popupbox coupons"> <asp:datalist...> <itemtemplate> <asp:checkbox id="chk1" runat="server"/> <asp:imagebutton id="btn1" runat="server"/> </itemtemplate> </div> </div> </div>

Regex Exlude a String if Followed by a Particular String -

i have seen answers here , tried implement them unsuccessfully. basically, want include @generated . however, if '@generated' followed 'not', such @generated not , want exclude that. here attempt: ^/(?!not)(@generated)$ i tested on regex pal , not work. furthermore, cannot find pattern works reliably. instance, don't want accidentally tag not when @generated not precede it. you use below regex, @generated(?!\s*not) demo it match word @generated not followed 0 or more spaces , string not .

winforms - how to export and save a file fetching name from database and contains "/" in its name c# -

i have winforms application.in application exporting text file local machine , path coming database "c:\myfiles". now problem exporting such file has "/" (forward slash) in between name "abc/def/testing" . when exporting file local machine giving error "c:\\myfiles\\abc/def/testing.text" not exist or check specified path exist. i stuck in problem.any appreciated.thanks in advance. you can't. filenames can;t have forward slashes in them. replace them character underscore ( _ ): filename = filename.replace("/","_"); or replace all invalid characters: string invalidchars = new string(path.getinvalidfilenamechars()); foreach (char c in invalidchars) { filename = filename.replace(c.tostring(), ""); } from msdn : use character in current code page name, including unicode characters , characters in extended character set (128–255), except following: the following

Will an Addin Built in outlook 2010 template work on outlook 2013 -

i have addin have built in visual studio 2012 outlook 2010 addin template. want know whether work on outlook 2013 or not. i new office addins. highly appreciated. yes, versions of office backward compatible - comm addin built outlook 2010 should work fine in 2013.

php - Are conditional includes in Moodle possible? -

in moodle, there way conditionally include file depending on course being displayed? there other php workaround conditionally including files in moodle? essentially i'm trying edit incourse.php custom theme layout conditonally include different files based on course or page being displayed. thx yes, it's possible, moodle has global variable $course, can check realtime course info object in theme files, decide include.

javascript - What goes wrong if 77>602? -

what goes wrong if 77>602? tried in ie, firefox , chrome function getmaxvalue(data){ var maxvalue=0; for(var i=0;i<data.length;i++){ if(data[i].value>maxvalue){ console.log(data[i].value +">"+maxvalue); maxvalue=data[i].value; } } console.log("maxvalue:"+maxvalue); return maxvalue; } i data json: [{ "keyword": "user: allen-p", "value": "602" }, { "keyword": "from: phillip.allen@enron.com", "value": "598" }, { "keyword": "date: 2001", "value": "276" }, { "keyword": "subject: re:", "value": "228" }, { "keyword": "date: 2001 apr", "value": "77" }, ] needed add useless description stackoverflow. please me;). json file bit bigger , example. strings compared alphabetically if contain n

CreateJS - Collision detection between two createjs.Containers -

i have working in desktop browser not on touch devices because update variables need on mouseover. around trying check collision detection between 2 containers , update needed variables. items should snap placeholder positions when collision between 2 detected. catch items , placeholders placed dynamically item must able snap placeholder. var placeholders,items,selecteditem,collision,startx, starty, snapx, snapy, xpos, ypos; var stage = new createjs.stage("canvas"); createjs.touch.enable(stage); createjs.ticker.addeventlistener("tick", tick); function init(){ xpos = 0; ypos = 120; container = new createjs.container(); stage.addchild(container); placeholders = new createjs.container(); placeholders.name = "placeholders" stage.addchild(placeholders); items = new createjs.container(); stage.addchild(items); for(i=0;i<2;i++){ placeholder = new customcontainer(i, "#ff

How to force gradle to use/share ~/.m2/repository with Maven system wide? -

by default gradle uses ~/.gradle/cache cache maven artifacts. i use maven , set proxy , repository urls in ~/.m2/settings.xml , don't want duplicate settings gradle. official solution add: repositories { mavencentral() mavenlocal() # <== } to build.gradle . requires changing project build script , not acceptable. is possible set setting system wide or outside of project (without editing project own files)? i routinely want mavenlocal buildscript, need multi-module projects , need disable it, use in ~/.gradle/init.d/mavenlocal.gradle: allprojects { project -> buildscript { if( !project.hasproperty('skipmavenlocal') ) { repositories { println "adding buildscript mavenlocal()" mavenlocal() } configurations.all { resolutionstrategy.cachechangingmodulesfor 0, 'hours' } } } if( !project.hasproperty(

javascript - How to remove smiley character in contenteditable div -

i developing cross browser/platform application in html 5. using contenteditable text insertion. draw text inserted user on canvas. when user input smiley symbols (from nexus 7 in case), not able width of characters. i putting every character in non visible div(which have put @ negative coordinates) , getting div's width , height. is there way can remove these smileys inserted user? the application supports other languages chinese, japanese etc , cannot put check charcode, unless there specific range of unicode these special characters. thanks in advance.

Chrome and Firefox repair my Html tag? -

this question has answer here: should ol/ul inside <p> or outside? 5 answers i have following .html <p> <input class="inputname" /> <ul> <li>one value</li> </ul> </p> in google chrome, firefox , safari got (in source explorer) <p> <input class="inputname" /> </p> <ul> <li>one value</li> </ul> i can't reproduce issue, come smarty template .... somewhere have no idea where. i don't know look. every tags closed. have ever seen problem ? this because <p> tag cannot contain other block elements. most-likely want use <div> instead of <p> : <div> <input class="inputname" /> <ul> <li>one value</li> </ul> </div>

apache spark - Input format Problems with MLlib -

i want run svm regression, have problems input format. right train , test set 1 customer looks this: 1 '12262064 |f offer_quantity:1 has_bought_brand_company:1 has_bought_brand_a:6.79 has_bought_brand_q_60:1.0 has_bought_brand:2.0 has_bought_company_a:1.95 has_bought_brand_180:1.0 has_bought_brand_q_180:1.0 total_spend:218.37 has_bought_brand_q:3.0 offer_value:1.5 has_bought_brand_a_60:2.79 has_bought_brand_60:1.0 has_bought_brand_q_90:1.0 has_bought_brand_a_90:2.79 has_bought_company_q:1.0 has_bought_brand_90:1.0 has_bought_company:1.0 never_bought_category:1 has_bought_brand_a_180:2.79 if tried read textfile spark, without success. missing? have delete feature names? right in vowal wabbit format. my code looks this: import org.apache.spark.sparkcontext import org.apache.spark.mllib.classification.svmwithsgd import org.apache.spark.mllib.evaluation.binaryclassificationmetrics import org.apache.spark.mllib.regression.labeledpoint import org.apache.spark.mllib.lina

Creating rows automatically based on value limit in Microsoft Excel -

i want create carton based on maximum unit per carton particular item. eg. item quantity maxqtypercarton 12 5 b 6 3 this should give results follows creating rows in excel item cartonquantity 5 5 2 b 3 b 3 you can see item quantity has been divided 3 rows based on maxqtypercarton. also, item b has been divided 2 rows based on maxqtypercarton. any idea on this? the vba approach (just programming it) option explicit sub sub1() dim irow1&, irow2&, zitem$, zquan&, zmaxq&, zamt& irow2 = 10 ' ?? irow1 = 2 3 ' ?? zitem = cells(irow1, 1) zquan = cells(irow1, 2) zmaxq = cells(irow1, 3) while zquan > 0 zamt = zquan if zamt > zmaxq zamt = zmaxq cells(irow2, 1) = zitem cells(irow2, 2) = zamt irow2 = irow2 + 1 zquan = zquan - zamt loop next irow1 end sub