Posts

Showing posts from September, 2015

python - Can't run monkeyrunner script - java.lang.IllegalArgumentException: Bad level -

i tried shows me middle finger: ~/software/android-sdk-linux_x86-1.6_r1/tools$ sudo ./monkeyrunner -v help.py exception in thread "main" java.lang.illegalargumentexception: bad level "help.py" @ java.util.logging.level.parse(level.java:336) @ com.android.monkeyrunner.monkeyrunneroptions.processoptions(monkeyrunneroptions.java:130) @ com.android.monkeyrunner.monkeyrunnerstarter.main(monkeyrunnerstarter.java:192) it on freshly installed java, jdk, jre, eclipse, androidsdk, adt any ideas? why sudo ? shouldn't use it. other problem missing log level -v: usage: monkeyrunner [options] script_file -s monkeyserver ip address. -p monkeyserver tcp port. -v monkeyserver logging level (all, finest, finer, fine, config, info, warning, severe, off) also, sure have help.py in current working directory or specify path.

java - Upload image using POST, php and Android -

i getting following error message after trying upload image using multipartentity in android: error: problem [picture] (file upload error 4) i using following code upload image: string url = "http://www.uploadurl.com/api/files.php"; httpclient httpclient = new defaulthttpclient(); httpcontext localcontext = new basichttpcontext(); httppost httppost = new httppost(url); multipartentity multientity = new multipartentity(httpmultipartmode.browser_compatible); file file = new file(environment.getexternalstoragedirectory().getabsolutepath() + "/temp/" + image_filename); contentbody cbody = new filebody(file); stringbody sb1 = new stringbody(getnameformatted()); stringbody sb2 = new stringbody(getdeviceid()); multipartentity multipartcontent = new multipartentity(); multipartcontent.addpart("name", sb1); multipartcontent.addpart("uuid", sb2); multipartcontent.addpart("picture", cbody); httppost.setentity(multipartcontent); ...

how to receive response from ajax call with sencha touch from codeigniter / ExtJS -

i trying response codeigniter when send ajax request sencha touch/ ext with ext.ajax.request({// url: formbase.url, //something 'http://path.to/mobile/login/ajax_validatelogin', success: function(response, opts) { console.log('login success!'); console.log('data: ' + response.responsetext); }, failure: function(result){ console.log('login error! '); }, method: 'post', params: form.getvalues() }); form = new ext.form.formpanel(formbase); //... and in codeigniter like function ajax_validatelogin() { $username = $this->input->post('username'); $password = $this->input->post('password'); $data['username'] = 'arschkarte'; //$username; if($username == "f"){ $data["success"] = true; } else { $data[...

java multithreading problem -

below part of code. confused why "notify 1" can not wake function waiting. it seams have with: when 1 thread executing synchronized method object, other threads invoke synchronized methods same object block (suspend execution) until first thread done object. why result not: wait, notify1, wait finish, notify2, . . . instead is: wait, notify1, notify2, notify2, . . . notify2, notify 2, notify 3, wait finish, skip wait, skip wait, skip wait, . . . code { . . . multithreadcontent m; void dividetoparts(file testfile,fileinputstream fileinputstream, object hashmachine) throws ioexception, interruptedexception{ . . . //run here m = new multithreadcontent(fileinputstream,(int)temp23,(int) (testfile.length()%temp23), numberofparts, hashmachine); new thread(new read()).start(); m.upda...

java - Eclipse surround with quotes and other blocks -

i find myself wanting highlight string in eclipse , double or single quoting it. can't seem find shortcut it. in textmate example if highlight string , type either ' or " string surrounded them. same should work ) , } think well. i've added code template doing doesn't ever appear in menu , there doesn't seem way create shortcuts either. note should entirely keyboard driven , not involve secondary menus, that's goal anyway. go java > editor > templates , add new template, e.g. called quote , follows: "${word_selection}"${cursor} then, in editor, write text want quote, highlight it, press ctrl + space , type quote , hit return. highlighted text should quoted now. if don't template proposals when pressing ctrl + space , make sure have them checked in java > editor > content assist > advanced . just tried , works me!

qt - Compiling OpenCV SVN trunk in Windows - error in highgui/libVideoInput -

i know there several questions none has shown me can against error get. using this guide able compile current opencv release (2.2) using guide , cmake. release works fine , can write code using in qt. therefore need with_qt enabled , need build myself. but unfortunately found out 2.2 release doesn't support types of cameras (since camera stream 720p webcam). i've read fixed in latest svn trunk version. so checked newest svn trunk out , ran cmake again, created new folder, selected source files, mingw compile links g++.exe , qcc.exe, configured , enabled "with_qt" , generated necessary makefiles. i started windows powershell admin , tried compile "mingw32-make"... @ 56% crashes this: [ 56%] building cxx object modules/highgui/cmakefiles/opencv_highgui.dir/src/grfmt_sunras.obj [ 56%] building cxx object modules/highgui/cmakefiles/opencv_highgui.dir/src/grfmt_tiff.obj linking cxx shared library ..\..\bin\libopencv_highgui220d.dll creating library...

c++ - Why use QVector(Qt) instead of std::vector -

i'm new c++ , qt, i'm @ c#/java. the point cross-platform, i'm confuse qt. isn't std::vector cross-platform, doesn't qt provide equivalent non-crossplatform thing? also how file , qfile different? a link nice, :) this article loooks good. compares qt template library standard template library: qtl vs stl hope, you'll find interesting seeing differences listed there in article. edit: here find interesting: my opinion biggest advantage of qtl has same implementation (including binary compatibility) on oses supported qt . stl implementations might below par when comes performance or might missing functionality. platforms don’t have stl! on other hand, stl more customizable , available in entirety in header files… like said, there no clear winner . like said, no clear winner. still reading article makes lots of things clear. better know difference going one, without knowing other.

debugging - Visual Studio 2010 F10/F11 Stepping Slow, Toolbar Stepping Fine? -

i'm running visual studio 2010 sp1, r# 5.1, , few other extensions (like powercommands , productivity power tools). somewhere along lines, debugging got super slow. if use f10 / f11 keys step, vs hangs bit , steps. if use toolbar buttons stepping, it's snappy expected. any idea what's shortcut keys? i had same problem - extremely slow debugging keyboard ( f10 example). symptoms: if click step on toolbar, works normal, the lag during debugging present not in visual studio anywhere (notepad, browser,...), if set other browser default browser in visual studio (i tried firefox), works ok, if disable third-party browser extensions in ie, works ok, if enable third-party browser extensions , disable lastpass, problem gone , debugging keyboard fast again! so, try disable lastpass extension if have or extensions , try it. edit1 - allready posted on lastpass forum: http://forums.lastpass.com/viewtopic.php?f=12&t=61029 edit2 - , here on :) https:...

jquery - Can I replace all asp controls with simple html controls form with same functionalities? -

i having project asp.net controls in .aspx page , javascript validation , stored procedures databases , asp:gridview , datasource controls display , such things. now, want change old aspx controls : asp:textbox, asp:dropdownlist with input, select in html. how time take develop 100 aspx forms in simple html query, xml datasource, cs file , generic handlers ?? have 1 done before or tried 1 ? idea or bad idea... suggestions welcomed :) added after mvc suggestions(to make more clear) typically want complete within month. use jquery , cs page connections, create dynamic html , things, handler call 2 files , aspx design , database configuration file (config file connections, security , things )... my main doubt able obtain perfect functionality ? this kind of broad question, i'll give shot. changing asp:textbox input type="text" loses server side functionality. aspx can't access plain html control. add id , runat="server" it, ...

html - Javascript: Disable button on Drop Down Select -

i have dropdown menu couple of values link functions. have textbox , submit button. want if value in drop down box selected disables or hides submit button , possibly textbox made blank , once value selected turns both on. my html code: <body> <p><label>drawing tool: <select id="dtool"> <option value="line">line</option> <option value="rect">rectangle</option> <option value="pencil">pencil</option> <option value="eraser">eraser</option> </select></label></p> //some canvas code <form id="frmcolor"> <input type='color' id='color' /> </form> <input type='submit' value='change color' id="colorsubmit"/> javascript in linked file called canvas.js: ... tools.eraser = function () { var tool = th...

iphone - Add Observer to BOOL variable -

is possible add observers simple variables such bools or nsintegers , see when change? thanks! you observe keys notified when value changes. data type can anything. defined objective-c property (with @property in .h file) ready go if want observe bool property add view controller follows: in myviewcontroller.h: @interface myviewcontroller : uiviewcontroller { bool mysetting; } @property (nonatomic) bool mysetting; in myviewcontroller.m @implementation myviewcontroller @synthesize mysetting; // rest of myviewcontroller implementation @end in otherviewcontroller.m: // assumes myvc defined property of otherviewcontroller - (void)presentmyviewcontroller { self.myvc = [[[myviewcontroller alloc] init] autorelease]; // note: remove self observer before myvc released/dealloced [self.myvc addobserver:self forkeypath:@"mysetting" options:0 context:nil]; // present myvc modally or navigation controller here } - (void)observ...

wpf - How do I move something I made in Microsoft Blend into Visual Basic? -

i need submit project tomorrow, , topic wpf using xaml. using vb way. still beginner @ programming, needed help. i've got ton of wpf , blend tutorials open in tabs in browser, have no idea start, , no idea project. asked tutor , said he'll checking our understanding of xaml, , creating object using xaml other way round. i stumbled onto tutorials of media players main in wpf, , decided go it. because have never used blend or wpf along xaml before, don't know do, if make button in blend effects, may add coding behind in vb. please me out. i've got 15 hours before have submit. you're going need microsoft vb.net express 2010 at least. i'm not sure if supports wpf free. i'd , start drinking coffee. if guess copying xaml new project place start.

c# - How do I get the _real_ thread id in a CLR "friendly" way? -

as exercise writing code display o/s processes , o/s threads within process (like sysinternals process explorer does). i found .net's managedthreadid(s) not o/s thread ids. after bit of reading came across appdomain.getcurrentthreadid(). unfortunately, function marked "obsolete" (which mean "not available" in future). 1 solution found use interopservices directly call win32 getcurrentthreadid. fine but, feels counter .net philosophy. my question is: there clr "friendly" way of obtaining real id of current thread ? for reference, here snippet of code showing i've tried far. // 1 , // 2 display correct thread id, // 3 , // 4 attempts obtain same info in clr friendly way (but don't work.) thank help, john. [dllimport("kernel32.dll")] static extern int getcurrentthreadid(); static void main(string[] args) { // appdomain.getcurrentthreadid() "obsolete" int threadid1 = appdomain.getcurrentthreadid(); //...

php - How do I alphabetize a list of domains in this way? -

so if wanted organize list of websites alphabetically, , there of form: example1.com, test.com, stackoverflow.com, google.com, easy. however, want organize subdomains. consider following 3 domains: a.domain.com domain.com anotherdomain.com if handed them on software alphabetize, alphabetized this: a.domain.com anotherdomain.com domain.com however, not how want them alphabetized. want them alphabetized domain, , subdomain "tiebreaker," in other words, this: anotherdomain.com domain.com a.domain.com could tell me how code php (or javascript) this? (you can assume each "website" on fresh line of code.) $array = array( 'b.domain.com', 'a.domain.com', 'domain.com', 'anotherdomain.com', 'php.net', 'example.com' ); function sort_domains($domain1, $domain2) { $domain1 = array_reverse(explode('.', $domain1)); $domain2 = array_reverse(explode('.', $dom...

Send SMS Freeswitch via web interface -

i installed freeswitch , bought khomp device send sms trought it! i'm able send sms command line inside freeswitch client(fs_cli). enabled xml-rpc module send via web, i'm not able start application send via web. anybody had heard sending sms using xml-rpc connecting freeswitch virtual machine , sending it? thanks , sorry bad english.

java - Apache HttpClient: Location of redirected URLs -

i'm using apache's httpclient (for java) load url getting redirected http 301 response. news, httpclient follows redirect automatically, , don't need manually loop through redirects. the part haven't figured out final destination. because i'm getting headers of final successful (http 200) query, there no location header. since redirect occurs behind scenes of httpclient.execute(..), code doesn't know whether there has been redirect, , has redirected to. how vital piece of information? need recode in java.net classes info? for record, i'm using apache httpclient on android, , need backward compatibility android 1.6. all hail redirecthandler (helps read docs)

objective c - Memory management in interface builder -

if put label in interface builder, , don't connect iboutlet, have memory leak? or system call dealloc itself? no, won't have leak. without iboutlet, never directly calling retain on object. therefore thing retaining object view label subview of, because when add subview view, calls retain. when parent view dealloced, call release on of subviews, dealloc label.

C# split string but keep separators -

there exist similar questions, of them use regexen. code i'm using (that strips separators): string[] sentences = s.split(new string[] { ". ", "? ", "! ", "... " }, stringsplitoptions.none); i split block of text on sentence breaks , keep sentence terminators. i'd avoid using regexen performance. possible? i don't believe there existing function this. can use following extension method. public static ienumerable<string> splitandkeepseparators(this string source, string[] separators) { var builder = new text.stringbuilder(); foreach (var cur in source) { builder.append(cur); if (separators.contains(cur)) { yield return builder.tostring(); builder.length = 0; } } if (builder.length > 0) { yield return builder.tostring(); } }

Rails: "new or edit" path helper? -

is there simple , straightforward way provide link in view either create resource if doesn't exist or edit existing on if does? ie: user has_one :profile currently doing like... -if current_user.profile? = link_to 'edit profile', edit_profile_path(current_user.profile) -else = link_to 'create profile', new_profile_path this ok if it's way, i've been trying see if there's "rails way" like: = link_to 'manage profile', new_or_edit_path(current_user.profile) is there nice clean way that? view equivalent of model.find_or_create_by_attribute(....) write helper encapsulate more complex part of logic, views can clean. # profile_helper.rb module profilehelper def new_or_edit_profile_path(profile) profile ? edit_profile_path(profile) : new_profile_path(profile) end end now in views: link_to 'manage profile', new_or_edit_profile_path(current_user.profile)

tsql - Getting those records that have a match of all records in another table -

within realm of problem have 3 entities: user position license then have 2 relational (many-to-many) tables: positionlicense - 1 connects position license ie. licenses required particular position userlicense - 1 connects user license ie. licenses particular user has. additional complexity: user licenses have validity date range ( validfrom , validto ) the problem these input variables: userid identifiers particular user rangefrom defines lower date range limit rangeto defines upper date range limit what need get ? particular user (and date range) need list of positions particular user can work at. problem user must have @ least licenses required every matching position. i'm having huge problems writing sql query list. if @ possible using single sql query (can have additional ctes of course). if can convince me doing in several queries more efficient i'm willing listen in. some workable data copy , runs script. 3 users, 3 positions...

oop - Question about Javascript properties and instances -

i can't figure out myself why foo.bar in example undefined , explain? var foo = "foo"; foo.bar = "baz"; console.log(foo.bar); // undefined q2: how add references properties , methods string instance foo ? help appreciated, thanks. -- edit -- note: question generic string instance , not string global object . using "classic" prototyping suggested not option, because way every string instance have property called bar , while want augment instances . this duplicate of why can't add properties string object in javascript? . basically, you're creating string, , primitive type in javascript. you cannot add properties primitive types in javascript .

iphone - How do you Create a single-bundle App/Archive using static libraries like Core-Plot? -

Image
i struggled bit before found answer , i'm posting here. problem: building archive core-plot resulted in organizer error said building single-bundle archive. issue seemed problem headers located in /usr of install_root. see below solution. there may other ways. 1 worked me. create run script in build phase of target app. then run archive. wha-la!

admin - error drupal after copy & paste folder, and same DB -

i copied , pasted whole drupal content folder server localhost , dumped db localhost, admin user authentication credentials not working in localhost. i reset admin password ( update admin set pass = md5('newpassword') uid=1; ) also in watchdog table having message when try authenticate: "session opened %name." any ideas?? the error parameter $cookie_domain on file /sites/default/settings.php . working fine now

sql server - How to remove a column from an existing table? -

how remove column existing table? i have table men fname , lname i need remove lname how it? alter table men drop column lname

c# - Entity Framework Code First POCOs and reasons why / why not setup relationships? -

i wasn’t sure how word question , may change based on feedback. when idea have reference relationships (in pocos) setup can parent record child or reverse? practice have way “reverse” lookup item or collection of items? know depends on application, want make sure of before start molding application. so, let’s have 2 tables: states , countries. states has relationship countries (many-to-one) , vice-versa (one-to- many). class state have property country , country class property collection of states. pretty standard. in example may make sense allow country lookup associated states. can think of time may not care association don’t have overhead of loading items collection or single item? it more design decission of entities. if using code first need navigation property on @ least 1 side create relation in database. can start simple approach , define property on side make sense , add other side if need somewhere. there situations know never work child entity without pa...

java - How to talk to Tomcat server from a PHP application -

i developing new report engine company, our main web application writing php 5 , running on apache server. new report server designed use apache fop 1.0 ruing on tomcat7,so far created own xslt stylesheets , can manage generate pdf report url , let display in web browser.my goal on project generate dynamic report xml file export php application. could explain me logic behind how can give 2 talk each others. understand post xml , xslt string report server , post result want(like pdf). i know need java involved,and php dev. don't have background java,if show me examples or links, appreciate. i using saxon-b fop 1.0 on tomcat 7 report server. if need more info me,please leave comment. add soon. thanks there 2 things going need study. http://www.w3schools.com/php/php_ajax_intro.asp tutorial on using xhr object php. should go through that. also, if aren't familiar xhr object, read well: http://www.w3schools.com/xml/xml_http.asp you're going have c...

naming conventions - JavaScript - Advisability of closing and returning state in a single method -

my team debating right name ui framework javascript method following: it gets widgets state, if any it removes widget page it returns retrieved state framework can recreate later the proposed name 'destroy.' team members feel people may not expect method named destroy return anything. name 'getstateanddestroy' more descriptive suggests single responsbility principle failure. thoughts? see more of naming or design issue? git has similar, name stash.

Sharing Bad Words On Blog Post -

i have bad (spam) words list spam protection filters. want share them blog readers. put list blog post i'm worring something. there lot of bad word on post, because of google ban me ? how can put list post ? inside of <blockquote> tag ? put in txt file , link downloadable? or better xml or json if don't mind people linking it. surely don't want post them :)

c# - Can't set palette in bitmap -

i have been writing pcx decoder and, far, pcx image parses fine, can't work out how set palette of bitmap. i have created bitmap so: bitmap bmp = new bitmap(width, height, stride2, system.drawing.imaging.pixelformat.format8bppindexed, pixels); but can't seem set palette using following method: for (int = 0; < 256; += 3) { color b = new color(); b = color.fromargb(palette[i], palette[i + 1], palette[i + 2]); bmp.palette.entries.setvalue(b, i); } in example, have read through each byte in palette of pcx file , stored them in palette[]. there, have used set entries in palette of bitmap. how set colours? this had me confused too. seems bitmap.palette returns clone of bitmap's palette. once you've modified copy, need reset bitmap's pallete using bitmap.palette = palette , e.g. colorpalette palette = bitmap.palette; color entries = palett...

cluster analysis - Text classification, preprocessing included -

which best method document classification if time not factor, , dont know how many classes there are? in (incomplete) knowledge, hierarchical agglomerative clustering best approach if don't know how many classes. of other clustering algorithms either require prior knowledge of number of buckets or sort of cross-validation or other experimentation determine sensible number of buckets.

java - Determining the JVM's command-line root class -

when subclass inherits main() superclass, possible determine actual class invoked on command-line? example, consider following 2 classes, in main implemented a , inherited b : public class { public static void main(string[] args) throws exception { // replace <some magic here> determine class // invoked on command-line final class<? extends a> c = a.class; system.out.println("invoked class: " + c.getname()); final instance = c.newinstance(); // instance here... } } public class b extends { } we can invoke b (i.e., b 'inherit' main - @ least in whatever sense static methods can inherited), have not found method determine actual class invoked user: $ java -cp . invoked class: $ java -cp . b invoked class: the closest i've come require subclass implement main() , call helper method in superclass, reads thread stack determine calling class: public class abystack { pub...

email - POP3/SMTP on Ubuntu using Linux group -

i need setup pop3/smtp server on our ubuntu server ( example.com ). found postfix useful job. possible let users group users (on system) use service, can login username/password? example, if kevin user group users , can login on pop3 server , retrieve (and send) mail kevin@example.com ? possible save in- , outgoing e-mails in database? regards, kevin here ís link postfix features . have found store users in database. i using mailserver configured after tutorials of workarounds.org , have implemented servers following solution few clients 100 concurrent users now. but example dbmail project offers @ least storing mails databases.

java - Use FTP4J to resume upload progress and also get how many percent uploaded -

any 1 have example how upload ftp4j support resume , how show progress bar? i have implemented sort of following code. i discovered if use compressed streams , cannot rely on transferred bytes reported listener, because server can wait further data in order decode previous received blocks. hovewer, if streams plains, in cases of lost connection still cannot rely on total transferred bytes reported listener. so, realized best way ask server how many bytes received. in template, temporal redundancy more general , involves control connection ftp server. limit while loop data connection, i.e. upload. ftpclient ftpclient = null; long writtenbytes; boolean iscompletedstartingdelete = false; // our policy overwrite @ first (int attempt = 0; attempt < max_attempts; attempt++) { try { ftpclient = getftpclient(); configureftpclient(ftpclient); dologin(ftpclient); ftpclient.changedirectory(remotedirectory); if (!iscompletedstartingdele...

c# - Difference between throw new Exception with no surrounding catch and putting this in a catch? -

what difference (if any) in writing: if (file.exists(filepath)) //something else throw new filenotfoundexception(); and surrounding if/else block, above, in try brace catch. in fact, catch needed? if so, catch? or perhaps better comparison put if part of above block in try brace (without if statement) , catch filenotfoundexception , throwing call stack (throw). thanks by surrounding if block try catch means going have handle missing file there , in catch (see @lukas's answer). if going handle missing file in code, don't need else-throw, because know file missing first if. on other hand, if want calling code (somewhere higher call stack) handle missing file, passing information on in exception ok, don't want go wrap throw in try-catch because won't thrown out of block of code.

C# Client-Server Video streaming -

are there c# libraries facilitate streaming of video in client-server architecture? interested in finding resources learn more on subject of video streaming on .net platform, , streaming in general. thanks! in previous attempts @ problem have come conclusion (from other people's recommendations) book keystone piece problem - http://www.amazon.com/programming-microsoft-directshow-television-pro-developer/dp/0735618216 i had read before out of print , used copies available @ around $150 - looks there new prints available has dropped price down around $90 - still have contend being technology microsoft has deemed depracated (but haven't replaced new yet) , of course if @ reviews on book doesn't seem worth $40 cap on written decade ago. that being said - has been 2 years since attempting such project information may deprecated directx itself! ;)

entity framework 4 - Selecting Related Entities When No Association Exists -

ef4 great pulling in associated data do when association not explicit? example illustrates situation: mastertable has child1id , child2id column. there 2 tables child1 , child2 corresponding primary key child1id , child2id. there master, child1 , child2 entities. there no foreign key or entity framework association between master , child1 / child2 tables or entities. how can select master records , corresponding child records 2 child tables when have matching child ids in master? i can't retrofit relationship or association. richard you must select them manually linq entities. here how left join between 2 tables: var query = m in context.masters m.id == 1 join c in context.childs on m.child.id equals c.id leftjoin x in leftjoin.defaultifempty() select new { id = x.id, name = x.name, child = x.childs }; btw. if entit...

database - Are there PHP tools to generate CRUD screens from DB schema? -

i've been using phpmyedit generate crud screens databases; it's quick way start interacting data in projects (and lets me toss internal admin pages fast)... doesn't read db schema, have manually set up. i'm looking tool/way generate crud beginning end: give db table, , reads schema, generates html markup form, , crud work on db itself. does exist? goal have 0 setup basic functionality, , i'd love option of being able extend basic setup further refine experience. (for example: if can see database table has 4 varchar() fields, ready go 4 editing fields "out of box," i'd able add little bit of code/set flags specify 1 varchar() column meant hold email address, tool data validation allow emails in field.) update: i'm seeking solution can drop existing php project(s) -- not entire framework. i'm looking drop-in admin too, here's 1 found far: http://ajaxcrud.com/

mysql - Adding defaults to integer columns, error saying 'right sytnax near 'default-1 default null' -

i have column named 'parent_id' trying add default of -1 to: change_column :categories, :parent_id, :default => -1 the type integer in mysql. i getting error: 'mysql2 error......'default-1 default null' @ line 1: alter table 'categories' change 'parent_id' 'parent_id' default-1 default null it seems missing = sign? also, how do db:migrate on test db? you're missing column type in change_column , should more this: change_column :categories, :parent_id, :integer, :default => -1 the giveaway this: default-1 . change_column method wants 3 arguments , hash of optional arguments. :default => -1 getting mashed column type because didn't specify :integer third argument.

escaping - JSF: How to let #{...} expansion not be escaped? -

i have custom el function (defined in myfunctions.taglib.xml ) returns chunk of html, want copy verbatim output, <f:verbatim> #{mylib:generatehtml()} </f:verbatim> however, expansion of #{...} escaped. how make not escaped? i believe there option escape characters verbatim. <f:verbatim escape="#{boolean}" />

mapreduce - Hadoop spiled records -

i couldn't find documentation on how hadoop handles splilled records. there link can found online. thanks time. check out http://hadoop.apache.org/common/docs/r0.20.2/mapred_tutorial.html#map+parameters , section right below http://hadoop.apache.org/common/docs/r0.20.2/mapred_tutorial.html#shuffle%2freduce+parameters i'm not sure if covers you're looking for, points in direction start looking more.

python - CodeIgniter-like Routes in CherryPy -

i'm coming php frameworks, , 1 thing them routing sort of taken care of me: can drop of controllers in directory controllers , automatically call posts::delete(12) when user visits http://www.example.com/posts/delete/12 . realize can use routes cherrypy, i'm kind of annoyed how limited documentation is— there's nothing on how should format class name (should call postscontroller()? care?), using routes.mapper.connect() vs routes.connect() , , happens when calls default route ( /:controller/:action/:id ). i'd use python, don't want have define every single route. point me python web-framework newb tutorial on how use routes or explain how 1 goes structuring cherrypy web-app can have couple of routes laid out like d = cherrypy.dispatch.routesdispatcher() d.mapper.connect('main', '/:controller/:action', controller='root', action='index') d.mapper.connect('main', '/:controller/:action/:id', controller='root...

bash - Trying to parse logfile based on start and end time -

i trying parse large zipped logfile , collect matching parameters within time range: wed nov 3 09:27:20 2010 : remote ip address 209.151.64.18 wed nov 3 11:57:22 2010 : secondary dns address 204.117.214.10 i able grep other parameter using line below: gzcat jfk-gw10-asr1.20100408.log.gz | egrep gabriel|98.126.209.144\|13.244.137.58\|16.151.65.121 i have been unable parse start time and/or end time. assistance appreciated. assuming log file chronologically sorted e.g.: gzcat jfk-gw10-asr1.20100408.log.gz | sed -n '/nov 3 09:/,/nov 3 11:/p' to log entries between 09:00:00 , 11:59:59 on nov, 3rd.

ios - Lock my iPhone app to a specific language (Localization) -

i have xcode4 project have support several languages (localization files) .. text , xib files change correct when change languange on iphone .. question is; can make release specific languange, if have several localization files? force app use 1 localization? my idea set flag in info.plist file like; localization = english (lock app enligsh language) you can deleting localized strings , nib files. don't think can lock app particular language (if localization support there other language).

javascript - This code doesn't work in IE -

hi have jquery/js script. takes encoded url string , parses , saves variable values variables. basically php's $_get does. function geturlvars() { var map = {}; var parts = window.location.search.replace(/[?&]+([^=&]+)(=[^&]*)?/gi, function(m,key,value) { map[key] = (value === undefined) ? true : value.substring(1); }); return map; } basically script want. url string: /autopop.html?email=test%40test.com&lastname=test+last&&firstname=+test+first i values: email = test%40test.com lastname = test+last firstname = +test+first what want auto-populate form on same page information. (i know you're thinking server-side script better solution boss says don't have access that, trust me, i've tried) long story short, here's rest of code: var keys = geturlvars(); $(document).ready(function(){ var fname = keys['firstname'].replace(/\+/g , " ").trim(); var lname = keys['lastname'...

java - Need to run Lucene Analyzer offline from servlet -

this might quite meaty question problem have spring servlet used real-time searching. need strip out lucene analyzer runs offline , called servlet everytime query comes in it, rather having analyzer within servlet. however, don't quite know how this, , call analyzer service servlet. can point me in right direction? at moment, have this: ramdirectory ramdirectory = new ramdirectory(); standardanalyzer analyzer = new standardanalyzer(version.lucene_31); indexwriterconfig config = new indexwriterconfig(version.lucene_31, analyzer); indexwriter indexwriter = new indexwriter(ramdirectory, config); document document = new document(); // test data document.add(new field("firstname", "john", field.store.yes, field.index.analyzed)); document.add(new field("occupation", "engineer", field.store.yes, field.index.analyzed)); document.add(new field("firstname", "mary", field.store.yes, field.index.analyzed)); document.add(...

how start up other apps and help to fill the data on android -

i want develop app users start other apps needs username , password,so must start other apps , fill username , password login userface of apps, example,i want start app helps user login facebook , fill username , password in login userface of facebook app in app,now konw name of facebookapp, 1.how start in app?(i don't know package name of app started up) 2.when have started app,how automatically fill username , password? you don't. afaik, example htc's "sense", facebook credentials stored sync account in accounts api. since think not encouraged override common android use cases, have find out accounts storing. for this, try find out how android.accounts working. samplesyncadapter deluivered sdk dev sample applications place start.

php - Prevent redirection to root url -

i trying access webpage. manage redirect webpage session id shown: http://www.sbstransit.com.sg/mobileiris/(tqkjtlnqkh2lw5v4rz4yurzf)/mobresult_svclist.aspx?stopcode=16101 i added mobresult_svclist.aspx?stopcode=16101 after session id retrieve information. however, not access page , keep been redirected root url: http://www.sbstransit.com.sg/mobileiris/(tqkjtlnqkh2lw5v4rz4yurzf)/index_nextbus.aspx?__redir=1 . do know how prevent redirection root url using php or other codes? thanks. you cannot. if server sends redirect header, can of course choose not follow it, page body still empty if server side doesn't generate it.

c - difference between 2 different implementations of declaring structures -

gcc 4.4.4 c89 i wondering real difference between following 2 implementations of defining structures? channel.h file struct channel_tag; struct channel_tag* init_channel(size_t channel_id); void dispose_channels(struct channel_tag *channel); channel.c file typedef struct channel_tag { size_t channel_id; } channel_t; =================== second implemenation =============== channel.h file typedef struct channel_tag channel; channel* init_channel(size_t channel_id); void dispose_channels(channel *channel); channel.c file struct channel_tag { size_t channel_id; }; many suggestions, in first case have 1 data type, , second have 2 (where 2nd typedef'ed first). there no difference in generated code. many people more convenient read/write code omits struct keyword.

php - how to use session ids for authentication purpose -

i using session variables $_session['user_id'] , $_session['passwd'] store id , password of user once when logs in. i checking these 2 variables database each time user moves new php page authentication. didnt know session_id() . i dont think doing authentication right way. feel there done session_id security stuff. and 1 more doubt- can these session variables hacked when use session variables way mentioned what should do? an attacker cannot change or read $_session variables, long there no other vulnerability present, general bad practice store password longer necessary on server several reasons. it sufficient check password once when user logs in. afterwards need store authenticated user_id in session. have know session belongs to, grant necessary permissions specific user. know user submitted correct password, otherwise wouldn't have stored user_id in session in first place.

android - How to create a custom ListView with "extends Activity"? -

i learning android programming, able create custom listview with: public class project1 extends listactivity { .... } with xml file custom layout. know how same thing with public class project1 extends activity { .... } all tutorials looked @ use extends listactivity , know there make things simpler, sake of learning how hard way??? have @ tutorial. http://techdroid.kbeanie.com/2009/07/custom-listview-for-android.html go thru post. advanced : lazy load of images in listview edited according comment : consider example of displaying list of countries , abbreviated names first custom listview have create xml file representing listview : <?xml version="1.0" encoding="utf-8"?> <!--main.xml--> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android...

iphone - Reflection doesn't work for CCScene, why? -

i have sub-class of cclayer, named myscene. in app delegate added code: -(void) applicationdidenterbackground:(uiapplication*)application { [[ccdirector shareddirector] stopanimation]; if( [[ccdirector shareddirector] runningscene] != nil ) { if( [[[ccdirector shareddirector] runningscene] iskindofclass:[myscene class]] ) { myscene *scene = (myscene*) [[ccdirector shareddirector] runningscene]; [scene goingtobackground]; } } } the app has running scene, , know it's myscene, iskindofclass doesn't return yes. why? [[ccdirector shareddirector] runningscene] returns ccscene not cclayer object. comparing ccscene cclayer sub class i.e. myscene return false. try set tag of myscene object , object tag , compare it. return yes

android - Can we have two canvases in an activity ? (OR) Having a canvas outside the onDraw() is not working -

@override protected void ondraw(canvas canvas) { // draw graphic objects ..... } public void displaycalc(){ //do calculation & display results near these graphic objects string result = string.valueof(value); //do calculation //display calculated values canvas c =new canvas(); paint paint = new paint(); paint.setstyle(paint.style.fill); paint.setantialias(true); paint.setcolor(color.white); c.drawtext(result,200,300,paint); } but if have same thing in function ondraw works fine. i know why or changes have make working @override protected void ondraw(canvas canvas) { // draw graphic objects //do calculation & display results near these graphic objects ..... string result = string.valueof(value); //display calculated values paint p...

java - JSONDeserializer().serialize(ListJson) -

hi have jsonstring ["ttt","uuuu"] how deserialize in list have following code java.util.list pop = (java.util.list)new flexjson.jsondeserializer().deserialize(listjson); i not work can 1 please help for objects can this: list<myobject> list = jsondeserializer<myobject>().use("values", myobject.class).deserialize(listjson); i guess myobject can string too. answer copied how deserialize jsonarray list<map> in java using flexjson.deserializer?

android - Synchronizing Database with server by use of a checksum -

in application store data server on first time login db. on each of next login (or after periodic interval of time) need mechanism check updation , if there exists 1 download updated data , update local db. there proposition use sort of checksum calculated @ local end , match checksum coming server. how implement execution of checksum update data. there other recommendations achieve same task timestamp? can associate timestamp tables instead of being column in db? solution : this have implemented this: there no need of checksum though. each , every table in database has column indicate last update timestamp particular row. , last update timestamp tables stored in different table altogether. timestamp sent server fetch update in data.

sendmessage - Convert string to IntPtr -

sorry english poor. convert string intptr using copydatastruct cd = new copydatastruct(); cd.dwdata = 0; cd.lpdata = marshal.stringtohglobalauto(msg).toint32(); cd.cbdata = msg.length; marshal.stringtohglobalauto(msg); and send window using sendmessage method when receive , read intptr string using copydatastruct cd = (copydatastruct)marshal.ptrtostructure(lparam, typeof(copydatastruct)); byte[] b = new byte[cd.cbdata]; intptr lpdata = new intptr(cd.lpdata); string temp = marshal.ptrtostringuni(lpdata); marshal.copy(lpdata, b, 0, cd.cbdata); string strdata = encoding.default.getstring(b); i receive data m\0s\0g\0!\0@\01\0|\01\0|\0c\0:\0\\0u\0s\0e\0r\0s\0\\0f\0.\0a\0l\0s\0a\0 when make strdata.replace("\0","") i receive message truncated. msg!@1|1|c:\users\f.alsa original message msg!@1|1|c:\users\f.alsayyed\desktop\file.ktb to me looks replace function found 0 termination earlier string ends, seems...

c - Type overloading macro -

i have bunch of printf debug helper macros , pretty cool have not specify type, there can allow macro overloading in c(can gcc specific if available in gcc 4.3). thought maybe typeof apparently doesn't work. example macro(i have ascii terminal color stuff can't remember of top of head) #ifdef _debug #define dprint_int(x) printf("int %s equal %i @ line %i",#x,x,__line__); . . . #else #define dprint_int(x) . . . #endif try this; uses gcc's __builtin methods, , automatically determines type you, best can, , makes easy debug macro don't have specify type. of course, can compare typeof (x) float, etc. etc. #define debug(x) \ ({ \ if (__builtin_types_compatible_p (typeof (x), int)) \ fprintf(stderr,"%d\n",x); \ else if (__builtin_types_compatible_p (typeof (x), char)) \ ...

java - get value using jquery -

i want value of h:outputtext label using jquery, for <h:outputtext id="cal_att_to_date" binding="#{attendance_calculation.cal_att_to_date}"> <f:convertdatetime type="date" pattern="dd-mmm-yyyy" timezone="gmt+5:30"/> </h:outputtext> var value = $('#cal_att_to_date').text();

parsing - Not able to parse JSON file in JavaScript -

i using javascript parse json file. not able understand error getting. please me on topic. **my code: html file: <title>json parser</title> <script type="text/javascript"> function webglstart() { var request = new xmlhttprequest(); request.open("get","test.json"); var my_json_object = json.parse(request.responsetext); alert (my_json_object.result[0]); } </script> </head> <body onload="webglstart();"> </body> </html> test.json file: {"result": [0,1,2,3,4] } alert in above code not show on webpage. it's straight forward jquery: <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $.getjson('test.json', function(data) { $.each(data, function(key, val) { console.log("key=" + key + " ...