Posts

Showing posts from June, 2011

How php and own frameworks works in background? -

i new on web programming .i on c# .net platform on desktop. tried understand php , php frameworks confused little . understand php file can import classes in file php file require_once function. frameworks doesnt import own classes require_once function . think different dont understand.can explain me please? most frameworks uses technique called "autoloading" automatically resolve , include needed dependencies. an "autoloader" function called php when unknown class being referenced. "autoloader" can either procedurally create class or include external file based on file name. the current (php 5.1.2 , higher) proper way of doing using spl_autoload_register() . here example of autoloader: function autoload_example($classname) { $normalizedname = strtolower($classname); if(file_exists('includes/' . $normalizedname . '.inc')) { require_once('includes/' . $normalizedname . '.inc'); } elseif(file...

postgresql - How to add custom DB provider to be accessible in Visual Studio? -

Image
i wanted work custom db provider in visual studio. need use entity framework. for example, downloaded npgsql, registered them in gac: gacutil -i c:\temp\npgsql.dll gacutil -i c:\temp\mono.security.dll and added machine.config file: <add name="npgsql data provider" invariant="npgsql" support="ff" description=".net framework data provider postgresql server" type="npgsql.npgsqlfactory, npgsql, version=2.0.6.0, culture=neutral, publickeytoken=5d8b90d52f46fda7" /> but npgsql did not appear in datasource list in visual studio: how add custom db provider list? upd: if use command string edmgen.exe got error: error 7001: failed find or load registered .net framework data provider. you need declare dbfactoryprovider in config file (web.config, machine.config, etc). here's sample 1 pulled project using mysql: <system.data> <dbproviderfactories> <remove invariant="mysq...

linux - c++ profiler that can attach to a running process? -

i have program written in c++ want profile, , want avoid restarting when start , stop profiling. ideally profiling both cpu usage , memory allocation. there tool allow me this? i'm running on linux. free oprofile perf systemtap (probably want redhat/centos distro this) not free vtune

ruby - Installing RMagick Gem -

i wanted gem install rmagick and got this: building native extensions. take while... error: error installing rmagick: error: failed build gem native extension. /usr/bin/ruby1.8 extconf.rb extconf.rb:1:in `require': no such file load -- mkmf (loaderror) extconf.rb:1 imagemagick , libmagickwand-dev installed. using ubuntu linux. any help? yours, joern. use rvm install ruby (preferred) or use apt-get install ruby ruby-dev aptitude install build-essential imagemagick libmagickcore-dev libmagickwand-dev gem install rmagick --edit 1-- need ruby-dev (or ruby-full) compiling rmagick before gem install.

emacs:highlight the current line by underline it -

in vim, can use "set cursorline" in dotvim file turn on. there way in emacs? in .emacs, customize face hl-line-mode , like: (global-hl-line-mode 1) (set-face-attribute hl-line-face nil :underline t) hl-line-face variable stores name of face hl-line-mode uses show current line. can customize :foreground :background , bunch of other attributes liking. check docs here . the global-hl-line-mode turns on highlighting current line in buffers. if want in buffers, turn on m-x hl-line-mode .

c# - iTextSharp 5 polish character -

i have problem polish character using itextsharp. want create pdf html. works fine polish character missing. use function lower: private void createpdf(string html) { //memorystream msoutput = new memorystream(); textreader reader = new stringreader(html);// step 1: creation of document-object document document = new document(pagesize.a4, 30, 30, 30, 30); // step 2: // create writer listens document // , directs xml-stream file pdfwriter writer = pdfwriter.getinstance(document, new filestream("test.pdf", filemode.create)); // step 3: create worker parse document htmlworker worker = new htmlworker(document); // step 4: open document , start worker on document document.open(); worker.startdocument(); // step 5: parse html document worker.parse(reader); // step 6: close document , worker worker.enddocument(); worker.close(); ...

wildcard - The issue of * in Command line argument -

i wrote program in java accepts input via command line arguments. input of 2 numbers , operator command line. multiply 2 numbers, have give input e.g. 5 3 * , it's not working written. why not accepting * command line? that's because * shell wildcard: has special meaning shell, expands before passing on command (in case, java ). since need literal * , need escape shell. exact way of escaping varies depending on shell, can try: java programname 5 3 "*" or: java programname 5 3 \* by way, if want know shell * , try printing content of string[] args main method. you'll find contain names of files in directory. this can handy if need pass filenames command line arguments. see also wikipedia: glob for example, if directory contains 2 files, a.log , b.log command cat *.log expanded shell cat a.log b.log wikipedia: escape character in bourne shell ( sh ), asterisk ( * ) , question mark ( ? ) characters wildcard charact...

linux - Incrementing Clocks -

when process set run initial time slice of 10 example, in hardware should know initial timeslice , decrement , when time slice turns 0, interrupt should fired! in freebsd kernel, understand hardclock , softclock task of accounting. question is, decrementing of clock parallel execution of process? i'll use pit example here, because it's simplest timing mechanism (and has been around quite while). also, answer x86-specific; , os-agnostic. don't know enough internals of freebsd , linux answer them specifically. else might more capable of that. essentially, timeslice "decremented" parallel execution of process timer creates irq each "tick" (note timers such hpet can 'one-shot' mode, fires irq after specific delay, can used scheduling well). once timeslice decrements zero, scheduler notified , task switch occurs. happens "at same time" process: irq jumps in, runs code, lets process keep going until timeslice runs out. it...

sql server - SQL IDENTITY COLUMN -

hey guys have sql table statement. lest records have in table have date , identity column autonumbered , defines order transactions displayed in front end client. issue during insert of data have gone missing , transactions between 2 dates missing. i need insert data table need insert them between dates , not @ end of table.if a normal insert data appear @ end of table , not @ date specify because identity column autonumbered , cannot updated. thanks using set identity_insert (table) on , force sql server let insert arbitrary value identity column - there's no way update identity column. what's big problem few gaps anyway?? yes, might bit of "cosmetic" problem - how hassle , effort really want spend on cosmetic problems?? order of entries still given - gaps. so again: what's big deal?? identity columns guaranteed ever increasing - that's guarantee. , 99% of cases, that's more enough....

spring - Direct Deposit via Authorize.net's eCheck.net API in Java -

how start, if i'd write spring online application depositing money business bank account customer bank account . it common scenario keep balance customer , when decide withdraw can opt bank account deposit. i'm looking in java. examples , real open source project usage appreciated! udpate: hinted in comments automatic clearing house or ach (aka electronic funds transfer or eft ) interested see in java api example or project. how create ach or eft java authorize.net's echeck.net api ? i think looking @ authorize.net (or other payment gateway) able find looking for. actual api going different each gateway, there dozens. sample code: http://developer.authorize.net/downloads/samplecode/

jquery - Fixed floating element-adding animation to addclass -

i want add fadein effect menu when changes classes fixed position @ top when scroll down page. http://jsfiddle.net/duewg/9/ the js: $(function () { var msie6 = $.browser == 'msie' && $.browser.version < 7; if (!msie6) { var top = $('#navmenu').offset().top - parsefloat($('#navmenu').css('margin-top').replace(/auto/, 0)); $(window).scroll(function (event) { var y = $(this).scrolltop(); if (y >= top) { $('#navmenu').addclass('fiksed'); } else { $('#navmenu').removeclass('fiksed'); } }); } }); is effect looking for? http://jsfiddle.net/duewg/10/ the code: <script> $(function () { var msie6 = $.browser == 'msie' && $.browser.version < 7; if (!msie6) { var top = $('#navmenu').offset().top - parsefloat($('#navmenu').css('margin-top').replace(/auto/, 0)); $(window).scrol...

regex - Java: Delimiters and regular expressions -

i'm using scanner method work on string , need filter out junk here's sample string 5/31/1948@14:57 i need strip out / @ : theres doc: http://download.oracle.com/javase/1.5.0/docs/api/java/util/regex/pattern.html but it's confusing. if you're looking split up, use string#split() string[] parts = "5/31/1948@14:57".split("[/@:]");

jQuery code to track clicks on outgoing links (Google Analytics) -

i found on web: $('a[href^=http]:not("[href*=://' + document.domain + ']")').click(function() { pagetracker._trackpageview('/outgoing/' + $(this).attr('href')); }); but it's not working. in google analytics account there no /outgoing/ links showing (it's been 24+ hours since implemented it). what's wrong code? i'm using jquery of course ;) i have: <script type="text/javascript"> var gajshost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3cscript src='" + gajshost + "google-analytics.com/ga.js' type='text/javascript'%3e%3c/script%3e")); </script> <script type="text/javascript"> try { var pagetracker = _gat._gettracker("ua code"); pagetracker._trackpageview(); } catch(err) {} </script> try (note double quotes attribute values...

php - How do I set up mod rewrite to do this? -

hi guys heres scene - i'm building web application creates accounts users. setup file structure: root/index.php root/someotherfile.php root/images/image-sub-folder/image.jpg root/js/somejs.js when users create account choose fixed group name , users can join group. thought of having textbox in login screen enter group user belongs login to. instead have virtual folders in case: root/group-name/index.php i heard can done apache mod rewrite i'm not sure how - here? basically instead of having &group-name=yourgroupname appended every page of nature above. you can configure mod rewrite in .htaccess file, e.g. root/.htaccess: rewriteengine on #make sure urls represent files or directories not rewritten rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d #update if files not in /root rewritebase /root rewriterule ^([^/]+)/(.*\.php)$ $2?group-name=$1 [l,qsa] so request matching /[groupname]/[php file] should re-written /[php fi...

Refferenced by projects .net 4.0 assemblies have no IL. How? and What for? -

Image
there don't understand. today desided find out inside sistem.web.dll version 4.0.0.0 decided find place assembly located. and opened assembly reflector - methods empty - , ildasm 7.0 sdk. saw after research i've found fullfeatured assemblies in gac. actualy here c:\windows\assembly\nativeimages_v4.0.30319_32\system.web\82087f17d3b3f9c493e7261d608a6af4 they larger in size. why references goes not gac, c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.0\ why don't have il inside? how works? mabe don't understand something. as observed, dlls stripped off il code. described below, cannot reference assembiles in gac , gac not allow store xml files. http://p3net.mvps.org/topics/basics/integratinggacwithvs.aspx in addition, helps target different versions of .net framework , right intellisense in visual studio 2010. vs 2010 know allows mutli targetting.

Should I re-write all my ASP.NET web-services as WCF? -

is there added benefit worth bother of spending time converting existing asmx web-services wcf? (i have 10 web-services in project) as stated here , if don't need "to guarantee message delivery, participate in transactions, or use binary serialization instead of xml," don't bother. asmx still works fine many purposes.

bash - Cross-platform getopt for a shell script -

i've found out getopt not cross-platform (in particular freebsd , linux). best workaround issue? use getopts (with "s"). according bash faq 35 : unless it's version util-linux, , use advanced mode, never use getopt(1). getopt cannot handle empty arguments strings, or arguments embedded whitespace. please forget ever existed. the posix shell (and others) offer getopts safe use instead.

security - What are the common compliance standards for software products? -

this generic question software products. know compliance standards applicable software product. i know question gives away nothing. so, here example referring to. cisecurity security certification/compliance lists out products ceritified them compliant standards published @ website, i.e, cisecurity.org. compliance simple answering questionnaire product , approved thirdparty cisecurity or apply whole organization, instance, pci-dss compliance. i interested in knowing standards products know/designed/created, comply to. give context behind question: developer of data-masking tool. said tool helps mask onscreen html text in banking web application using filters. so, instance, if bank application lists out user information ssn, product when integrated banking product, automatically identifies ssn pattern , masks pre-defined format.so, have product marketing team wanting more buzz words compliance able sell more banking clients. hence, understanding "compliances apply product...

c# - how to create a more accurate Break Point or Try/Catch -

i have 2 loops outer repeat 64 times know there index out of bound error how can set break point or try/catch block,etc shows me index , line of code causing problem. ( c# winapp) thanks all. in vs debugger, can enable "break on thrown exception" in exceptions dialog. don't need set breakpoint, debugger automatically stop when exception raised. you make change in: debug >> exceptions >> common language runtime exceptions just check appropriate exception in "thrown" column in dialog: alt text http://img248.imageshack.us/img248/5733/breakg.png if need break before exception raised (let's inspect volatile data), it's possible set conditional breakpoints on particular line breaks when condition in code true. this, can set regular breakpoint , right click on red circle icon in margin , select: [condition...]. this brings conditional breakpoint dialog can write expression cause debugger break when evaluated true (or whe...

visual sourcesafe - Push TFS 2008 code to remote VSS over VPN? -

we have local team foundation server 2008 keep our code under version control. however, have paranoid client has own visual source safe installation wants keep running copy of code on server well. such, i'm hoping there way can nightly push our tfs repository vss repository. i'm not concerned keeping each changeset on tfs different changeset on vss, once-nightly push creates new changeset on vss , uploads latest changeset tfs. i guess first part if possible tfs push update vss. i've noticed replies question have been tune of "don't it", can't find states cannot done. second part automating process having tfs server connect client's vpn, push code changes. i have full control on tfs server , can customize vss install, if there settings need changing, i'm limited on can settings on either firewall or server specific settings on client's vss server. i'd suggest setting nightly build script doesn't have solution buil...

jsf 2 - Tomcat error: Not Found in ExternalContext as a Resource -

i got error when tried access development site via http://localhost/home/index.html redirects http://localhost/home/views/main/index.xhtml : java.io.filenotfoundexception: /views/main/index*.xhtml not found in externalcontext resource i'm using tomcat 7.0.8, mojarra jsf 2.0.4 eclipse helios. have checked war deployment file index.xhtml file , it's there in war file. checked ../wtpwebapps/home/views/main directory , can see eclipse has deployed index.xhtml file. the stacktrace got is: 07/02/2011 3:58:53 org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet [faces servlet] in context path [/home] threw exception java.lang.nullpointerexception @ com.sun.faces.lifecycle.restoreviewphase.notifyafter(restoreviewphase.java:301) @ com.sun.faces.lifecycle.restoreviewphase.dophase(restoreviewphase.java:114) @ com.sun.faces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:118) @ javax.faces.webapp.facesservlet.service(fac...

Django many-to-many query -

hello have following model: class participation(models.model): workflow_activity = models.foreignkey('workflowactivity') user = models.foreignkey(user) role = models.foreignkey(role) current = models.booleanfield() this many-to-many 'through' table. want filter instances of workflow_activity have either 1 of these conditions: no users assigned, ie, no entries workflow_activity in participation table no current active users, ie, rows workflow_activity in participation table have current==false help building query appreciated! edit: hey everyone, responses. guess im approaching thing wrong. requirement im building sort of ticketing system has auto assign function assigns users tickets based on selection logic. im running assign function periodic task (using celery), need select tickets unassigned current state of ticket. current boolean used mark if particular user assigned current state of ticket. any ideas/thoughts on implementing t...

c++ - How to move files in Qt? -

is there cross-platform function in qt equivalent movefile function in windows , mv command in linux? sure, qdir::rename() following old unix / posix tradition of calling rename. which makes sense if think of file complete path: underlying inodes just assigned different path/file label.

Android: Drawing a canvas to an ImageView -

i'm new android programming , i'm trying figure out this; in layout have textview, imageview, , button, on vertically oriented linearlayout. i want able dynamically draw circles in imageview, without disturbing rest of layout(textview/button). i'm trying create canvas, , use drawcircle function within canvas set location of circle. , draw canvas imageview in way. cannot work, there trick this? or method fundamentally wrong? how go drawing circles imageview without recreating entire layout? thanks! i had same challenge , came conclusion overwriting ondraw @ least in general case not work. my blog explains reasons. worked me following: create new image bitmap , attach brand new canvas it. draw image bitmap canvas. draw else want canvas. attach canvas imageview. here code snippet this: import android.graphics.bitmap; import android.graphics.canvas; import android.graphics.paint; import android.graphics.rectf; import android.graphics.drawable...

asp.net - Webmethod with EnableSession=true attribute -

i have asp.net 3.5 web application in have used many pagemethods. webmethod(enablesession = true), attribute hamper performance of application? probably no. performance overhead isn't noticeable @ until complex datatypes dataset's stored in session.

what's the best practice to attach a entity object which is detached from anthoer ObjectContext? -

as mentioned in title, how many methods available? i have case: entity object 1 objectcontext, , detach entity obejct ojbectcontext object, , return it. later, if make changes on object, , want save changes database. think should write this, right? (well, works me.) public url getoneurl() { url u; using(servicesentities ctx = new servicesentities()) { u = (from t in ctx.urls select t).firstordefault<url>(); ctx.detach(u); } return u; } public void savetodb(url url) { using(servicesentities ctx = new servicesentities()) { var t = ctx.getobjectbykey(_url.entitykey) url; ctx.detach(t); ctx.attach(url); ctx.objectstatemanager.changeobjectstate(url, system.data.entitystate.modified); ctx.savechanges(); } } url url = getoneurl(); url.ursstring = "http://google.com"; //i change content. savetodb(url); or public void savetodb(url url) { using(servicesentities ctx = new servicesen...

css - How do I add a comment to an image using jQuery -

so trying replicate facebook's picture tagging functionality, , have functionality onclick, box created , there comment box. now issue want able (without doing back-end processing) take input input field , add in form underlying image area have selected. add small image area, shows comment there. how do that? see code below have comment box: <script type="text/javascript"> $(function() { var tag_box = $("<div>").appendto("body").css({ "width": "40px", "height":"40px", "border":"4px solid #000000", "position":"absolute", "display":"none", "padding":"15px" }); var comment_box = $("<form action='#'><input id='comment' type='text' name='...

html - Javascript anchor href change and form post -

i have form coded below. href value anchor tag determined value selected in dropdown. <form name=xyz method=post> //random stuff <a href="#" onclick="setanchor()"> //some image </a> </form> i setting href property of form in javascript this: if(dropdown.option selected = "x") windows.location.href = url; else windows.location.href = url; the problem having using windows.location causes form use method. code expects post method continue. how can fix this? not married above method. way can set form action url, based on option selected user, work me. if have form: <form id="myform" action="page.php" method="post"> you can submit (with post method) (that is, instead of window.location... ) so: document.getelementbyid("myform").submit(); you can set url submited this document.getelementbyid("myform").action = "page.php"...

.net - What is '=>'? (C# Grammar Question) -

this question has answer here: what '=>' syntax in c# mean? 7 answers i watching silverlight tutorial video, , came across unfamiliar expression in example code. what => ? name? please provide me link? couldn't search because special characters. code: var ctx = new eventmanagerdomaincontext(); ctx.events.add(newevent); ctx.submitchanges((op) => { if (!op.haserror) { navigatetoeditevent(newevent.eventid); } }, null); lambda operator : a lambda expression anonymous function can use create delegates or expression tree types. using lambda expressions, can write local functions can passed arguments or returned value of function calls... huzzah!

android - Track amount of clicks user clicks button -

i wandering if there way track amount of clicks user clicks button. i creating game , user allowed take 5 turns. after these turns user has lost game. i need create maybe if statement amount of clicks user takes reaches > 5 user has lost. possible. i appreciate on this. thanks edit: button link2btn = (button)findviewbyid( r.id.answerselected ); link2btn.setonclicklistener( new view.onclicklistener() { public void onclick(view v) { i++; getanswer(); } the answer method works fine except if > 5 statement within answer is: else if(i>5){ correctanswer.settext("you have lost"); use flag variable , make increment on button press. like int i=0; when button pressed i++; now condition if(i>5){}

c# - Performance issues with repeatable loops as control part -

in application, need show made calls user. user can arrange filters, according want see. problem find quite hard filter calls without losing performance. using : private void processfilterchoice() { _filteredcalls = serviceconnector.serviceconnector.singletonserviceconnector.proxy.getallcalls().tolist(); if (cbooutgoingincoming.selectedindex > -1) getfilterpartoutgoingincoming(); if (cbointernextern.selectedindex > -1) getfilterpartinternextern(); if (cbodatefilter.selectedindex > -1) getfilteredcallsbydate(); wbpdf.source = null; btnprint.content = "pdf preview"; } private void getfilterpartoutgoingincoming() { if (cbooutgoingincoming.selecteditem.tostring().equals("outgoing")) (int = _filteredcalls.count - 1; > -1; i--) { if (_filteredcalls[i].caller.e164.length > 4 || _filteredcalls[i].caller.e164...

xml - How to put this symbol: " ' " (simple Quotation mark) in a XMLfile of android? -

i translating text italian, got error on line of xml of strings.xml because ' symbol on l'utente: <string name="usernotexist">l'utente non esiste</string> how solve error? try <string name="dialog">l\'tutente non esiste </string>

Good tutorial for WinDbg? -

are there tutorials showing how use windbg ? basic tutorials & usage demos installing , configuring windbg (windows debug tools) mike taulty - word windbg windbg tutorials windows debuggers: part 1: windbg tutorial different ways "start"/attach windbg start debugging windbg (includes how debug .msi) how debug windows service setting windows debugging debugging sql server... here , here , here , here workspaces (understanding how work) pimp debugger: creating custom workspace windbg debugging uncovering how workspaces work in windbg cmdtree allows define "menu" of debugger commands easy access used commands without having remember terse command names. don't have put command definitions same cmdtree text file....you can keep them separate , load multiple ones (they own window). amazing helper .cmdtree how make cmdtree window dock @ startup in windbg making easier debug .net dumps in windbg using .cmdtree microshaof...

python - Do comments slow down an interpreted language? -

i asking because use python, apply other interpreted languages (ruby, php, javascript). am slowing down interpreter whenever leave comment in code? according limited understanding of interpreter, reads program expressions in strings , converts strings code. seems every time parses comment, wasted time. is case? there convention comments in interpreted languages, or effect negligible? for case of python, source files compiled before being executed (the .pyc files), , comments stripped in process. comments could slow down compilation time if have gazillions of them, won't impact execution time.

gcc - C++ std::stringstream seemingly causes thread to hang or die under SunOS -

i have application developed under linux gcc 4.2 makes quite heavy use of stringstreams wrap , unwrap data being sent on wire. (because grid api i'm using demands it). under linux fine when deploy sunos (v5.10 running sparc) , compile gcc 3.4.6 app hangs when reaches point @ stringstreams used. ****new information added 9/7/2010**** still didn't solve after lot of tinkering around found clue. in fact think found problem i'm @ loss how fix it! see linker output below: ld: warning: symbol `typeinfo std::basic_iostream<char, std::char_traits<char> >' has differing sizes: (file /home/roony/dssdk/cppdriver/lib/libdsdrivergcc3.so value=0x28; file /usr/sfw/lib/libstdc++.so value=0x20); /home/roony/dssdk/cppdriver/lib/libdsdrivergcc3.so definition taken so warning says there mismatch in definition of iostream etc between 2 libraries how fix, or override 1 or other.. ****end new information**** in more detail: main thread accepts requests ...

c - Recursive Sort Function -

i've written program recursively sort array. however, following error on line 11: syntax error before ']' token. here code: //this program recursively sorts array #include<stdio.h> void rec_sort(int values[], int n); main() { int vals[4]; vals[0] = 37; vals[1] = 48; vals[2] = 56; vals[3] = 63; printf("this array sorted: %x\n", rec_sort(vals[], 4)); system("pause"); return 0; } void rec_sort(int values[], int n) { //base case if (n<2) return; int maxindex=0; int i; //find max item in array in indexes 0 through n-1 for(i=1; i<n;i++) { if(values[i] > values[maxindex]) maxindex=i; } //swap element 1 stored in n-1 //set temp n-1, set n-1 in array max, set max temp int temp = values[n-1]; //store temp last element in array values[n-1] = values[maxindex]; //store last element max value in array values[maxindex] = temp; //temp keep on changing, array sorted //recur...

Run python file -- what function is main? -

i have simple python script, 'first.py': #first.py def firstfunctionever() : print "hello" firstfunctionever() i want call script using : python first.py , have call firstfunctionever() . but, script ugly -- function can put call firstfunctionever() in , have run when script loaded? if __name__ == "__main__": firstfunctionever() read more @ docs here .

osx - Machine Code tutorial for Mac -

i want learn machine code. not specific reason. heck of it. wondering if there machine code tutorials. have macbook 2.4 ghz intel core 2 duo processor. first of all, unless masochist, think prefer tutorial on intel assembly language programming machine code. assembly language uses human readable instructions - kind of low level programming language. machine code machine readable - machines, not wetware ;-) all intel chips use variation of x86 instruction set. wikipedia article referenced above gives examples of assembly vs machine code resources learn assembly language (see external links @ bottom of article).

antlr - ANTLR3: Parameters and semantic predicates ("cannot find symbol", "illegal start of type") -

i realize "branch" in antlr3. i figured using branch[boolean is_a] : ({ $is_a}? => a) | ({!$is_a}? => b); would trick, compiling errors "cannot find symbol" , "illegal start of type", because in in generated source i.e. dfa45.specialstatetransition(...) not have parameter is_a . i tried omitting => ¹, and/or omitting $ of $is_a . the first sets of a , b not disjoint. in fact b of type ((c) => c) | a . ¹) don't understand difference between {...}? => ... , {...}? ... i'm not 100% sure why error: i'd need see entire grammar that. anyway, there no need check both is_a and !is_a . , both $is_a , is_a valid. let's you're parsing list of numbers, , every 4th number, want handle through different "branch". grammar like: grammar t; parse @init{int n = 1;} : (number[n\%4 == 0] {n++;})+ eof ; number [boolean multipleof4] : {multipleof4}?=> int {system.out.prin...

Is there an HTML attribute to tell smartphone keyboards to show special email keys? -

i notice when using touch-screen smartphone (no physical keyboard) when app asks email address entered in textbox, on screen keyboard modified provide specialized keys enter blocks of text, '.com' or push characters foreground key, '@'. is there html attribute or style can add html input boxes tell smartphone/browser provide these specialized keys? according http://www.bennadel.com/blog/1721-default-to-the-numeric-email-and-url-keyboards-on-the-iphone.htm you should use <input type="email"/> it not work on android.

how to get the drawing graphic on picture box in c# -

i have created picturebox in panel. drew graphics on picturebox. want graphics on button clicking. how can that? check this link. in particular 46.9 how programmatically load, modify , save bitmap? section of page. you'll idea though code sample in vb. good luck!

javascript conversion string to UTC date -

i'm converting string timestamp using var timestamp = new date(month+"/"+day+"/"+year).gettime()/ 1000; my question how set utc timezone before converting timestamp ? use date.utc() method instead of .gettime() . var timestamp = date.utc(year,month,day) / 1000; (note: month expected 0-11, not 1-12.)

c# - is Microsoft.Practices.EnterpriseLibrary.Data.Database.SetParameterValue thread safe? -

i'm using database run queries , thinking optimize stuff up. i doing 2 static objects : private static database db = ... ; private static dbcommand cmd = db.getsqlstringcommand("... col = @colparam"); .... cmd.prepare(); //one call and thinking do: db.addinparameter(cmd, "colparam", dbtype.string, "some value on each call") when calling it. it works 1 time. after first call receive variable names must unique within query batch or stored procedure an error message regarding @colparam parameter. so thinking in replacing add set @ each call: db.setparametervalue(cmd, "colparam", "some value on each call") but safe? have feeling...??!?!?!?. is thread safe have 1 command object on set value on each call? if 2 users set value @ same time? happens then? this in premature optimisation bucket. not sure think optomising. your real questions should dbcommand thread safe. answer no. documenation on db...