Posts

Showing posts from June, 2011

jquery - Add delay in between two if conditions -

i add wait() or delay between 2 functions. function(imageid) { //alert("i main slider called "); if(en==1) { var selected=$('#' + sel); $(selected).animate({"left": "+=30px","opacity": "0.99"},"slow"); $(selected).animate({"height":"354px","width":"295px"},30); $(selected).css("-webkit-transform-style","preserve-3d"); $(selected).css("-webkit-transition","all 1.0s linear"); $(selected).css("transform-style","preserve-3d"); $(selected).css("transition","all 1.0s linear"); $(selected).css("-webkit-transform","rotatey(0deg)"); $(selected).css("transform","rotatey(0deg)"); en=0; } if(my.circular)

Java Applet - "Block potentially unsafe components from being run?" message -

Image
this question has answer here: logically solving java security error 1 answer since latest java update, 2 of applets displaying warning pop-up our users though both of jar files using signed. have verified signed using jarsigner -verify myjarfile.jar command. below popup message seeing... my applet invokes c++ dll through jni. c++ dll invokes c# netmodule. does know can popup go away? says application contains both signed , unsigned code, signing every java file (there 1) in jar file. there higher level of signing need do? edit: occurring of latest java update. see quote below taken this page . authors , vendors of applications deployed using either java applets or java web start technology – applications distributed end users @ runtime via web browser or network - should sign code using trusted certificate best user experience. specifically, java code

parsing - ANTLR rewrite rules in grammar file -

i have rule looks this: a : (b | c) d; b : 'b'; c : 'c'; d : 'd'; with grammar antlr builds flat parse tree. how can rewrite first rule (and leave other 2 unchanged) whatever matched being returned under root node called a? if first production rule this: a : b d; then have been rewritten a : b d -> ^(a b d) and have solved problem. first grammar rule yields more 1 possibility resulting parse tree ^(a b d) or ^(a c d) . how express when rewriting rule? you can use ? operator in rewrite follows. a : (b | c) d -> ^(a b? c? d);

mercurial hg update abort: no such file or directory -

i'm working on c++ project on opensuse linux box using mercurial versioning , did pull our server repository local working directory. tried hg update, got following error message: abort: no such file or directory: /home/username/documents/dev/proj/.hg/store/data/images/general/picture.png.d i'm pretty new mercurial , wondering if there's way can troubleshoot this. appreciated, thanks! your repository may corrupt. start running hg verify see if there errors. mercurial wiki has a page dedicated this should out well.

xslt - How to find all numbers in a string -

ich versuche mit einer funktion sämtliche zahlen aus einem element oder string zu ermitteln. dabei soll die anzahl der zahlen und ihre stelligkeit egal sein. folgende funktion habe ich bislang geschrieben: <xsl:function name="itp:find_num"> <xsl:param name="tmp"/> <xsl:if test="matches($tmp,'\d+')"> <xsl:analyze-string select="$tmp" regex="{'\d+'}"> <xsl:matching-substring> <xsl:sequence select="."/> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="''"/> </xsl:non-matching-substring> </xsl:analyze-string> </xsl:if> </xsl:function> beispiel xml: <address>street 12, 12345 town<address> bei dem funktionsaufruf soll dann die entsprechende zahl ausgewählt werden können: ...select="itp:find_num(addres

internationalization - Django I18n Translation of The whole document -

when start translating django application. {% trans 'profilbild'%} all other trans blocks with umlaut not translated. solution ? regards that's not how works, i18n tag translates string or variable, takes one argument. did read documentation ? you want blocktrans update (the op changed question): did run makemessages -l <desired_lang> successfully did run compilemessages successfully did restart django process after these steps?

c# - How can you set Gendarme to run with Teamcity when doing a build? -

i have set teamcity server start working continous integration , having daily builds , when vcs check-in detected. me , team working on videogame, using unity game engine , c# programming language. have used gendarme manually on our project , can totally use benefits offers. trying make run build step of teamcity, can seem figure out how make work. have expirience combination of tools? experience shared apreciated. thanks. well did ended finding solution , i'am posting here interested can see it. teamcity has command line build step can used using gendarme part of build process(for custom scripts going write here in workspace property of build step need put each of .exe's are). here console command needed it: gendarme.exe --v --html your\path\to\save\report\gendarmereport.html --severity --confidence "path/to/your/project/library/scriptassemblies/assembly-csharp.dll" "path/to/your/project/library/scriptassemblies/assembly-csharp-firstpass.dll&

bash - rename multiple files in shell script -

rename multiple files...in shell i have 3 files in dir abc.tar.gz abc2.tar.gz abc3.tar.gz using command : rename abc abc.part abc*.tar.gz it converts them into abc.part.tar.gz abc.part2.tar.gz abc.part3.tar.gz after added 3 more files in it.. abc.tar.gz abc2.tar.gz abc3.tar.gz and when fire rename abc abc.part abc*.tar.gz it rename 6 files final output abc.part.tar.gz abc.part.part2.tar.gz abc.part.part3.tar.gz abc.part.part.tar.gz abc.part2.tar.gz abc.part3.tar.gz i want prevent multiple rename... should rename command? means final output should below,no matter how time fire rename command. here number of files dynamic ..it 3,4...or whatever... cannot add statically 3 or number !! abc.part.tar.gz abc.part2.tar.gz abc.part3.tar.gz as final argument rename, use: abc{,2,3}.tar.gz

c++ - QThreads interruption with slots and signals -

i have class contains qthread . in initialization function of class thread should started. works correct. in thread there have while(bool certaincondition){} certaincondition should changed signal/slot connection. the problem during while running signal/slot not opened. you not running event loop in thread, or blocking long time in while-loop. slot cannot called until have returned control event loop, happen after have finished while-loop. as workaround, can try calling qcoreapplication::processevents() inside while-loop.

class - Android pass context causes NullPointerException -

i trying make methods work other classes current activity. in case there backup mechanism uses toasts , works flawlessly if method in same class activity every time it's called there nullpointerexception. these essential lines main activity: backup bckp; private context context = main.this; bckp.copybackup(backupdir, backupdirfile, database, context); and called method: public void copybackup(final string backupdir, final string target, final string source, final context context) { final file sdcard = environment.getexternalstoragedirectory(); if (sdcard.canwrite()) { inputstream input = null; try { input = new fileinputstream(source); } catch (filenotfoundexception e) { toast.maketext(context, "there error finding database", toast.length_short).show(); e.printstacktrace(); } file dir = new file (backupdir); if (!dir.exists()) { dir.mkdirs();

performance - SCALA: Which data structures are optimal in which siutations when using ".contains()" or ".exists()"? -

i know in situations data structures optimal using "contains" or "exists" checks. i ask because come python background , used using if x in something: expressions everything. example, expressions evaluated quickest: val m = map(1 -> 1, 2 -> 2, 3 -> 3, 4 -> 4) //> m : scala.collection.immutable.map[int,int] = map(1 -> 1, 2 -> 2, 3 -> 3, 4 //| -> 4) val l = list(1,2,3,4) //> l : list[int] = list(1, 2, 3, 4) val v = vector(1,2,3,4) //> v : scala.collection.immutable.vector[int] = vector(1, 2, 3, 4) m.exists(_._1 == 3) //> res0: boolean = true m.contains(3) //> res1: boolean = true l.exists(_ == 3) //> res2: boolean = true l.contains(3) //> res3: boolean = true v.exists(_ == 3)

php - Using Curl to get remote page source how to echo only one line of the code based on its number -

i working n getting source code of remote page url of remote page got dynamically url user click according arrays array('event_id', 'tv_id', 'tid', 'channel') : use code below who;e page source , works great. <?php $keys = array('event_id', 'tv_id', 'tid', 'channel'); // order matter $newurl = 'http://lsh.streamhunter.eu/static/popups/'; foreach ($keys $key) $newurl.= empty($_request[$key])?0:$_request[$key]; $newurl.='.html'; function get_data($newurl) { $ch = curl_init(); $timeout = 5; //$useragent = "mozilla/5.0 (windows; u; windows nt 5.1; en-us)applewebkit/525.13 (khtml, gecko) chrome/0.x.y.z safari/525.13."; $useragent = "ie 7 – mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; .net clr 1.1.4322; .net clr 2.0.50727; .net clr 3.0.04506.30)"; curl_setopt($ch, curlopt_useragent, $useragent); curl_setopt($ch, curlopt_fai

java - Use recursion to count the number of nodes whose value field is between min and max, inclusive, from the "cur" node to the end of the list -

my attempt @ solution, know not right because output program incorrect. doing wrong? i have inner node class, each value fields.this method should return number of nodes have value fields between ints min , max. //---------------- countinrange( node, int, int ) ------------------ private int countinrange( node cur, int min, int max ) { if(cur == null) return 0; else { if(cur.value >= min && cur.value <= max) return (1+ countinrange(cur.next, min, max)); } return 1; } the problem recursive call if value in range, otherwise pretend remainder of list has 1 element in range. you need recursive call whether value in range or not. difference whether add 1 result or not before returning it.

java - Jackson: Serializing enums as interfaces -

(disclaimer: extreme oversimplification. actual scenario considerably more complex.) say have 2 systems, producer , consumer. code independent, aside single shared interface: public interface thing { string getname(); string getdescription(); int getprice(); } the idea producer creates bunch of data , sends json on http. producer has bunch of implementations of thing, each additional pieces of metadata , stuff required in data generation process. as it's undesirable producer have kind of knowledge of jackson/serialization aside thin layer @ top, serialization attributes should kept out of thing implementations. due amount of implementation being grow in future, having mixins of them becomes unsustainable. believed sufficient apply annotations thing interface itself. the first simple approach @jsonserialize annotation on interface. @ first, seemed work, resulted in problem. of implementations of thing enums, resulting in jackson serializing them name instea

Android - How to Align Point in the Center of Graph? -

Image
i'm user achartengine plot graph. when plot more 1 point there no problem, because evrey point shown in graph, when point 1 align on left side of graph, on x axis , isn't shown. so how move point in center of graph? thx in advance! after adding first point, supposing location of point @ x, y, following: renderer.setxaxismin(x - 1); renderer.setxaxismax(x + 1); renderer.setyaxismin(y - 1); renderer.setyaxismax(y + 1); or short version: renderer.setrange(new double[] {x - 1, x + 1, y - 1, y + 1}, 0); later, when add second point, make sure either set other visible ranges using approach above or reset visible ranges using this: renderer.setrange(new double[] {mathhelper.null_value, mathhelper.null_value, mathhelper.null_value, mathhelper.null_value}, 0);

php - mysql update qty on complete order array -

this question has answer here: mysql update table ajax class 1 answer i'm trying update quantities left in stock on items in order, when order completed in point of sale system my code far is $order=$_get["order"]; include('php/config.php'); $invoice=$order; $voucher=$_get['voucher']; $card=$_get['card']; $cash=$_get["cash"]; $date = date('y-m-d'); $sql="select * `orders` `invoice` = '".$invoice."'"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $parts[] = array( "part" => $row['part'], "qty" => $row['qty'], ); $sqlstock = "update `stock` set available='available - $parts[qty]' part = '".$parts['part']."'"; } probably best single piece of sql:- u

enthought - canopy ipython notebook blank -

i installed canopy 1.0.0.1160 under os 10.8.3 can run ipython fine shell python 2.7.3 | 64-bit | (default, mar 25 2013, 15:52:02) type "copyright", "credits" or "license" more information. ipython 1.0.dev -- enhanced interactive python. however, when run try start ipython notebook ipython notebook --pylab=inline it works in safari, not in chrome. , can't run old ipython notebooks created under epd 7.3 can suspect ipython bug (i found youtube video having similar issues? there workarounds? or should wait new ipython build/canopy release?

c# - Webservice Report Export ReportExecution2005.asmx 404 Not Found -

i trying connect ssrs server 2008 r2 access webservice. http://srsserver/reportserver/reportexecution2005.asmx but whenever tried connect url 404 error. have logged onto server the file exists of file server in program files\microsoft sql server\servername\reporting services\reportserver i not sure how troubleshoot 404 issue ideas ?

java - How to using Bundle in if else -

in code have if else block. in if else want include button using bundle have tried , error. code below, have ideas why getting error? package com.apps.visitkuningan; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.view.window; import android.widget.button; import android.widget.imageview; import android.widget.textview; public class ketwisata extends activity{ intent iinntteen; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); this.requestwindowfeature(window.feature_no_title); setcontentview(r.layout.ket_wisata); string tampil = getintent().getextras().getstring("key"); imageview img1 = (imageview) findviewbyid(r.id.wisata); textview nama = (textview) findviewbyid(r.id.nama); textview alamat

c - alarm stop's when signal arrive -

i'm trying combine signal , alarm. have 2 processes. 1 receiving input user, , write pipe , sending signal (sigusr2) other process. in other process, have infinite loop produces alarm every second. program should handle both alarm signal's , sigusr2 signals. alarm handle work fine, when signal arrive , signal handler active seem don't return loop produce alarm's. read man page of alarm , signal's , didn't find anything. says signal handler function should return original code, doesn't. know why code don't return loop after signal handler, , how force alarm handler function every second if signal's received meanwhile. this loop: while (1) { signal (sigusr2 , signal_hand); signal (sigalrm , alarm_hand); alarm (1); pause(); } this signal handler function: void signal_hand (int sig) { // reading pipe , doing things accordingly ... } and alarm handler function: void alarm_hand (int sig) { // doing things ... } eevery time sigusr2

hash - Is java's hashCode() deterministic? -

Image
this question has answer here: java, object.hashcode() result constant across jvms/systems? 6 answers is java's hashcode() deterministic? i try implement document search engine uses minhashing algorithm , use hashcode pre-hash words. same word going same hash every time run it? is going same hash if run different machine (32 bit vs 64bit)? it depends on class referring to. base object.hashcode implementation not, since, stated in documentation : as reasonably practical, hashcode method defined class object return distinct integers distinct objects. ( this typically implemented converting internal address of object integer , implementation technique not required javatm programming language.) addresses not deterministic, consider used source of entropy. but, instance, string has deterministic hash code determined follows: (image taken

arrays - jQuery each call to other function -

i curious why not work. more hypothetical did run issue on site doing. trying avoid jquery function inside function. selector window instead of each of boxes. edit* ** understand how doing $(".box").each(function(){ // code here }); not sloppy or bad practice functions inside of functions? http://jsfiddle.net/b8yp3/3/ css .box { height: 50px; width: 50px; background: green; margin-bottom: 5px; } html <div class="box"></div> <div class="box"></div> <div class="box"></div> javascript function changeme(obj) { console.log(obj); $(obj).css("background", "blue"); } $.each($(".box"), changeme(this)); second each paramater must function - not function result: $(".box").each(changeme); function changeme(n, obj) { ........

Codeigniter file upload failing -

i have form allows file uploads. adds database fine, doesn't save file specified folder. view , model code below (my controller check see if file set proceeds upload) view: <form action="admin/admin_area/save_personnel" method="post" enctype="multipart/form-data" id="add_personnel"> <input type="file" name="offshore_medical_certificate" /> </form> controller: function uploadoffshoremedical($uid) { $status = ""; $msg = ""; $file_element_name = 'offshore_medical_certificate'; $certificate_name = 'offshore medical'; if ($status != "error") { $config['upload_path'] = './certificate_files/'; $config['allowed_types'] = 'pdf|doc|docx|txt|png|gif|jpg|jpeg|'; $config['max_size'] = 1024 * 8; $config['encrypt_name'] = true; $this->load-&

How to deploy an asp.net mvc 4 application with database? -

i'm new asp.net , want following: i have asp.net mvc 4 website uses local database (mdf). want install website on windows 2012 server (amazon ec2). my questions: how handle database? how move onto server? there several steps: according microsoft ( http://msdn.microsoft.com/en-us/library/dd410407(v=vs.90).aspx ), should publish first website local folder; can embark database clicking include files app_data folder . you transfer published folder windows 2012 in, example, subfolder of c:\inetpub\wwwroot . you have create new web site in iis (i'll let search ;-) ) note: not familiar mdf files, have modify web.config , point actuel path of mdf file ( c:\inetpub\wwwroot\my_site\appdata\mydatabase.mdf ). note: also, iis user account should have right write database; folder c:\inetpub\wwwroot\my_site\appdata\ should have security modified accordingly (right click, properties / security ) add iis user (as account should run web site).

c# - Match Route Only if specific Parameter -

i trying create route matches if specific parameter used in url. for example: routes.maproute( name: "bannerads", url: "go/{web}", defaults: new { controller = "communicationsalias", action = "bannerads", web = urlparameter.optional } ); i want url match http://www.domain.com/go/web?=111222 but not http://www.domain.com/go/advertising how change route function way? you need make part of url static in route then: routes.maproute( name: "bannerads", url: "go/web", defaults: new { controller = "communicationsalias", action = "bannerads" } ); and place route above more general one: routes.maproute( name: "bannerads", url: "go/{web}", defaults: new { controller = "communicationsalias"

python - Checking through a variable to see if it doesn't contains anymore strings -

def main(): #word = input("word guess player 2:") word = ['h','e','l','l','o'] word2 = "hello" #make list of _ same length word display =[] in range (0,len(word)): display.append("_") chances = int(input("number of chances guess word:")) if len(word)== 11: print ("your word long. has 10 charecters or less") else: word = word if chances < len(word): answer = input("your word {0} letters long , sure don't want more chances? yes or no?". format (len(word))) if answer == "no": chances= int(input("number of chances:")) else: chances = chances ("ok lets continue game") print ("player 2, have {0} chances guess word.". format (chances)) won = false underscore = false while chances > 0 , won == false , un

c - Is there a way to redirect syslog messages to stdout? -

i have application can run in 2 modes, either cli, or daemon. i using syslog() logging. however, when run in cli mode i'd logging, except marked log_debug , messages sent console instead of logged. i have tried use setlogmask() , doesn't seem redirect console. what best way this? as suggested in comments maverik, wrote wrapper around syslog determines whether send output log or console. here in case ever needs this. void mylog (int level, const char *format, ...) { va_list args; va_start (args, format); if (remote) { vsyslog(level, format, args); } else { if (level == log_debug) vsyslog(level, format, args); else vprintf(format, args); } va_end(args); }

javascript - CalendarExtender saying the wrong date is selected, possibly timezone related -

Image
i have page textbox , calendarextender supposed allow me detect date selected. however, reporting date isn't selected. <asp:textbox id="tbeffectivedate" runat="server" cssclass="input-small" maxlength="10" text='<%# bind("neweffectivedate", "{0:mm/dd/yyyy}") %>'> </asp:textbox> <ajaxtoolkit:calendarextender id="atkeffectivedate" runat="server" firstdayofweek="sunday" targetcontrolid="tbeffectivedate" format="mm/dd/yyyy" onclientdateselectionchanged="checkforsunday"> </ajaxtoolkit:calendarextender> essentially i'm making sure user has selected sunday, when select day on calendar, javascript says day before. i'm perplexed. function checkforsunday(sender, args) { var selecteddate = new date(); selecteddate = sender.get_selecteddate(); // both of these show date before d

3d - Tetrahedron height vertices -

if given irregular tetrahedron's vertices coordinates a(x1,y1,z1) b(x2,y2,z2) c(x3,y3,z3) d(x4,y4,z4) , need compute 3d coordinate h(x,y,z) of height vertex a. after many google search able find barycentric coordinate not vertex of height. please help. three points b, c, d define plane a*x+b*y+c*z-d=0 , where a = y2 * (z3 - z4) + y3 * (z4 - z2) + y4 * (z2 - z3) b = z2 * (x3 - x4) + z3 * (x4 - x2) + z4 * (x2 - x3) c = x2 * (y3 - y4) + x3 * (y4 - y2) + x4 * (y2 - y3) d = x2 * (y3 * z4 - y4 * z3) + x3 * (y4 * z2 - y2 * z4) + x4 * (y2 * z3 - y3 * z2) (derived mathworld formula (18)) normal vector plane (a,b,c). h point - height vertex a, ah vector normal bcd plane, , h lies in plane bcd. h = (x1+k*a, y1+k*b, z1+k*c), , have substitute these coordinates in plane equation, solve k coefficient, calc h point coordinates substitution: a*(x1+k*a) + b*(y1+k*b)+c*(z1+k*c)-d=0

The wordpress loop doesn't return the post structure -

i installed latest wordpress build (3.5.1) , when add loop usual doesn't return normal structure. this php: <?php get_header(); ?> <?php $pageid = get_query_var('page_id'); $postid = $post->id; ?> <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> <div class="wppost" id="post-<?php the_id(); ?>"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h1><?php the_title(); ?></h1></a> <div class="wpentry"><?php the_content(); ?></div> </div> <?php endwhile; ?> <div class="wpnavigation"> <?php posts_nav_link('','f&ouml;reg&aring;ende sida','n&auml;sta sida'); ?> </div> <?php else : ?> <div class="wppost" id="

jquery - $.ajax callback function is inside another function -

i having 1 function called when ever custom controls loaded. please refer below code. function load() { getdata(); } function getdata() { $. ajax({ url://remote url, type:"get", success:function(data) { //going set data control } }); } so success callback function takes time return "data" (i.e fetch data remote url) load() client side method gets completed , our control rendering. want load() method needs wait until success function return data remote url , load() function completed render our control based on data. how load() function need wait callback gets completed. thanks, siva 1) place client side rendering code inside of success handler... 2) separate method , call success handler. both approaches solve problem of load function completing , causing ui render before data returns.

Clojure WebSocket Client -

i have set websocket server using http-kit should accept web socket connections. basic example shown in http-kit documentation. the question is: how create clojure client connects it? the client can clojure http library, don't mind. know javascript clients, , believe java has api use clojure. looking clojure library supports websockets both client and server. saw nothing in http-kit code make easy. aleph has support websockets on both server , client. can take time used asynchronous style , aleph's core abstractions, it's tool once hang of it.

java - Cannot find associated value in a hashmap from a passed in key -

i working existing code in eclipse project. in method below called cardtypeforpbfvalue() , cannot find key in hashmap though can see while debugging code. pbfvaluemap populated follows: [1=atm, 2=debit, 3=credit, 4=payroll] i'm not sure why cannot associated value of credit when i'm passing in value of 3 in cardtypeforpbfvalue() below. getting value of null . any help/direction appreciated. here code i'm working with: public static enum cardtype { credit(3), atm(1), debit(2), payroll(4); cardtype(int pbfvalue) { this.pbfvalue = (short) pbfvalue; } public static hashmap<short, cardtype> pbfvaluemap = new hashmap<short, cardtype>(); static { (cardtype cardtype : cardtype.values()) { short value = cardtype.pbfvalue; pbfvaluemap.put(cardtype.pbfvalue, cardtype); } } public static cardtype **cardtypeforpbfvalue**(int pbfvalue) { cardtype returnvalue

hql - Hibernate query left outer join. -

select table1.name,table1.url,table1.address,table1.city,table1.state,table1.errormsg msg, sum(table2.id not null) qe,table4.tp pt table1 left outer join table2 on table2.table1id=table1.id left outer join table3 on table3 .id=table1.pdid left outer join table4 on table4.venueid=table3 .id table1.visible = 1 group table1.id order table1.name,table1.city,table1.state,qe,pt; i new hql have converted based on objects clueless based on how frame left outer join in hql. tried using exception in thread "main" org.hibernate.hql.ast.querysyntaxexception: sum aggregate function throws: exception in thread "main" org.hibernate.hql.ast.querysyntaxexception: expecting close, found 'is' near line 1, please

serialization - Sequentally Channel Write Sends Corrupted Data in Java.NIO -

i have server uses non blocking sockets, nio. server works in separate thread , there thread called game. game thread holds server object , uses server.sendmessage, server thread reads data. when call sendmessage 2 times sequentally 2 packets in while loop, after moment "java.io.streamcorruptedexception: invalid stream header: 6b6574b4" error in client. part of server code : public void write(selectionkey channelkey, byte[] buffer) { if (buffer != null) { int byteswritten; try { socketchannel channel = (socketchannel) channelkey.channel(); synchronized (channel) { byteswritten = channel.write(bytebuffer.wrap(buffer)); } if (byteswritten == -1) { resetkey(channelkey); disconnected(channelkey); } } catch (exception e) { resetkey(channelkey); disconnected(channelkey); } } } public void broadcast(byte

gwt - Add handler to chart to fire when any pixel on chart is clicked -

i using gwt wrapper moxiegroup highcharts. how can make click anywhere on chart fire event. thought might right starting point chart.adddomhandler(new clickhandler() { @override public void onclick(clickevent event) { window.alert("clicked"); } }, clickevent.gettype()); it seems highcharts has trouble passing events through it, either design or because of conflict svg. said moxiegroup has couple methods should out. this method should use add click handler background of chart. clicking on series, or near series won't fire handler. chart.setclickeventhandler(new chartclickeventhandler() { @override public boolean onclick(chartclickevent chartclickevent) { gwt.log("chart click"+chartclickevent.getclientx()); return false; } }); the following handler allow capture click events when click on series. chart.setseriesplotoptions(new seriesplotoptions() .setseriesclickeventhandler(new seriesclickeventhandler

Deserialize Json likes from friends of facebook asp.net mvc -

i need deserialize json string facebook graph: { "id": "1741240583", "music": { "data": [ { "name": "kmn | kill name", "id": "168949476496447", "created_time": "2013-05-01t07:30:54+0000" }, { "name": "hocus pocus", "id": "174462922710692", "created_time": "2013-04-16t17:55:46+0000" } ] } } the way have did this: public class result { public music music { get; set; } } public class music { public data[] data { get; set; } } public class data { public string[] name { get; set; } } protected void button1_click(object sender, eventargs e) { string teste = "{\"id\": \"723560709\",\"music\": {\"dat

ruby on rails - Why do a add_index migration add the type string to a column if not called otherwise -

i have table existant t.integer :column_name . if rails g migration add_index_to_table_name column_name:uniq existent column_name created new string type if dont call otherwise column_name:integer:uniq why this? wouldnt easier add index :unique => true it? the helper method intended handle adding or removing columns: api reference , rails guide . you need first generate migration: rails g migration add_index_to_table_name and edit contain appropriate commands: class addindextotablename < activerecord:migration def change add_index :table_name, :column_name, unique: true end end

c# - Tessnet2 returning only one character -

i'm writing application , want read image , extract text. testing porpuses i'm passing in image 6 characters. here code. bitmap image = new bitmap("eurotext.tif"); tessnet2.tesseract ocr = new tessnet2.tesseract(); ocr.setvariable("tessedit_char_whitelist", "abcdefghijklmopqrstuvwxyz0123456789"); // if digit ocr.init(null, "eng", false); // use correct tessdata list<tessnet2.word> result = ocr.doocr(image, rectangle.empty); foreach (tessnet2.word word in result) console.writeline("{0} : {1}", word.confidence, word.text); the result 100 : ~ the second time ran returned: 100 : - please help!!! thanks try bigger picture. got "~" few times result when started tessnet2. after used bigger picture (textsize should more 12) programm worked fine. to enlarge picture , try different sizes, can use trackbar , following code: c# bitmap originalimage = new bitmap(imagepath, true);

Android: FileObserver monitors only top directory -

according documentation, "each fileobserver instance monitors single file or directory. if directory monitored, events triggered files , subdirectories inside monitored directory." my code goes like, fileobserver fobsv = new fileobserver("/mnt/sdcard/") { @override public void onevent(int event, string path) { system.out.println(event+" "+path); } }; fobsv.startwatching(); however, onevent() triggering when file changed in /mnt/sdcard/ . if create file in /mnt/sdcard/downloads/ , method not getting fired. is there problem code? according documentation the documentation incorrect, noted in this issue . is there problem code? no, fileobserver not recursive, despite documentation contrary.

c - Obscuring user input in command line programs -

i'm writing few functions getting , storing user password. it's working ok there way of replacing typed @ prompt asterisk, example? this standard behaviour in windowed applications i've had through c libraries of fgets/getc type functions don't seem offer control on this. edit: trying ansi c, running on os x. answers below have pointed me in right direction - search didn't turn few of links... you didn't platform or compiler, see ansi c no-echo keyboard input . maybe getch() or kbhit() or getpass(), depending on environment.

eclipse - SVN link folders -

i have visualsvn server , eclipse connected svn repository! need have 3 folders: android project folder ios project folder www folder how make when pull android project folder svn have www folder inside project , when committing commits edited www folder www folder autside android project folder done both android , ios project because both use www folder? out? as hd1 mentioned: can svn:externals . use following commands add www folder directories android , ios : svn propset svn:externals '../www www' android svn propset svn:externals '../www www' ios you can make changes directory www 3 folders, , changed visible in 3 folders. however, careful when creating branches or tags. in cases, have update externals, too.

Is it possible to add bold and Italic in one line is css? -

currently saw can like: body{ font-weight:bold; font-style:italic; } is there way do... body{ font: bold italic??? } yes, via css shorthand font rule . formal syntax: [ [ <‘font-style’> || || <‘font-weight’> || <‘font-stretch’> ]? <‘font-size’> [ / <‘line-height’> ]? <‘font-family’> ] | caption | icon | menu | message-box | small-caption | status-bar see also: http://www.w3.org/tr/css2/fonts.html#font-shorthand some examples: p { font: 12px/14px sans-serif } p { font: 80% sans-serif } p { font: x-large/110% "new century schoolbook", serif } p { font: bold italic large palatino, serif } p { font: normal small-caps 120%/120% fantasy }

asp.net mvc - Best way to pass data back to Server using Knockout.js and Viewmodel -

we have existing viewmodel has bunch of properties, has lists of enums in order populate dropdowns in view. i noticed when using knockout.js , trying post json info back, when call: ko.tojson(viewmodel); it converts all of model when sending back, including enums, not necessary when trying send server save data. i suggested wrapping data in , doing post, there nice clean, simple way post data values without enums using knockout? best way this? should viewmodel contain enums or bad design? check out answer similar question: https://stackoverflow.com/a/14629775/91189 yes, view model should contain data, enums, etc view needs. data post server not need contain view model's data. straightforward approach is, when you're ready send data server, construct model contains data request needs. a different, more built-in approach expose model property on view model , bind view needed. way model pre-constructed , ready submit when are.

java - Unicode Filtering Problems -

i have small problem in java. using apache poi text doc, pdf , docx files. however, getting weird symbols , signs can't seem filtered. somehow cant unicode of symbols. web  g how can use filter strings, have usuall symbols (/", still can use german letters: "üäö"?

logparser - Log Parser recusive file read -

i'm trying using micorosofts log parser read multiple sets of iis log files. now, query works fine, however, work properly, need have directory listed files exist directly under. i want able recursive search under high level directory. have found how thru dlls, can't find how command prompt. there has simple solution this, , i'm missing it. add -recurse:-1 option command-line. check available command-line options input format with: c:\>logparser -h -i:iis example output: input format: iis (microsoft iis log format) parses microsoft iis log files syntax: <filename> | <siteid> [, <filename> | <siteid> ... ] <siteid> = '<' siteid '>' siteid can siteid number, qualified adsi path (e.g. "//gabriegi1/w3svc/1"), or site name (e.g. "my external site"), containing wildcards parameters: -locale <locale name> : 3-letter id of log file locale

html - jQuery not animating CSS3 background with toggleClass -

i having problems trying make small button flash background colors toggling between 2 classes. toglling works, isnt smooth. problem css. i'm using css3 gradients bagrounds. here code: css: .cos{ background:none; } .cos_hover{ background: linear-gradient(bottom, rgb(161,0,3) 17%, rgb(115,0,2) 59%); background: -o-linear-gradient(bottom, rgb(161,0,3) 17%, rgb(115,0,2) 59%); background: -moz-linear-gradient(bottom, rgb(161,0,3) 17%, rgb(115,0,2) 59%); background: -webkit-linear-gradient(bottom, rgb(161,0,3) 17%, rgb(115,0,2) 59%); background: -ms-linear-gradient(bottom, rgb(161,0,3) 17%, rgb(115,0,2) 59%); background: -webkit-gradient( linear, left bottom, left top, color-stop(0.17, rgb(161,0,3)), color-stop(0.59, rgb(115,0,2)) ); -moz-box-shadow: inset 0 10px 28px -2px #000; -webkit-box-shadow: inset 0 10px 28px -2px #000; box-shadow: inset 0 10px 28px -2px #000; } html:

android - At the top of my app there is my app name how do I get rid of it? -

how rid of margin @ top app name , icon? here sdk versions if need them android:minsdkversion="11" android:targetsdkversion="17" change manifest file : <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@android:style/theme.notitlebar" > note android:theme="@android:style/theme.notitlebar"

iphone - how to access any method only once while launching the app for first time -

i have web service fetch data in json form. calling service everytime application launching (inside appdidfinishlaunching method) , storing in local file. want call service first time app launching , next time wanted use file in have stored json data. nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; //live json data url nsurl *url = [nsurl urlwithstring:@"my url"]; nsdata *urldata = [nsdata datawithcontentsofurl:url]; //attempt download live data if (urldata) { nsstring *filepath = [nsstring stringwithformat:@"%@/%@", documentsdirectory,@"data.json"]; [urldata writetofile:filepath atomically:yes]; } //copy data initial package applications documents folder else { //file write nsstring *filepath = [nsstring stringwithformat:@"%@/%@", documentsdirectory,@&qu

shell - bash/zsh: which files get loaded at login? -

today when checked $path variable in z shell (on os x 10.8.3), got following result (i broke lines clarity): /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin: /opt/x11/bin:/usr/local/git/bin: /usr/texbin:/usr/gcc-4.8.0/bin:/opt/local/bin:/opt/local/sbin the first , last lines quite normal. /usr/bin etc. default; , /usr/gcc-4.8.0/bin:/opt/local/bin:/opt/local/sbin manually loaded through ~/.zshrc . however, middle line peculiar. x11 , git cannot default, , not appear in .zshrc either. suppose there files other .zshrc loaded @ login (i use login shells). these files then? in advance.

c# - Application.Restart() does not close the old one, but start a new one -

c# wpf application, kinect application called page, wanted restart whole application system.diagnostics.process.start(system.windows.forms.application.executablepath); system.windows.forms.application.exit(); also not close old one. why it? hack can do? kind last-minute need hack solution because going demo in hour. thanks. you can use this. work on wpf system.diagnostics.process.start(environment.currentdirectory+"\\yourexename"); close();

c# - How to use BackgroundWorker with custom Progress Dialog (Form with ProgressBar)? -

i've got method loads files. takes lot of time show user progressbar window, can minimize whole application or cancel progress. i've read bunch of tutorials backgroundworkers , progressbars none of these covers scenario, when progressbar @ other form. don't know when should open new form , how access progress bar there. so far i've tried: mainform: private void addfoldertoolstripmenuitem_click(object sender, eventargs e) { ctlfolderselectdialog dlg = new ctlfolderselectdialog(); if (dlg.showdialog() == dialogresult.ok) { backgroundworker.runworkerasync(dlg); // pass variables ctlfolderselectdialog } } private void backgroundworker_dowork(object sender, doworkeventargs e) { form_dialogs.progressdialog progressdialog = new form_dialogs.progressdialog(); progressdialog.showdialog(); // open progress dialog window myclass.loadfiles((ctlfolderselectdialog)e.argument); // work progressdialog.close(); // close progress win

java - Is it expensive to use try-catch blocks even if an exception is never thrown? -

we know expensive catch exceptions. but, expensive use try-catch block in java if exception never thrown? i found stack overflow question/answer why try blocks expensive? , .net . try has no expense @ all. instead of doing work of setting try @ runtime, code's metadata structured @ compile time such when exception thrown, relatively expensive operation of walking stack , seeing if try blocks exist catch exception. layman's perspective, try may free. it's throwing exception costs - unless you're throwing hundreds or thousands of exceptions, still won't notice cost. try has minor costs associated it. java cannot optimizations on code in try block otherwise do. example, java re-arrange instructions in method make run faster - java needs guarantee if exception thrown, method's execution observed though statements, written in source code, executed in order line. because in try block exception can thrown (at line in try block! exceptions th

neo4j Multiple optional paths - cypher -

i'm tracking if user has liked , or voted on object in list of objects others posted.. can either likes , votes, not both. (a person can both , vote on object , these options not mutually exclusive). to problem let me describe in relational terms (left joins used - object returned, liker , voter data returned if record of type exists) [object]+ -> liker + -> voter what i'd return is: objectid likerid voterid 2343 null 88 2345 11 null 2382 44 1256 2400 null null yet every way i've sliced cannot come out . either row 2400 skipped (i've tried every combination of where), or values shifted likerid voterid column (bug?). here sample of cypher: start objects=node(158) match contestant-[:posted]->object_node-[:posted_object]->objects<-[?:posted_object]-object_node_a<-[?:likes]-liker , objects<-[?:posted_object]-object_node_b<-[?:votes]-voter return id(object, id(liker), id(v