Posts

Showing posts from February, 2011

iphone - Double border to a UIButton -

Image
i have display uibutton in following image. button size can varying. how can that? please suggest way. if want simple outline (it's little hard tell image button is), create button uibuttontypecustom (so blank slate) set background color black. next, calayer of button (through layer method) , set bordercolor , borderwidth properties desired.

php - Paged query exhausting memory -

i want export big table csv, impossible select data @ once , export, open file handle writing , call function takes query , loops through different pages, i'm calling page size of 20 small, after time of execution (maybe 30 minutes), leads error: fatal error: allowed memory size of 100663296 bytes exhausted (tried allocate 85 bytes) in /usr/home/www/wp-includes/wp-db.php on line 1402 this function, $fichero alraedy opened file handle, $pagina_size had value of 20 in last test: function sql2csv_streamed($fichero, $sql, $pagina_size=50) { global $wpdb; $limite1 = 0; $limite2 = $pagina_size-1; $sql_pagina = $sql . " limit $limite1,$limite2"; error_log($sql_pagina); // add values in table while ($rssearchresults = $wpdb->get_results($sql_pagina, array_a)) { foreach ( $rssearchresults $res ) { fputcsv ($fichero, $res , ";"); } $limite1 += $pagina_size; $limite2 += $pagi...

multithreading - need to understand thread(this, ThreadName) in java? -

public class getcurrentthread implements runnable { thread th; public getcurrentthread(string threadname) { th = new thread(this,threadname); //<----doubt system.out.println("get threadname "+th.getname()); th.start(); } public void run() { system.out.println(th.getname()+" starting....."); system.out.println("current thread name : " + thread.currentthread().getname()); } public static void main(string args[]) { system.out.println("current thread name : " + thread.currentthread().getname()); new getcurrentthread("1st thread"); //new getcurrentthread("2nd thread"); } } can explain 2nd line of above code doing? understanding "th = new thread(this,threadname)" is, create thread object name given; let name "1st thread".now, "this" keyword doing here?because when remove , try name of thread got name no issues, never started run()...

c++ - Manipulating with the double pointers across function calls in VC++ -

my scenario follows: in caller function:: idirect3dsurface9 * surf = null; func(&surf); hr = surf->lockrect(, , ); // throws exception bcoz "surf" still null. dont know why ?? in called function: func(idirect3dsurface9 **surfreceive) { surfreceive= new idirect3dsurface9*[10]; idirect3dsurface9* surfcreate = null; hr = xyz->createoffscreenplainsurface( width, height, formt, d3dpool_default, &surfcreate, null); if (failed(hr)) return hr; surfreceive[0] = surfcreate; } my doubt that, in caller (as have shown in code above), surf still null after caller returns back. , throws exception when call lockrect() o...

vb.net - value of type '1-dimensional array of Byte' cannot be converted to integer, any ideas? -

i have used following code read memory address pointer , offset however, i've come use again , can't figure out how got working last time, i'm receiving error "value of type '1-dimensional array of byte' cannot converted integer" highlighting bytesataddress variable in readprocessmemory calls. i've been stuck on 25 minutes can point out me wrong i'm sure it's simple. thanks! public shared function readpointerfrommemory(byval baseaddress integer, byval pointeroffset integer, byval bytestoread integer, byval phandle intptr) integer dim bytesataddress byte() = new byte(bytestoread - 1) {} dim bytesread integer dim memorybase integer dim returnval integer readprocessmemory(phandle, ctype(baseaddress, intptr), bytesataddress, bytestoread, bytesread) memorybase = bitconverter.toint32(bytesataddress, 0) memorybase += pointeroffset readprocessmemory(phandle, ctype(memorybase, intptr), bytesataddress, bytestorea...

ios - What is the meaning of the "Application Requires iPhone Environment" key in info.plist? -

i'm having trouble understanding specific requirements in info.plist file in app. should change @ all, or default settings typically "correct" options? specifically, entry: application requires iphone environment if set yes, imply iphone capable of running app, meaning ipod touch or ipad won't able run app? here's apple's documentation on "lsrequiresiphoneos" bits of application's info.plist file. basically means app designed run under ios. flag should set yes no matter if target device iphone, ipod touch or ipad. who knows, maybe in not-so-distant future, macos able run ios apps (or vice versa)?

Android: Webview does not resize on rotation (ICS) -

i have simple webview in layout, following setup <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rootview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/baserepeat" android:gravity="top|center_horizontal" android:orientation="vertical" android:paddingbottom="20dp" android:paddingleft="20dp" android:paddingright="20dp" > <webview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/productdetailcontentwebview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:background="@drawable/baserepeat" /> //other items... inside manifest have containing ac...

actionscript 3 - Patterns of simple as3 animations -

i want add functionality photo gallery - different types of animation of thumbs of photos. did code below. works fine, desired thumbs bounced off edges of stage. and importantly, need different patterns of animation - movement 3d carousel, spinning in circle, movement of sun's rays , back, etc. i grateful if have ready-made pieces of code these , similar animations. [bindable] private var stagew:int = capabilities.screenresolutionx; [bindable] private var stageh:int = capabilities.screenresolutiony; private var itemsvector:vector.<image>=new vector.<image>(); private var xspeedvector:vector.<number>=new vector.<number>(); private var yspeedvector:vector.<number>=new vector.<number>(); stage.addeventlistener(event.enter_frame, update); private function movesetup():void { for(var i:int = 0; < flexglobals.toplevelapplication.objects.length; i++){ if (flexglobals.toplevelapplication.objects[i] image){ var item:image=flexgl...

ruby on rails - How to get the line of code that triggers a query? -

is there way (a gem, plugin or else) in rails 3.2 know line of code triggers database query? example in log have: user load (0.4ms) select `users`.* `users` `users`.`id` = 5 limit 1 how can know line of code triggers query? thx... i've found solution: module querytrace def self.enable! ::activerecord::logsubscriber.send(:include, self) end def self.append_features(klass) super klass.class_eval unless method_defined?(:log_info_without_trace) alias_method :log_info_without_trace, :sql alias_method :sql, :log_info_with_trace end end end def log_info_with_trace(event) log_info_without_trace(event) trace_log = rails.backtrace_cleaner.clean(caller).first if trace_log && event.payload[:name] != 'schema' logger.debug(" \\_ \e[33mcalled from:\e[0m " + trace_log) end end end in initializer add querytrace.enable!

c# - My Website not Working with ajaxcontroltoolkit 3.5 IIS 7.5 -

i have website asp.net c# when hosted locally works fine. when used iis 7.5 , windows server 2008 ajax control tool kit not work properly. can me please. error shown in firebug: networkerror: 404 not found - http://www.acmeinfovision.com/settings/clientsalaryheadsetting.aspx?_tsm_hiddenfield_=ctl00_toolkitscriptmanager1_hiddenfield&_tsm_combinedscripts_=%3b%3bajaxcontroltoolkit%2c+version%3d3.5.60501.0%2c+culture%3dneutral%2c+publickeytoken%3d28f01b0e84b6d53e%3aen-us%3a61715ba4-0922-4e75-a2be-d80670612837%3af2c8e708%3ade1feab2%3a720a52bf%3af9cec9bc%3a589eaa30%3aa67c2700%3aab09e3fe%3a87104b7c%3a8613aea7%3a3202a5a2%3abe6fb298%3aaf404b5%3a698129cf%3abb25728f%3a289e72ab" client...89e72ab sys.extended undefined [break on error] ...tl00_droppanel"),"dynamicservicepath":"/settings/clientsalaryheadsetting.aspx","... master page code looks this <%@ master language="c#" autoeventwireup="true" codebehind="site.ma...

php - OpenCart User Database [BLOB - 198B] -

in opencart database layer have follow example firstname cart wishlist john [blob - 132b] [blob - 0b] sarah [blob - 198b] [blob - 19b] what blob , can create own? (i creating external register page not using official one) can use same fields or leave them blank? the mysql record shows (phpmyadmin): field: cart type: text length/values: blank default: null collation: ut8_bin attributes: blank null: checked auto increment: not checked comments: blank the cart , wishlist fields automatically filled saved data cart , wishlist respectively logged in users. they're used remember person has added cart/wishlist when log in again. cart field reset when person makes purchase

performance - matlab bsxfun not multithreading? -

i using matlab r2011a , according documentation bsxfun function multithreaded since r2009a (http://www.mathworks.com/help/techdoc/rn/br5k34y-1.html). when use bsxfun compare matrix against upper , lower bound this: szs=10000; szt=50000; matt=rand(szt,3); mats=rand(szs,3); matsub=rand(szs,3); matslb=rand(szs,3); k=1:szs matchid = all([bsxfun(@lt,matt,matsub(k,:)) bsxfun(@gt,matt,matslb(k,:))],2); end on task manager see 1 core of engaged. missing out or normal? bsxfun executes passed function in parallel launching threads inside same matlab process. using "task manager" in windows, can't see threads in execution, running processes. just keep in mind supported multithreaded functions , speed applies if data large enough (but above threshold in example). another option parallel computing toolbox . using matlabpool function, can open new sessions of matlab in back, each in separate process. , when call parfor distributes load on workers. approach ...

objective c - How to control CAKeyframeAnimation with touch gesture? -

i have caemitterlayer animated along bezier path (closed form, '8', out of 4 control points) cakeyframeanimation . want control animation slide of touch-finger along (but not on) path. how possible , possible? make cgpoint click; variable remember initial "drag" point, create local nsevent handler... [nsevent addlocalmonitorforeventsmatchingmask: nsmousemovedmask | nsleftmousedownmask handler:^(nsevent *e) { if ( e.type == nsleftmousedown ) click = e.locationinwindow; else "yourdelta" = click - e.locationinwindow; // pseudocode return e; }]; "yourdelta" offset of initial point current location... achieve similar results scroll events, monitoring nseventscrollwheelmask ... , looking @ e.deltax , e.deltay values. edit: i'm not familiar event handling on ios.. same technique applied normal event handlers... ie. - (void)touc...

ruby - how to solve undefined local variable or method `has_mailbox'? -

i following this tutorial add messaging functionality between users in rails app, got error in user model. class user < activerecord::base has_mailbox end this gives me following error: undefined local variable or method `has_mailbox' #<class:0xb60f6f84> any ideas? i've checked gem, try run rails g has_mailbox:install when install gem in rails app, idea check generators available rails g //list of available generators

php - Detecting browser/version with javascript vs. detecting on server side? -

we building bookmarklet, , wondering if can detect on client side javascript browser , version number more accurately doing on server side using agent. we push detection results server main request. the questions is, can approach work better , more accurate? or both can same mistakes , javascript computes user-agent (which can changed plugin/proxy). important please don't forget building bookmarklet , can't load fancy tools modernizr , jquery doesn't work out fast. i might wrong, think js uses user agent. far haven't seen js browser detect code doesn't compute user agent. correct me if wrong. if helps try jquery $.support property detection/support particular features need rather relying on browser name , version. easy fake user-agent. according this navigator object uses user-agent header.

Delegate memory leakage issue in iOS SDK -

i have memory leakage issue in delgate ios sdk. please check image here http://screencast.com/t/tizjknbt if coming on view, crashing , if retain it, via [self.delegate retain]; wont crash. first, use annoying warning message: http://jomnius.blogspot.ro/2011/09/declaration-of-struct-sockaddrin-will.html second, why retain delegate? have nonatomic, retain class property no need manually retain it... the crash doesn't have this, it's more trying access deallocate object somewhere. suggestion comment/delete retain line, enable nszombies ( how enable nszombie in xcode? ) , tell more crash

ruby on rails - Book recommendation to improve programming solution skills -

i'm self taught. i'm doing of work in rails. find difficult solve complex programming problems, i'm sure lot of do. subject or book study improve programming solving skills? is there specific book matter? maybe math, algebra, calculus? general computer science? book http://pragprog.com/book/ahptl/pragmatic-thinking-and-learning ? general oop? i have on 20 years of programming experience, , in experience ways improve programming skills (not in order of priority) a) solve complex programming problems b) revisit solutions see improvements can made (2-3 passes @ least).a book tips improve programs refactoring: http://www.amazon.com/refactoring-improving-design-existing-code/dp/0201485672 c) dr. dobbs excellent site tips , insight: http://www.drdobbs.com/ e) @ other people's code, eg. open source code don't develop frog in mindset. great way learn practices. f) learn program in multiple languages (eg java, php). great way improve ski...

ubuntu - Tar unexpected EOF error on extraction. -

i have problem tar archive i have tried solutions mentioned on other thread tar error: unexpected eof in archive issue has arrisen in different way. history. i got new laptop after old ubuntu laptop died. pulled out hdd , zipped old home directory. after installing ubuntu on new system, copied on oldhome.tar.gz file. i extracted few files individually, didn't need on old home untill recently. i opened archive the default archive manager shipped ubuntu , whilst opening error message above. the original home drive 30gb in size (before being zipped up). can 'unzip' archive , comes 1.2 gb, if use gzrecover utility can extract small number of original files , directories (using cpio). here questions. there way can 'recover' original file had saved disk (remember able open , extract files previously), impression file considerably smaller was. has been caused extraction of few individual files deep inside archive? will there still 'footprint...

Setting Proxy IP and Port in android code? -

is there way add proxy ip , port in android application internet access routed through proxy? from link got information try { settings.system.putstring(getcontentresolver(), settings.system.http_proxy, "127.0.0.1:100");//enable proxy }catch (exception ex){ } but trying system variable cannot resolved? please help!! thanks in advance httpurlconnection con =null; url url = new url("xxxxx"); proxy proxy=new proxy(java.net.proxy.type.http, new inetsocketaddress(android.net.proxy.getdefaulthost(),android.net.proxy.getdefaultport())); con = (httpurlconnection) url.openconnection(proxy); is okay?

batch file - Using .bat to launch a powershell script -

i can execute following script in powershell when try run script .bat unsucessful.is there way .bat file calls powershell script keeps failing. how create .bat script run powershell script below. cd 'program files (x86)\citrix \xenapp \serverconfig' .\xenappconfigconsole.exe /executionmode:join /farmname:xencity /odbcusername:chris /odbcpassword:jahner0 /dsnfile:"c:\xencitylifesqlds.dsn" please guys many thanks you can putting powershell @ start of command powershell cd 'program files (x86)\citrix \xenapp \serverconfig' .\xenappconfigconsole.exe /executionmode:join /farmname:xencity /odbcusername:chris /odbcpassword:jahner0 /dsnfile:"c:\xencitylifesqlds.dsn" that calls powershell , gives command run, except running in cmd.

java ee - Send XML file as response to ajax -

i have created xml file database. xml file need send response servlet ajax. have checked various forums , blogs on web , found response xml created @ time when servlet called. in case have xml file in server, need send response ajax. help !! in doget() or dopost() method make sure set content-type before writing response. this... printwriter pr = response.getwriter(); response.setcontenttype("application/xml"); //parse data xml string xml = parsexml(root); pr.write(xml); note: content-type of "text/xml" should valid. frameworks jquery , prototype support both.

character - Reseting the player position when a certain Y coordinate is reached -

my problem whenever character reaches y coordinate, want position reset @ (destination x, destination y). have far, , isn't working. of other code works, whenever walk y coordinate, doesn't anything. named boolean y coordinate "death". boolean death = false; if (jumper.getposition().y == 1.0f ) { death = true; } and here try reset it: if (death == true) { create(); } can't simplify this: if (jumper.getposition().y == 1.0f ) { // print here create(); } and if it's not working might because conditional isn't correct ... want make sure type same can compare , accessing object want access. (you might want make both ints if you're doing 1 because floats funsies , values aren't represented if you're doing bunch of computation on can throw values off).

How to correctly communicate between two different MVC Controllers in Java Swing? -

can explain me how controller can call controller method in simple still correct way? please provide code! background: have 2 different controllers-view-model , 2 libraries , need communicate between each other: settingswindow/settingscontroller/settingsmodel: responsible app settings. model singleton because need settings data on app; a library monitoring directory creates event every time file created in specific directory. monitored dir path defined in settingsmodel; i'm using java 7 watchservice api that; a library monitoring webserver , download new files. webserver address , save directory both defined in settingsmodel; i'm using httpsurlconnection , timer that; mainwindow/maincontroller/mainmodel: responsible main app window, has table must updated every time new file created in monitored directory, , everytime file downloaded above libraries. so how correctly instantiate , communicate 4 different features? how controllers commnuicate between them, sin...

XPath ignore span -

i have html contains tags below: <div id="snt">text1</div> <div id="snt">text2</div> <div id="snt">textbase1<span style='color: #efffff'>text3</span></div> <div id="snt">textbase2<span style='color: #efffff'>text4</span></div> how can all text s included in <div> tags using xpath, ignoring span fields? i.e.: text1 text2 textbase1text3 textbase2text4 this cannot specified single xpath 1.0 expression. you need first select relevant div elements: //div[@id='snt] then each selected node string node : string(.) in xpath 2.0 can specified single expression : //div[@id='snt]/string(.) xslt - based verification : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="text"/> <xsl:template match="div[@id=...

php - Where do I get the amazon API key for Zend? -

where amazon api key , amazon secret key use in zend framework? keys amazon s3 work there? infact, confused signup. could give me link signup? thanks you can register aws account here: https://aws-portal.amazon.com/gp/aws/developer/registration/index.html after need access credentials, on aws security credentials page . go there, log in (if needed) , take @ "access key"-tab. copy access key id (amazon api key) , secret access key (amazon secret key) zend application.

iphone - TabbarController with Default View -

i developing iphone application in there 3 class class a, class b , class c. want show class default view 2 tab class b , class c using tabbarcontroller. can 1 suggest me how it. sounds you're looking for: [tabbarcontroller setselectedindex:1]; upon launching app, or other time can set controller shown, above method.

c# - Error Message: Type or namespace definition, or end-of-file expected -

i've searched internet, previous answers said semicolon missing. that's not problem. else can cause error? in third site, several people asked question scenario different. error > type or namespace definition, or end-of-file expecte d public partial class seensms : system.web.ui.usercontrol { //temp sql connection //public sqlconnection mycon; sqlconnection mycon = new sqlconnection(@"data source=asoft20\mamut;initial catalog=viltranew;userid=sa;password=sa123"); protected void page_load(object sender, eventargs e) { string[] msg_arr = request.querystring["arr"].split('|'); if (!ispostback) { string moose = request.querystring[1]; } if (msg_arr != null) { if ((msg_arr.length == 3) && (msg_arr[1].tolower() == "slett")) { int hours = convert.toint32(msg_arr[2]); if (hours ...

run gnu-screen/tmux/byobu from client -

i need understand fundamental concept terminal multiplexers yet can't seem find answer. as understand these programs need installed on server not on clients. it's not problem gnu-screen installed on systems it's not case tmux , byobu. problem don't have permission install software on server. there way can run byobu client show statistics server connect? also effect of 'byobu-enable' option? i think there misunderstanding here. when connect server , run command (byobu in case), running command on server. statistics reported server. it's possible open byobu session on own desktop of course, if you're ssh'd machine, you're executing commands on machine. byobu-enable sets byobu launch automatically when open terminal. don't since can have confusion if have byobu running locally and on remote end have connected to, causes problems when try interact byobu itself.

c# - Gives different meaning in another scope -

here have part of code.in here got error. error >>a local variable named 'msg' cannot declared in scope because give different meaning 'msg', used in 'parent or current' scope denote else but use thing inside smshelper class.then scope public class smshelper { private string msg; private string converttoisofromutf8(string msg, string to, string from) { string iso_msg = null; if (from.equals("utf-8")) { system.text.encoding iso = encoding.getencoding("iso-8859-1"); system.text.encoding utf8 = encoding.utf8; byte[] utfbytes = utf8.getbytes(msg); byte[] isobytes = encoding.convert(utf8, iso, utfbytes); string msg = iso.getstring(isobytes); } the 3 lines marked <-- this below each represent declaration of separate variable, each having same name msg . conflict eachother. private string msg; // <-- private str...

Google script DocsList service query string not working -

i'm making little script automatically organize autogenerated spreadsheets. goal archive spreadsheets in directory based on name (all of them start same name end in pattern i'm using organize them). problem have function: lstfile = docslist.find('type:spreadsheet title:"prog_gral_centre"'); the function doesn't have query options specified in the docs , i'm using on script , working fine! i've tried putting only: lstfile = docslist.find('prog_gral_centre'); which should find 200 documents, none found! actually, if type prog_gral_centre search box of google drive, documents found, don't know what's wrong search filter. any thoughts? the method find(query) looks string in file content, not on file name... it worked (meaning without issue mentioned) i'm not sure solution use case since there risk filename found inside doc name (as reference example...). why don't try getting filenames in array , search ...

Android - Short range communication (Like NFC) -

when application running in foreground on 2 android smartphone's, want exchange data between them. one phone connected internet , other phone might not connected. exchanging data using web server not possible. i tried client server socket communication. if phone connected internet via router ip address not public (192 range) hence not able access it. i tried exchange data using bluetooth there lot of prompts (like enable bluetooth, discoverability, pairing etc). nfc option few phones support it. keep last option. there other possible means of peer peer communication. if phone ip address not in public range, possible access (using nat or means) ?

android - How to start app from first when home button is clicked -

in application when click home button , when again when open app should come first.i having splash screen first activity.when open app,the app should start splash screen. @override public void onattachedtowindow() { super.onattachedtowindow(); this.getwindow().settype(windowmanager.layoutparams.type_keyguard); } @override public boolean onkeydown(int keycode, keyevent event) { if(keycode == keyevent.keycode_home) { log.i("home button","clicked"); onpause(); } return false; } protected void onpause() { super.onpause(); intent i=new intent(h2.this,homeexampleactivity.class); startactivity(i); // start first activity } i tried in way overriding on pause method not working.please me how solve issue you can try this: boolean hasgone = false; @override void onresume() { super.onresume(); if(hasgone...

PHP string concat doesn't trigger -

i've got following bit of code check if form multiple fields correctly filled. problem is, doesn't concat strings properly. below code of code: if(strlen($name) < 2 || strlen($email) < 6 || strlen($subject) < 5 || strlen($message) < 15){ $alert = "there problems: \n"; if(strlen($name) < 2){ $alert . "name short \n"; } if(strlen($email) < 6){ $alert . "email short \n"; } if(strlen($subject) < 5){ $alert . "the subject short \n"; } if(strlen($message) < 15){ $alert . "your message short \n"; } $alert . "please fill in te fields correctly"; echo $alert; ?> <script> alert(...

python - SublimeText2 plugin settings: Escape Dollar sign for a regex in DocBlockr plugin's settings -

docblockr sublimetext2 lets declare custom variable type rules based on name of variable. from readme: "jsdocs_notation_map": [{ "regex": "tbl_?[rr]ow", // arbitrary regex test against var name "type": "tablerow" // can add own types }] i want catch variables start $ character example: "jsdocs_notation_map": [{ "regex": "^[$].+", // word starts $ "type": "htmlelement" // type }] so $header caught above regex. unfortunately above not work. plugin won't recognize $header variable "htmlelement". i have tried following regex strings: $ - matches everything, varnames no $ inside them. \\$ \\\\$ $$ \\$$ \\\\$$ [$] [\\$] sidenote: editor won't let me insert odd numbers of \ . all of them match nothing, except first matches everything. this not regex question. regexs should work, (ex: ^[$].+ ) not work because...

encryption - Bouncy Castle C# PGP Decryption example -

i have been looking day yesterday, , can't seem find working example of pgp decryption using bouncy castle in c# finally got work. main issue had other samples fact private key ring had included key signing coming first when trying load key decryption. why why had add check elgamalprivatekeyparameters type on key. below code. not clean, works. private static pgpprivatekey getprivatekey(string privatekeypath) { using (stream keyin = file.openread(privatekeypath)) using (stream inputstream = pgputilities.getdecoderstream(keyin)) { pgpsecretkeyringbundle secretkeyringbundle = new pgpsecretkeyringbundle(inputstream); pgpsecretkey key = null; foreach (pgpsecretkeyring kring in secretkeyringbundle.getkeyrings()) { foreach (pgpsecretkey secretkey in kring.getsecretkeys()) { pgpprivatekey privkey = secretkey.extractprivatekey("12345...

one search term - two sets of results with codeigniter. how to? -

i have search form. when type term, first search trough users table , return name, username, e-mail etc…and next should perform query same search term table example: posts , return posts user name , post. so have return , display 2 sets of results. must admit totally lost, , have no idea how proceed. anyone can me idea how codeigniter? thanks in advance, zoreli you cannot 2 searches asycn if what's you're looking do. the best , easiest way this: $this->load->model('search'); $data['users'] = $this->search->searchusers($searchterm); $data['posts'] = $this->search->searchposts($searchterm); $this->load->view('yourview',$data); this assumes search model has methods search tables. in view, can iterate on $users , $views reference returned results.

Post to friend wall in facebook in iphone? -

hi trying post on friend wall using friend id this [facebook requestwithgraphpath:@"1581445658/feed" andparams:[nsmutabledictionary dictionarywithobject:@"hello morning" forkey:@"message"] andhttpmethod:@"post" anddelegate:self]; but getting error 400 bad request. please suggest me how to rid of bad request. note: method work first 10-15 time after start giving error. continuously giving error. i think id blocked fb. have tried other id ?

tridion - XML validation error when updating Keyword metadata -

following on earlier question creating address books (many peter!), have small throw-away console application doing , working great - in addition i'm trying update metadata of keyword item id of created address book. slightly shortened snippet ... staticaddressbook ab = new staticaddressbook(); ab.title = title; ab.key = key; ab.save(); // id correct keyword tcm id keyword k = tdse.getobject(id, enumopenmode.openmodeedit); if (k != null) { k.metadatafields["addressbookid"].value[0] = ab.id.itemid; k.save(true); } i keep getting following error on save(): xml validation error. reason: element 'metadata' in namespace 'uuid:2065d525-a365-4b45-b68e-bf45f0fba188' has invalid child element 'addressbookid' in namespace 'uuid:2065d525-a365-4b45-b68e-bf45f0fba188'. list of possible elements expected: 'contact_us_email' in namespace 'uuid:2065d525-a365-4b45-b68e-bf45f0fba188' but know keyword ha...

windows phone 7 - How to launch Bing Map with GPS Latlon -

for google map, can use code map browser: http:// maps.google.com/map? q= lat,lon. for bing map, how can done? thanks you can use bingmapstask launch bing maps app specified centre point (or search parameters - there how-to article on msdn , although code simple as: bingmapstask bingmapstask = new bingmapstask(); //omit center property use user's current location. bingmapstask.center = new geocoordinate(52.1, 1.2); // substitute lat/long bingmapstask.show();

c++ - How to convert 0 (and only 0) into my data structure -

i implementing si unit type system. ensure units don't leak in , out, don't want implicit conversion of values unit, , vice-versa. however, convenient able convert 0 unit system, bit can pointers, 0 implicitly converts null pointer, no other value does. so question is: can replicate kind of implicit conversion of 0 null pointer? or can use advantage achieve same thing? for example think of such constructor? constexpr unit_t(void*) : _value(0) { } note: unit in type, not in value. edit: why casting 0 unit? the reason want this, write algorithms don't know units. example, if have matrix of lengths , want invert it, first compute determinant, , if it's not 0, return inverse (otherwise, error). so convenient treat 0 literal generic unit. , happens pointers. can type: void* c = 0; but not: void f(int a) { void *c = a; } the classical solution pointer private type, user can't name. way, way can match through implicit conversion 0 . (usin...

java - in which cases equals() is similar to ==? -

possible duplicate: difference between equals , == in cases equals() works == operator? it seems both act similar primitive data types . there other cases in both of them act equal? == compares bits of reference object type if have reference same object case for example integer value -128 , 127 (inclusive) caches (while autoboxing) instance case here mentioned range of value of integer

java - TextView not being displayed / Relative Layout -

this might seem easy question of folks, can't find way display textview after trying numerous solutions proposed on site. not using built-in eclipse xml tool android , textview visible on graphical layout. here's i've got far : <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/home_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <imageview android:contentdescription="@string/no_of_screens" android:id="@+id/imageviewhome" android:layout_width="290dp" android:layout_height="212dp" android:layout_gravity="center_horizontal" android:paddingtop="40dp" android:src="@drawable/logo" /> <relativelayout android:id="@+id/relativeid" android:layout_width="match_parent" android:lay...

javascript switch/case : are types compared? -

possible duplicate: is safe assume strict comparison in javascript switch statement? does switch/case statement in javascript compare types or values? in other words, when have following code: switch (variable) { case "0": [...] break; case "1": [...] break; default: [...] break; } is equivalent to if ( variable == "0" ) { [...] } else if ( variable == "1" ) { [...] } else { [...] } or to if ( variable === "0" ) { [...] } else if ( variable === "1" ) { [...] } else { [...] } edit: there way force compare values , types @ once? yes, types compared. if input equal clauseselector defined === operator, set found true. ecma-262 , page 95.

railo - Jelastic or Cloudbees support for websockets -

does know if it's possible use websockets on cloudbees or jelastic. deployed railo project websockets on port 10126, works beautifully on tomcat local setup nothing happens when deployed both jelastic , cloudbees. at jelastic do. 1 of outcomes of our making public ips available. doing short how-to article coming topic. can out on our blog (http://blog.jelastic.com) or our twitter account (@jelastic).

objective c - "Cannot find interface declaration for <class>" -

screenshots i'm having quite hard time setting category on class made. i've read, objective-c allows create category on any class, not closed-source ones. (it wouldn't make sense other way.) of course can add category messages actual class file, want keep them separate (as category uncommonly special use of class can used generally). want share class, keep category private... anyway. i've stripped down category show issue @ hand. (currently) 4 errors on first category message. number of errors receive on line directly proportional how many times references, not rise. know causing this? your resources.h file, imported bytecollection.h, imports bytecollection+words.h. when bytecollection+words.h imports bytecollection.h, results in circular dependency†. simplest way break circular dependency move 1 of imports implementation file rather header. looks should possible resources.h. † might wondering, why problem if have circular dependency? well, #import...

android setting different fonts/colors in listview -

i have created listview 3 rows in android. if set different fonts/colors on rows, how achieve this? far have tried different things without sucess. latest try, try set getcomment() italic, have no clue doing :d. please help! public string tostring() { return this.getalias() + " " + this.dateformat.format(this.getdate()) + "\n" + (html.fromhtml("<i>" + this.getcomment() + "</i>" + "<br />")); } i assume have defined rows in xml layout file. can change color / style of text in textview simple parameters: <textview ... android:textcolor="#ffff0000" android:textstyle="italic" />

c# - Conflicting versions of ASP.NET Web Pages detected -

i moved php asp.net. i'm trying deploy basic mvc 3 application hosting provider. after deploys, visit website, , displays: conflicting versions of asp.net web pages detected: specified version "1.0.0.0", version in bin "2.0.0.0". continue, remove files application's bin directory or remove version specification in web.config. i'm not sure look. 'out of box' mvc 3 application no modification. tried use method, "http://stackoverflow.com/questions/10896878/conflicting-versions-of-asp-net-web-pages-detected-specified-version-is-1-0-0" had no luck. any appreciated. you need set webpages:version appsettings appropriate value. in case has 2.0.0.0 <appsettings> <add key="webpages:version" value="2.0.0.0"/> </appsettings>

Joomla! 2.5.4 Hacked: Having trouble with diagnosis -

my joomla 2.5.4 site cracked last night. moreover, joomla forum down, , can't run joomla's diagnostic utility. (fpa-en.php) i have followed joomla's instructions diagnosis no success. (see below) have emailed webhost (i on shared server, use host recommended joomla specialist in joomla sites). so, question do next? here info have far. using joomla 2.54 (the latest). extension updated recent release, , none on joomla vulnerable extensions list. passwords of other administrators changed not mine fortunately. user_notes table deleted, renders user manager in admin section useless. according logs attack hit following files in sequence: /administrator/index.php /index.php (root) /plugins/authentication/joomla/joomla.php /plugins/user/joomla/joomla.php and changes users , user_notes tables. there no junk in either index.php attack ip 199.15.234.216, fort worth server of supremetelecom.com fortunately, have backups , there no defacement, until can...

Mysql: Subtracting values based on two queries -

i have following 2 queries. select account_name,sum(amount) amount1 entries left join accounts on accounts.id = entries.accounts_id side = 'd' , op_balance_dc = 'd' group accounts.id here's result of query: query1 select account_name,sum(amount) amount2 entries left join accounts on accounts.id = entries.accounts_id side = 'c' , op_balance_dc = 'd' group accounts.id here's result of second query query2 i not trying display results of above 2 queries, trying achieve account_name, amount1 , amount2 above queries , subtract amount2 amount1- , add value table's column. example: (amount1-amount2)+op_balance //here op_balance column name and display account_name , (amount1-amount2)+op_balance could please me query? thanks :) please let me know if need anymore information.:) edited here's structure of tables: table name: accounts table name: entries ...

Can I declare a global variable in xquery in Marklogic Server? -

i want global variable can use in different .xqy pages. can declare such variable in xquery in marklogic server ? you can declare variable in module. instance config.xqy. declare variable $precision xs:integer := 4; for using variable need import module in work module. import module namespace conf = "http://your-namespace" @ "config.xqy"; and refer variable: $config:precision

python - Whether eval() better than self-analysis? -

here situation, have string follows 'a':1 'b':2 'c':3 i want turn dict, have 2 options: split string ' ' , ':' put pairs dict . replace ' ' ',' , append '{' , , '}' string , use eval() dict . so question 1 faster? i this: import ast result = ast.literal_eval(''.join(["{", s.replace(" ", ", "), "}"])) you can (although difference may negligible): import ast result = ast.literal_eval("{" + s.replace(" ", ", ") + "}") it's better use ast.literal_eval it's safer purpose using eval() .

java - How to read test logs -

i have run maven test have logs in big log file can found error pointing out to. see when go down bottom says faliure exception message null , functional clas test name , othe id names? tests fail logged in respective test report files. when there errors mvn test lead this: (assuming typical surefire usage) [error] please refer .../project/target/surefire-reports individual test results. if in directory, you'll see this: (specific project) some.rnd.pkg.anygiventest.txt (depending on configuration, may have xml instead, or in addition, etc. xml has significant other information well, classpath , property info--it can handy sometimes, although stack trace enough.) stack traces in there.

c# - Regular expression for quoted text and special characters -

i'm trying figure out regular expression in .net can detect xml special characters enclosed in quotation marks. can contain other characters @ least 1 ocurrence of following has exist < > & ' " matches "hello &" "& something" "testing <>" does not match "foo bar" i've tried expressions "[&<>\"\'\w\s]+" regex accepts strings special characters absent. the purpose of expression cleanse xml attributes special characters might crash parsers. your regex says string of of characters (e.g. \w ) should match. try instead: ^.*[&<>\"\'].*$ you shouldn't need escape quotes, though. and hope you're using dom parser retrieve attribute values...

c++ - what's the meaning of *& -

i java coder , not familar c++ language. right now,i read following code: void method(a* a,a*& b); *a; *b; method(a,b); and question is: what's meaning of "*&"?does means represent value of b itself? thx b reference pointer of a . so if method sets b , b in scope of call changed.

r - comparing values in a row -

i trying compare values on data frame rows, , removing ones match, this dat[!dat[1]==dat[2]] where > dat returns n1 n2 n1 n4 n4 n5 n1 n3 n4 n4 so want compare values , delete last row, since both columns have same data. when use above code, tells me error in ops.factor(left, right) : level sets of factors different the str(dat) reads 'data.frame': 5 obs. of 2 variables: $ v1: factor w/ 2 levels "n1","n4": 1 1 2 1 2 $ v2: factor w/ 4 levels "n2","n3","n4",..: 1 3 4 2 3 i suspect in creation of data, inadvertently , implicitly converted columns factors. possibly happened when read data source, e.g. when using read.csv or read.table . example illustrates it: dat <- read.table(text=" n1 n2 n1 n4 n4 n5 n1 n3 n4 n4") str(dat) 'data.frame': 5 obs. of 2 variables: $ v1: factor w/ 2 levels "n1","n4": 1 1 2 1 2 $ v2: factor w/ 4 levels ...