Posts

Showing posts from January, 2010

c++ - New C++11 range-for (foreach) syntax: which compilers support it? -

i saw c++11 code fragment in this boostcon presentation jeremy siek : deque<int> topo_order; topological_sort(g, front_inserter(topo_order)); (int v : topo_order){ //line 39 cout << tasks[v] << endl; } upon trying compile in gcc there following error: main.cpp:39: error: expected initializer before ‘:’ token which got me wondering, compilers support syntax? well, @ least gcc supports in 4.6 (feature called "range-based for"). if have latest version, don't forget add -std=c++0x option.

autocomplete - ASP.NET MVC3 Razor - Auto-complete Tutorial? -

how implement auto-complete asp.net, mvc3, , razor? you use jquery ui autocomplete control along mvc action returns jsonresult right data

javascript - Change Focus after button press -

i have simple button calls routine onclick. use document.getelementbyid('start').disabled=true; to disable button can not pressed again. on things there no problem after that. in 1 instance need detect key presses, or rather key releases once button klicked.i use document.onkeyup=wichkeypressed; to detect key press. works fine if not disable button, not work if disable button. it must focus problem. if click mouse on blank area on screen, key press detected or without disabling button. have tried changing focus several other elements, far no go. have given body id , tried change focus it, results remain same. i appreciate ideas on subject. thank you. instead of disabling button, add css class , set flag preventing action happening again when button clicked.

linux - Grabbing Images from a Webcam to be used with OpenCV -

this follow previous question, opencv ps 3 eye can suggest library allow me grab frames camera without fuss (like video videoinput lib windows) , pass them opencv within application? i had parallel problem using different webcam: worked in cheese/etc, v4l-info showed proper setup, opencv fail with: highgui error: v4l2: pixel format of incoming image unsupported opencv unable stop stream.: bad file descriptor after flailing found at least 1 guy had similar problems webcams in various applications. in blind faith promptly punched in export ld_preload=/usr/lib/libv4l/v4l1compat.so , « poof » worked. the opencv v4l2 interface not robust v4l implementation , export quick workaround (opencv appears revert v4l). with quick browse of opencv/modules/highgui/src/cap_v4l.cpp appear though opencv use v4l2. i'm running ubuntu lucid 2.6.32-28-generic x86_64, libv4l-0 v0.6.4-1ubuntu1 opencv pulled head of repo few days ago. in course of explaining i've res...

How does the Image Hover jQuery plugin work? -

i use image hover plugin on website. since have used jquery week, not skilled. following: on website have sorts of thumbnails created shows previews of projects. want is, when come across picture "hovered" there pattern picture were. (this pattern @ images meant.) can me implement code? this part of fade: if(opt.fade){ var offset = node.offset(); var hover = node.clone(true); hover.attr('src', hoverimg); hover.css({ position: 'absolute', left: offset.left, top: offset.top, zindex: 1000 }).hide().insertafter(node); node.mouseover( function(){ var offset=node.offset(); hover.css({left: offset.left, top: offset.top}); hover.fadein(opt.fadespeed); node.fadeout(opt.fadespeed,function(){node.show()}); } ); hover.mouseout( function(){ node.fadein(opt.fadespeed); hover.fadeout(opt.fadespeed...

Simple PHP XSS / Urlencode Question -

i have email address param email addresses passed un-encoded so: http://domain/script?email=test+test@gmail.com what php escaping/encoding let me safely display email address on input field on page? everything tried causes encoded chars show instead of user-friendly email address (i.e. test%2btest%40test.com) update - here's i've tried: going ?email=test+test@gmail.com to: urlencode($_get['email']) = test+test%40test.com (@ sign encoded) htmlspecialchars($_get['email']) = test test@test.com (lost +) htmlspecialchars(urlencode($_get['email']) = test+test%40test.com (@ sign encoded) recall i'm trying take unencoded url email param , safely output value of input field while keeping plus signs intact. maybe should try this? str_replace("%40", "@", htmlspecialchars(urlencode($_get['email']))) if want safely output in value of input field, need htmlencode first htmlspecialchars . example : ...

Gmail won't send attachment from my application on Android -

i trying add emailing capabilities android application. trying send file contains json string representing application data using action_send intent. problem on device, htc desire froyo, gmail sends actual email, not attachment, though see attachment when gmail app starts attached. however, on emulator, using default email application, works fine. works if using application such astro file manager send attachment directly sd card it's default suggested mime type. encountered similar? code looks this: intent sendintent = new intent(intent.action_send); sendintent.settype("application/sal"); sendintent.putextra(intent.extra_subject, "shopping list"); log.d(tag, "attachment file: " + uri.parse("file:/" + filewithpath)); sendintent.putextra(intent.extra_stream, uri.parse("file:/" + filewithpath)); i have tried variety of mime types also, such application/json or text/plain same result. apparently, there issue uri...

android - The application has stopped unexpectedly! Arraylist Hashmaps and TabHost -

i have problem code , don't seem find ! error is...application has stopped unexpectedly! don't have clue what's going on. (i'm devandroid begginer) first tab works ok, when switch second 1 arraylist hashmap, crashes. here bonuriactivity code: public class bonuriactivity extends listactivity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.tab_bonuri); final string url="http://xxxzzz/throwdata.php?p=bonuri"; listview lv = (listview) findviewbyid(android.r.id.list); simpleadapter adapter = new simpleadapter(bonuriactivity.this, getbonuri(url), r.layout.list_bon, new string[] {"produs", "cantitate", "um", "idvinzare"}, new int[] { r.id.produs, r.id.cantitate, r.id.um, r.id.idvinzare }); lv.setadapter(adapter); } private arraylist<hashmap<string,string>> getbonuri(string key_121)...

HABTM and belongsTo at the same join, cakePhp -

i have model fix relationship habtm device model. device model has belongsto device_type model, this, getting device type name: var $belongsto = array('device_type'=>array('fields'=>'name')); so, need every fix, devices , device_types. when make fix->find('all', array('recursive' => 2)) expect every device related fix ( this works ok ) , every device, device_type.name (which not working). instead every device in result ( an empty array ): ["device_type"]=> array(0) { } besides this, when make query testing: fix->device->find('all') , returns current device_type.names every device related fixes, means models related propertly. any help? thanks. first thing notice, naming conventions should lower case under_score multi-word table names. and apparent relationships not set correctly if not getting data on recursive 2. it's kind of hard make more judgement limited code.

What are some good ways to parse HTML and CSS in Perl? -

i have project input files used xml. i'm being asked start processing html embedded css instead, , i'd accomplish cleanly , few code changes possible. using xml::libxml parse xml files, we're moving html css, i'm thinking i'll need move else. said, before dig myself knee deep silly decisions i'll regret, wanted ask here: guys use kind of task? the structures of old xml , new html input files pretty similar, both holding same information. html uses divs in place of xml's text nodes, , holds style information in style tags , attributes instead of separated xml attributes. an example of old xml is: <text font="timesnewroman,bolditalic" size="11.04" x="59" y="405" w="52" h="12" bold="yes" italic="yes" cs="4.6" o_bbox="59,405;52,12" o_size="11.04" o_cs="4.6"> text </text> an example of new html is: <div o...

hierarchical data - SQL Server Tree Query -

i need ms sql server query. i’m not of dba. have application organization table made of parent-child relationship: create table [dbo].[organizations]( [orgpk] [int] identity(1,1) not null, [orgparentfk] [int] null, [orgname] [varchar](200) not null, constraint [pk__organizations] primary key clustered sample data looks this: orgpk, orgparentfk, orgname 1, 0, corporate 2, 1, department 3, 1, department b 4, 2, division 1 5, 2, division 2 6, 3, division 1 7, 6, section 1 8, 6, section 2 i'm trying generate query returns org path based on given orgpk. example if given orgpk = 7 query return 'corporation/department b/division 1/section 1' if give orgpk = 5 return string 'corporation/department a/division 2' thank assistance. with organizationsh (orgparentfk, orgpk, orgname, level, label) ( select orgparentfk, orgpk, orgname, 0, cast(orgname varchar(max)) label organizations orgparentfk null union ...

c++ - Code coverage and Profiling command line tool in VS2010 Ultimate -

i can run commands generate .coverage file code coverage result. vsinstr -coverage helloclass.exe /exclude:std::* vsperfcmd /start:coverage /output:run.coverage helloclass vsperfcmd /shutdown can use same tool getting profiling report? if so, can that? if not, tools available profiling in vs2010? profiling uses same toolset code coverage, commands different. profiling, can both instrumentation , sample profiling. for instrumentation profiling (the similar code coverage): vsinstr myapp.exe vsperfcmd /start:trace /output:trace.vsp myapp vsperfcmd /shutdown for sample profiling (sampling): vsperfcmd /start:sample /output:sample.vsp /launch:myapp.exe vsperfcmd /shutdown these steps change if you're profiling managed code (you need use vsperfclrenv ). msdn has documentation , examples on using profiling command-line tools .

disable the notification of sms in android -

possible duplicate: can delete sms in android before reaches inbox? i working on android sms app , want disable sms notification particular messages. had tried shared preference uncheck sms notification didn't work;after tried update message status using broadcast receiver onreceive method notification appers....can suggest me how disable sms notificatioin of native android sms app using shared preference or other way thank in advance you intercept sms in broadcastreceiver , abort broadcast prevent sms apps seeing it, manually insert sms sms contentprovider . but that's terrible, fragile, uses non-public apis , possibly break third-party sms applications. so basically, no can't properly.

java - Base class does not define equals but sub-class needs to. How to implement? -

i don't have access base class code. need able define equals in sub-class take base class properties consideration. additionally base class not have protected fields. fields accessible through accessors/mutators. would considered bad comparisions of base class fields in sub-class equals ? why ? i need because base class has default equals not work purpose has fields need taken consideration when doing sub-class equals... yes, can this, there won't problems calling getters in superclass can determine equality way want, long follow contract: reflexive : x.equals(x) should return true. symmetric : x.equals(y) == y.equals(x) transitive : x.equals(y) && y.equals(z) => x.equals(z) consistent : multiple invocations of x.equals(y) consistently return true or false unless x or y mutated between calls. and equals-hashcode contract: equal objects must have equal hashcodes http://download.oracle.com/javase/6/docs/api/java/lang...

html parsing - extracting paragraph in python using lxml -

i extract paragraphs in html python. used lxml module doesn't looking for. print html.parse(url).xpath('//p')[1].text_content() <span id="midarticle_1"></span><p>here first paragraph.</p><span id="midarticle_2"></span><p>here second paragraph.</p><span id="midarticle_3"></span><p>paragraph three."</p> i should add that, in different pages have different number of paragraph, make list , put paragraph after that. print html.parse(url).xpath('//p/text()') output ['here first paragraph.', 'here second paragraph.', 'paragraph three."']

c# - Unable to create a constant value of type 'Closure type' -

here linq entity query , i'm getting error "unable create constant value of type 'closure type'. primitive types ('such int32, string, , guid') supported in context. " does 1 know how fix or workaround. ps. i'm using linq entity not linq sql list<int> listint list<int> listinttwo return (from oa in _entity.tableone join cc in _entity.tabletwo on oa.tablesix.columnone equals cc.tablesix.columnone join os in _entity.tablethree on oa.tablethree.columntwo equals os.columntwo join cs in _entity.tabletwotatus on cc.tabletwotatus.columnthree equals cs.columnthree join app in _entity.tablefour on cc.tablefour.columnfour equals app.columnfour join cl in _entity.tablefive on app.tablefive.columnfive equals cl.columnfive listint.any(x =>x == cc.tabletwotatus.columnthree) && listinttwo.any(x => x == os.columntwo) && cc.tablesix.columnone == colu...

ios - How to get Core Data object from specific Object ID? -

i can object's id in core data using following code: nsmanagedobjectid *moid = [managedobject objectid]; however, there way object out of core data store giving specific object id? know can using nsfetchrequest, this: nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"document" inmanagedobjectcontext:managedobjectcontext]; [fetchrequest setentity:entity]; nspredicate *predicate = [nspredicate predicatewithformat:@"(objectid = %@)", myobjectid]; [fetchrequest setpredicate:predicate]; however, i'd in way not initiate own fetch request. ideas? you want: -(nsmanagedobject *)existingobjectwithid:(nsmanagedobjectid *)objectid error:(nserror **)error fetches object store has id, or nil if doesn't exist. (be aware: there 2 methods on nsmanagedobjectcontext similar-seeming names tripped me up. keep them straight, here's ...

c# - Filtering an array with duplicate elements -

i have array of fileinfo objects duplicate elements i'd filter, i.e.e remove duplicates, elements sorted last write time using custom comparer. format of file names follows: file{number} {yyymmdd} {hhmmss}.txt what i'd know if there's elegant way of filtering out 2 files same file number recent present in list, i.e. have 2 elements in array following file names: file1_20110214_090020.txt file1_20101214_090020.txt i keep recent version of file1 . code have getting files follows: fileinfo[] listoffiles = disearch.getfiles(filesearch); icomparer compare = new filecomparer(filecomparer.compareby.lastwritetime); array.sort(listoffiles, compare); thanks help. update: forgot add caveat, program in question using .net 2.0, no linq unfortunately. sorry confusion, above corrected file number same with linq, do: var listoffiles = disearch .getfiles(filesearch) .groupby(file => file.name.substring(file.name.i...

sorting - Radix sort in java help -

hi need improve code. trying use radixsort sort array of 10 numbers (for example) in increasing order. when run program array of size 10 , put 10 random int numbers in 70 309 450 279 799 192 586 609 54 657 i out: 450 309 192 279 54 192 586 657 54 609 don´t see error in code. class intqueue { static class hlekkur { int tala; hlekkur naest; } hlekkur fyrsti; hlekkur sidasti; int n; public intqueue() { fyrsti = sidasti = null; } // first number in queue. public int first() { return fyrsti.tala; } public int get() { int res = fyrsti.tala; n--; if( fyrsti == sidasti ) fyrsti = sidasti = null; else fyrsti = fyrsti.naest; return res; } public void put( int ) { hlekkur nyr = new hlekkur(); n++; nyr.tala = i; if( sidasti==null ) f yrsti = sidasti = nyr; else { sidasti.naest = nyr; sidasti = nyr; } } public int count() { return n; }...

c# - Regex return between -

i have following code. note wild card want. (please forgive bad code before final refactor). string findregex = "{f:.*}"; regex regex = new regex(findregex); foreach (match match in regex.matches(blockoftext)) { string findcapture = match.captures[0].value; string between = findcapture.replace("{f:", "").replace("}", ""); } what dont code trying in between found, double replace statements. there better way? additional: here sample string dear {f:firstname} {f:lastname}, you can use parens group part of match , extract later: string findregex = "{f:(.*?)}"; regex regex = new regex(findregex); foreach (match match in regex.matches(blockoftext)) { string between = match.captures[1].value; } if want 2 matches (e.g. first-name last-name example), make 2 groups: string findregex = "{f:(.*?)}.*?{f:(.*?)}"; regex regex = new regex(findregex); foreach (match match in regex.matches(blocko...

objective c - load webview content in the initializer -

this ipad app. press 1 of 2 buttons , presents modal view controller containing webview display pdf. created uiviewcontroller class containing webview, , want use 1 of 2 initializers depending on button user pushes. when initialize object want set pdf displayed. modal view coming blank(no pdf displayed). however, when use same code within -(void)viewdidload{} work. why this? thanks! - (id)initaspi{ nslog(@"initaspi called"); [super init]; nsstring *urladdress = [[nsbundle mainbundle] pathforresource:@"pipdf" oftype:@"pdf"]; nsurl *url = [nsurl fileurlwithpath:urladdress]; nsurlrequest *urlrequestobj = [nsurlrequest requestwithurl:url]; [prescribinginfowebview loadrequest:urlrequestobj]; return self; } initialization your initialization method wrong. read implementing initializer - handling initialization failure @ ... http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/articl...

CSS Float left question -

Image
the following code injected page via jquery. can't change that, can change css: <div id="slideshow-prevnext" class="slideshow-prevnext"> <a id="prev" class="left" href="#"><span class="invisible">prev</span></a> <a id="next" class="right" href="#"><span class="invisible">next</span></a> <a href="#" class="dot">&nbsp;</a> <a href="#" class="dot">&nbsp;</a> <a href="#" class="dot">&nbsp;</a> </div> i want 3 <a href="#" class="dot">&nbsp;</a> appear on left of , 2 ("prev" , "next") on right. how can it? tried float:left not work. edit : css long post. development site here @ : http://site2.ewart.library.ubc.ca/ i'm not par...

Show/hide using jQuery cookies -

so i've created simple tip box fades in on page load, option close box. i'm trying make box hidden if visitor clicks close link. i'm new cookies, i'm doing wrong, have: $('#close').click(function(e) { jquery.cookie('tip', 'hide', cookieopts); $(this).parent('div.tip').fadeout(1000); e.preventdefault(); }); jquery.cookie('tip', 'show', cookieopts); $('.tip').delay(500).fadein(1000); var shouldshow = jquery.cookie('tip') == 'show'; var cookieopts = {expires: 7, path: '/'}; if( shouldshow ) { $('.tip').delay(500).fadein(1000); } else { $('.tip').css('display', 'none'); } i revised code: http://jsbin.com/ujixi4/4/edit a little bit simpler, achieves want. var cookieopts = {expires: 7, path: '/'}; //this isnt working reason alert('c:...

asp.net - How do I print an ASP clientID in a web page? -

how print asp clientid in web page? <td class="coldatos" colspan="1"><asp:textbox id="fecha_aplicacion" runat="server" width="85%"></asp:textbox> <a href="javascript:alert('<%=fecha_aplicacion.clientid %>')"> mostrar fecha </a></td> update: need print in asp side, no code behind side(onload,oninit,etc)( i'm not familiar asp terms) client side only: <a href='javascript:alert("<%= fecha_aplicacion.clientid %>")'> how work? i believe if not work yet single/double quote escapes...

java - Invisible Window with visible components -

i'm looking way use image window, or, @ least, in appearance. logical solution seems using invisible window visible components. google offers me 2 solutions : awful 1 : take screenshot of under window , use background while making window undecorated. "on way official" 1 : use awtutilities make window transparent. cool, doesn't work icedtea or linux (i didn't try official jre on linux yet). is there other way achieve same result (using awt or swing) ? unfortunately quick answer window transparency @ least no (unless wants prove me wrong, love!) screenshots may work better think though if contents of window aren't changing much. the awtutilities method (or same thing in official api java 7 onwards) requires hardware acceleration prohibits working 100% reliably across platforms, it's not guaranteed work on windows boxes.

lisp - how to make sbcl automatically load a core? -

i have core saved. how make sbcl load automatically? the -core command line argument should it. man page: --core <corefilename> use specified lisp core file instead of default. (see files section standard core, or system documentation sb-ext:save-lisp-and-die information how create custom core.) note if lisp core file user-created core file, may run nonstandard toplevel not recognize standard toplevel options.

(PHP) Extracting the correct birthdate when searching for age in a database -

in database have field set birthdate (e.g. 1989.08.10 (yyyy.mm.dd)). have function converts info correct year (e.g. 17, 22, 30 years). in search engine i'm making have query built various inputs required user, whereas 2 of these age, min , max. example, select ages between 18-25. my problem i'm not sure how i'm supposed finished results can't imagine how add query. presume have make 2 while loops somehow finished result: while($row = mysql_fetch_array($query){ $age = convertfunc($row['birthdate']); while(xxxxx){ code here } } i'm quite lost on this, clarify. want similar in search query against database: select * users user = '$name' , fromage >= 18 , toage <= 25 this select fields corresponding age min , max. try like. select * users datediff(birthdate,now()) between date_add(now(),interval -15 years) , date_add(now(),interval -25 years)

Trying to solve an unknwon segmentation fault in C -

i'm trying learn how use fast fourier transform, , have copied fft algorithm numerical recipies in c called four1. have written small function test fourier transforms simple function. upon execution program returns segmentation fault. can't find fault can me? #include <stdio.h> #include <math.h> #define swap(a,b) tempr=(a);(a)=(b);(b)=tempr void four1(float data[], unsigned long nn, int isign) { unsigned long n,mmax,m,j,istep,i; double wtemp,wr,wpr,wpi,wi,theta; float tempr,tempi; n=nn << 1; j=1; (i=1;i<n;i+=2) { if (j > i) { swap(data[j],data[i]); swap(data[j+1],data[i+1]); } m=n >> 1; while (m >= 2 && j > m) { j -= m; m >>= 1; } j += m; } mmax=2; while (n >...

python - what is this url mean in django -

this code : (r'^q/(?p<terminal_id>[^/]+)/(?p<cmd_type>[^/]+)/?$', 'send_query_cmd'), the view : def send_query_cmd(request, terminal_id, cmd_type): waht ?p mean . i dont know url mean , thanks (?p<id>regexp) syntax python regular expression named group capturing. http://docs.python.org/library/re.html ->> scroll down (?p... as p stands for.. parameter? python? origin sounds fun. anyways, these same regular expressions django url resolver uses match url view, along capturing named groups arguments view function. http://docs.djangoproject.com/en/dev/topics/http/urls/#captured-parameters the simplest example this: (r'^view/(?p<post_number>\d+)/$', 'foofunc'), # we're capturing simple regular expression \d+ (any digits) post_number # passed on foofunc def foofunc(request, post_number): print post_number # visiting /view/3 print 3.

cocoa touch - Automatic Subscription In-App Purchases: Restoring Subsequent Renewals -

according apple in app purchase programming guide: the app store creates separate transaction each time renews subscription. when application restores previous purchases, store kit delivers each transaction application. let's imagine app subscription client-side-only (no server component). simplest way verify subsequent renewals have been billed seems restoring previous purchases every month. however , pops user's itunes password prompt every time call restorecompletedtransactions seems bad user experience. recourse use server receipt verification code (along new "shared secret")? the app store calls paymentqueue , posts transaction each time auto-renews. transaction posted transaction.transactionstate==skpaymenttransactionstaterestored. the issue unfortunately gets posted 1 device. second device not posting. therefore, detect auto-renewal, or rather detect lack of autorenewal , deny device continuing subscription, have restorecompletedtransa...

Adding Column to GridView data source and bind data to it at run time, C# -

i working on task requires binding data gridview has 7 columns. 6 columns of gridview binded dataset database sql command... need bind last column dynamically @ run time data comes file @ run time. there mechanism add 7th column datasource @ run time , bind it's value? . . e.row.cells(7).text = f.name.tolower.replace(cstr(databinder.eval(e.row.dataitem, "licensename")).tolower, "").replace(".7z", "").trim . . how got value you need template column, : <columns> ... ... <asp:templatefield> <itemtemplate> <asp:label id="lblseventhcol" runat="server" ondatabinding="lblseventhcol_databinding"></asp:label> </itemtemplate> </asp:templatefield> </columns> and protected void lblseventhcol_databinding(object sender, eventargs e) { (sender label).text = getdynamicdata(); }

php - Strangest Issue With IE -

i'll try specific possible. know impossible debug without being able replicate issue maybe can advise how can go debugging because i'm out of options. i have application allows user select screenshots , print them. when click print, takes user new page , displays images in minimal template. user prints page straight in browser. the user's selection of images passed on using session. in every other browser session correctly obtained , images displayed. in people's ie case. in ie , few others, session not there..wait it..until manually press refresh button. i'm on verge of canceling support ie better developer in me tells me have through somehow. i tried meta refresh if no session. page keeps refreshing. session not obtained until literally press refresh button. i have tried: deleting cache, disabling cache, deleting temp internet files, using ie tester , testing other ie versions. i'm on win 7 64 bit if makes difference. i'm @ wits end this...

android - How to clear stack history? -

consider having application containing activity a,b,c. launched launcher , b launched a. b has button. requirement on clicking button on b present history of activity stack a->b should clear , history stack must contain c. possible ? if plz advise me... thanks in advance ! although tedious, can done launching using activity methods startactivityforresult(), setresult(), finish(), , onactivityresult(). in pseudo-code: a: startactivityforresult(b) b: startactivityforresult(c) c: startactivity(d); setresult(clear); finish() d: ... b: (onactivityresult) setresult(clear); finish() a: (onactivityresult) finish() if you're willing change architecture bit more "natural" way use flag_activity_clear_top easy way go a, b, c a. a third way set a, b, , c use nohistory, lose ability out of c b or a.

javascript - How can an Eclipse plugin programmatically change JSDT's default formatter template? -

Image
i'm developing plugin extends eclipse jsdt , change default profile javascript formatter (so plugin users don't need preferences->javascript->code style->formatter->import) i couldn't find obvious jsdt extension points. there way plugin or need own rebuild of jsdt? it seems there no way extend. anyway, because of issue , few other fixes need haven't yet made jsdt, decided include forked copy of jsdt in plugin. , formatting improvement takes 2 changed lines:

android - The application stops running when executing getLac(),getCellId() -

this code,i cant able value of cellid , lac value.this code, public class lac extends activity { private int mcid ; private int mlac ; gsmcelllocation location; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); telephonymanager tel=(telephonymanager)getsystemservice(context.telephony_service); location = (gsmcelllocation) tel.getcelllocation(); mlac=location.getlac(); mcid=location.getcid(); toast.maketext(getapplicationcontext(),"lac="+mlac+"cellid="+mcid+type,toast.length_long).show(); } } when run emulator says application stops running unexpectedly.i used permission (access_coarse_location),(access_fine_location) . mlac=location.getlac(); i sure returning null (-1) , getting nullpointerexception because gsm location area code unknown , try running on device instead of emulator.

c# - Generating html to pdf using itextsharp -

public void pdfgenforffd(textbox textbox3, hiddenfield hiddenfield1, hiddenfield hiddenfield4, ajaxcontroltoolkit.htmleditor.editor editor1) { httpcontext.current.response.clear(); httpcontext.current.response.contenttype = "application/pdf"; // create pdf document document pdfdocument = new document(pagesize.a4, 50, 25, 15, 10); pdfwriter wri = pdfwriter.getinstance(pdfdocument, new filestream("d://" + hiddenfield1.value + "_" + hiddenfield4.value + ".pdf", filemode.create)); pdfwriter.getinstance(pdfdocument, httpcontext.current.response.outputstream); pdfdocument.open(); string htmltext = editor1.content; //string htmltext = htmltext1.replace(environment.newline, "<br/>"); htmlworker htmlworker = new htmlworker(pdfdocument); htmlworker.parse(new stringreader(htmltext)); pdfdocument.close(); httpcontext.current.response.end(); } i using above code pdf generation h...

oracle - How to set new date entries to current date? -

i trying create trigger. supposed update new date entry sysdate. far, have following code. however, "invalid table name" , "sql statement ignored" errors. create or replace trigger new_orders after insert on orders each row begin if inserting update set order_date := sysdate; end if; end; / create or replace trigger new_orders before insert on orders each row begin :new.order_date := sysdate; end; /

pinvoke - setting the system time with C#.NET without using kernel32.dll -

is there way set system time in c#.net without using kernel32.dll? i'm on 64 bit system , calling set time function seems return "false" me. the .net framework not concern low level system management concerns of nature. the problem here cannot ask question without telling why matters you, people can contextualise answer without having psychic. why need this? quicker? worried dll might not on system :d one way of finding out use reflector (get while it's hot) kernel32 method name- chances whatever wrapping using p/invoke and, unless they're paying silly buggers use same name wrapper stub.

Adding Dyanmic In() Conditions in Sql Server -

facing problem generating sql server query in following query dynamic conditions added check whether value null or not select * tblemployees employeename = case when @employeename not null @employeename else employeename end but need add in () conditions , parameter in in () null or blank ,if parameter /string passed in condition blank donot want add condition in query. so how can achieve this.a helping hand useful me. thanks , regards, d.mahesh depending on value of parameter (blank of not), can create sql string accordingly. declare @sqlcommand varchar(1000) if(isnull(@yourparameter,'')='') @sqlcommand = 'your query goes here' else @sqlcommand = 'your query goes here' and then, run using dynamic query execution exec (@sqlcommand) if not dynamic query then, select .... .... case when isnull(...

c# - Cross-Page PostBack error when posted from one folder to another -

i'm getting 'object reference not set instance of object.' error on previouspage after using postbackurl. i created simple test page recreate problem, worked fine, until moved source , destination pages different folders. reason previouspage object null? how fix it? both folders source , destination pages in in root directory of website. source page: /companies/test.aspx <asp:content runat="server" id="content" contentplaceholderid="fullpage"> <asp:textbox id="demo" runat="server"></asp:textbox> <asp:linkbutton id="testlink" text="test" runat="server" postbackurl="~/documents/test2.aspx"> testing </asp:linkbutton> </asp:content> public string myvariable { { return demo.text; } } destination page: /documents/test2.aspx <%@ previouspagetype virtualpath="~/companies/test.aspx" %> ...

jquery - Simultaneous :hover for parent and its child element -

is possible use jquery achieve simultaneous ":hover" both parent , child element @ same time ? specifically, both parent , child change background images when ever cursor moves on parent tag changing child elements background well. the reason ask make nav-bar out fixed backgrounds functions more dynamically when changing content. please ask if of unclear. , have nice day. why want use jquery achieve this? div.parent:hover { background: red; } div.parent:hover div.child { background: blue; } this won't work in ie6 since ie6 supports :hover on parent tag.

c# - Update issue with data-bound Listbox and PropertyGrid -

this part of aoi class (nothing special it): class aoi : inotifypropertychanged { private guid _id; private string _name; private string _comment; public guid id { { return _id; } } public string name { { return _name; } set { _name = value; onpropertychanged("name"); } } public string comment { { return _comment; } set { _comment = value; onpropertychanged("comment"); } } public override string tostring() { if (_name.length > 0) { return _name; } else { return _id.tostring(); } } } i keep them in bindinglist<aoi> bound listbox . in selectedvaluechanged event of listbox assign selected object propertygrid , user can modify aoi . this works fine except name field (which displayed in listbox (...

defining variables in Javascript -

i have many variables in javascript function , don't fit on 1 line declaration. var query_string = $('list_form').serialize(), container = $('list_container'),position = container.cumulativeoffset(), layer = $('loaderlayer'), remote_url = "/web/view/list_offers.php?" + query_string; is there way define these variables on multiple lines 1 var keyword? var query_string = $('list_form').serialize(), container = $('list_container'), position = container.cumulativeoffset(), layer = $('loaderlayer'), remote_url = "/web/view/list_offers.php?" + query_string; if recall correctly, pattern advocated doughlas crackford declare multiple variables script needs. quick tip: beawere of javascript hoisting :)

php - Select where a value present -

first database example: id, product_id, cat, name, value -------------------------------- 1,1,algemeen,processor,2 ghz 2,1,algemeen,geheugen,4 gb 3,2,algemeen,processor,3 ghz 4,2,algemeen,geheugen,4 gb 5,3,beeldscherm,inch,22" 6,3,beeldscherm,kleur,zwart 7,3,algemeen,geheugen,3 gb 8,3,algemeen,processor,3 ghz i want 1 query select follow id's: 1,2,3,4,7,8 because cat = algemeen , name = processor these products. id 5,6 present product 3. so, entry's (cat , name) present products (product_id) have selected. the database contains 80.000 entry's lot of diffrent cat's, name's , value's. is possible 1 query or php necessary? how do this? my apologies bad english. i think mean, show records combination of (cat, name) present in product_ids, right? select t.id, t.product_id, t.cat, t.name, t.value ( select cat, name tbl group cat, name having count(product_id) = count(distinct product_id) ) p join tbl t on t.cat = p.cat , t.n...

iphone - Saving the value of UISlider -

i've managed implement uislider in cocos2d works surprise. i've been looking through nsuserdefaults samples can't work correctly. wondered if help. think have saving of value correct. - (void) valuechanged:(float) value tag:(int) tag{ if (tag == 1) // music volume [self updatelabel:value]; [cdaudiomanager sharedmanager].backgroundmusic.volume = value; cclog (@"unknown slider"); nsuserdefaults *prefs = [nsuserdefaults standarduserdefaults]; [prefs setfloat:value forkey:@"floatkey"]; [prefs synchronize]; } it's reloading defaults i'm kind of stuck, i've put in initialization of class. i'm not sure if should go there... nsuserdefaults *userdefaults = [nsuserdefaults standarduserdefaults]; if ([userdefaults floatforkey:@"floatkey"]) { [userdefaults setfloat:value forkey:@"floatkey"]; } in initialization, setting value floatkey in prefs instead of getting it. w...

checking database in android -

i have check whether database exists or not in android?? how can check? should return boolean value after checking?plz provide me code. something like: private boolean databaseexists() { sqlitedatabase checkdb = null; try { string mypath = db_path + database_name; checkdb = sqlitedatabase.opendatabase(mypath, null, sqlitedatabase.open_readonly); if(checkdb != null){ checkdb.close(); return true; } else { //database not exist return false; } } catch (sqliteexception e) { //database not exist return false; } }

static method with private methods within it [C#] -

i wanted make class draw have static method consolesquare() , wanted make other methods in class hidden ( private ).but got errors in marked places , don't know how solve them , still achieve same idea ( consolesquare() - static ; other methods hidden ) class draw { private string spaces(int k){ string str=""; for(;k!=0;k--) str+='\b'; return str; } private string line(int n,char c){ string str=""; for(;n!=0;n--) str+=c; return str; } public static void consolesquare(int n,char c){ string line = line(n,c); // ovdje string space = c + spaces(n - 2) + c; //ovdje console.writeline(line); (; n != 0; n--) console.writeline(space); console.writeline(line); } } declare them private static .

symfony1 - symfony 1.4 propel:build-all not working on Mysql 5.5 -

i using symfony 1.4.8 , mysql 5.5 got error when run symfony propel:build-all you have error in sql syntax; check manual corresponds mysql server version right syntax use near ‘type=innodb’ @ line 1 1 fixed issue. seems in ddl, can’t “type=innodb|myisam|foo” anymore. have “engine=innodb|myisam” edit 1 file symfony/lib/plugins/sfpropelplugin/lib/vendor/propel-generator/classes/propel/engine/builder /sql/mysql/mysqlddlbuilder.php line 156, change follows:- $script .= “engine=$mysqltabletype”;

How do I convert characters like "&#58;" to ":" in python? -

possible duplicate: convert xml/html entities unicode string in python in html sources, there tons of chars "&# 58;" or "&# 46;" (have put space between &# , numbers or these chars considered ":" or "."), questions is, how convert them supposed in python? there built in method or something? hopefully can me out. thanks i not sure there built-in library or not, here quick , dirty way regex >>> import re >>> re.sub("&#(\d+);",lambda x:unichr(int(x.group(1),10)),"&#58; or &#46;") u': or .'

creating menu in Android -

i creating android application involves menu.can provide me sample code code of creating menu. in advance tushar http://developer.android.com/guide/topics/ui/menus.html for pleasure, some code: @override public void oncreatecontextmenu(contextmenu menu, view v, contextmenuinfo menuinfo) { super.oncreatecontextmenu(menu, v, menuinfo); menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.context_menu, menu); }

iphone - UIScrollView Horizontal scrolling - Disable left scroll -

how can disable scrolling left on uiscrollview. users can scroll right? thanks ** * update * **** this have now. have subclassed uiscrollview , overwritten following methods @implementation touchscrollview - (bool)touchesshouldbegin:(nsset *)touches withevent:(uievent *)event incontentview:(uiview *)view { nslog(@"touchesshouldbegin: touched!"); return yes; } - (bool)touchesshouldcancelincontentview:(uiview *)view { nslog(@"touchesshouldcancelincontentview: touched!"); return no; } in viewcontroller have set following attributes: scrollview.delayscontenttouches = no; scrollview.cancancelcontenttouches = yes; touchesshouldbegin being called touchesshouldcancelincontentview not being called , cant figure out why!! thanks just add in uiviewcontroller uiscrollviewdelegate float oldx; // here or better in .h interface - (void)scrollviewdidscroll:(uiscrollview *)ascrollview { if (scrollview.contentoffset.x < oldx) ...

Google chrome html5 support -

is there ready official reference html5 support google chrome? see chrome , chromium blogs has lot of information, looking table or simple page 1 can see developments on html5 support. example want see when html5 datepicker supported? (as read online, opera supports now( articles 1 year old:-) ) thanks. check out when can use... helpful! to answer question: it's supported in opera , chrome. full support browsers isn't expected in near future.

php - in_array - 'in_object' equivalent? -

is there such function in_array , can used on objects? nope, can cast object array , pass in_array() . $obj = new stdclass; $obj->one = 1; var_dump(in_array(1, (array) $obj)); // bool(true) that violates kinds of oop principles though. see comment on question , aron's answer .

A Base page in ASP.NET -

do recommend every web site created in visual studio, should create base page serves parent class? what exact benefits/drawbacks? if want override way in asp.net works, can more efficient build base class rather including code in every page. 2 specific instances i've done are: ispostback little-known fact: it's quite feasible craft request that, asp.net, looks postback submitted request. this? hackers, that's who. call ispostback in case return true , shoud return false . round this, build base class overrides ispostback: public class mybase inherits system.web.ui.page <debuggerstepthrough()> _ public shadows function ispostback() boolean 'check built-in ispostback , make sure http post return (page.ispostback andalso request.httpmethod.toupper = "post") end function end class error handling in beginning asp.net security , blowdart talks fact if use asp.net's error handling redirect client c...

HTML-How To Set onclick to be AutoClick -

hey, i'm trying set html file click automaticaly on login button. how can it. try : onclick="window.open(this.href,'_self')". dosen't work. if want trigger click when page loads use: onload="window.open(this.href,'_self')"

how to write database independent layer using Linq -

how can write database independent, data layer using linq sql? example have 1 dbml file, can use database @ runtime ( specifying web.config) entity framwork better option, not implemented in mono can't use it. edit : mean different databases sql server, mysql or sqllite. prefer use dblinq other databases. edit 2 : have created linq sql mapping class following blog post. http://blogs.msdn.com/b/spike/archive/2010/01/08/how-to-use-linq-to-sql-without-using-the-designer-generated-classes.aspx how can use other databases. you need 3rd party linq provider alinq http://www.alinq.org/ suports mono. structured microsoft, linq sql database dependent, ie works ms sql. believe alinq work on mono. here's better list of 3rd party providers: http://blog.linqexchange.com/index.php/links-to-linq-providers/

php - How to use $_POST to send data to a wordpress page? -

hey guys, wanted know how send data wordpress page using $_post ? , page has template named data_page.php should action value in form ? data_page.php or myweb.com/data-page/ ? and thank :d if using mod_rewrite, ( http://codex.wordpress.org/using_permalinks explains), , http://myweb.com/data-page/ mapped function, can write <form action="http://myweb.com/data-page/" method="post"></form>

filing in c language -

possible duplicate: replacing word in file, using c i doing filing in c language. have created txt file , write data it. program progress have search text , replace other word problem facing suppose in file wrote "i bought apple market" if replace apple pineapples , apple has 5 char , pineapple has 9 char write "i bought pineapple m market" that has affect words written after apple because of different char length i have use fseekpos function find pointer position thanks take data io function store in double pointer ( use 2 dimension ) after seeing eof, clear used file, close write function task , manipulate data stored in 2 dimension open again, write manipulated data in

javascript - Js Pagination error -

i need perform pagination need display 5 rows every time. first 5 rows displayed. on second click, next 5, third rows no. 11-15, , on. need display if @ least 1 row there (after n clicks totalrows mod 5 less 5). not this. function rightarrow() { pagecount = document.getelementbyid('pgcnt').value; //totalrows / 5 totcount = document.getelementbyid('totcnt').value; //totalrows currpage = temprows - pagecount + 2; //current set of rows document.getelementbyid('temppage').value = temppage; var m = totcount%5; if(pagecount != temprows) m = 5; else { m = (totcount % 5) - 1; document.getelementbyid('rightarr').disabled = true; } document.getelementbyid('pgcnt').value = document.getelementbyid('pgcnt').value - 1; for(i = 0; < m;i++) { $.ajax({ type: "post", ...

regex - Why are accents accepted in sfValidatorEmail? -

there bug in application, apparently accents in email address not considered error , sfmailer crashing error because of this. digging through code realized wasn't blame. sfvalidatoremail uses regular expression: const regex_email = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i'; accents in first part of email accepted. should sfvalidatoremail not accept accents or should sfmailer accept it? sfmailer should accept it. legitimate have accents in first part of email address.

javascript - Launching an editor in HTML documents -

Image
i'd edit html document adding button , launching editor. for example, add button in html (/abc/def/hello.html), <button type="button">edit code</button> and clicking edit button , want launch editor (textmate example, or other editing software) opening /abc/def/hello.html . of course, editing possible machine made /abc/def/hello.html file. how can that? added if it's not possible open editor, possible store file information clipboard or show dialog box? i'll give name of file, job should easy it's showing file name when user clicks. you're going need server-side scripting support this. first invent own mimtype, call application/x-prosseek-edit, make button link script generates 'application/x-prosseek-edit' file (and serves mime type). file should contain machine readable version of how retrieve file , launch in editor. e.g. <?php header('content-type: application/x-prosseek-edit'); print ...