Posts

Showing posts from August, 2013

Visualize Rails schema.rb with tool/plugin/script -

i looking tiny tool/script/plugin visualize rails schema.rb file our project not have maintain separate diagram manually. do have experiences on subject? check out railroad . it creates diagrams models , controllers. bet want. produces dot files can viewed graphviz or other programs. i've had success it, when have ton of models, may need manual rearrangement decent looking diagram. railroad example http://railroad.rubyforge.org/diagrams/depot_models_full.png

Touch Screen Simulator: Are there any windows simulator to test application in touch screen environment -

i want test application in touch screen environment. application web site build in asp.net(.net framework 3.5) , flash. want test application simulator windows xp/vista/7. please let me know there simulator released microsoft or third party can test application. thanks vinay pandey you can use windows 8 , visual studio 2012 express , there windows simulator when run windows store (aka metro) applications trough vs. can run simulator without vs , run installed windows app trough it. simulator located in : c:\program files\common files\microsoft shared\windows simulator\11.0\microsoft.windows.simulator.exe or c:\program files (x86)\common files\microsoft shared\windows simulator\11.0\microsoft.windows.simulator.exe

xml parsing problem in iPhone -

i have xml feed in chinese, nsxlparsers unable parse. gives error 31 while parsing. error 31 occur due document encoding unknown. i tried utf-8 , ascii encodings convert string rendered via [nsstring stringwithcontentsofurl:@"http://news.baidu.com/n?cmd=4&class=finannews&tn=rss"] to corresponding format. can body shed light on how parse xml feeds written in languages. thanx in advance try debugg using - (void)parser:(nsxmlparser *)parser parseerroroccurred:(nserror *)parseerror { nsstring * errorstring = [nsstring stringwithformat:@"unable download story feed web site (error code %i )", [parseerror code]]; nslog(@"error parsing xml: %@", errorstring); uialertview * erroralert = [[uialertview alloc] initwithtitle:@"error loading content" message:errorstring delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil]; [erroralert show]; } it find whether problem xml or encoding meth...

C# How to enable form by double clicking on tray icon -

i want make form default invisible. when user double click on tray icon should visible showing data database. how do such thing in c#. made system tray icon when run project shows form blank values. in advance. my tray icon on same form. tinkering visible property doesn't work, application class forces on form initializes properly. can override setvisiblecore() customize behavior. paste code form: bool mloaded; protected override void setvisiblecore(bool value) { if (value && !mloaded) { this.createhandle(); // ensure load event runs value = false; // keep invisible mloaded = true; } base.setvisiblecore(value); }

.net - How to find if a value is NULL in SQL Server using c# -

i know values null in datatable in c# returned executedatatable of sqlhelper class. string select = "select * testtable"; string val=""; datatable dt=dbcon.executedatatable(select); foreach (datarow dr in dt.rows) { foreach (datacolumn dc in dt.columns ) { if(dr[dc].equals (null)) { val ="null"; } else { val = dr[dc].tostring(); } } } but unfortunately didn't find way it. please let me know if there way. thank in advance. as david m's method, can use datarow.isnull : if (dr.isnull(dc))

user interface - grails ui dialog -

i trying would've thought simple, it's causing me huge headache. using grails ui plugin dialog box. have number of instances - dialog boxes need appear when button clicked. have got working. need have appear when page loaded... information / warning purposes. i'm struggling this.. should put trigger? don't want user have click before dialog appears. also - has managed change style of gui:dialog ? mine appearing text invisible background before added class=yui-skin-sam main.gsp body, that's had replace existing style class had on body! how frustrating !! had exact same problem... got working adding "visible=show" dialog's attributes. example: <gui:dialog title="modal dialog" modal="true" visible="show"> message appear in modal dialog when page loads. </gui:dialog>

java - When Getting GPS Location, load another URL -

i have little problem... have made android application extends webview. webview html page map on this: map example , here got inspiration. oncreate method looks this: super.oncreate(savedinstancestate); //removes title bar in application requestwindowfeature(window.feature_no_title); setcontentview(r.layout.main); //creation of webview found in xml layout file browserview = (webview)findviewbyid(r.id.webkit); //removes both vertical , horizontal scroll bars browserview.setverticalscrollbarenabled(false); browserview.sethorizontalscrollbarenabled(false); mylocationmanager=(locationmanager)getsystemservice(context.location_service); //enable javascripts url = "http://www.my-homepage.dk/map_example.html"; browserview.getsettings().setjavascriptenabled(true); //the website wrapped webview browserview.loadurl(url); so when application get...

Change color of a line separator in Cocoa -

is there way change color of line ("vertical line" , "horizontal line" of interface builder). line separator in ib nsbox , didn't find method change color when used nsboxseparator. it doesn't line color exposed "line" convenience object, regular nsbox. you can use regular nsbox box type set custom , border color set whatever desire. size down single pixel width or height.

asp.net - Session values null after redirect except when running in VS Debug mode -

i have asp.net web application takes user input across several forms. sort of wizard. on first form, user enters information clicks "next" button. in click event of button save information session object (via properties in master page). redirect next page. here example of doing: in fist page... protected void nextbutton_click(object sender, eventargs args) { //go next form master.sessionval1 = value1; master.sessionval2 = value2; response.redirect("~/thenextpage.aspx", false); } in masterpage.cs.. public long value1 { { return (long)session["value1"]; } set { session["value1"] = value; } } public long value2 { { return (long)session["value2"]; } set { session["value2"] = value; } } pretty basic stuff. when run in debug mode in vs2008 works perfectly. when push test server (iis7) nullreference exceptions when try access value1, value2, etc. stored in session object. update: have...

html - Php syntax error, little help -

i have string: $imagename ="$ad_id_stripped"."_1".".jpg"; $display_table.="<a href='../ad.php?ad_id=$row[ad_id]' target='_parent'> <img style='border:none;' src='../ad_images/$category/thumbs/$imagename?time()' class='shadow'></a>"; echo $display_table; as maybe can see trying add time() function in there... however, there no time() added this! have tried various quotes etc without luck... any ideas? thanks $imagename ="$ad_id_stripped"."_1".".jpg"; $display_table.="<a href='../ad.php?ad_id=$row[ad_id]' target='_parent'> <img style='border:none;' src='../ad_images/$category/thumbs/$imagename?" . time() . "' class='shadow'></a>"; echo $display_table; you want time() function out of string , concatenate

html - PHP IF Statement executing both conditions -

i'm integrating payment system website. have response script takes in data secure server , displays customer if payment has gone through or not. problem if statement displaying both messages customer, if payment has been successful or unsuccessful. here if statement: <? if ($result == "00") && ($payersetup == "00") && ($pmtsetup =="00"){ ?> thank <br/><br/> return home page <a href="http://www.xx.com"><b><u>click here</u></b></a> <br/><br/> <? } else { ?> <br/><br/> there error processing subscription. try again please <a href="http://www.xx.com/signup.html"><b><u>click here</u></b></a><br><br> please contact our customer care department @ <a href="mailto:support@xx.com"><b><u>support@xx.com</u></b></a> <? } ?> i have t...

c# - Cannot convert expression type 'lambda expression' to return type 'System.Linq.Expressions.Expression<System.Func<IProduct,string,bool>>' -

ok, i'm lost. why 1st function wrong (squiglies in lambda expression), 2nd 1 right (meaning compiles)? public static expression<func<iproduct, string, bool>> isvalidexpression(string val) { return (h => h.product_name == val); } public static expression<func<iproduct, bool>> isvalidexpression2() { return (m => m.product_name == "ace"); } your first function going need 2 arguments. func<x,y,z> defines 2 parameters , return value. since have both iproduct , string parameters, you'll need 2 arguments in lambda. public static expression<func<iproduct, string, bool>> isvalidexpression(string val) { return ((h, i) => h.product_name == val); } your second function func<x,y> , means function signature has 1 parameter, , lambda statement compiles.

security - Collecting Credit Card Information - not to collect payment -

i working in php on linux server mysql. i have requirement (that have attempted talk them out of) collect credit card information users our company can use card numbers hold hotel rooms conference. not charging cards ourselves @ all, instead sending them hotel. need able download csv file , each time signs email go admin information. i tried explain wasn't secure, several other developers have done them in past before working here. my question is; there anyway make secure? if not there third party options make happen? edit: i appreciate has posted far, has made me want attempt less , less. if add answers simple explanations, oriented @ non-tech people, appreciated, in fact site source , links me great deal. haven't found sites explain in non-tech way. it's bad idea storing card details. you're opening world of pain in form of pci-dss audits. not simple 'use encryption', need have processes in place securely manage encryption keys, s...

asp.net - When the schemas of database changed,how to use SqlWorkflowPersistenceService in WF? -

for reasons,the schemas of database not dbo. when using sqlworkflowpersistenceservice in wf,there error found "cannnot find stored procedure 'retrievenonblockinginstancestateids'".but if update procedure "xxx.retrievenonblockinginstancestateids" "dbo.retrievenonblockinginstancestateids" there ok.how fix it? or how define default schemas in wf? have set schemas xxx default schemas in current use login asp.net in sql 2005 i have solved it. create user without sa permissions in sql stored procedure can found seems if accout contains sa, default schemas cannot personal if have set it.

Python - signal.alarm function -

i'm trying build python timeout exception runs in milliseconds. the python signal.alarm function has 1 second resolution. how 1 equivalent function requests sigalrm signal given process in, milliseconds, opposed seconds? i've found no simple solutions of yet. thanks in advance input. use signal.setitimer() instead.

iphone - CFBundleExectuable Error -

can’t install application the application @ /users/myname/documents/sdk/iphoneapplications/x/build/debug-iphoneos/x.app not specify cfbundleexecutable i don't know means or how fix it. can help? occurs when trying build device - iphone 3g running 4.1 , using latest sdk allows me build on ios 4.1 this value specified in info.plist file. check target debug configuration , make sure have correct plist file specified. double-click on target , search packaging section or info.plist. if plist correct, check content of info.plist make sure have either value either key cfbundleexecutable or key executable file (they same value, can displayed raw or friendly labels).

sql server - Why does my trigger not fire? -

i have following table: if object_id(n'dbo.node') null create table dbo.node ( id bigint identity primary key, parentid bigint null foreign key references node(id) on delete no action, datecreated datetime not null, lastupdated datetime not null, [name] nvarchar(500) not null, ); now, because sql server complains when try set foreign key cascaded delete, have created trigger work: create trigger node_delete on node delete begin delete node parentid in (select id deleted) end now here's sample data set: id parentid datecreated lastupdated name 520 1 2010-01-12 02:26:26.890 2010-01-12 02:26:26.890 test 1 523 520 2010-01-12 02:32:44.777 2010-01-12 02:32:44.777 test 2 now let's run bit of sql: delete node id=520 the node should delete, along child node. why error? msg 547, level 16, state 0, line 1 delete s...

java - Regex to return unique lines when pattern matched -

i parsing log file , trying match error statements. part of line matching "error cs" apply numerous lines duplicates not. there way can not return duplicates. using java flavor of regex.. example: simple regex returns class1.cs(16,27): error cs0117: 'string' not contain definition 'empty' class1.cs(34,20): error cs0103: name 'thiswworked' not exist in current context class1.cs(16,27): error cs0117: 'string' not contain definition 'empty' class1.cs(34,20): error cs0103: name 'thiswworked' not exist in current context would return: class1.cs(16,27): error cs0117: 'string' not contain definition 'empty' class1.cs(34,20): error cs0103: name 'thiswworked' not exist in current context one solution match using regexp , put line data structure set deals removing duplicates you. @ end of parsing print contents of set. if you're concerned order add map of kind line key , line number ...

How to make entire screen blackish when jquery ui popup is visible? -

how make entire screen blackish when jquery ui popup visible? so want modal dialog? then can set modal true if you're using jquery dialog. $(".selector").dialog({ modal: true });

c# - Fastest way to chop array in two pieces -

i have array, say: var arr1 = new [] { 1, 2, 3, 4, 5, 6 }; now, when array-size exceeds 5, want resize current array 3, , create new array contains upper 3 values, after action: arr1 = new [] { 1, 2, 3 }; newarr = new [] { 4, 5, 6 }; what's fastest way this? guess i'll have unmanaged corner, no clue. some more info: the arrays have able size without large performance hits the arrays contain int32's purpose of array group numbers in source array without having sort whole list in short: want split following input array: int[] arr = new int[] { 1, 3, 4, 29, 31, 33, 35, 36, 37 }; into arr1 = 1, 3, 4 arr2 = 29, 31, 33, 35, 36, 37 but because ideal speed reached array size of 3, arr2 should split 2 evenly sized arrays. note i know array's implementation in memory quite naive (well, @ least in c, can manipulate count of items in array array resizes). there memory move function somewhere in win32 api. guess fastest: change arr1 contai...

iphone - shark does not show source code -

we trying run shark on our iphone application. however, in analyzed samples not list of our application function. listed libraries , when click on of those, assembly code visible. of sites mention 'generate debug symbols' option when building app; not able find option either. instead have enabled 'generate profiling information' option. can please how see application functions , source code in analyzed samples of shark? you have compile debugging (not symbols), see shark manual.

c# - .NET HttpWebRequest Speed versus Browser -

i have question regarding performance of .net httpwebrequest client (or webclient, gives similar results). if use httpwebrequest request html page (in case news.bbc.co.uk) , analyse speed (using httpanalyzer) @ response read application, slower browser (firefox, chrome, ie) requesting same resource (all caches cleared etc). .net application takes approximately 1.7 seconds versus 0.2 - 0.3 seconds browser. is purely down speed , efficiency of code / application or there other factors consider? code follows: httpwebrequest request = null; uri uritest = new uri("http://news.bbc.co.uk"); request = (httpwebrequest)webrequest.create(uritest); request.method = "get"; request.keepalive = true; request.headers["accept-encoding"] = "gzip, deflate"; httpwebresponse response = (httpwebresponse)request.getresponse(); response.close(); if make 2 requests second 1 happen more quickly? i have notice speed disparities between browsers...

jasper reports - How to prevent duplication of bar chart in iReport -

i've tried use chart in ireport first time. i've used bar chart , anytime preview chart see plenty of them, iithink 6. need single 1 there didn't do? have query : select count(*) total_message, `status`, date_format(date_created,'%m') `month` message year(date_created)=$p{year} group `status`, month(date_created) order `status` desc and have result |total message | status | month | |1 | failed | january | |10 | sent | febuary | |11 | sent | march | |123 | sent | april | |156 | failed | may | .......... up december. my serie expression set ${status} categorie expression ${month} value expression ${total_message} can me? reading this! you didn't provide code, have guess: have put chart in details band, , printing each record in datasource. put chart in non-repeatable band.

actionscript 3 - Working with Masks in Flash -

i'm having hell of time trying custom mask work on project i'm creating. the mask i'm trying use applied pixel mask on layer in photoshop doc i'm working off, can't seem figure out proper way layer mask imported flash, compile .swc , called actionscript. (i'm coding in flex) whats proper workflow getting pixel mask imported photoshop when call: container.mask = mymask; it'll show shape want, , not square box size of shape? thanks in advance, driving me batty! you'd have convert mask shape in photoshop vector shape, import vector flash. in photoshop: click on mask's thumbnail in layers palette. in channels palette, click mask's channel click "load channel selection" button @ bottom of palette. open paths palette, click "make work path" button. create vector path of mask area. click newly created path in paths palette. see path in document window. select path selection tool (the black arrow), click...

session - Spring Security - Cannot access my welcome webpage while I'm already logged -

i have website uses spring security. have realized when logged in application , tried access website again without closing session 404 error. mean if application has context name "myapp" can acess localhost:8080/myapp when not logged in, when logged in , entered url error. doesn't happen example if enter localhost:8080/myapp/control/login displays login form correctly. here spring -security configuration: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:sec="http://www.springframework.org/schema/security" xsi:schemalocation=" http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/s...

bash - Compiled vim from source on Mac OSX and getting 'shell returned 127' error? -

on mac osx 10.6 machine, started use macvim vim. noticed terminal version different macvim version (macvim 7.3 , terminal version 7.2)... thought used same vim? i need 7.3 of features. set wanting update terminal version. cloned using mercurial (the perferred way according official site) , did usual compile it. did work , have 7.3 in terminal. but, on commands when exiting, can error: /bin/bash: q: command not found shell returned 127 press enter or type command continue ...i've tried hardest try , fix problem, trying reinstall macvim, deleting vim in /usr/local/bin , compiling again , can't rid of annoying error. can possibly me? doing wrong? ...most of time using macvim, it'd nice me have in terminal - how i'd have on ubuntu servers. any fantastic! i'm not sure on exact path, somewhere few folders deep applications/macvim.app folder vim executable run in terminal (use -g option launch in gui mode). you should able throw in .bashrc : ...

rails conditional show -

how can render show action on conditions? def show @post = post.find_approved if @post.approved approved = true end respond_to |format| # want render show.html.erb if approved true if not redirect user came end end redirect_to :back unless approved respond_to |format| render whatever end

iphone - Xcode: gcc-4.2 failed with exit code 1 -

i'm working on game iphone use oolong engine rendering, , tried update project newest version. however, following error when try compile: gcc-4.2 failed exit code 1 in build results see in cpp file error happens, don't see additional information. how can more info going wrong in order track down problem? edit after inspecting compile output, got following lines, error occurs: {standard input}:61:selected processor not support 'fmrx r0, fpscr' {standard input}:62:unshifted register required -- 'bic r0,r0,#0x00370000' ...somemorelines {standard input}:69:selected processor not support 'fmxr fpscr,r0' this vfo code 1 of #include files. works fine in examples come engine. there screwed project settings? compared them 1 of examples , seem identical. go build->build results or hit shift-command-b. there's icon on far right of error message looks bunch of horizontal lines. click or select "all messages". you...

c++ - Keeping memory usage within available amount -

i'm writing program (a theorem prover happens) memory requirement "as possible, please"; is, can better using more memory, practical purposes without upper bound, needs use memory available, no more , no less. can figure out how prioritize data delete lowest value stuff when memory runs short; problem i'm trying solve how tell when happening. ideally system call returns "how memory left" or "are out of memory yet?"; far can tell, no such thing exists? of course, malloc can signal out of memory returning 0 , new can call handler; these aren't ideal signals, better nothing. problem, however, want know when physical memory running out, can avoid going deep swap , thereby making grind halt; don't suppose there's way ask "are having swap yet?" or tell operating system "don't swap on account, fail requests if comes that"? another approach find out how ram in machine, , monitor how memory program using @ momen...

c# - WSDL.exe generated client gives: Unhandled Exception: System.InvalidOperationException: There is an error in XML document (...) -

i have webservice returns complex objects. public class resource; public class asset extends resource; public class collection extends resource; the methods return subclasses work fine: asset[] getassets(); collection[] getcollections(); however methods return base class generating exception: resource[] getresources(); the webservice written in java using cxf dont think matters. able use base class methods sample client created java. here exception using .net client: `unhandled exception: system.invalidoperationexception: there error in xml document (1, 173). ---> system.invalidoperationexception: specified type not recognized: name='asset', namespace='http://www.turimsaint.com/', @ <return xmlns=''>`. here client code generated wsdl.exe [system.web.services.protocols.soapdocumentmethodattribute("", requestnamespace = "http://www.turimsaint.com/", responsenamespace = "http://www.turimsaint.com/",...

How does the scanf function work in C? -

why require ampersand (&) in scanf function. output or type of error (compile or runtime) in following c code? #include <stdio.h> void main() { int a; printf("enter integer:"); scanf("%d", a); } the & in c operator returns address of operand. think of way, if give scanf variable a without & , passed by-value, means scanf not able set value see. passing by-reference (using & passes pointer a ) allows scanf set calling functions see change too. regarding specific error, can't tell. behavior undefined. sometimes, might silently continue run, without knowing scanf changed value somewhere in program. cause program crash immediately, in case: #include <stdio.h> int main() { int a; printf("enter integer: "); scanf("%d",a); printf("entered integer: %d\n", a); return 0; } compiling shows this: $ gcc -o test test.c test.c: in function ‘main’: test.c:6:...

regex - Notepad++ I'm looking for a regexp to select all occurances of 'href="' that do not match 'href="javascript' -

this code editor notepad++. i'm looking regular expression solve following problem: i have set of html files. need find links in them not links javascript functions. if search string ' href=" ' 342 results , if search ' href="javascript ' 301 results. i'd @ 41 elements in first set. links not javascript function calls. i'd grateful if more familiar regular expressions me out on one. this match urls don't start "j", work you. href="[^j]

python - How do I get all instances of VLC on dbus quickly? -

basically problem is, way instances of vlc search non-named instances org.freedesktop.mediaplayer identity function , call it. (alternatively use introspection api, wouldn't seem solve problem) unfortunately many programs upon having sent dbus call, not respond, causing long , costly timeout. when happens multiple times can add up. builtin timeout excessively long. if can decrease dbus timeout somehow solve problem, ideal solution way. i got idea put each call "identify" inside thread , kill threads take long, seems not suggested. adding multithreading increases cpu load while not increasing speed of program much. here code trying run (more or less) painfully slow. import dbus bus = dbus.sessionbus() dbus_proxy = bus.get_object('org.freedesktop.dbus', '/org/freedesktop/dbus') names = dbus_proxy.listnames() name in names: if name.startswith(':'): try: proxy = bus.get_object(name, '/') ident...

c# - MVVM Foundation: Why return ICommand when its defined as RelayCommand -

i using samplemodel project mvvm foundation .why icommand returned when _decrementcommand declared relaycommand . know relaycommand inherits icommand won't clearer return relaycommand ? public icommand decrementcommand { { return _decrementcommand ?? (_decrementcommand = new relaycommand(() => --this.value)); } } relaycommand _decrementcommand; this principle of using least specific type can away with. concrete or specific types liability because more expose things callers don't need know , more need changed (making them implementation detail). in case, if return icommand, can change underlying command type without breaking callers. can expect callers won't have know more function should know, meaning less break oo principles.

Convert mysql query results to CSV (with copy/paste) -

i work in command line mysql. common need take query's results , import them numbers document (similar excel document). what fastest method doing this? method 1: select outfile you can select outfile directly mysql, takes several steps. export query necessary arguments make csv format, fields optionaly enclosed by , delimited by . sftp server , grab file delete file server method 2: copy/paste i tend method. me seems little faster that's because don't remember how construct select outfile query above , have up. copy/paste local text file open in text editor , replace | , save csv , open in numbers. how this?: mysql -b -e "$my_query" > my_data.csv the output format tab-separated rather comma-separated @ least excel , openoffice calc automatically adapt this. btw, convenience , enable non-interactive execution of mysql commands, recommend setting secure ~/.my.cnf file (readable you) entries this: [client] user=your_m...

terminology - Confusing terms in asp.net -

i confused following terms. please elaborate on each of following means: run time execution time dynamically creation virtual machine you can use msdn or google these terms. http://msdn.microsoft.com for example: runtime: http://msdn.microsoft.com/en-us/library/aa479328.aspx

asp.net - ListView Running total -

i have listview , calculate running total of values. every dataitem have bound listview, has "amount". on listview1_itemdatabound, data item's "amount" value, cannot find how access item. this kind of similar, think, except want running total, not total @ end. displaying totals in listview layouttemplate you should able find item in dataitem inside listviewitem. sample code might like: public int listviewtotal { get; set; } protected void mylistview_itemdatabound(object sender, listviewitemeventargs e) { if (e.item.itemtype == listviewitemtype.dataitem) { // retrieve underlying data item. in example // underlying data item datarowview object. datarowview rowview = (datarowview)dataitem.dataitem; listviewtotal += rowview["amount"]; //set text of listview control new total: label lbl = (label)e.item.findcontrol("myamountlabel"); lbl.text = listviewtotal.tostri...

antlr - What is wrong with this grammar? (ANTLRWorks 1.4) -

Image
i have following code written in antlrworks 1.4 grammar hmm; s : (put_a_in_b)|(put_out_a)|(drop_kick)|(drop_a)|(put_on_a); put_a_in_b : (put_syn)(id)(in_syn)(id); put_out_a : (put2_syn)(out_syn)(id) | (e1)(id); drop_kick : ('drop')('kick')(id); drop_a : (drop_syn)(id); put_on_a : (e2)(id); put_syn : 'put' | 'place' | 'drop'; put2_syn : 'put' | 'douse'; in_syn : 'in' | 'into' | 'inside' | 'within'; out_syn : 'out'; e1 : 'extinguish'|'douse'; drop_syn : 'drop' | 'throw' | 'relinquish'; ws : ( ' ' | '\t' | '\r' | '\n' ) {$channel=hidden;}; id : ('a'..'z'|'a'..'z'|'_') ('a'..'z'|'a'..'z'|'0'..'9'|'_')*; e2 : ...

perl - How can I edit file metadata in OS X? -

does know if possible directly edit file metadata on os x. in perl. parameter i'm trying change kmditemfslabel (the color of file). i've had search around , can't seem find way without using module such mac::glue or external application (finder). the kmditemfslabel attribute property of finder. need use way communicate finder change data. far know, there no bit can twiddle perl change finder's data without going through finder. there several ways this: use camelbones when new version comes out. allows bridge objective c perl. need use apple method cocoa system calls. steep learning curve cocoa... if have developer tools, use /developer/tools/setfile (if supports metadata item) use osascript send message finder change color of file. can @ this earlier post hints on doing that. most of perl related objective c / cocoa bridges have died unfortunately. macperl has not been updated since 2005. almost easiest methods require knowing @ least mini...

gwt - What Files to Deploy to Tomcat? -

what files need have deploy gwt web app tomcat, preferably in war? can't quite distinguish if build.xml needed when there 'war' folder when create new app via wizard in eclipse. can advise? with recent versions of gwt (1.6 , up, maybe 1.5) need include what's in war folder. can war folder (zip , give .war extension). if you're using google plugin eclipse , may able try right-clicking on project , selecting "export -> war" (i'm not sure though, i'll verify when work, in hour). you not need build.xml in there.

c# - problem writing regular expression -

i trying write regular expression matches of following: {string} {string[]} {string[6]} where instead of 6 in last line, there positive integer. also, wherever string appears in above lines, there int . here regular expression wrote : {(string|int)(([]|[[0-9]])?)} . worked wouldn't allow more 1 digit within square bracket. overcome problem, modified way : {(string|int)(([]|[[0-9]*])?)} . the modified regex seems having serious problems. matches {string[][]} . can please tell me causes match against this? also, when try enclose [0-9] within paranthesis, exception saying " too many )'s ". why happen? can please tell me how write regular expression satisfy requirements? note : tryingthis in c# you need escape special characters {} , []: \{(string|int)(\[\d*\])?\} you might need use [0-9] instead of \d depending on engine use.

java - Most efficient way to create a large file (> 1GB) -

i know efficient way create large dummy file in java. filesize should above 1gb. used unit test method accepts files <= 1gb. create sparse file. is, open file, seek position above 1gb , write bytes. relevant: create file given size in java

c++ - How to nicely output a list of separated strings? -

usually, when had display list of separated strings, doing like: using namespace std; vector<string> mylist; // lets consider has 3 elements : apple, banana , orange. (vector<string>::iterator item = mylist.begin(); item != mylist.end(); ++item) { if (item == mylist.begin()) { cout << *item; } else { cout << ", " << *item; } } which outputs: apple, banana, orange i discovered std::ostream_iterator if found nice use. however following code: copy(mylist.begin(), mylist.end(), ostream_iterator<string>(cout, ", ")); if get: apple, banana, orange, almost perfect, except , . there elegant way handle special "first (or last) element case" , have same output first code, without "complexity" ? although not std: cout << boost::algorithm::join(mylist, ", "); edit: no problem: cout << boost::algorithm::join(mylist | boost::adaptors::transf...

Address data extraction from text via asp.net (vb.net) -

i have address data surrounded random text. there way extract data either call web service or vb.net function? example: 1111 s wilson road apt b8 city state 55555 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 if random data 0's, try doing string.replace rid of 0's , trim() rid of spaces. use regex accomplish same task rid of 0's. if random data random, there way can introduce delimiters in @ beginning , end of address? instance, have: #1111 s wilson road apt b8 city state 55555# 0 0 0 0 0 0 0 0 0 0 0 0 this way, substring function extract data need using special characters delimiters. -d

Changing Eclipse project to use Maven? -

my boss asked me convert 1 of our projects use maven build. created pom.xml file , maven builds project fine , runs tests , everything. "fine", boss said, "we don't need these more" , deleted /libs directory project, , deleted jre classpath. that's fine, still builds in maven, eclipse shows in jre or in /libs unresolved in editor. because of error indications, i'm considering going vi. how can eclipse can thing? to create eclipse .classpath , .project files, following: mvn eclipse:eclipse this create references local maven repository, means you'll have build @ least once maven, can download files. believe have define eclipse classpath variable m2_repo (at least, have 1 defined, , can't see other reason i'd have done that). i'll assume boss deleted jre entry eclipse classpath, dumb not dumb deleting actual jre directory. maven-build classpath file should include appropriate, or can go "build path" dialo...

sql - Can you query two tables in one statement in Android? -

i'm trying reduce number of queries android's database. want email or im address contains user defined search term. right i'm doing 2 separate queries: email: cursor emails = cr.query( contactscontract.commondatakinds.email.content_uri, null, contactscontract.commondatakinds.email.data + " ?", new string[] {searchterm}, null); im: cursor cursor = cr.query( contactscontract.data.content_uri, null, contactscontract.commondatakinds.im.data + " ?", new string[] {searchterm}, null); does know of easy way combine both queries? crux of problem seems 2 content uri's different. simon you try joining tables using matrixcursor . here example .

Silverlight 4: change themes/styles for whole app without using Toolkit -

we embarking on our first silverlight project, coming wpf. it's relatively simple web portal , avoid references silverlight toolkit, given our experience wpf toolkit. i'm not of coder , have couple questions related themes: implicit styles make easier. seems clear switch out resource dictionaries change theme. how do without relying on toolkit? how apply styles entire application, in wpf, instead of wrapping things in theme containers? see there applicationthemeuri can use, requires toolkit. thanks. just note on siverlight toolkit. last time used wpf toolkit (which while ago), got impression more-or-less optional. wouldn't same true of silverlight toolkit. adds great deal of important functionality difficult implement on own, , while it's not bug-free, it's pretty reliable. can't vouch every aspect of it, we're using extensively in large silverlight project (~30k lines of code), , find indispensable. unless you're aware of spec...

namespaces - rails nested object form and namespaced controller -

i have nested object this: class work < activerecord::base belongs_to :issue belongs_to :author has_many :pages, :class_name => 'work' accepts_nested_attributes_for :pages, :allow_destroy => true end class page < activerecord::base belongs_to :work end and have form create/edit work, fields nested page object. followed this post setting things up, i'm using helper form creates new page when start out. module adminhelper def make_work(work) returning(work) |w| w.pages.build if w.pages.empty? end end end then, in form partial have: - form_for make_work(@work) |f| ... - f.fields_for :page |page_f| = page_f.label :text %br = page_f.text_area :text %p = f.submit "submit" that displays fields page, when it's submitted looks create action in works controller. create action in admin works controller (namespaced), breaks. i try namespaced object, if way doesn't know pages: - form...

css - Cross-browser 'cursor:pointer' -

i found these css attributes , make cursor hand: ie - style="cursor: hand;" ns6/ ie6 - style="cursor: pointer;" cross browser - style="cursor: pointer; cursor: hand;" however notice stack overflow using "cursor: pointer" in css. however, apparently work on ie. so ... gives? correct, browser-independent way use css item? according quirksmode , cross-browser syntax is: element { cursor: pointer; cursor: hand; } they give more information cursor well: in past hand value microsoft's way of saying pointer; , ie 5.0 , 5.5 support hand. because it's cursor value that's used often, other browsers have implemented hand. since ie 6 , 7 support pointer, there's no more reason use hand, except when older ies part of target audience. i think page linked might little outdated newest browsers.

algorithm - The best distribution of cameras inside a room -

my problem cover 100% of room cameras in 2d. camera can modelled polygon. finished modelling , necessary tools. problem algorithm. complexity of blind search big room many obstacles high. so know better (or optimal) algorithm? this sounds promising: http://www.springerlink.com/content/u7gp44hchuhly6yg/

perl - How can I communicate with an application that does not return to the command prompt? -

i need build test bench sending appropriate inputs application. however, once launch application, takes control , not return command prompt (unless exit command executed application). in case there technique can send command application perl script , interpret output application? my operating system windows. if it's gui application, take @ the win32::guitest module . sends events gui applications - simulating user input. for command line application, recommend the expect module . unfortunately, expect doesn't work under windows.

syntax - Python NameError -

list1 = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z] item in list1: print item not sure why above code throwing error: nameerror: "name 'a' not defined" in addition using quotes properly, don't retype alphabet. >>> import string >>> string.ascii_lowercase 'abcdefghijklmnopqrstuvwxyz' >>> l = list(string.ascii_lowercase) >>> print l ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', ... >>> help(string)

python - What exactly do "u" and "r" string flags do, and what are raw string literals? -

while asking this question , realized didn't know raw strings. claiming django trainer, sucks. i know encoding is, , know u alone since unicode. but r exactly? kind of string result in? and above all, heck ur do? finally, there reliable way go unicode string simple raw string? ah, , way, if system , text editor charset set utf-8, u anything? there's not "raw string "; there raw string literals , string literals marked 'r' before opening quote. a "raw string literal" different syntax string literal, in backslash, \ , taken meaning "just backslash" (except when comes right before quote otherwise terminate literal) -- no "escape sequences" represent newlines, tabs, backspaces, form-feeds, , on. in normal string literals, each backslash must doubled avoid being taken start of escape sequence. this syntax variant exists because syntax of regular expression patterns heavy backslashes (but never @ end, ...

c# - Application freezing while creating visual container for DataGrid rows -

i'm working on problem has me on it's toes last weeks or so. this not normal freezing problem solveable multi-threading, because i'm doing business logic. i have view datagrid, datacontext viewmodel supplying observablecollection<t> collectionviewsource named igroupingjournal . <datagrid grid.row="1" itemssource="{binding source={staticresource igroupedjournal}}"> <datagrid.columns> <datagridtextcolumn binding="{binding path=datetime}" header="datetime" /> [...] </datagrid.columns> </datagrid> usually, 50 rows having 7 columns displayed, causes application freeze while these rows generated. i ruled out following causes this: 1.1. complex business class producing overhead -> tested data holding class, produces no increase in speed 1.2. expensive database query gets executed in gui thread due getting data via linq -> data gets fetched in workerthread c...

c# - $.post doesn't work on locally deployed site -

i "converted" html website web forms. convert, mean opened website in visual studio 2010, added web.config file allow httppost protocol, , called converted. however, form doesn't want post .aspx page. missing? when build app, there no binary created deploy local iis (7.5 on windows 7) <form name="register2" method="post" action="#" onsubmit="return false;"> then $.post in $(function() {... $('form[name="register2"]').submit(function () { var $registerform2 = $('form[name="register2"]'); if ($registerform2.valid()) { $.post({ type: 'post', url: 'createaccount.aspx', data: $(this).serialize() }); } else { //do validation $registerform2.validate(); } }); when submit form, chrome tells me request url url:http://localhost/mysite/[object%20object] , receives error code 404. page createaccount.a...

Drupal: How do I modify form ui after 'Remove' button pressed using AJAX? -

i using drupal 6 , have ajax module installed. have following code: function remove_manufacturer_role_form($form_state) { $form['#ajax'] = array( 'enabled' => true ); $form['hidden'] = array('#type' => 'value', '#value' => 'is_it_here'); $form['submit'] = array('#type' => 'submit', '#value' => t('remove manufacturer')); return $form; } function remove_manufacturer_role_form_submit($form, &$form_state) { $current_vars = ogrolerequestmanufacturerblock_get_current_vars(); if( $current_vars ) { $curr_gid = $current_vars['current_gid']; $curr_uid = $current_vars['current_user_id']; $delete_query = "delete {og_users_roles} rid in (select rid {role} name='manufacturer') , uid=$curr_uid , gid=$curr_gid"; if( db_query($delete_query) ) drupal_set_message("you removed manufacturer proj...

svn - Do I need to checkout both TRUNK and BRANCH to merge branch back into trunk -

having issue, here problem. created branch trunk, made changes branch on local dev box, committed changes , want merge changes in branch trunk. i run command: 46 version created branch, 49 branch version now sudo svn merge -r 46:head http://path/to/branch/repo/verion/that/is/checkout after running command in web gui see if changes have been made trunk, don't see them. thought maybe should run commit command. sudo svn commit -m "merging branch trunk" still after checking trunk don't see changes. can please tell me i'm doing wrong? thanks you should make sure working copy @ trunk switching trunk: cd /path/to/workingcopy svn switch http://server/svn/repo/path/to/trunk before merging, make sure you're date (run svn update , , there no dirty files. then can merge branch trunk working copy: svn merge -r 46:head http://server/svn/repo/path/to/branches/mybranch this change files, , allow commit merge

iphone - How can I migrate my user-generated data to the computer? -

i have query regarding backup of third party application data on pc. i developing application can store photos, text, recordings. user can add number of photos or recordings. so @ runtime, size of application storage go on increasing. user never want loose data storage limited. hence taking backup of data on computer , deleting iphone seems essential. so standard way of taking backup of third party application data? is there way can save data on mac windows using itunes? is there limit on amount of storage third party application can take? itunes perform complete backup of iphone when plugged in sync, contain application-specific data files. however, way restore restore entire system image, emergency backup, not need. third parties have typically provided own backup , synchronisation strategies. there 2 broad approaches: in conjunction companion desktop version of same application (eg. omnifocus, things, 4 track) using web service (eg. darkslide flickr) ...

c# - GetType() on Array item? -

i have initialised array may contain no items. lets call a , calling gettype() on a return type of array. possible type of items array contains? obviously a[0].gettype() work, array empty , cause null reference exception. well, can element type of array : type type = array.gettype().getelementtype(); (that's not quite same getting types of items in array - object[] may entirely populated strings, example.)

java - separate rmiregistry and server application -

i'm developing basic application starts rmiregistry @ server: try { // create registry , bind name , object. registry = locateregistry.createregistry(thisport); registry.rebind("rmiserver", this); } catch (remoteexception e) { throw e; } i want run registry on machine. possible separate this? i want run registry on machine. possible separate this? its possible. if registry running on different machine, can locate using locateregistry.getregistry(host, port)

ruby module as collection of methods -

i have rails app loads lots of data java services. i'm writing module allow me populate select boxes data , i'm trying include these can reference them in views. here's module module filteroptions module select def some_select return "some information" end end end my idea include filteroptions in application_helper, , thought reference methods using select::some_select not case. have include filteroptions::select can reference method some_select on own. don't want though think it's bit confusing may not know some_select coming own module. so, how write methods of module public static methods can include main module, , reference methods using sub-module namespace select::some_select if define module methods within context of module itself, can called without import: module filteroptions module select def self.some_select return "some information" end end end puts filteroptions::selec...

How to get an array of all enum values in C#? -

i have enum i'd display possible values of. there way array or list of possible values of enum instead of manually creating such list? e.g. if have enum: public enum enumnum { typea, typeb, typec, typed } how able list<enumnum> contains { typea, typeb, typec, typed } ? this gets plain array of enum values using enum.getvalues : var valuesasarray = enum.getvalues(typeof(enumnum)); and gets generic list: var valuesaslist = enum.getvalues(typeof(enumnum)).cast<enumnum>().tolist();

Why was JavaScript implemented using prototypal inheritance? -

there lots of articles , posts explaining how javascript inheritance works, why javascript implemented using prototypal inheritance instead of classical inheritance? i love javascript, i'm not saying it's bad thing... i'm curious. here's brendan eich has happened: http://weblogs.mozillazine.org/roadmap/archives/2008/04/popularity.html as i've said, , others @ netscape can confirm, recruited netscape promise of "doing scheme" in browser. @ least client engineering management including tom paquin, michael toy, , rick schell, along guy named marc andreessen, convinced netscape should embed programming language, in source form, in html. the diktat upper engineering management language must "look java". ruled out perl, python, , tcl, along scheme. i'm not proud, i'm happy chose scheme-ish first-class functions , self-ish (albeit singular) prototypes main ingredients. java influences, y2k date bugs primitive vs. ...