Posts

Showing posts from April, 2011

algorithm - What's the easiest way to generate a list of combinations in C++? -

oftentimes, have problem property can either true or false, property b either true or false, , on. want test every combination of being true while b being false, , on. example might need following list: [true,true,true] [true,true,false] [true,false,true] [true,false,false] [false,true,true] [false,true,false] [false,false,true] [false,false,false] in haskell or python, can done list product function. my question is, what's simplest and/or quickest way generate this? have done converting number binary, converting binary array. seems cumbersome because decimal binary conversion isn't trivial, , need worry padding binary leading zeroes fill array properly. i have implemented , re-implemented kind of function in different contexts enough times wonder, there way simple enough can implement scratch when necessary -- without having think? i'm not sure of code along these lines should work. for( int = 0; < 8; i++ ){ printf( "[%s, %s, %s]\n", (

java - How maven war dependency actually works? -

assume have following dependency <dependency> <groupid>group</groupid> <artifactid>aid</artifactid> <version>${project.version}</version> <scope>runtime</scope> <type>war</type> <exclusions> <exclusion> <!-- declare exclusion here --> <groupid>sample.projectb</groupid> <artifactid>project-b</artifactid> </exclusion> </exclusions> </dependency> seems code dosn't work since have excluded library in crated war file. there specification how war dependency works? when depend on war you're using "overlay" feature: http://maven.apache.org/plugins/maven-war-plugin/examples/war-overlay.html are trying achieve "overlay" functionality or trying depend on jars within war?

jquery - Duplicate input in form -

i have dynamically generated form multiple text input fields: <input class="w200" type="text" value="" name="field[7018]"> <input class="w200" type="text" value="" name="field[7019]"> <input class="w200" type="text" value="" name="field[7020]"> ... <input class="w200" type="text" value="" name="field[7055]"> using jquery, how can detect duplicate values on input? there's post on so proposes following solution: $("#check").click(function() { $.post("checkname.php", { name : $("#textboxname").val() }, function(data) { //data contain output file `checkname.php` if(data=="ok") { //imagine case output ok if not duplicate found alert('ok'); else { al

cron - cronjob running php web application -

using cpanel want setup cronjob. have php page doing import post data. reach import page have pass login page working post data. can done? you can create php script accessed via , 2 post requests itself. you can simulate post request on both login page , import page using php curl . steps send post request curl login page . specify curl keep cookies (cookie jar, read manual exact syntax). after session cookie saved in cookie jar (a file), send post import page , using authentication received first post. you can find more information curl post here: http://www.electrictoolbox.com/php-curl-form-post/

windows xp - How do I change the start menu from classic view to WinXP Start Menu? -

Image
i working on computer running winxp using classic windows start menu. i've googled, can find how change windows xp and/or win7 start menu to classic start menu, not how change back windows xp (windows 7 has utility download this). there's no option in control panel either...just windows classic style or windows standard views. tried "taskbar , start menu" , although see new blue chrome design in dialog box, not change classic win xp look. know how this? thanks! see first screenshot. first radio button xp menu.

regex - Oracle SQL - REGEXP_LIKE contains characters other than a-z or A-Z -

i create query select records contain characters not a-z or a-z so this select * mytable regexp_like(column_1, '![a-z] [a-z]') the ^ negates character class: select * mytable regexp_like(column_1, '[^a-za-z]')

ruby on rails - How to turn a sqlite3 table to a postgresql table? -

i started project rails without knowing heroku required postgresql. convert sqlite3 table postgresql table. how can it? i found way sql inserts : begin transaction; insert places ("id", "name", "content", "tags", "created_at", "updated_at") values ('0', 'bac à papier', null, 'bac de recyclage', '13309980782012-03-06 03:57:21.219233', '13309980782012-03-06 03:57:21.219233'); insert places ("id", "name", "content", "tags", "created_at", "updated_at") values ('1', 'bac pvm', 'plastique/verre/métal', null, '13310076572012-03-06 03:57:21.219233', '13310076572012-03-06 03:57:21.219233'); insert places ("id", "name", "content", "tags", "created_at", "updated_at") values ('2', 'bac de déchets', null, 'poubelle&

timer - Is preceding a function with CALLBACK or WINAPI or PASCAL (in MFC) is absolutely necessary or only for readability purpose? -

in mfc vc++ , settimer function setted using callback procedure. link read a function marked __stdcall uses standard calling convention named because win32 api functions (except few take variable arguments) use it. and that, have understand, vc++ mfc functions use __stdcall calling conversions. and callback defined follows.... #define callback __stdcall what have read: preceding function callback used emphasise particular function called automatically whenever necessary(like in settimer case or onclick case in javascript), my doubt is , in mfc vc++ functions(except few take variable arguments) has default calling convention of __stdcall. hence either preceding or not preceding function callback or winapi or pascal has same effect? is absolutely necessary computer? depends on context. when mismatch calling convention , either lucky because datatypes on stack happen match requirements of api, or fail miserably when code run on different a

soap - org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize -

i trying call service passing xml request. getting error in response xml. can please in problem. using soapui , have set credential in request header. response : soapenv:server.userexception org.xml.sax.saxexception: simpledeserializer encountered child element, not expected, in trying deserialize. it sounds though you're sending element it's not expecting, i.e. request invalid reason. check lint tool ensure it's valid, double check spec service you're making request to. failing that, you'll need provide lot more information better answer.

php - Best method for storing quiz results in MySQL -

i'm trying record test/quiz scores in database. what's best method when there might lot of tests , users? these options considered: should create new column each quiz , row users, or have limitations? might slow? should create new row each user & quiz? should stick original 'user' database , encode in text? elaborating little on plan: javascript quiz, submits score ajax, , script sends database. i'm new php i'm not sure approach. any appreciated :) school science fair i create database table, maybe 1 lists students (name, dob, student id), , 1 tests (score, date, written by). access db, or can students access too? if latter case, need make sure create accurate security or "views" ensure student can see own grades @ time (not everyone's).

android - How to handle a binary data response in WebView -

my activity has intent filter pick specific url , open in webview control, brings user auth page (user name/password). after authentication done user binary stream response (file). there way handle response , read data stream? i tried setup custom webviewclient overridden shouldoverrideurlloading method, app doesn't there. @override mmywebview.setwebviewclient(new customwebclient()); mmywebview.loadurl("http://xxx.xx.x.xx:xxxx/getcert"); ... private class customwebclient extends webviewclient { @override public boolean shouldoverrideurlloading (webview view, string urlconection) { // break point here doesn't stop debugger return true; } } neither works mmywebview.setwebviewclient(new webviewclient(){ @override public boolean shouldoverrideurlloading (webview view, string urlconection) .... }); server reacts on requests in same way both app , build-in browser. build-in browser starts download file receive

editor - Can vim recognize indentation styles (tabs vs. spaces) automatically? -

i'm working on large codebase, each file has different indentation conventions: tabs, 4 spaces, 3 spaces, etc. i default on tabs , set shiftwidth=n expandtab smarttab when come across spaces-indented file, that's annoying. is there functionality in vim, or plugin, can recognize that, instance, current buffer uses indentation 3 spaces per shift? various plugins exist attempt handle situation. here few found search detect indent @ vim.org sleuth detectindent yafia indentconsistencycop indentfinder

installation - Is APC compatible with PHP 5.4 or PHP 5.5? -

it doesn't seem apc has been updated coincide php 5.4 release (i wish have included apc in php core planned). i can't seem find definitive answer whether current apc works php 5.4+. managed find ubuntu packages php 5.4, php-apc packages won't install. zend opcache included in php 5.5 on 21st march 2013, php 5.5 beta 1 released including "zend opcache" - looks firmly replacement apc going forward included in php core, , have be maintained each new release. i advise depend on apc it's opcode caching test code upcoming built-in opcode cache, , feed issues encountered ensure stable final release. i not know means future of apc. apc php 5.4+ still flagged beta this means developers not consider stable . while many people experiencing no problems @ current svn releases, there still odd report of edge cases people under configurations, or under heavy load. as want use in production environment, make sure thoroughly test release (beta

sql - Insert values into a new table with "position in group" column? -

i have table: c1 c2 c3 ---------- 100 200 100 201 100 203 200 405 200 408 ...and table created 3 columns. i need add values above table new table including new column like, c1 c2 c3 -------------- 100 200 1 100 201 2 100 203 3 200 405 1 200 408 2 ...and on. c3 dependent on c1 , when c1 changed, set 1 , continue increment. the second table created , empty. need copy values of columns c1 , c2 of old table new table , @ same time, insert new values c3 of second table. insert my_table2 select c1, c2 ,row_number() on (partition c1 order c1, c2) my_table

php - Uncaught OAuthException: Error validating application -

i developing first facebook app, includes creating new album , posting photos user wall. learning through facebook documentation , few tutorial , came code, getting following error it. fatal error: uncaught oauthexception: error validating application. thrown in /home/base_facebook.php on line 1106 plus: don’t know if matters or not, when printing out the echo $facebook->getuser(); variable giving me ‘0’ in return though user (which in case myself) logged in. kindly me through this. code: $config = array( 'appid' => '3663250024856', 'secret' => 'b14ac6d2b7dbdtyb259599b06983e881', 'fileupload' => true, 'cookie' => true ); $facebook = new facebook($config); echo "user status:".$facebook->getuser(); $facebook -> setfileuploadsupport(true); $album_details = array('message' => 'album desc', 'name' => 'album name');

c++ - How to find height and width of a rectangle in OpenCV? -

how can find width , height of rectangle drawn function cvrectangle following parameters? cvrectangle( input1, cvpoint(200,178), cvpoint(190,110),color ,1, 8 ); you set parameters, calculating width , height should trivial, shouldn't it? width = (200-190) , height = (178-110) . but, @bubble suggests, since you're dealing pixels, don't forget add 1, resulting in (200 - 190) + 1 width , (178 - 110) + 1 height. or expect cvrectangle give rectangle "object" can these values from? doesn't.

javascript - Toggling(or Flashing) a particular cell in a Table for some time frame -

Image
i have created table in html , make particular cell flashing(on , off ) sort of.can please let me know if possible using javascript. <html> <body> <h4>two rows , 3 columns:</h4> <table border="1" width="100%" height="400" align="top"> <tr style="height: 1"> <td> <table width="100%" border="2" height ="100" align="top"> <tr> <td bgcolor="#ffff00">1-1</td> <!-- r1c1 yellow --> <td>1-2</td> </tr> <tr> <td>1-3</td> <td>1-4</td> </tr> </table> </td> <td> <table width="100%" border="2" height ="100" a

android - SmsManager.sendDataMessage(..., onSpecificPort , ...,.. ) Is not Filtering SMS On Port Basis -

what want send sms on specific port , application listening sms receiving same port should react sms receiving. i have receiver this <receiver android:name=".binarysmsreceiver"> <intent-filter> <action android:name="android.intent.action.data_sms_received"/> <data android:port="8091"/> <data android:scheme="sms"/> </intent-filter> </receiver> and sending sms below manager.senddatamessage(phonenumber, null, (short) sms_port, data, pisend, pidelivered); myreceiver did receive msg issue along side others receivers able listen. my native inbox of device catching sms. if declare receiver different port number able listen. verified logs. or if change port number first receiver receives . only god know why port not filtering sms. please gave suggestions. direction or hint or solution welcomed. thanks answer por

Objective-C ASCII decimal integer to NSString conversion -

how can convert , ascii decimal integer nsstring in objective-c? (example: 36 "$") thanks you can use following: nsstring *s = [nsstring stringwithformat:@"%c", 36]; nslog(@"%@", s); // $

How to display error in different controller after post in ASP.NET MVC3 -

first thing, sorry english. i have 2 forms in index. login form post localhost/account/logon register form post localhost/account/signup how can display error in localhost/ after user post 1 of form ? currently error display in localhost/account/logon or localhost/account/signup these codes: #index action in homecontroller public function index() actionresult return partialview("_default") end function #_default layout <html> <head></head> <body> @code html.renderaction("signup", "account") end code @code html.renderaction("logon", "account") end code </body> </html> #signup action in accountcontroller public function signup() actionresult return partialview() end function <httppost()> _ public function signup(user userview) actionresult

javascript - Google+ Style Image Gallery -

Image
i'm trying emmulate following: any ideas how? photos have same height , photos arrange/cropped/resized dynamically fit on rows there no jagged sides left or right. if resize browser window resizes photos fit. have tried isotope , jquery masonry , neither give me effect. i implemented thing. here's how did it: when page loads, measure available width of target container (the container images live), , call maxwidth i make ajax call, passing maxwidth server i determine list of gallery images display on server, , process each 1 one during iteration of list, keep adding images row, row's length being maxwidth available (which passed up). once image overflows maxwidth, calculate overflow amount i take overflow amount, divide number of images in row, , subtract value off each of images in row (so 1 image doesn't width reduced much) i repeat each row, each row adds maxwidth some things had consider: i had take account width of margins wanted in b

mysqlimport - how to import data from csv file to mysql table? -

i'm trying load data csv file mysql table(already created). loading failed. tried directly without using query "it shows error 23 rows skipped". i used query: load data infile 'c:\\users\username\documents\file.csv' table table1 lines seperated '\n'; please try maybe correct load data local infile 'c:\users\username\documents\file.csv' table lines terminated '\n' (columns);

asp.net mvc 3 - Posting .net MVC 3 FromsCollection from other domain with jquery ajax -

ok, i'm totally new .net mvc3 , i've run problem. i developing mobile application using jquery mobile , wish send data mobile application web-page. on server have this: [httppost] [validateinput(true)] public actionresult save(formcollection actionvalues) { int age = int32.parse(actionvalues["age"]); string fn = actionvalues["first_name"]; string ln = actionvalues["last_name"]; createandstorepersonmodel(age,fn,ln); // dummy method, not important return new httpstatuscoderesult(200); // 3nigma } what want able actionvalues , store them in model, store model database. sake of example we'll assume want store "person" attributes: "first_name, last_name, age". might expand model in future. from mobile app run following code: $.ajax({ type: "post", url: "http://external.url/save", datatype: "json",

php function in function -

i trying build function call function. example, if have array full of function names call, possible call function every array value without writing in script? example: function email($val=null) { if($val) $this->_email = $val; else return $this->_email; } function fname($val=null) { if($val) $this->_fname = $val; else return $this->_fname; } for email fname etc. but want have like: function contr_val($key,$val) { function $key($val=null) { if($val) $this->_$key = $val; else return $this->_$key; } function $key($val="hallo"); } and call with: contr_val("email","test") what you're trying create member variables dynamically , retrieve values. __get() , __set() for*. here's how use it: class testclass { var $data = array(); public function __set($n, $v) { $this->data[$n] = $v; } public

java ee - Why use a parent pom file when generating an ear file? -

i read question on - how add war inside ear maven in top voted answer "joelittlejohn" - "now create parent module (with pom) , add war module , ear module it. make sure set parent of war , ear modules corrently. when run mvn package new parent, war file built war module , ear file (containing war) built ear module." but why create parent pom ? why not created standard maven project single pom. single pom file contains dependencies & modules, generate .ear file 1 pom file ? something : <plugin> <artifactid>maven-ear-plugin</artifactid> <version>2.3.2</version> <configuration> <finalname>myearfile</finalname> <version>5</version> <generateddescriptorlocation>${basedir}/src/main/application/meta-inf</generateddescriptorlocation> <modules> <webmodule> <groupid>com.your.group.id&

image processing (mainly opencv) indexing conventions -

i trying understand indexing conventions of image processing type functions, in opencv. so indexing pixel [row, column] i.e. y,x, right? think pretty common in image processing. but when picking points rectangle in opencv requires [col, row] i.e. x,y. , true function wants cvpoint so if writing function say, takes sample coordinate in image, should [col, row] or [row, col] ? internally image almost stored in rows - index naturally [row,column] but in maths x,y more common function asks individual pixel coordinate better f(x,y) opencv confuses matters creating images call specifies image (rows,cols) ie. image(height,width) nam image cols-rows ie 640x480 or 1920x1080

c# - Call Javascript from GridView TemplateField -

i have gridview, have coded below <asp:templatefield headertext="item"> <itemtemplate> <asp:button id="btnitem" onclientclick="javascript:searchreqsult(<%#eval("id") %>);" cssclass="save" runat="server" /> </itemtemplate> </asp:templatefield> i face run time error says button control formatted correctly suppose issue following onclientclick="javascript:searchreqsult(<%#eval("id") %>);" any idea? try following code protected void gridview1_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { button btn = (button)e.row.findcontrol("btnitem"); btn.attributes.add("onclick","searchreqsult(this.id);"); } }

How to not show a record in an array adapter based on IF criteria in android -

hi have array adapter populated array so: private class placesdetailadapter extends arrayadapter<placedetail> { private arraylist<placedetail> items; public placesdetailadapter(context context, int textviewresourceid, arraylist<placedetail> items) { super(context, textviewresourceid, items); this.items = items; } @override public view getview(int position, view convertview, viewgroup parent) { view v = convertview; if (v == null) { layoutinflater vi = (layoutinflater)getsystemservice(context.layout_inflater_service); v = vi.inflate(r.layout.placedetail_list_row, null); } placedetail o = items.get(position); if (!o.gettype.equals("place") { textview tt = (textview) v.findviewbyid(r.id.placedetailtitle_txt); tt.settext(o.getname()); imageview iv = (imageview) v.

php - Confused by the "Time to first byte" TTFB -

the famous ttfb confusing me. what describes it, first byte of http response or first byte of underlying protocols tcp? you can read gzipping content lower ttfb, why? zipping means more cpu load on server side should result in worse ttfb or wrong here? the time of "flushing" content seems important, have trouble finding more information on it. how can influence flushing, e.g. on php based webpage? simple setting/configuration of server or location in code perform "echos" ? thank you ttfb delay between end of request , receiving response, we're talking web here when browser received first byte. gzipping content increase ttfb provided server isn't overwhelmed should negligible delay. what gzipping reduce overall time download content. normally server won't send page browser until whole page has been generated, flushing return content browser can process , start downloading , files referenced sooner. a explanation of flushing st

php - Select unique from all columns into a single column -

i have 4 columns setup have same type of data . want create table unique entries entries in columns. c1 (name1) c2 (name2) c3 (name3) r1 r1 c1 (john) r1 c2 (tiny tim) r1 c3 (big sally) r2 r2 c1 (big sally) r2 c2 (john) r2 c3 (paul) r3 r3 c1 (tiny tim) r3 c2 (paul) r3 c3 (rajesh) r4 r4 c1 (normal ned) r4 c2 (big sally) r4 c3 (normal ned) this need c1 r1 john r2 big sally r3 tiny tim r4 normal ned r5 rajesh r6 paul you can using union keyword. select c1 table union select c2 table union select c3 table; the results ask. then values , insert on new table or use insert ... select insert quickly.

html - -moz-linear-gradient not working on IE -

i'm using gradient background: -moz-linear-gradient(center bottom , #e8e8e8 0%, #f2f2f1 50%) repeat scroll 0 0 #f5f5f4; this not showing in ie, haven't found links or need if browser ie. any ideas on how handle this? you might interested in reading this: prefix or posthack . as comments state -moz- vendor specific prefix mozilla. if you're interested in cross browser gradients, find easiest way use gradient generator sort through different implementations , prefixes.

java - JSP Servlet Script, Passing Parameters -

this question has answer here: value passed request.setattribute() not available request.getparameter() 2 answers the error [i new user can't post images (just links)] http://i.imgur.com/aejev.png my ask.jsp(lines 15-20)------------------------------------------------------ <%! string corpus = new string(); string getstory() { corpus = request.getparameter("story"); return corpus; } %> it seems cannot find symbol "request" although have sent 'processstory' servlet shown below:- finally { requestdispatcher rd = request.getrequestdispatcher("/ask.jsp"); request.setattribute("story", storytold); rd.forward(request, response); out.close(); } try chaning <%! <% , request.getparameter() request.get

arrays - Given a set S, find all the maximal subsets whose sum <= k -

this facebook interview question came across @ online portal. given set s, find maximal subsets sum <= k. example, if s = {1, 2, 3, 4, 5} , k = 7 output is: {1, 2, 3} {1, 2, 4} {1, 5} {2, 5} {3, 4} hints: output doesn't contain set subset of other. if x = {1, 2, 3} 1 of solution subsets of x {1} {2} {3} {1, 2} {1, 3} {2, 3} omitted. lexicographic ordering may used solve it. any ideas how solved? i have idea - need tree. if have given input of {1, 2, 3, 4, 5} , , you're searching maximal subsets - should build tree starting biggest numbers, , allways expand while sum <= k (so don't stop on 4-2, go down 1 4-2-1). so, nodes starting 5 be: 5-1 / 5-2 - 2 have sum <= 7 starting 4: 4-3 / 4-2-1 / 4-1 (subset of previous) starting 3: 3-2-1 / 3-1 (subset of previous) starting 2: 2-1 (subset of 3-2-1) starting 1: 1 (subset of 2-1) then can sort valid outputs , {1, 2, 3} {1, 2, 4} {1, 5} {2, 5} {3, 4}

Permissions Error: Within a python script, I need to find a server file in unix system and open it to run commands for the user -

in unix system, within python script, trying open terminal window , start server. understanding python has subprocess module supposed allow such thing. so: import subprocess subprocess.popen(['path terminal']) returns: oserror: [errno 13] permission denied how run right permissions? or, there better, secure way need? i'm relatively new programming, please reorient discussion if question misguided. thank you! edit: state execute /applications/utilities/terminal.app , apparently running mac os x. mac os x .app programs are directories. can started mac os shell command open . to open program /path/to/server in fresh max os terminal session: import subprocess termapp=['open','-a','/applications/utilities/terminal.app'] sp=subprocess.popen(termapp+['/path/to/server']) there's shell-command version of terminal, not need open -a . import subprocess termapp=['/applications/utilities/terminal.app/contents/maco

ios - Custom font is not added to project -

Image
i have same issue described here i have font called antiquaa.ttf. font added supporting files of project. in app plist have entry fonts provided application , antiquaa.ttf added there. i can't use font in app. when run method can't see font. nsarray *familynames = [[nsarray alloc] initwitharray:[uifont familynames]]; nsarray *fontnames; nsinteger indfamily, indfont; (indfamily=0; indfamily<[familynames count]; ++indfamily) { nslog(@"family name: %@", [familynames objectatindex:indfamily]); fontnames = [[nsarray alloc] initwitharray: [uifont fontnamesforfamilyname: [familynames objectatindex:indfamily]]]; (indfont=0; indfont<[fontnames count]; ++indfont) { nslog(@" font name: %@", [fontnames objectatindex:indfont]); } [fontnames release]; } [familynames release]; what missing ? push add button in "c

How would I make an audio streamer in Java? -

i have searched quite bit , haven't found solid answer this. basically, looking way able stream music online continuously, example radio station. i recipient able access stream well, preferably using browser using url this: http://123.114.138.78/stream/radio.mp3 the source audio file should local audio file. i have looked using jmf cannot see how in that. i go jmf or fmj simplest solution. can rtp streaming. if want precisely on http should @ ffmpeg http streaming.

stack dump in twisted app.py 'application' error when using twistd but works with python? -

i trying use twisted when try run of example code provided twisted package, seems crash when use "twistd" instead of "python" for example, using example code given twisted, if run command : twisted -ny echoserv.py unhandled error traceback (most recent call last): file "/usr/lib/python2.7/site-packages/twisted/application/app.py", line 652, in run runapp(config) file "/usr/lib/python2.7/site-packages/twisted/scripts/twistd.py", line 23, in runapp _someapplicationrunner(config).run() file "/usr/lib/python2.7/site-packages/twisted/application/app.py", line 386, in run self.application = self.createorgetapplication() file "/usr/lib/python2.7/site-packages/twisted/application/app.py", line 451, in createorgetapplication application = getapplication(self.config, passphrase) --- --- file "/usr/lib/python2.7/site-packages/twisted/application/app.py", line 462, in getapplication applic

php - Dynamic PDF generation -

this i'm trying do. have student result application in i'll print out pdf format of specially designed result's sheet.. http://www.4shared.com/photo/yg8vcjye/results_layout.html my question is possible send html, css , php variables final result sheet pdf engine, or design new page result_printout.php page , implement pdf engine on page. i'll happy honest opinions thanks help honestly, haven't done before, think should help: http://www.rustyparts.com/pdf.php

ios - Naming the class of hello world program for Mac in Xcode -

i programming hello world program , i'm new xcode. followed tutorial in apple developer website https://developer.apple.com/library/ios/#documentation/ides/conceptual/xcode_quick_start/010-tutorial_using_xcode_to_write_hello_world/hello_world_tutorial.html when tried make new file objective-c class in cocoa mac os x, required class name while in tutorial saying "subclass of nsview (# 3 in tutorial). i put nsview , clicked [next] , asking put new file not name of file. in tutorial (# 4), there "save helloview.m . what supposed name class name? nsview.m or helloview.m ? (i cannot post snapshots because i'm new stackoverflow....) nsview name of superclass don't want call class that, go helloview. class inherits functionality superclass, can add or override behaviour requires. hth

nested - Can you use EXISTS with OR in SQL? -

ok question states have list restaurants have been reviewed “daniel johnston” or have both type “italian” , @ least 1 rating score of @ least 4. i've been trying query: select name restaurant exists (select rest_id restaurant, rates restaurant.rest_id=rates.rest_id , restaurant.type = 'italian' , rates.score>=4) or rest_id in (select rest_id reviews, user user.user_id=reviews.user_id , user.fname = 'daniel' , user.sname = 'johnston'); but keeps returning errors. i've run different parts separately , ok. i'm wondering if can't use exists , or, , if can't, better way? my logic want name of restaurant if it's italian , has @ least 1 review score of on 4, exists suitable that, , using 2 exists doesn't seem make difference why revert normal nested query second part. i've messed around lot , cannot seem figure out wrong, appreciated! subqueries seldom give best performance, faster straight

android - Additional table not created -

i'm trying add second table application i'm not having luck. 2 tables own classes , singletons. pass in reference of database in onupgrade method , again instance variable. @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { transtable = transactiontable.getinstance(db); systable = systemtable.getinstance(db); oncreate( db ); transtable.updatetable(); systable.updatetable(); } the oncreate method calls create methods in tables. @override public void oncreate(sqlitedatabase db) { transtable.createtable(); systable.createtable(); } the second table, systable, doesn't throw , exception while executing following create statement. public void createtable() { db.rawquery("create table if not exists " + tablename + " (" + "_id integer primary key autoincrement, " + lastused + " integer, " + balance + " integer, " + accountname

javascript - Learning AJAX, html code won't do anything -

i have set servlet displaying usernames,passwords,wins,and losses checkersgame wrote. want create ajax program access page , create table listing users wins , losses (like simple leader board). html code won't work , can't see why. can log page list variable url , see xml file servlet. appreciated. <html> <head> <script type="text/javascript"> function requestupdate() { var req = newxmlhttprequest(); req.onreadystatechange = function() { if(req.readystate == 4) { displayresult(req); } } var url = "http://localhost:8080/checkers/checkersservlet"; req.open("get",url,true); req.send(null); } function displayresult(req) { var div = document.getelementbyid("scoreboard"); div.innerhtml = "<table border> <tr> <th> username </th> <th> wins </th> <th> losses </th> </tr>" ; var doc

linux - Running a shell subscript as the parent script's user -

if want call shell script within main script file particular user, how go doing it? child script seems loose context of user running , haven't found useful sub-scripting techniques. ex: war-install.sh if [ ! -d /opt/tomcat/ ] ./tomcat-install-files/install.sh fi the problem here if run war-install.sh root or sudo command, ./tomcat-install-files/install.sh seems lose sudo/root context. how can rectify this? thanks! i agree roosh weird going on. in general run command user: sudo -l <user> <cmd>

javascript - Including PHP variables in an external JS file? -

i have few lines of jquery in web application. code inline @ moment because accepts couple of php variables. <script type="text/javascript"> $(document).ready(function(){ $('.post<?php echo $post->id; ?>').click(function() { $.ajax({ type: 'post', url: 'http://domain.com/ajax/add_love', data: { post_id: <?php echo $post->id; ?>, user_id: <?php echo $active_user->id; ?>, <?php echo $token; ?>: '<?php echo $hash; ?>' }, datatype: 'json', success: function(response) { $('.post<?php echo $post->id; ?>').html(response.total_loves).toggleclass('loved'); } }); return false; }); }); </script> i'm big fan of best practices though, move jquery external js file. how ach

multithreading - Android AsyncTask threads limits? -

i developing application need update info every time user logs in system, use database in phone. operations (updates, retrieving data db , etc.) use async tasks. till didn't see why shouldn't use them, experienced if operations of async tasks stop on pre-execute , don't jump doinbackground. strange leave that, developed simple application check whats wrong. , strange enough, same behavior when count of total async tasks reach 5, 6th 1 stops on pre-execute. does android have limit of asynctasks on activity/app? or bug , should reported? did experience same problem , maybe found workaround it? here code: simply create 5 of threads work in background: private class longasync extends asynctask<string, void, string> { @override protected void onpreexecute() { log.d("testbug","onpreexecute"); isrunning = true; } @override protected string doinbackground(string... params) { log.d("testb

Arduino Serial analogWrite -

how able read serial input on arduino , write value led? i.e. if type 042 console, should execute analogwrite(led, 42); if(serial.available()){ int val = serial.read(); digitalwrite(led, val); }

c# - Is there a correct method or quick way for changing the name of my application/solution -

i have made application, wondering if there way change name of application/.sln . because namespaces need changed etc. but curious whether theres correct proceedure/easy method go it? you can rename project right-clicking project in solution explorer , select rename. doesn’t change physical folder name. change physical folder name, first right-select “open folder in window explorer”, close solution (file> close solution), rename folder contains project (the folder in *.csproj file resides). when reopen solution, vs won’t able load project. fix this, remove stale project entry in solution explorer, right-select properties of solution > add > existing project , navigate select *.csproj file. caveat: namespaces classes stay same before rename.

svn delete - returns No write-lock error (TortoiseSVN 1.7.6) -

Image
i'm trying delete folder d:\svn_home\eclipseworkspace\mf_center_info svn. right click on folder => tortoisesvn => delete => yes all this returns error: no write-lock in d:\svn_home\eclipseworkspace how can fix this? do svn-rename (not regular rename), commit, can svn-delete successfully. tried doing regular rename first , renamed original name, still received error when trying delete folder.

Android widget doesn't work immediatelly after update -

i have problem android widget(it shows battery state). if have widget on home screen , update android market there problem working. widget doesn't work until battery state not change. don't know how fix it. there function, started (after installation of new version ) in appwidgetprovider or service? sometimes have restart program launcher widget update after installing market. go settings → apps → running. choose "launcher" (this may named differently depending on version of android; may have touch "show cached processes" see it). touch "stop". now touch home button again, , go widget chooser (pre-android 4.0, long-touch home screen; android 4.0+, touch application launcher button in middle of bar , select widgets tab). you should see widget. add home screen normal.

c++ - Why can't I initialize non-const static member or static array in class? -

why can't initialize non-const static member or static array in class? class { static const int = 3; static int b = 3; static const int c[2] = { 1, 2 }; static int d[2] = { 1, 2 }; }; int main() { a; return 0; } the compiler issues following errors: g++ main.cpp main.cpp:4:17: error: iso c++ forbids in-class initialization of non-const static member ‘b’ main.cpp:5:26: error: brace-enclosed initializer not allowed here before ‘{’ token main.cpp:5:33: error: invalid in-class initialization of static data member of non-integral type ‘const int [2]’ main.cpp:6:20: error: brace-enclosed initializer not allowed here before ‘{’ token main.cpp:6:27: error: invalid in-class initialization of static data member of non-integral type ‘int [2]’ i have 2 questions: why can't initialize static data members in class? why can't initialize static arrays in class, const array? why can't initialize static data members in class?

ruby on rails - Rake Migrate will not work on developement -

i'm following along tutorials , teaching how create , run migrations. has been working far have run in problem. when have come migration not work in development database. used rake db:migrate rails_env=production see if migrations work , on database can go through migrations , down again no problems errors when run rake db:migrate rails_env=development pauses few seconds returns me console awaiting command. no errors shown or nothing returned show has done , when checking db nothing has changed. can be? use --trace rake db:migrate --trace show database.yml file please.

php - how to put a Cookie into an array? -

i'm trying store array cookie, following error: warning: setcookie() expects parameter 2 string, array given how can put array cookie? edit2: edited code, , store cookie array now, i've got huge problem though. not override values first submission if size of second array smaller. example. first submission array[1206,0402], second submission array[0402]. outcome [0402,0402] wrong. function cuukko($var,$val){ setcookie($var,$val,time()+60*60*24*365); } function preg_dw($var){ global $isset; if ($isset&&is_array($_post[$var])&&sizeof($_post[$var])>0){ $c=0; foreach ($_post[$var] $key => $value) { $val[$c]=trim(preg_replace('/\s\s+/',' ',preg_replace('/[^\d\w\s\(\)\[\]]+/','',$value))); cuukko($var."[".$c."]",$val[$c]); $c++; } } elseif (isset($_cookie[$var])) $val=$_cookie[$var]; return (sizeof($val)>0)?$val

android listening to notifications -

i'm developing app in want listen notifications app on phone. i'm pretty new android development, guidance appreciated. my thought need create service extends accessibilityservice , implement onaccessibilityevent . i'm not sure how connect service app notifications want listen to... you cannot "connect service app notifications want listen to" -- all notifications all apps, because point behind accessibilityservice provide accessibility features. blind user not blind 1 app, apps. that being said, welcome examine accessibilityevent see came from.

Can I use external XML files in for layouts in Android? -

this might silly question, generate layout xml file android on server, , when user presses button, xml file loaded android app. is possible @ all? i not think possible. layout inflator documentation here : from documentation constructor: public view inflate (xmlpullparser parser, viewgroup root) states: important performance reasons, view inflation relies heavily on pre-processing of xml files done @ build time. therefore, not possible use layoutinflater xmlpullparser on plain xml file @ runtime. why not create xml views , build them application? how android apps typically done. if want support totally dynamically generated screens going lot of work. developing own layout sytax, , creating view knows how dynamically render view syntax. need reinvent layout inflator thats built os.

android - Error in wrapping a custom adapter around cwac-endless adapter -

i'm using custom adapter , wrapping around cwac-endless adapter. problem wrapping condition being ignored , method inside cacheinbackground() being called infinitely. i'm attaching concerned code.please suggest me solution this. thank you. @override protected boolean cacheinbackground() { systemclock.sleep(100); // pretend work try { msg=getmsgs(); } catch (clientprotocolexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (parserconfigurationexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (saxexception e) { // todo auto-generated catch block e.printstacktrace(); } log.d("count", " "+ getwrappedadapter().getcount());

iphone - I am getting "_OBJC_CLASS_$_BarcodePickerController" error while integrating red laser -

complete description of error undefined symbols architecture armv7: "_objc_class_$_barcodepickercontroller", referenced from: objc-class-ref in viewcontroller.o ld: symbol(s) not found architecture armv7 clang: error: linker command failed exit code 1 (use -v see invocation) please give idea.. in advance. sounds using redlaser sdk, forgot link sdk project.

xhtml - css positioning issue with float and margin -

this example on jsfiddle http://jsfiddle.net/yg6tx/5/ so question is, why red div( pagewrap ) not taking height of it's inner elements? if specify float:left , takes height, margin: 0 auto no longer holds. how can acheive both? ( margin:0 auto + div needs take height ). do need specify height explicitly? i'm newbie, question might seem simple. try updated fiddle: http://jsfiddle.net/yg6tx/12/ as in original fiddle there no images due incorrect path of images in fiddle no images per requirement have changes layout. as per requirement images @ position, red div taking entire height per elements inside , center margin:0 auto; if lagging please comment can change per requirement.

html - How to set z-index for a shadow (CSS) -

say have box z-index:4 + css shadow. have box z-index:2; how make shadow object 1 on top of object 2? here example of looking for html <div id="shadow"> </div> <div id="under"> </div> css #shadow { background-color: #35bfff; height: 300px; width: 100px; -moz-box-shadow: 0px 0px 11px rgba(0,0,0,1); -webkit-box-shadow: 0px 0px 11px rgba(0,0,0,1); box-shadow: 0px 0px 11px rgba(0,0,0,1); float: left; z-index: 999; position: relative; } #under { float: left; height: 300px; width: 100px; background-color: red; position: relative; } ​ live demo ​

php - Jqgrid custom format use bracket() if negatif value -

Image
is solution in jqgrid if there negative number show bracket "()" ? ex: show (23) if value -23 thanks you can use custom formatter want. format numbers or integers correctly can call $.fmatter.util.numberformat method $.jgrid.formatter.number or $.jgrid.formatter.integer second parameter. example of formetter is formatter: function (cellvalue, options) { var value = parsefloat(cellvalue), retult, op = $.extend({}, $.jgrid.formatter.number); // or $.jgrid.formatter.integer if(!$.fmatter.isundefined(options.colmodel.formatoptions)) { op = $.extend({}, op,options.colmodel.formatoptions); } retult = $.fmatter.util.numberformat(math.abs(value), op); return (value >= 0 ? retult : '(' + retult + ')') + ' €'; } you can additionally change color or other css style of displaying of negative numbers. can use cellattr property add class or style attribute in cells negative numbers: cellattr: