Posts

Showing posts from January, 2015

windows 7 - php mysqldump and zip 7z -

i have line of php backing databases, work's charm (windows 7): $exec_str = "{$real_path}bin\mysqldump -h {$mysql_db_host} -u {$mysql_db_user} -p{$mysql_db_pasw} {$db_name} > {$backupdir}\\{$db_name}.sql"; but rather prefer have .sql files compressed 7zip (as 7z) this 1 not work (path 7za.exe correct) instead generates empty 7z files: $exec_str = "{$real_path}bin\mysqldump -h {$mysql_db_host} -u {$mysql_db_user} -p{$mysql_db_pasw} {$db_name} | {$real_path}7za > {$backupdir}\\{$db_name}.sql.7z"; what doing wrong? i used 7z compress output mysqldump (windows server 2008 r2), used command line batch files , automated tasks instead. also, used 7z.exe, not 7za. note following commands executed windows command terminal, i.e start->run-> cmd i created batch file automated task run contents: mysqldump -u<mysqlusername> -p<mysqlpassword> <schemaname>|7z.exe -si<nameinzip> <zippedpathandname.7z> thi...

input - iOS - dispatcherTimer blocking touches events? -

i using dispatcher source timer update view @ different frame rates. (8, 12 or 24 fps) here code initializes dispatchertimer , function used create timer. (this function directly taken apple doc in subsection "creating timer": http://developer.apple.com/library/mac/#documentation/general/conceptual/concurrencyprogrammingguide/gcdworkqueues/gcdworkqueues.html ) call: self.dispatchtimer = [self createdispatchtimerwithinterval:self.project.frameduration * nsec_per_sec leeway:0.0 * nsec_per_sec queue:dispatch_get_main_queue() block:displayframe]; function: - (dispatch_source_t)createdispatchtimerwithinterval:(uint64_t)interval leeway:(uint64_t)leeway queue:(dispatch_queue_t)queue block:(dispatch_block_t)block { dispatch_source_t timer = dispatch_source_create(dispatch_source_type_timer, ...

Can I get the C++ preprocessor to send output during compilation? -

i have been debugging particularly insidious bug believe caused unexpected changes stem different behavior when different headers included (or not). this not structure of code let's take @ scenario: #include "newly_created_header_which_accidentally_undefines_some_define.h" // ... #ifdef some_define code_which_i_believe_i_am_always_running(); #else code_which_fails_which_i_have_forgotten_about(); // runtime error stack traces here, don't know this... or maybe it's strange linker error #endif i search through git commits , narrow down cause of bug, compiling , running code countless times, find after several hours difference required causing bug inclusion of appears benign , unrelated header. perhaps great argument why preprocessor sucks. but it. preprocessor cool because lets make shortcuts. it's of these shortcuts, when not used carefully, bite in butt pretty hard. so @ juncture have helped if use directive #echo "running old cr...

objective c - object mapping using introspection restkit -

i'm trying parse soap response using restkit. i'm able convert soap xml response objects if define mappings , relationships myself. but, wondering if it's possible use introspection (or else) automatically convert soap xml response objective-c object. sample xml: <return> <userid xsi:type="xsd:int">1113050187</userid> <location xsi:type="ns1:location"> <city xsi:type="xsd:string">san francisco</city> <state xsi:type="xsd:string">california</state> </location> </return> i convert xml object: @interface return : nsobject @property (strong, nonatomic) nsinteger userid; // attribute @property (strong, nonatomic) location *location; // relation @end the closest thing come using introspection on return class properties , using each attribute: [mapping addattributemapping:[rkobjectattributemapping mappingfromkeypath:@"userid.text...

iphone - Adding objects in Core Data -

i trying familiar core data , had xcode create subclasses of nsmanagedobject me. 1 addressannotation has information location street, zip, address, etc. other is: map : nsmanagedobject @property (nonatomic, retain) nsstring * name; @property (nonatomic, retain) nsset *locations; - (void)addlocationsobject:(addressannotation *)value; - (void)removelocationsobject:(addressannotation *)value; - (void)addlocations:(nsset *)values; - (void)removelocations:(nsset *)values; when want add location map, do: - (void)insertlocationintomap:(map *)map { [map addlocationsobject:self.address]; i nslogged map object , address object , both have values in it. when try adding object existing map object, not seem added. output of map logged is: <map: 0x7087480> (entity: map; id: 0x7084ff0 <x-coredata://8d6d7849-e7ec-48a3-ba95-c082d09e5d6d/map/p1> ; data: { locations = "<relationship fault: 0x768e4e0 'locations'>"; name = asdf; }) if cr...

c# - Dynamic data for JQuery in ASP.NET pages -

problem i have pages need dynamic data website generate output users. a simple solution aspx(php, ...) page generate data , create html page serving gui retrieving data first page , showing users. in method can call gui page example form1.aspx , data page form1.json.aspx. although method, not suitable when creating components it. another method i'm using using same gui page call querystring retrieve data. page should check query string , if exists, generate data , remove else page. example method if call page form1.aspx, retrieve data, need call form1.aspx?json here example of i'm doing: protected void page_load(object sender, eventargs e) { if (request.querystring.tostring().indexof("json") == 0){ this.controls.clear(); response.clear(); // send pure data client } else { // render page gui } } however method becomes messy if add master page and/or inherit page template page. master pages can removed in page_p...

PHP: Evaluating variable in string, and then changing value of variable -

i have string such following: $s1 = "apples"; $s2 = "$s1 great"; echo $s2; my understanding of php double-quotes in second line cause $s1 evaluated within string, , output be apples great however, if wanted keep $s2 "template" change $s1's value , re-evaluate new string? possible? example: $s1 = "apples"; $s2 = "$s1 great"; echo $s2 . "\n"; $s1 = "bananas"; $s3 = "$s2"; echo $s3 . "\n"; i find output following is: apples great apples great what hoping more like: apples great bananas great is such thing possible php can keep "template" string same, change input variables, , reevaluate new string? or not possible php? well, this: (just quick mashup). $template = "{key} great"; $s1 = "apples"; $s2 = "bananas"; echo str_replace('{key}',$s1,$template) . "\n"; echo str_replace('{key}',$s2,$tem...

c# - EXT.NET Combobox in gridpanel show value instead of text -

i have big problem in ext.net. have gridpanel combobox inside. combobox work fine when grid load, if click on combobox edit, combobox show me value instead of text. if select 1 of possible item in combobox, save result , retry edit same combobox, @ time value show correct (i see text , thi correct.) follow code: the render function: var statusrenderer = function (value, st) { var ind = st.find("value", value); var r = st.getat(ind); if (ext.isempty(r)) { return ""; } return r.data.text; }; the column in gridpanel: <ext:column id="columnprofilo" runat="server" dataindex="profilo" text="profilo"> <renderer handler="return statusrenderer(value, #{storeprofilo});" /> <editor> <ext:combobox id="comboboxprofilo" selectonfocus="t...

ios - UIWebView Bookmark Bug with pdfs -

i have code generates pdf text files, , adds bookmarks various locations within said pdf using uigraphicsaddpdfcontextdestinationatpoint , uigraphicssetpdfcontextdestinationforrect . uiwebview appears bugged, clicking bookmarks temporarily renders other bookmarks send view top of document. "temporarily" because clicking on unaffected bookmark seems reset bookmarks point supposed to. this doesn't appear coding problem, occurs in uiwebview . when open pdf in ibooks, links work fine. prefer view pdf in app, , other ways i'm aware of ( uiimageview & uisliderview ) eliminate bookmarks altogether. i'm hoping there way fix uiwebview problem no longer occurs. any suggestions?

php - How does this mod_rewrite code resolve properly? -

my .htaccess file follows: options -multiviews rewriteengine on rewritecond %{http_host} ^example.com rewriterule ^(.*)$ http://www.example.com/$1 [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ $1.php it works, i'm wondering how works. example, if type in example.com/main , file @ www.example.com/main.php . how .php extension if code tells rewriting stop after adding www. beginning of example.com ? edit: or should create unique id purpose of logging in remembered user? the particular behavior you're asking comes because rule rewriterule ^(.*)$ http://www.example.com/$1 [r=301,l] is 301 redirect; instructs browser initiate new http request. l causes (can cause) last rule executed that request ; new request comes in correct hostname , proceeds onward.

animation - Clearing plotted points in R -

i trying use animation package generate "evolving" plot of points on map. map generated shapefiles (from readshapespatial/readshapelines functions). the problem when it's plotted in loop, result additive, whereas ideal result have evolve. are there ways of using par() missing? my question is: there way clear points ploted points function , not clearing entire figure not having regraph shapefiles? in case wants see code: # plotting underlying map newyork <- readshapespatial('nycpolygon.shp') routes <- readshapelines('nyc.shp') par(bg="grey25") plot(newyork, lwd=2, col ="lightgray") plot(routes,add=true,lwd=0.1,col="lightslategrey") # plotting points , save gif ani.options(interval=.05) savegif({ par(bg="grey25") # begin loop (i in 13:44){ infile <-paste("week",i,".csv",sep='') mydata <-read.csv(file = infile, header = true, sep=",") plo...

How to get a ClickOnce application path and version number using C#/.NET code? -

i want path , version number of clickonce application, provided name of clickonce application. when manually searched it, found @ path follows: 'c:\users\krishnaim\appdata\local\apps\2.0\1hcg3kl0.k41\vo5bm4jr.rpo\head..tion_7446cb71d1187222_0005.0037_37dfcf0728461a82\headcount.exe' but keeps on changing, , become hard-coded path. there way clickonce application (for example, headcount.exe installed) path , version number using c#/.net code? it seems little bizarre, getting current directory of executing assembly bit tricky code below may doing more think should, assure mitigating issues others may attempt use assembly.getexecutingassembly .location property. static public string assemblydirectory { { //don't use assembly.getexecutingassembly().location, instead use codebase property string codebase = assembly.getexecutingassembly().codebase; uribuilder uri = new uribuilder(codebase); string path = uri.unescaped...

jquery - remove qtip when element is removed from dom -

i apply tooltip qtip2 via jquery .on event on mouseover, on img , div elements. elements need removed dom while qtip still showing, , removal not under control. result qtip stays there forever. how can remove qtip when associated element removed? edit underlying elements not removed jquery's .remove() innerhtml=.. qtip2 automatic removal not working here. as asking qtip2 way, here is. in qtip2-initialization, add this: events: { //this hide event remove qtip element body , assiciated events, leaving no dirt behind. hide: function(event, api) { api.destroy(true); // destroy } } tested qtip 2.2.0. source

c++ - Ctypes not finding symbols in shared library created using CMake -

my cmake setting create shared lib in linux like set (cmake_cxx_flags "-fpic") set (lib_utils_src utils.cpp ) add_library (utils shared ${lib_utils_src} ) source utils.cpp double addtwonumber(double x, double y) { return x + y; } when trying access 'addtwonumber' function using ctypes like import os import ctypes c libpath = '/home/ap/workspace/learningcpp/lib/libutils.so' libutils = c.cdll.loadlibrary(libpath) prototype = c.cfunctype( c.c_double, c.c_double, c.c_double ) addtwonumber = prototype(('addtwonumber', libutils)) res = addtwonumber(c.c_double(2.3), c.c_double(3.5) ) i getting message like. attributeerror: /home/ap/workspace/learningcpp/lib/libutils.so: undefined symbol: addtwonumber i checked libutils.so using "nm --demangle libutils.so" command , shows 'addtwonumber' symbol in it. why still getting "undefined symbol...

javascript - Center an image inside a div. Horizontally and vertically -

i think question has been asked many times i've been searching web whole day , cannot find single solution. want centre image inside div looks frame. have images of different sizes, portrait, landscape. want them centered horizontally , vertically , not overflow container if size larger. i've read div vs table designs seriously, right want job done, solution appreciated. check demo - http://jsfiddle.net/x6jdu/ table-cell has ie8+ support

php - Memcache interesting bug - a:0:{} -

the code simple $mem = $this->memcache->get("memche_".$_session['userid']."_page_".$page); if(empty($mem)){ // make query , save data memcache } else { // memcache } but right there no data cache not empty if print_r($mem); a:0:{} and pass if statement if(empty()) that not bug, have empty array stored in memcache. array empty, not variable referencing array. var_dump(unserialize('a:0:{}')); array(0) { } you should checking if $mem false ($mem===false), not if empty. memcache returns false if cache key doesn't exist.

regex - Strip URL - Python -

ok how use regex remove http and/or www http://www.domain.com/ domain.com assume x kind of tld or ctld input example : http://www.domain.x/ www.domain.x output : domain.x if want use regular expressions instead of urlparse() or splitting string: >>> domain = 'http://www.example.com/' >>> re.match(r'(?:\w*://)?(?:.*\.)?([a-za-z-1-9]*\.[a-za-z]{1,}).*', domain).groups()[0] example.com the regular expression might bit simplistic, works. it's not replacing, think getting domain out easier. to support domains 'co.uk', 1 can following: >>> p = re.compile(r'(?:\w*://)?(?:.*?\.)?(?:([a-za-z-1-9]*)\.)?([a-za-z-1-9]*\.[a-za-z]{1,}).*') >>> p.match(domain).groups() ('google', 'co.uk') so got check result domains 'co.uk', , join result again in such case. normal domains should work ok. not make work when have multiple subdomains. one-liner without regular expres...

How to disable autogrowing of the field in JEditable? -

i have been developing application , use following code jeditable: <script type="text/javascript" charset="utf-8"> $(function() { $(".field").editable("http://"+document.location.host+"/index.php/welcome/update_record", { event : "mouseover", style : "inherit", autogrow: { lineheight : 0, maxheight : 0 }, submitdata: function (value, settings) { return { "old_value": this.revert}; }, callback: function(value, settings) { } }); }); i need disable autogrowing of field in order if user moves on fields field won't grow. field grows if user moves on it. need it, please help. thank much. i have used success...

android - can anyone explain this code of media controller? -

can explain code of media controller? videoview = (videoview) findviewbyid(r.id.player); videoview.setvideouri(uri.parse("android.resource://"+ getpackagename()+ "/" +r.raw.sample)); videoview.start(); mediacontroller controller = new mediacontroller(this); controller.setmediaplayer(videoview); videoview.setmediacontroller(controller); the code gets videoview id, sets uri of file play embedded resource , starts playback. then attaches mediacontroller view renders progress bar , controls play / pause video.

eclipse - Git repository clone always import the same project -

edit: found out causing problem. i've added new remote/origin/ entry in git config that's causing eclipse fetch same project everytime. i new git. having problem cloning repo eclipse. no matter repo try clone, "import project git" screen force me select same project name(in case it's membership program) , when click finish button. import "membership program" eclipse. here link ( http://imgur.com/09pol ) containing screenshots of import process can better idea of talking about. anyone have idea did wrong? perhaps try selecting 'new project' radio button on second dialog in screenshot.

gcc - Linux 32 bit disassembly has call instructions to next byte -

i'm creating driver 32 , 64 bit linux os. 1 of requirements of code needs self contained no call outs. on 64-bit i've no issues, on 32-bit gcc seems add call instruction next byte. after searching bit found link: http://forum.soft32.com/linux/strange-problem-disassembling-shared-lib-ftopict439936.html is there way disable on 32-bit linux? example: 32 bit disassembly: <testfunc>: 0: push %ebp 1: mov %esp, %ebp 3: call 4 <test_func+0x4> <...some operation on ebx mentioned in link above> 64 bit disassebmly: <testfunc>: 0: push %rbp 1: mov %rsp, %rbp 3: <...no call here> there no call in "testfunc" @ all. why 32-bit compiler adding these "call" instructions? appreciated. what you're seeing in 32-bit disassembly may way make code position-independent. remember call pushes onto stack return address, equal eip +constant? in 64-bit mode there rip -relative addressing. in 32-bit there isn...

python - Images in wx.ListControl are cut off -

i have wx.listctrl in report mode , use image list display icons 50x50 pixels setitemcolumnimage. problem text display in column right of icon less 50 pixels high , parts of icons higher text cut off. is there way tell listctrl adjust row height height of icons? last refuge change fontsize of text, there should better way. update: here of code: self.list = util.listctrl(nb, style=wx.lc_report| wx.lc_single_sel|wx.lc_no_header|wx.lc_align_left) self.list.insertcolumn(0, 'avatar', width=-1) self.list.insertcolumn(1, 'name', width=-1) self.list.setcolumnwidth(0, 50) self.imagelist = wx.imagelist(50, 50, 255, 20) self.list.setimagelist(self.imagelist, wx.image_list_small) = 0 user in self.users: self.list.append(['', user['name']]) if user['avatar']: bitmap = wx.bitmapfromimage(user['avatar']) imageidx = self.imagelist.add(bitmap) self.list.setitemcolumnimage(i, 0, imageidx) ...

ruby - annotate command "no such load to file" with -R -

the annotate command fails when using -r option load additional files before loading models version 2.4.1.beta. files appear found, error still occurs (if use wild-card path first file displayed error). similar error message appears here ( https://github.com/ctran/annotate_models/issues/78 ) solution there use: gem 'annotate', github: 'ctran/annotate_models' but if replace annotate in gemfile above, , do: gem uninstall annotate bundle install then bundle reports on first line: updating git://github.com/ctran/annotate_models.git and later: using annotate (2.5.0.pre1) git://github.com/ctran/annotate_models.git (at master) note neither message says "installing". executing annotate ends annotate executable not being found. solutions? (ruby 1.9.2p280, rails 3.2.2)

How to ensure all the async calls are back in javascript -

i have piece of javascript code doing function asyncs(){ var backcount = 0; function done(){ if(backcount === 2){ alert("all done"); dosomthinguseful(); }else{ backcount ++; } } function asynccall(callback){ myremotecall(callback); } asynccall(done); asynccall(done); asynccall(done); } function dosomethinguseful(){ alert("travel moon.") } this working. wondering if there better approach don't have write ugly counter function. i recommend using flow control library async or nimble handle sort of thing. internally pretty same thing gives them in reusable patterns.

iphone - Problems Making a TableView Fade -

Image
using uiview animatewithduration , i'm setting uitableview alpha 0 fades away in disappearing animation. however, i'm noticing when uitableview fades, there areas on each cell turn black before fading. if there image, whole area behind turns black while fading, , inset space on both left , right edge turn black. i've tried setting of background colors of uitableviewcell subviews white , still doesn't work. this tableview not embedded in uitableviewcontroller. instead, it's separate floating tableview i'm using menu. here example of happens when it's fading: here code i'm using well [uiview animatewithduration:imageviewcontrollerbarsanimationduration delay:0 options: uiviewanimationoptionallowuserinteraction animations:^ { if (self.menu.superview) { self.menu.alpha = 0; } } completion:^(bool finished) { if (self.menu.superview) { [self.men...

Why does java native HashMap in clojure run slowly? -

i associate key hash map 10000000 time. here's java code , output: import java.util.hashmap; public class testmap { public static void main(string[] args) { hashmap<integer, integer> mp = new hashmap<integer, integer>(); long start = system.currenttimemillis(); (int = 0; < 10000000; i++) { mp.put(1, 1); } long end = system.currenttimemillis(); system.out.println("elapsed time: " + (end - start) + " msecs"); } } $ javac testmap.java && java -cp . testmap elapsed time: 38 msecs and call java clojure in repl: user=> (import java.util.hashmap) java.util.hashmap user=> (def mp (hashmap.)) #'user/mp user=> (time (dotimes [n 10000000] (.put mp 1 1))) "elapsed time: 10024.797 msecs" nil both code same thing, clojure version runs exstreamly slow!! what's problem? add type hint better: user> (import 'java.util.hashmap) ...

c# 4.0 - How to print multiple pages in silverlight -

how print multiple pages in silverlight. have scenario in silverlight , have button click event able print contents in single page , excess content been removed im not getting next page print this button click event private void btnsubmitprint_click(object sender, routedeventargs e) { _currentindex = 0; printdocument docprin = new printdocument(); docprin.printpage += new eventhandler<printpageeventargs>(docprin_printpage); string documentname = "balaji"; docprin.print(documentname); } //i combine list single string using linq void docprin_printpage(object sender, printpageeventargs e) { string delimeter = "\n"; var checkval = listofpagecomments.select(i => i.comment.insert(100, environment.newline));//this linq operation var listofpagecommentsascendin...

html - Radio Button Label Positioning -

i need place label text left , radio button right side of div . here code: http://jsfiddle.net/mk3dv/3/ also when check result in code, radio checked image size varies. solution? updated fiddle code: http://jsfiddle.net/mk3dv/10/ credit goes rickyduck

php - DOM manipulation in codeigniter before page loads -

is there way modify html of view file before or loaded, such containing div element can wrapped around existing elements have particular class. so example: if have element <div class="add-wrapper-to-this-elem"> </div> somewhere within view file test_view.php, when load view via $this->load->view('test_view'); view load wrapper div around elements class of add-wrapper-to-elem is possible , how go it? you can create wrapper view file content , load view instead: <div class="add-wrapper-to-this-elem"> <?php $this->load->view('test_view');?> </div>

class - How are classes not objects in C++? -

i reading " design patterns: elements of reusable object-oriented software ", (specifically chapter prototype design pattern) , stated that... "prototype particularly useful static languages c++ classes not objects , , little or no type information available @ run-time." (pg 121) (emphasis mine) i had thought classes synonymous objects, , i'm confused statement means. how classes not objects, , why matter if language static? in c++, declares class: class { public: int a; }; whereas declares object: a a; one cannot interrogate class run-time, 1 can interrogate object. makes sense say, "object 'a', address? please invoke operator+ . etc." in c++, static typing, makes no sense say, "class a, list of members? please add new member, "b"." in other languages (python comes mind), 1 can manipulate classes in way, because each class object. in addition serving template objects, class itself object...

iphone - Stop iframe redirect/opening mobile safari in phonegap project -

currently have been loading page hidden iframe within phonegap project way of scraping data off mobile version of website use within app. the problem 1 particular site has type of frame buster , sends redirect exits app , loads page in mobile safari. is there way stop reload ? leaving ethics of scraping aside :-) if you're using phonegap build, add config.xml file: <preference name="stay-in-webview" value="true" /> if you're not using build set in cordova.plist/phongap.plist : openallwhitelisturlsinwebview = 'yes'

append - jQuery add text from a <textarea> to <tr> -

i've checked similar threads, either unclear or advanced i'm still couple of days learning jquery. i have text area: <textarea class='text' rows='10' cols='25'></textarea> and want after user has entered text press add text button <button type='button' class='addtext'>add text</button> and so, text they've entered show in table <tr></tr> . i googled can jquery append function, didn't solution problem. so, there way this? $('.addtext').click(function(){ $('.smth').append( text in textarea tr ); }); p.s. .smth row class = <tr class='smth'></tr> in order textarea 's value, use $("#idoftextarea").val() , e.g. var text = $("#idoftextarea"); // run dom lookups once if possible var row = $('.smth'); // , store results in variables row.append("<td>"+text.val...

ruby on rails - Error on starting application Bundler::GemNotFound -

i have started new app getting error when click 'about application's environment' link on welcome aboard page. error starting application rack app raised exception when pow tried run it. bundler::gemnotfound: not find activesupport-3.2.6 in of sources my app running: rails 3.2.6 ruby 1.9.3p194 rubygems 1.8.24 rvm 1.14.5 pow 0.4.0 i found similar questions problem wit husing passenger, i'm not using that. when run gem list get: * local gems * actionmailer (3.2.6) actionpack (3.2.6) activemodel (3.2.6) activerecord (3.2.6) activeresource (3.2.6) activesupport (3.2.6) arel (3.0.2) builder (3.0.0) bundler (1.1.4) coffee-rails (3.2.2) coffee-script (2.2.0) coffee-script-source (1.3.3) daemon_controller (1.0.0) erubis (2.7.0) execjs (1.4.0) fastthread (1.0.7) hike (1.2.1) i18n (0.6.0) journey (1.0.4) jquery-rails (2.0.2) json (1.7.3) mail (2.4.4) mime-types (1.19) multi_json (1.3.6) passenger (3.0.13) polyglot (0.3.3)...

html - CSS in site.css not working with <div id> in layout in asp.net -

Image
i trying this: but getting this: my _layout.cshtml: <!doctype html> <html> <head> <title>@viewbag.title</title> <link href="@url.content("~/content/site.css")" rel="stylesheet" type="text/css" /> <script src="@url.content("~/scripts/jquery-1.6.2.min.js")" type="text/javascript"></script> </head> <body> <div id="header"> <div class="title">sports store</div> </div> <div id="categories"> @{html.renderaction("menu", "nav");} </div> <div id="content"> @renderbody() </div> </body> </html> my menu.cshtml: @model ienumerable<string> @{ layout = null; } @html.actionlink("home", "list", "product") @foreach (var...

php - Update Database Field Error CodeIgniter -

i getting following error message in codeigniter 2.1: a php error encountered severity: notice message: array string conversion filename: database/db_active_rec.php line number: 1407 i'm trying update fields in database. have code , every tutorial same batch upload. works anyway thing display such error. this have in model: function update2($data){ $this->db->update_batch('users',$data, "id"); } this have in controller: public function updatevalues(){ $this->load->model('get_db'); $newrow = array( array( 'id' => '3', 'firstname' => 'rapphie' ), array( 'id' => '2', 'firstname' => 'charmie' ) ); $this->get_db->update2($newrow); echo "it has been updated"; } try hope work function update2($data){ foreach($data $string_val)...

android - How can I programmatically make sure a user has selected an option with AlertDialog.Builder? -

in android application, have created dialog box showing user multiple options list. i have used class so: http://developer.android.com/reference/android/app/alertdialog.builder.html more specifically, used setmultichoiceitems now options displaying correctly , works well. however, need make sure user has selected 1 of these options , not pressed proceeding button have set using setpositivebutton. is there way can programmatically make sure 1 or more of these options picked? set quick if statement , display warning dialog if none of options picked. thank , apologize if question has been asked before. the easiest way use dialoginterface.onmultichoiceclicklistener keep track of user's selections. initialize array before create dialog , every time user makes/clears selection add/remove array. once user hits positive button check if array empty: if is, made no selections.

ruby on rails - Mongoid upsert with a different key -

is possible upsert mongodb collection json/hash of fields, instead of using _id objectid field, use different indexed field such external_id ? i using update items receive feed on daily basis, , such, feed items don't contain internal id. yes, possible upsert custom id in mongoid, in 3.0.0.rc circa june 27, 2012. app/models/item.rb class item include mongoid::document field :external_id, type: string field :_id, type: string, default: ->{ external_id } field :text, type: string end test/unit/item_test.rb require 'test_helper' class itemtest < activesupport::testcase def setup item.delete_all end test "external id" item.new( text: 'lorem ipsum' ).upsert item.new( external_id: 'an external id', text: 'dolor sit amet' ).upsert puts item.all.to_a.collect{|item|item.inspect} end end output run options: --name=test_external_id # running tests: #<item _id: 4ff202501f98ce820...

ios - Certain mobile browsers on iPhone not executing Javascript properly -

i attempting run javascript returned url load in uiwebview. script takes image , draws dot on show users location. in mobile safari, uiwebview, , google chrome mobile image not generated correctly , dot in wrong place. in desktop safari, chrome, opera mini, , android version of app works fine. i need assistance getting work in uiwebview/mobile safari. problem 1: call context.drawimage() in zoomin() method generates following error in debug console mobile safari: "javascript error. undefined. index_size_err: dom exception 1: index or size negative, or greater allowed value." problem 2: in zoomout() method, image drawn fine, dot in not in right position. update: can seen in code below, added console.log statements print out width , height of original image. in offending browsers these values half of should be. i'm trying figure out why. code: window.onload = function zoomin() { var canvas = document.getelementbyid("area"); var cont...

Hibernate: Persist XML values without Java Classes -

is there hibernate utility allows persist xml values in database without marshaling java classes? no. while can imagine possible hibernate, it's wrong tool task. hibernate created map entities db rows. you either have implement dom-like structure defines entities hibernate should use or write importer using plain jdbc or maybe create simple entities fill xml , persist hibernate.

extjs - Grid - button click handler -

in grid , when click on action button (the delete , edit button shown in code below), need pop open window without alerting user alert message; in following code using handler handler: buttonclicked , trying access row value clicked different function below; buttonclicked :function (){... 1.) don't know how this, can please me ? 2.) can access row clicked , display name controller class ? ext.define('countryapptest.view.user.gridview' ,{ extend: 'ext.grid.panel', initcomponent: function() { this.store = 'store'; this.columns = [ { xtype:'ac', items: [{ { icon: 'lib/extjs/examples/restful/images/delete.png', handler : buttonclicked }] }, { text: "username", dataindex: 'username' } ]; this.viewconfig = { forcefit: true }; this.callparent(arguments); }, buttonclicked:function (grid, rowinde...

How do to block comments in Liberty Basic? -

each day has own data, , need run science stuff without using recent data. basically need block comment out. how done in liberty basic? liberty basic not support multi-line comments. supports these 2 single line formats: 'this comment rem comment so best alternative repeatedly type: ' + down arrow + left arrow some basic programming languages support multi-line comments so: /' multi-line comment '/

hadoop - How does Pig store results to multiple locations with a single map-only job? -

i'm beginner pig , hadoop. i'm trying understand what's going on behind scenes in simple pig script. i'm reading in data, splitting 3 new relations, , storing each in different directory. script runs on psuedo distributed hadoop installation 1 map-only job. i have been trying figure out how implement in plain java map/reduce in single map-only job. trivial achieve filtering/splitting, don't know how i'd map job send different key/value pairs different outputs. come think of it, don't know how i'd able send output multiple places in 1 full map/reduce job. rawtweets = load 'geotaggedtweets' using pigstorage(',') (...); split rawtweets ustweets if country == 'us', gbtweets if country == 'gb', idtweets if country == 'id'; store ustweets 'testustweets' using pigstorage(','); store gbtweets 'testgbtweets' using pigstorage(','); store idtweets 'testidtweets' using pigstora...

stored procedures - The MySQL "DELIMITER" keyword isn't working -

ok so, i've been ripping hairs ou on one, why doesn't work? delimiter | create procedure decrypt_pw() reads sql data begin select 'hey select'; end| it's basic , i'm pretty sure i'm using correct syntax, missing? error: 21:14:07 [delimiter - 0 row(s), 0.000 secs] [error code: 1064, sql state: 42000] have error in sql syntax; check manual corresponds mysql server version right syntax use near 'delimiter | create procedure decrypt_pw() reads sql data begin select 'he' @ line 1 21:14:07 [end| - 0 row(s), 0.000 secs] [error code: 1064, sql state: 42000] have error in sql syntax; check manual corresponds mysql server version right syntax use near 'end|' @ line 1 i'm using dbvisualizer, latest version, problem software itself? perhaps should explain myself better, passwords encrypted in database (no need worry), , allows me decrypt them, personal project i'm working on. i trying develop script allo...

Erlang binary pattern matching fails -

why issue badmatch error? can't figure out why fail: <<ipaddr, ":*:*">> = <<"2a01:e34:ee8b:c080:a542:ffaf:*:*">>. pattern matching of binary proceeds left-to-right match ipaddr first before tries following segment. there no back-tracking until there match. default typed variable ipaddr matches 1 byte. see bit syntax expressions , bit syntax proper description , more examples. as alternative using pattern matching here might consider using binary module. there 2 functions useful you: binary:match/2/3 , binary:split/2/3 . these search may better fit problem. as last alternative try using regular expressions , re module.

Single MySQL table into multidimensional JSON with PHP -

i have table in database called timeline_entries . table contains following fields: id , headline , text , startdate , type , media , caption , credit . id field used referencing individual entries through cms. i have worked out how export data json , save file, i'm struggling find way format following structure; { "timeline": { "headline":"value", "type":"default", "startdate":"value", "text":"value", "asset": { "media":"value", "credit":"value", "caption":"value" }, "date": [ { "startdate":"value", "type":"", "headline":"value", "text":"value", ...

c - Same line documentation of typedefs with Doxygen -

i have c header file lot of typedef's , #defines . able doxygen accept comments on same line, this: typedef uint32_t u_num_logpltntry; //!< number of u_logpltentry typedef uint32_t u_num_rectl; //!< number of u_rectl and this: #define u_srccopy 0xcc0020 //!< info srccopy #define u_srcpaint 0xee0086 //!< info srcpaint however, neither of these forms work. typedef comment applied following line. #define s comment vanishes ether. if //! line precedes #define comment associated following #define . really not want have offset comments 1 line! is there doxygen syntax this? using doxygen 1.8.1.1 running on windows. this works me. guess problem being caused above snippet showing us. if there's doxygen comment block above typedef , doxygen associating typdef instead of inline comment. take @ surrounding doxygen comments , make sure nothing going on. you can try placing typedefs in header , see if doxygen pr...

datamapper - What do you think is the best approach for creating a data mapping layer in python? -

i appreciate hearing opinions on best approach creating light-weight data mapping layer between python objects , postgres database. i'm using psycopg2 library, , plan use pgbouncer. looked @ this: http://codeinthehole.com/writing/domain-model-mapper-a-php-data-mapper-implementation/ basic idea, isn't clear how closing connection after queries. component i'm building similar forum in has familiar user, post, forum tables, etc. the best approach not create new layer, use existing one. sqlalchemy full-featured, others good, such storm . maybe explain why want write new one?

ios - MonoTouch Binding Library - EXC_BAD_ACCESS (SIGSEGV) -

my app crashes on live device only, when use kiip monotouch bindings. works fine on simulator. here part of stack trace: 0 libsystem_c.dylib 0x30eb293c memset$variant$cortexa8 + 52 1 sample 0x002b5738 gc_clear_stack_inner (misc.c:298) 2 sample 0x002b574c gc_clear_stack_inner (misc.c:299) 3 sample 0x002b574c gc_clear_stack_inner (misc.c:299) 4 sample 0x002b574c gc_clear_stack_inner (misc.c:299) 5 sample 0x002b574c gc_clear_stack_inner (misc.c:299) 6 sample 0x002b574c gc_clear_stack_inner (misc.c:299) 7 sample 0x002b574c gc_clear_stack_inner (misc.c:299) 8 sample 0x002b574c gc_clear_stack_inner (misc.c:299) 9 sample 0x002b574c gc_clear_stack_inner (misc.c:299) 10 sample 0x002b574c gc_clear_stack_inner ...

java - Why unit testing with Spring 3.1 WebMvcConfig fails? -

from spring 3.1, can use javaconfig more @enable* annotations. so made webconfig set webmvc configuration, , tried test it. if extends webmvcconfigureradapter or webmvcconfigurationsupport webconfig unit test fails because of lack of servletcontext. code , messages below. webconfig.java @configuration @enablewebmvc public class webconfig extends webmvcconfigurationsupport {} test.java @runwith(springjunit4classrunner.class) @contextconfiguration(classes=webconfig.class) public class testfail { @test public void test() {} } message java.lang.illegalstateexception: failed load applicationcontext @ org.springframework.test.context.testcontext.getapplicationcontext(testcontext.java:157) @ org.springframework.test.context.support.dependencyinjectiontestexecutionlistener.injectdependencies(dependencyinjectiontestexecutionlistener.java:109) @ org.springframework.test.context.support.dependencyinjectiontestexecutionlistener.preparetestinstance(dependencyi...

position - Positioning the OverlayPanel of PrimeFaces -

can give me key/values fix overlaypanel position? want fix in middle, can't figure out. have example: <p:overlaypanel id="overlaypanelsearch" for="searchbutton" my="top" at="bottom"> this how understand it. "my" overlay panel box. "at" commandbutton. <p:commandbutton id="chartbtn" type="button" /> <p:overlaypanel id="chartpanel" for="chartbtn" my="right top" at="right bottom"> ... </p:overlaypanel> so above reads: "connect right top of overlay panel right bottom of command button"

Facebook FQL returns different data for same permissions -

i trying user's feed using fql. use following statement (bring video posts): select created_time, post_id, actor_id, message, attachment, likes.count, likes.friends, comments.count stream filter_key in (select filter_key stream_filter uid=me() , type='newsfeed') , is_hidden = 0 , 'video' in attachment i asked "read_stream" permission , got user's token my problem: when using "graph api explorer" (facebook's page) post friend of mine "liked" - author of post not friend. however, when using access_token of own application (not graph api explorer's token), can't see post !! i used "https://graph.facebook.com/me/permissions?access_token=" check both tokens have same permissions.... btw, able post using "where post_id=" - doesn't seem user permission problem well. any idea???? stuck here!!! pls................................... on graph api explorer page, if want see result...

node.js - Writing into a Stream ends up overflowing -

i using readline read large file line line able of detecting places can split meaningful pieces several other files. use writestream write files. when regular expression detects place cut, end() open writestream , open new 1 line read. problem files end truncated if end() call didn't job. i checked success of write() , pause input stream when buffer full. relevant part of code: var rl = readline.createinterface({ input: fs.createreadstream('basesystem.js',{encoding:'utf8'}), output: process.stdout }); rl.on('line', function (line) { var match = rexp.exec(line); if (match) { out.end(); console.log(path.join(path, match[2],'.js')); out = fs.createwritestream(path.join(path,match[2]) + '.js', {encoding:'utf8'}); } if (!out.write(line + '\n')) { console.log('***** paused **** '); rl.pause(); out.once('drain', function () { ...

sitecore6 - How to remember password field in Sitecore custom user profile? -

i've come across annoying problem custom properties added sitecore user profile. i've added password field custom user profile, field not prepopulate value on load, if make changes other fields , save, overwrite existing password blank, unless type in password again on every edit. for example, custom user profile original saved data: 1. phone number = 123.456.7890 2. password = 1234 edit phone number , save: 1. phone number = 123.123.1234 2. password = [blank] the problem because password field display blank on loading, there way make field fetch data , mask it? or have overwrite existing sitecore field resolver class ignore blank space? thank you. after checking sitecore documents... there no way handle without rewriting security api. user profile template handles basic text field type.

compilation - How to compile Lua scripts into a single executable, while still gaining the fast LuaJIT compiler? -

how can compile lua scripts single executable file, while gaining super fast performance benefits of luajit ? background: my lua scripts web application created (e.g. host http://example.com ) my current technology stack nginx (web server), lua/luajit (language retrieve dynamic content) i have around 50+ .lua files make web application (from models/views/controllers) freebsd 9 operating system for simplicity sake in deployment, i'd compile down of .lua scripts run web application down single executable. is possible , how? it appears lua official comes library called srlua what negatives compiling down .lua single executable (e.g. performance worse, etc)? translate of lua source code files object files , put them in static library: for f in *.lua; luajit -b $f `basename $f .lua`.o done ar rcus libmyluafiles.a *.o then link libmyluafiles.a library main program using -wl,--whole-archive -lmyluafiles -wl,--no-whole-archive -wl,-e . this line ...

c# - Prevent a user from deleting, moving or renaming a file -

what trying while program using file, want keep user renaming, deleting, or moving file (well... move delete , create @ different location according windows filesystemwatcher , digress). it has been suggested use filestream.lock or use mutex . however, filestream.lock seems prevent file being modified which trying allow . also, unsure if mutex can lock file, although still reading on in .net 4.0 library. does have advice on utilizing either 1 , if there code based solution problem? when opening file, can specify sharing mode. opening file fileaccess.read gives ability read file, while fileshare.readwrite allows file continue edited, not deleted or moved. var fs = file.open(@"c:\temp\file.txt", filemode.open, fileaccess.read, fileshare.readwrite); messagebox.show("file locked"); // while messagebox up, try open or delete file. // work here fs.close();