Posts

Showing posts from July, 2015

c# - iPhone, WMI, iis service -

i thinking writing application monitor iis service iphone, , send notification, perform resets if iis goes down. i dont want create web service rather connect machine, specifying credentials , data iis service state. is possible? is possible iphone? need make app generic enough people use hosted web sites , monitor health , being able reset and/or recycle apppools. cant implement service hosted environment. need able give iphone users ability connect host , once connected machine , authenticated perform wmis phone users can mess iis. possible? i see point not wanting use web service because want monitor , reset iis service, while web service based on iis. how restful service? have created restful service based on owin (open web interface .net) , kayak . kayak may have examples there. the cool thing tools or lib framework simple , not rely on iis. can provide 2 urls, 1 , 1 post. former status of iis server , post reset iis. services can xml of json based o...

node.js / ruby integration with beanstalkd -

this related another question specific payment processing, , example use case, considering trying integrate node.js , ruby on same server using beanstalkd. basically, want use node.js main web server, when need payment processing, i'd use robust , stable ruby. i considering trying use beanstalkd way have node.js queue payment processing jobs ruby perform in background. documentation beanstalkd little slim, i'm having trouble figuring out if approach, or how go it. can tell though, should straightforward start beanstalkd process , have node.js connect send jobs, , have ruby script can perform jobs , send results. beanstalk appropriate task. make sure use binlog option make jobs persistent between beanstalkd restarts. your node.js processes use tube (called, 'payments') , put jobs it, appropriate priority. your ruby script can watch payments tube , process jobs. make sure give jobs adequate ttl - want ensure payment processing has time complete b...

python - Where do I get a list of all known viruses signatures? -

i have written antivirus software in python, unable find virus signatures. software works dumping each file on hard disk hex, getting hex signature. signatures known viruses? about 2000 signatures here; http://files.codes-sources.com/fichier_fullscreen.aspx?id=21418&f=virussignatures.txt&lang=en and here http://www.nlnetlabs.nl/downloads/antivirus/antivirus/virussignatures.strings hope helps!

SQL Server 2005 connection with java. -

needed : connecting sql server2005 java. had put dll file in system32. i'm using sqljdbc_2.0 drivers 02:29:11,937 error [stderr] com.microsoft.sqlserver.jdbc.sqlserverexception: driver not configured integrated authentication. 02:29:11,937 error [stderr] @ com.microsoft.sqlserver.jdbc.sqlserverexception.makefromdrivererror(sqlserverexception.java:170) 02:29:11,937 error [stderr] @ com.microsoft.sqlserver.jdbc.sqlserverconnection.sendlogon(sqlserverconnection.java:2338) 02:29:11,937 error [stderr] @ com.microsoft.sqlserver.jdbc.sqlserverconnection.logon(sqlserverconnection.java:1929) 02:29:11,937 error [stderr] @ com.microsoft.sqlserver.jdbc.sqlserverconnection.access$000(sqlserverconnection.java:41) 02:29:11,937 error [stderr] @ com.microsoft.sqlserver.jdbc.sqlserverconnection$logoncommand.doexecute(sqlserverconnection.java:1917) 02:29:11,937 error [stderr] @ com.microsoft.sqlserver.jdbc.tdscommand.execute(iobuffer.java:4026) 02:29:11,937 error [stderr...

javascript - Retrieve the complete URL from an iFrame -

possible duplicate: how current location of iframe? hi want complete url, , methods know full url of iframe, , want 'final' document.location.href, how can it? i don't care if php or js, i'm guessing experiments php it's not possible... if want know currently are : client side - javascript - can use alert(window.location) . server side - php - .$_server["request_uri"] or $_server['path_info'] depending on want.

Jquery UI button gets disabled on refresh -

i asked on jquery forum few weeks ago without luck, try again here :) i've made simple widget project i'm working on, have encountered odd problem. it easiest explain example implementation. http://decko.dk/buttontest on page there 3 button. first 1 drop down widget. next 1 regular disabled button (a) , last 1 regular enabled button (b). if refresh page (press f5 or whatever) enabled button mysteriously disabled. have no clue why happens, if button not disabled begin with, button b not disabled when refreshing. also, if remove call insertafter in widget-code, button not disabled. can shed light on why strange behavior occurs? by way, have been able reproduce in firefox. i believe bug in how firefox remembers form field/control values , states: after first page load, there 3 <button> elements in document, , <button id="button_a"> disabled. (when jquery ui styled button enabled or disabled, sets underlying element same state.) fire...

c++ - using 'new' operator -

i have simple task concerning 'new' operator. need create array of 10 chars , input chars using 'cin'. should ? : char c = new char[10]; for(int i=0; < 10; i++) { cin >> char[i] >> endl; } no. try char* c = new char[10]; .

java - getenv() not working -

i've created stand alone java application in ubuntu 10.04 using netbeans 6.9. i'm not able use use getenv() command in netbeans, though if create separate java file in gedit , compile in terminal gives desired output. system.out.println(system.getenv("trgraph")); the above code when executed through terminal gives desired output same code if try run in netbeans returns null string. can tell me how output using netbeans?? you need launch netbeans same terminal after have set , exported trgraph. example, in terminal: $ export trgraph=foo $ netbeans&

hibernate - Issue with getHibernateTemplate.saveOrUpdate -

hi using hibernate 3.0 facing issue data saving. in below code client pojo want save. though tried flush still same problem try { gethibernatetemplate().saveorupdate(client); system.out.println("this executed"); gethibernatetemplate().getsessionfactory().getcurrentsession().flush(); } catch (dataaccessexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (hibernateexception e) { // todo auto-generated catch block e.printstacktrace(); } getting following exception org.hibernate.hibernateexception: no hibernate session bound thread, , configuration not allow creation of non-transactional 1 here @ org.springframework.orm.hibernate3.springsessioncontext.currentsession(springsessioncontext.java:63) @ org.hibernate.impl.sessionfactoryimpl.getcurrentsession(sessionfactoryimpl.java:574) @ com.hewitt.appinv.dao.clientdaoimpl.sa...

c# - I am downloading a link from nseindia site using my program but now I cant do it there is a error 403? -

i downloading file nseindia site using program there error 403(forbidden)(page not found). value same site using code webclient client = new webclient(); client.headers.add("user-agent", "mozilla/5.0 (compatible; msie 9.0; windows nt 6.1; wow64; trident/5.0)"); stream data; try { data = client.openread("http://www.nseindia.com/"); } catch (exception e) { messagebox.show("error: " + e.message + e.data + e.helplink); return ""; } streamreader reader = new streamreader(data); string s = null; int count = 0; while (reader.read()>0) { s = reader.readline(); if (s.contains("<td class=\"t1\">")) { messagebox.show("line: " + s); s= s.remove(0, 18); s = s.remove(s.length - 5); count++; if (count == 5) break; } } data.close(); reader.close(); return s; it seems site requires accept http request header: client.head...

Python: Traffic-Simulation (cars on a road) -

i want create traffic simulator here: http://www.doobybrain.com/wp-content/uploads/2008/03/traffic-simulation.gif didn't thougt deep this. i create class car. every car has own color, position , on. and create road array. but how tell car go? hear ideas? edit: forbidden new ideas programmers? why people want close thread? or ask such questions? dont understand them. :( edit2: next time go gamer-forum. ideas until now. thanks! there java-based package called processing targetted @ artists , non- or beginner-programmers includes nice visualization features, while presenting simplified development environment (no "public static void main(string[] args)", instance). @ demos show particle systems idea on how model individual cars. there python rendition of code call pyprocessing follows of same simple programming idiom. here little "tesla" applet - move mouse between 2 spherical electrodes.

objective c - How to make iPhone and iPad version of an app? -

i trying make app works on both iphone , ipad. looking how make interface compatible on both. when app loads displaying table view. how can load different nibs based on device? using switch between nibs. if ([[uidevice currentdevice] respondstoselector:@selector(userinterfaceidiom)]) { if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiompad) { device = @"ipad"; } else { device = @"iphone"; } } but in mainwindow.xib says view loaded view controller iphone. can make dynamic based on device? ie want show start of app different nibs based on device. thanks. actually, apple automatically, name nib files: myviewcontroller~iphone.xib // iphone myviewcontroller~ipad.xib // ipad and load view controller smallest amount of code: [[myviewcontroller alloc] initwithnibname:nil bundle:nil]; // apple take care of

functional programming - How reasonable/possible/difficult is it to write a tsocks clone in Haskell -

i'm reasonably competent programmer knows haskell, hasn't used in major projects. know enough c , systems , network programming believe can pick apart tsocks source code. i don't have experience low-level systems interfaces haskell provides. i'm looking advice people can offer me on topic, including, "don't it; you'll hate it," provided there explanation. i wouldn't this, except experiment. i'm haskell guy, not deep systems guy, there's caveat there. nonetheless, see following on tsocks page: tsocks based on 'shared library interceptor' concept. through use of ld_preload environment variable or /etc/ld.so.preload file tsocks automatically loaded process space of every executed program. there overrides normal connect() function providing own. when application calls connect() establish tcp connection instead passes control tsocks. tsocks determines if connection needs made via socks ser...

Android ImageButton with LayerDrawable Image -

i'm trying display layerdrawable imagebutton image. layers must have different top values. such top += 10; . used setlayerinset drawable layer items stretched images. tried different parameters , displayed other stupid layouts. after setlayerinset attempt used insetdrawable, giving top parameter own constructor: new insetdrawable(resources.getdrawable(r.drawable.soldier), 0, layertop, 0, 0); this time, tops ok, imagebutton displays small area of it. basic layout, let image, *---* | | | | --- the layout should be, *---* | | *---* | | *---* | | *---* | | | | --- i set android:scaletype="fitstart" , changed line below , working charm. new insetdrawable(resources.getdrawable(r.drawable.soldier), 0, layertop,0,-layertop); now have more questions, first, can see creating new instance every layers. if create 1 drawable object , set every items of array used creating layerdrawable , use layerdrawable.setlayerinset function ...

http - Which browsers' back button does not generate request to the server? -

i need test web application against browser button doesn't generate request server. could give me examples of such browsers? that doesn't depend on browser used, on http response headers sent it. if browser response headers instructed cache page, cache page. if instructed not cache page, not cache page , fire real request. you have control on response headers on server side.

c++ - why do game engines prefer static libraries over dynamic link libraries -

i've been reading few gaming books. , prefer create engine static library on dynamic link. new c++ not highly knowledge when comes static libraries , dynamic link libraries. know static libraries increase size of program, dll link libraries loaded need them within program. [edit] i've played games seemed used dll's load in sound, lighting, , not individually. level loading up. cause don't need when @ game menu. dynamic link libraries need position independent; can cause performance inefficiencies on processor architectures. static libraries can optimized when included in program, e.g., stripping dead code. can improve cache performance.

How to generate HHP file from CHM file -

when decompile chm file use microsoft html workshop. generates hhc,hhk , bunch of html files no hhp file. when create hhp file using new project option , compile create chm file. these 2 cmh files not of same size , behave differently. missing here? decompiling , re-compiling same chm file result different. well, logic dictates original hhp file different :-) though of course workshop versioning might related. as far know decompiling html not entirely reversable, , doubt takes proper care of workshop versioning. it's considered 1 way conversion, not way archive data reliably.

html - where put images files in big multimodules web app -

i have big web application (jsp). best way put images files? put images files in multi modules web application? i have many images have easy, separate access modify them. best way separate project can redeploy without stop main application part. solution acceptable? yes, acceptable. can create "assets" project, , have images/module1/ , images/module2/ folders, etc. just, in main application, need configure path assets application. can reside on different host. example http://assets.yoursite.com . , in main application you'll have: <img src="${assetserver}/images/module1/logo.png" /> (the assetserver request attribute may put there , configured in multiple ways, depending on setup , preferences. 1 example - configure context-param in web.xml, , put in request filter)

How do you ensure a Utility Projects library dependency gets packaged in the final EAR in Eclipse Galileo? -

i have 'utilty project', , 'ear project' includes 'utility project'. classes 'utility project' end being packaged jar , placed within 'lib' directory of exported ear, example: ear.ear meta-inf manifest.mf lib utility.jar (which expands to): meta-inf manifest.mf com acme foo.class bar.class however, 'utility project' relies on library (freemarker.jar) has been added build path using 'properties > java build path > libraries'. want freemarker.jar added ear follows: ear.ear meta-inf manifest.mf lib **freemarker.jar** utility.jar (which expands to): meta-inf manifest.mf com acme foo.class bar.class by searching around within eclipse i've found 4 potential avenues achieving this, none of have worked. if can cut chase , tell me should do, great. in...

php - Smarty caching problems with nested templates -

i have problem in caching in nested templates in smarty 3. seems when {include} smarty ignores caching settings of caller template. example, supposing smarty cache has been enabled in controller: in template1.tpl: {include file='template2.tpl' nocache} in template2.tpl: {include file='template3.tpl'} in template3.tpl {$smarty.now} the {$smarty.now} value displayed on page is, until cache not cleared, equal time of first page visualization, although first subtemplate forced not cached. annoying problem me, since need control caching settings of all content of template2.tpl , subtemplates template1.tpl. are there elegant workarounds? smarty not cache content of template2 (move {$smarty.now} their), cache template3. include nocache too. i experienced same problem , redesign template, i'm able cache of , parts without need of caching surrounded {nocache} content {/nocache}

javascript - Finding the methods/properties on a swf object -

i have swf object embedded web page. without having access source code of swf file, how can find methods/properties exposed? for example... alert(document.getelementbyid('swfobject').id); ...returns pop-up of "swfobject". , this... document.getelementbyid('swfobject').somemethod(); ...executes somemethod. thanks.

iPhone SDK Auto scrolling UIWebView to a specific position -

i have uiwebview displays third party web page (not page can control) need way scroll content of web view specific position in page. idea how implement it? thanks. ok, hate answer own question easier thought... [webview stringbyevaluatingjavascriptfromstring:@"window.scrollby(0,180);"];

memory - Difference between word addressable and byte addressable -

can explain what's different between word , byte addressable? how related memory size etc.? a byte memory unit storage , memory chip full of such bytes. memory units addressable. way can use memory. in reality memory byte addressable. it means binary address points single byte only . word group of bytes – 2, 4, 8 depending upon data bus size of cpu. to understand memory operation fully, must familiar various registers of cpu , memory ports of ram. assume know meaning 'mar memory address register', 'mdr memory data register', 'pc program counter register', 'mbr memory buffer register'. ram has 2 memory ports: 32 bit data/addresses, 8-bit opcode. suppose cpu wants read word (say 4 bytes) address xyz onwards. cpu put address on mar, sends memory read signal memory controller chip. on receiving address , read signal, memory controller connect data bus 32-bit port , 4 bytes starting address xyz flow out of port mdr. if cpu wants ...

objective c - Is it possible to print from iPhone & iPad app? -

from application, how can allow user print document or page iphone or ipad? versions of ios support printing? here simple code . -(void)printitem { uigraphicsbeginimagecontextwithoptions(self.view.bounds.size, yes, 0); cgcontextref context = uigraphicsgetcurrentcontext(); [self.view.layer renderincontext:context]; uiimage *imagefromcurrentview = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); uiprintinteractioncontroller *printcontroller = [uiprintinteractioncontroller sharedprintcontroller]; printcontroller.printingitem = imagefromcurrentview; uiprintinfo *printinfo = [uiprintinfo printinfo]; printinfo.outputtype = uiprintinfooutputgrayscale; printcontroller.printinfo = printinfo; printcontroller.showspagerange = yes; void (^completionhandler)(uiprintinteractioncontroller *, bool, nserror *) = ^(uiprintinteractioncontroller *printcontroller, bool completed, nserror *error) { if...

How to draw a flowchart in Enterprise Architect? -

does know tutorials on how draw flowchart in ea? i'm having problems using connectors. how connect without connector if possible? first check drawing flowchart diagram - should one: insert diagram->strategic modeling->flow chart. some tutorial can found on sparx webpage: http://www.sparxsystems.com/downloads/quick/strategic_modeling_with_enterprise_architect.pdf

c# - WPF ComboBox Databound to a class -

should possible bind wpf combo box class. have class implements iemunerable , ienumerator, , contains list of objects, follows: class myclass { public string title { get; set; } public string directory { get; set; } public myclass(string title, string directory) { title = title; directory = directory; } } class myclasses : ienumerable, ienumerator { private list<myclass> allclasses; private int position = 0; public list<myclass> getclasses() { allclasses = new list<myclass>() { new myclass("example1", "dir1"), new myclass("example2", "dir2") }; return allclasses; } public ienumerator getenumerator() { return (ienumerator) this; } public object current { { return allclasses[position]; } } public bool movenext() { position+...

iphone - One UINavigationcontroller for the whole app? -

i´ve created uinavigationcontroller in appdelegate , initialized "modelselectionviewcontroller". vc has different uibuttons , when touched, new vc ("modelviewcontroller") pushed on navigationstack. this "modelviewcontroller" acts template view , has uitabbarcontroller different tabs. first vc shown changes on navigationcontroller doesn´t work. set name of title navigationcontroller null. nslog(@"navi: %@", self.navigationcontroller); if change code push different vc when touching different tabs, navigation works third level of navigation hierachy. i want know if it´s possible use 1 navigationcontroller different tabs. hope made setup clear. appreciate help. thanks if create uitabbarcontroller view that's managed in uinavigationcontroller (ie: if create navigationcontroller first, , it's still around when create tabbarcontroller), you're starting fight frameworks. here's admonishment docs on combining vi...

javascript - Why is window not identical to window.self in Internet Explorer? -

there's convoluted backstory involving how came across this, why self property not equal window itself? in safari , firefox , friends, results i'd expect: > window == window.self true > window === window.self true the same isn't true in internet explorer, though: >> window == window.self true >> window === window.self false can account inconsistency? self property of window object pointing? casts equality, more vexing. that's not all, window!==window.window ! i believe we're seeing here difference between ‘inner window’ , ‘outer window’ objects. other browsers have these (eg. moz ); they're typically used present different view of window inside , outside own code. the inner window holds global variables , document-specific members. outer window accessible [cross-frame-] scripting via window-references frames[n] , parent , opener , , apparently self . bound owner viewport (browser window/frame), eg. when n...

jquery - jScrollPane jEditable DOM problems -

i having funky problem. here's code. run getjson() fetch info php pulls db , fill div result. have jscrollpane , jeditable user can scroll down , click edit of content. works , doesn't work makes me wonder if browser not interpreting code or if misunderstanding fundamental dom concepts here.... $().ready(function() { $('#pane1').jscrollpane(); $('#tab_journal').tabs(); $('#tab2').load("/journal_new.php"); var i=0; var row = ''; var k, v, dt; $.getjson("/ajax.php?j=22", function(data) { row = '<p>'; while(i<data.length) { $.each(data[i], function(k, v) { if (k == 'subject') { row += '<div style="font-size:1.5em; color:#000000;"><div class="editable" style="width:705px;" id="title-'+data[i].id+'">'+v+'</div></div>posted:...

c# - Modify this code to read bytes in the reverse endian? -

i have bit of code reads 8 bytes array , converts int64. i know how tweak code work when receiving data represented reverse endian... protected static long getlong(byte[] b, int off) { return ((b[off + 7] & 0xffl) >> 0) + ((b[off + 6] & 0xffl) << 8) + ((b[off + 5] & 0xffl) << 16) + ((b[off + 4] & 0xffl) << 24) + ((b[off + 3] & 0xffl) << 32) + ((b[off + 2] & 0xffl) << 40) + ((b[off + 1] & 0xffl) << 48) + (((long) b[off + 0]) << 56); } thanks help! how about: protected static long getlong(byte[] b, int off) { return ((b[off + 0] & 0xffl) >> 0) + ((b[off + 1] & 0xffl) << 8) + ((b[off + 2] & 0xffl) << 16) + ((b[off + 3] & 0xffl) << 24) + ((b[off + 4] & 0xffl) << 32...

c# - How do I refactor this IEnumerable<T> to be thread-safe? -

i looking @ skeet's atomicenumerable i'm not sure how integrate current ienumerable exmaple below ( http://msmvps.com/blogs/jon_skeet/archive/2009/10/23/iterating-atomically.aspx ) basically want foreach blahs type in thread-safe way. thanks so .. foreach on multiple threads ... giving correct order blahs b = new blahs(); foreach (string s in b) { } public sealed class blahs : ienumerable<string> { private readonly ilist<string> _data = new list<string>() { "blah1", "blah2", "blah3" }; public ienumerator<string> getenumerator() { return _data.getenumerator(); } ienumerator ienumerable.getenumerator() { return getenumerator(); } } do mean want each thread see same sequence, or between threads, each item should seen once? are able use .net 4? if so, parallel extensions (e.g. parallel.foreach ) friend - it's safer come :) edit: if want iterate ...

.net - How can I assign ColorDialog.Color to another form in C#? -

i trying assign color value returned colordialog on 1 form form. form 1 consists of 2 buttons: 'place order' (creates new form bunch of controls) , 'select color' (allows change color of place order form). can't have place order , select color open @ same time. therefore, somehow must reference backcolor property of place order form form has 2 buttons colordialog.color can assigned place order form. form1 code: private void selectcolor_click(object sender, eventargs e) { if (colordialog1.showdialog() == dialogresult.ok) { string color = convert.tostring(colordialog1.color); messagebox.show(color); this.backcolor = colordialog1.color; // backcolor accessible form } } the way doing this, need maintain variable hold color. this: //declare private variable hold color selected user private system.drawing.color selectedcolor; private void selectcolor_click(object sender, eventargs e) { if (colordialog1...

Python's random module is not importing -

i having problems importing python's random module using eclipse. creates red line under random when do: import random i think may have accidentally deleted it, , if so, how can back? tried copying , pasting source python documents, won't compile. first of all, try importing random in python shell. if not work, reinstall python. if pydev complaining random being missing, should try rebuilding pydev's module paths in preferences.

matlab - Simulink callback problem -

hey, have maybe simple problem using preloadfcn in model. i want model load m-file before starting simulation (this preloadfcn for, think). so added in file -> model properties -> callbacks -> preloadfcn line run('./init.m') in file there several variables set. model refers variables , throws exception, can't find them when click on "start simulation". indicates me, callback isn't doing should doing... the file 'init.m' in same directory simulation file. even trying add directory matlab path didn't take effect. greets poeschlorn does work run "init" @ matlab command prompt prior running model? if so, should replace callback simply init which run script "init.m".

c# - How do i use linq as datasource for a Microsoft report -

var exams = (from appointment in appointments select new {coursecode = (appointment.tag exam).id}).tolist(); rpt.localreport.datasources.add(new reportdatasource("dsexam". exams.asenumerable())); rpt.processingmode = processingmode.local; rpt.refreshreport(); each appointment object contains exam object. use results of linq query datasource of report. first row in ienumerable exams shown in report though contains 81 rows. how can fix this. var exams = (from appointment in appointments select new { ((exam)appointment.customfields["field"]).id, ((exam)appointment.customfields["field"]).name, ((exam)appointment.customfields["field"]).date, ((exam)appointment.customfields["field"]).period.starttime, ((exam)appointment.customfields["fiel...

html - Share image to flickr -

how add "share flickr" on specific gallery image? flickr provide documentation on uploading photos via api

Moving a file from a windows Java application to a linux box -

i'm doing project has run on windows machine. application creates csv file , saves windows filesystem. way transfer file machine running linux directory selected user. i not asking code (although if helps feel free :p ) asking more protocols use (ftp etc) , wether need take account such permissions in linux in experienced programming linux file systems. thanks in advance :) can windows machine see linux filesystem? there samba server running on linux machine? if so, can copy 1 filesystem other. if not, can try scp or sftp need have keys setup. way use runtime.exec copy file using windows specific command utility. if else fails, run java process on linux server , connect using sockets . windows client can write file socket , can written out linux server.

.net - Why doesn't Word "come to front" when we activate it? -

our winforms application interacts ms word , run code when document generated , want show in word in front of our application: [setup w word interop object] w.visible = true w.activate() when rolled out xp machines running office 2007 works intended. on win7 machines running office 2010 document loads behind our application , flashes on taskbar. any ideas? i stumbled upon similar problem recently. .net program called com application, on win7 neither show in taskbar nor on desktop @ all. wasn't able track down cause of this, wrote following function work around issue: [system.runtime.interopservices.dllimport("user32.dll")] private static extern bool setforegroundwindow(intptr hwnd); private static void bringapptofront() { foreach (var p in system.diagnostics.process.getprocesses().where(p => p.processname == "cominstancename")) { if (p.mainwindowhandle.toint32() != 0) setforegroundwindow(p.mainwindowhandle); ...

mysql - Where does the max length of 255 for CHAR fields come from? -

i mean 255 doesn't natural in context of computer science. i guess it's related 256, makes more sense in same context, wonder how. one byte = 8 bits. 2 ^ 8 == 256 distinct values, have handle 0, range 0-255.

java - Hibernate: how to use CONCAT and GROUP_CONCAT -

how can use concat() , group_concat() in hql queries? about concat : works same way in mysql (it concatenates strings, not aggregate function). you can add group_concat sql function configuration. way assume underlaying db knows function, , tie program mysql . import org.hibernate.cfg.configuration; import org.hibernate.dialect.function.standardsqlfunction; import org.hibernate.type.stringtype; // ... myconf.addsqlfunction("group_concat", new standardsqlfunction("group_concat", new stringtype())); you indicate output of function string. without when group_concat numeric fields hibernate assume result numeric , crash.

android - How to draw a frame by frame Animation from frame x to frame y -

i want know if there solution available in android allow me define animation entering set of frames (images), , allow me play frame number x y. i'm using animationdrawable frame frame animations , seems lack functionality. is there maybe different class me here? thanks lot! ita you can add frames x through y new animationdrawable using addframe(drawable frame, int duration) . since mentioned images, should use bitmapdrawable load images , pass animationdrawable along duration.

c# - Prevent Task.ContinueWith on exception -

i trying prevent task continuing if first part fails. my code looks that: task listener = task.factory.startnew(openconnection).continuewith((t) => listenfornumber()); void openconnection() { try { //stuff } catch { //morestuff } } void listenfornumber() { //even more stuff } now listenfornuber() should not executed if openconnection() enters catch block i tried continuewith((t) => listenfornumber(),taskcontinuationoptions.notonfaulted); but no success, help? :( thanks taskcontiuationoptions.notonfaulted have no effect unless method has faulted, i.e. exception thrown during execution unhandled. in catch block, should re-throw exception (and preserve stack trace) using throw; statement after you've performed work (some clean-up maybe) - otherwise exception won't thrown again, method not considered 'faulted'.

php - Set apart functions -

what way: keep functions in 1 file or set apart them? (like database.php, session.php) my approach split functionalities classes; , put each class 1 file. if have lot of functions, same - split them thematically separate files , include them when needed. if work classes, can make use of php's autoloader functionality automatically load php files needed instantiate class.

android - setOnItemClickListener not responding for Custom ListView -

i wrote custom adapter listview ,but when tried implement click event list item ,i found not responding ,i glad if suggest me solution. public class tourlist extends listactivity { .... setcontentview(r.layout.tourlist); ..... getlistview().setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view view,int position, long id) { //i couldn't reach here log.v(tag,"did u me"); } }); adap = new myadapter(tourlist.this,mylist); getlistview().setadapter(adap); and custom adapter is private class myadapter extends baseadapter { arraylist<hashmap<string,string>> elements; context ctx; public myadapter(context context, arraylist<hashmap<string,string>> mylist) { this.elements=mylist; this.ctx=context; } public boolean isenabled(int pos...

asp.net - Why is Request.QueryString readonly? -

i thought couldn't change querystring on server without redirect. but code works* me: request.querystring edit i'm amazed. so here questions regarding this: why request.querystring readonly? why code/hack work*? how safe it, if change readonly done editing, both regarding bad errors or unexpected behaviour, , regarding maintaining , understanding code? where in event cycle make sense crazy edit if using pageload , onpagerender? *more details: i have page items grouped tabs. each tab asp:linkbutton i want able link directly specific tab. querystring parameter 'tab=tabname'. works. when click new tab, querystring still in url, , tab specified in querystring gets activated , not 1 clicked. by using request.querystring edit not happen. solution 'works'. thanks in advance. well querystring property readonly because cannot changed on single request. browser sends 1 request 1 string 1 collection created. hack uses reflection (i....

c# - HtmlHelper.Button(..., string onClickMethod, ...) HTML-encodes single-quotes! -

i'm upgrading old project mvc 1.0 mvc 3.0 (yes, it's old), , i've run issue calling htmlhelper.button(..., onclickmethod, ...) html-encodes single quotes &#39; i can see how not issue if onclickmethod name of method called in javascript, how using it: return helper.button(name, buttontext, htmlbuttontype.button, string.format("window.location='{0}'", url)); which broken. is there way bypass encoding? can see hacking changing return type of method string, , doing: return string.format(helper.button(name, buttontext, htmlbuttontype.button, "window.location={0}").tostring(), "'" + url + "'"); but more or less hack, , not elegant. having &#39; should work. though document stream contains encoded value browser unencodes when builds dom. can use dom inspection tool see yourself. if put following on page see alert box fine upon click: <input type="button" onclick=...

How to transfer data from JSP to servlet when submitting HTML form -

i have jsp page html form: <form action="servlet"> <input type="text" name="name"/><br> <input type="text" name="group"/> <input type="text" name="pass"/> <input type="submit" value="submit"> </form> how obtain these data in servlet , add them database? create class extends httpservlet , put @webservlet annotation on containing desired url servlet should listen on. @webservlet("/yourservleturl") public class yourservlet extends httpservlet {} and let <form action> point url. i'd recommend use post method non-idempotent requests. should make sure have specified name attribute of html form input fields ( <input> , <select> , <textarea> , <button> ). represents http request parameter name. finally, need make sure input fields of interest enclosed inside...

android - How to stop a program running under Eclipse? -

i can't find option stop running program (whether in debug or release mode). so now, stop program (returning control eclipse) closing emulator. is there better way of doing this? such don't need close (and restart) emulator? i understand want stop app on emulator. can open devices window (in debug perspective), select process , press stop button on same window.

cocoa - save the text on coreData -

i new iphone development. in app, using 2 textfield , want save text on dada base entered in textfield want display it. here using coredata base. feeling difficult understand classes on coredata base. here created view based application. classes required achieve , there sample , idea?. if want save 2 nsstring s, should use simpler storage method, nsuserdefaults , instead of core data, used storing larger quantities of data. can save object nsuserdefaults using code: [[nsuserdefaults standarduserdefaults] setobject:somestring forkey:@"somekey"]; then can retrieve saved object this: nsstring *somestring = [[nsuserdefaults standarduserdefaults] objectforkey:@"somekey"];

WPF Background setting failed -

here code. var image = new bitmapimage(new uri(@"pack://application:,,,/images/background.png", urikind.relativeorabsolute)); var backgroundbrush = new imagebrush() { imagesource = image, viewport = new rect(0, 0, image.pixelwidth / actualwidth, image.pixelheight / actualheight), tilemode = tilemode.tile, stretch = stretch.none, }; // set main window. background = backgroundbrush; it works fine on pc xpsp3 , .net 4.0. when run same sample on eee pc t91mt windows 7 home premium fails. no exceptions, nothing drawn (solid color brushes drawn if used instead, though). thought result of limited resources, on viliv s5, has same specs works fine too. any ideas? thanks! update the root of problem viewport's rect. since bitmap has twice window's size x, rect (0, 0, 2, 1). so, on power computer xpsp3, left half of image drawn. on eee pc causes problem visualization. the answer normalizing viewport ...

c# - validation control unable to find its control to validate -

i have repeater bound number of custom dataitems/types on itemdatabound event repeater code calls renderedit function depending on custom datatype render custom control. (if validation flag set) render validation control appropriate rendered edit control the edit control overrides createchildcontrols() method custom control adding number of literalcontrols thus protected override void createchildcontrols() { //other bits removed - 'hidden' control trying validate this.controls.add(new literalcontrol(string.format( "<input type=\"text\" name=\"{0}\" id=\"{0}\" value=\"{1}\" style=\"display:none;\" \">" , this.uniqueid , this.mediaid.tostring()) )); //some other bits removed } the validation control rendered this: passed in e...

SQL IIF group by result in MS Access 2007 -

i using sql have thought should work. fast learning ms access has it's own idea of how use sql. select count([system_info].[id]) countofid, iif(left([system_info].[csmemory],len([system_info].[csmemory])-3) < 512000, "<512mb", iif(left([system_info].[csmemory],len([system_info].[csmemory])-3) < 1000000, "512mb - 1gb", "nope")) memorytext system_info group memorytext; so above code gives me error message "you tried execute query not include specified expression xxx part of aggregate function". i've googled fair bit , still pretty stuck. if remove count , groupby, query run , see list of labels create "memorytext". thanks help. if remove count , groupby, query run , see list of labels create "memorytext". in case, save version works qrybase: select [system_info].[id]), iif(left([system_info].[csmemory],len([system_info].[csmemory])-3) < 512000, "<512mb", iif(left([sy...

javascript - jQuery Deferred not working -

i trying out code function search(query) { var dfr = $.deferred(); $.ajax({ url: "http://search.twitter.com/search.json", data: { q: query }, datatype: 'jsonp', success: dfr.resolve }); return dfr.promise(); } test = { start: function(){ alert("starting"); } }; function gotresults(data) { alert(data.max_id); } function showdiv() { $('<div />').html("results received").appendto('body'); } $.when(search('ashishnjain')) .then(gotresults) .then(showdiv); this works expected. when write as: test.start() .then(search('ashishnjain')) .then(gotresults) .then(showdiv); it alerts "starting" , terminates.a working example can found @ http://jsfiddle.net/xqfyq/2/ . doing wrong? test not deferred object , not have method .then() . .when() is deferred object hence why works wh...

objective c - after importing '.h' into the '.m' file, are they FOREVER linked? -

i have carclass.h file declares carclass . #import carclass.h file carclass.m file of course go on implement carclass methods. finally, carapp.m file (which contains main ) #imports carclass.h - , works fine. ss there no problems there :-) however, i'm not sure understand why works - cause linkage seems little off: if carapp.m imports carclass.h file - without importing carclass.m file, or see implementations from? case once ".m" file - imports ".h" file - compiled, 2 files (.h , .m) sorta forever linked or something? don't it... the compiling process split in different phases, , #import directives interpreted long before linkage occurs. when give code files (.c, .m) compiler, try generate code object file (.o) it; is, binary representation of code. file not yet executable because needs more information. especially, it's not linked other file. header files, supposed contain declarations , no definition, typically don...

httprequest - D equivalent to XMLHttpRequest functions -

hey guys,i looking example code make http request in d, how xmlhttprequest of jscript. some people have created wrappers libcurl, can use make http requests. try one. https://github.com/gmfawcett/d-play-libcurl/blob/master/fawcett/curl.d

parsing - How do you build an XML parser? -

can direct me tutorial in building xml parser? realize languages have libraries task, i'm interested in learning grammar of xml , theory behind how parsers work. i've tried searching explains have been unable find anything. i think there isn't enough demand people write such tutorials; , commented, don't think general parser techniques of help. xml parsers not usual lex+yacc approach works (lexer part more parser, that's worth). i know production ready xml parsers beasts, might best off starting reading one. java has few examples, , xmlpull might amongst simplest proper parsers. woodstox , xerces compliant ("full") parsers, large codebase, not light reading. handle xml parser should, might educational too. beware half-backed fake parsers skip checks things xml specification mandates (javolution example checks few things, example none of character validity checks, or attribute name duplications). another thing read xml specification. 1 of w...

.htaccess - Mod Rewrite: I want to redirect all requests to index page unless the file exists (but not if the file is a php file) -

i have .htaccess file right now. sends index page unless wanted real file. sort of want, dont want able access .php file. have: rewriteengine on rewritecond %{request_filename} !-f [nc] rewriterule ^(.*) /index.php [nc] but want: if(file_exists(request) && !request.endswith(".php")) not redirect request else redirect index page this tried: rewriteengine on rewritecond %{request_filename} !-f [nc] rewriterule !(\.php)$ /index.php [nc] but if type in real location of php file, still tries load it. can add few lines top of every single php file asking php_self is. if php_self isnt index.php, redirect them index page. think .htacess can better. i think need tolook @ custom 404 (file not found) redirect rather checking if file exists

javascript - Access element in json having numerical index -

i have following format of json in want asscess 0.4 , kem , 2 , 2000 values seems doesn't have name index how 1 can access in jquery. when paste following code in json viewer getting numerical index 0.4 , kem , 2 "td": [ { "@attributes": { "class": "odd" }, "span": [ "3", "7" ] }, "0.4", "kem", "24\/04\/2010", "2000", "2", "14000", "good", "buckley", "56.0", "2:05.32", "36.65", "54.5" ] } first of all, parentheses don't match up; i'm assuming meant have open curly brace @ beginning of code sample. if so, object containing 1 field, "td". field array. array contains number of items, first of object , rest strings. so, if want acc...

ruby on rails - ActionController::MethodNotAllowed -

i have rails model called 'audioclip'. orginally created scaffold 'new' action, replaced 'new_record' , 'new_upload', becasue there 2 ways attach audio model. going /audioclips/new_record doesn't work because takes 'new_record' if id. instead of changing this, trying create '/record_clip' , '/upload_clip' paths. so in routes.db have: map.record_clip '/record_clip', :controller => 'audioclips', :action => 'new_record' map.upload_clip '/upload_clip', :controller => 'audioclips', :action => 'new_upload' when navigate /record_clip, get actioncontroller::methodnotallowed get, head, post, put, , delete requests allowed. i'm not extremely familiar inner-workings of routing yet. problem here? (if helps, have these 2 statements above map.resources => :audioclips yes, 2 routes conflicting mapped resource (the map.resources => :audioclips bit...

javascript - Custom routes/paths/roads on Google Maps -

Image
hey guys. need know if need achievable. i need able to, using either v2 or v3 (preferably 3), create paths ignore buildings in sense. i trying create kml file draw out of paths myself, , find way turn them on/off needed. for example. user wants go point point b. between these points number of buildings. user physically can walk through these buildings(it's campus). want show them on map. this way don't have loop-de-loop around, say, parking lot, other end of it. if there way @ this, i'd love know. an example of require can found here: http://www.uottawa.ca/maps/ it's pre-determined paths based on 2 inputs user dropdown menu. can plainly see this. have no clue if a) can done in v3, , b) how on earth did themselves. assistance required, , appreciated! if campus not big, may want consider defining polyline routes hand each permutation, such if have 4 buildings a, b, c , d, need define 6 routes: a:b, a:c, a:d, b:c, b:d, c:d then build...