Posts

Showing posts from February, 2011

c# - Proper usage of XMLRootAttribute in Monotouch -

i have class called school serializable. when serializes/deserializes need root element called school not school without having change class name school. used xmlroot attribute in following way: [xmlroot(elementname = "school")] i tried: [xmlroot("school")] neither of these did , resulting xml file contained root element called school. am missing something? i not see problem following code works monotouch 4 (maybe you'll find difference between , own code). i defined class like: [xmlroot ("school")] public class wrong { public string name { get; set; } } then serialized memorystream read string. wrong bad = new wrong (); xmlserializer ser = new xmlserializer(typeof(wrong)); using (memorystream ms = new memorystream ()) { ser.serialize (ms, bad); ms.position = 0; streamreader sr = new streamreader (ms); string st = sr.readtoend (); } the ...

php - Cakephp error [Deprecated: Assigning the return value of new by reference is deprecated in] -

i'm using xampp php 5.3.1 on local server, cake project use "1.2.0.6311 beta", ok, error msg deprecated: assigning return value of new reference deprecated in c:\xampp\htdocs\rh_pura\cake\libs\debugger.php on line 100 deprecated: assigning return value of new reference deprecated in c:\xampp\htdocs\rh_pura\cake\libs\cache\file.php on line 91 fatal error: class 'router' not found in c:\xampp\htdocs\rh_pura\cake\dispatcher.php on line 333 in other server ok too, can me? i solved: open cake/libs/configure.php , find line "error_reporting(e_all);" replace line following: error_reporting(e_all & ~e_deprecated); and fatal error, deleted files in /tmp thanks! :)

jQuery UI dialog error in Internet Explorer 9 rc1 -

i trying create landing page, multiple elements trigger jquery ui form, , timer pops form. it seems work in except ie9, odd, ie9 best 1 far! (</worms>) i'm using <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script> <script type="text/javascript"> $(function(){ var signup_step = '<?= $step ?>'; $('#signup-lightbox').dialog({ //line 31 width: "457px", modal: true, autoopen: false, closetext: '', position: ['center','top'] }); //etc </head> <body> <div id="signup-lightbox"><!-- etc --></div> script438: object doesn't support ...

CakePHP Media Plugin Helper problem -

i trying display uploaded image media plugin of cakephp. i added helper controller helper array: var $helpers = array('media.media'); . then, in view, have code: echo $media−>file($news['attachment'][0]['dirname'].ds.$news['attachment'][0]['basename']); . problem that, outputs error: undefined variable: media− [app/views/news/view.ctp, line 3] what problem? by way, if plugin has model user in app/plugin/users/models/user.php , create new model called user in app/models folder 1 loaded? thanks in advance help! first off if using 1.3.x refer helpers via $this->helpername->method(), there variable called $media being set in method. can check doing var_dump($media); the other option has maybe unset it. strange have helper set variable not set. due adding $helpers array wrong controller, can try add app_controller , see if works. if had in wrong place. if got second question correct, , talking auto loading, plugin c...

c++ dll templates (linker error) -

template <class t> class pst_object_recognition_api test { public: t t; inline bool operator==(const test & other) { return t == other.t; } }; class pst_object_recognition_api test_int : public test<int> { }; in other project imports dll have error error 3 error lnk2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall test<int>::operator==(class test<int> const &)" (__imp_??8?$test@h@@qae_nabv0@@z) referenced in function _main main.obj how can solve problem? the solution appears (removing pst_object_recognition_api template class): template <class t> class test { public: t t; inline bool operator==(const test<t> & other) { return true; } }; class pst_object_recognition_api test_int : public test<int> { };

PHP session problems -

i have part of site when user (not logged-in) can rate on form 1 - 5. form , backend works perfectly. i made when form posts, trips $_session['rated']; equal one. have immediate redirect origin page. on origin page, original rating form is, if $_session['rated']; = 1, form invisible, if it's 0 (by default) form shown. it worked first time, since i've not been able stop session or unset variables in way. i've tried different browser, clearing cookies, doing this: session_start(); session_unset(); session_destroy(); but nothing clears session, , form still shows invisible because $_session['rated']; still equals 1. what should do? you wrote if $_session['rated']; = 1 check code, if use = (the assignment operator). if do, that's culprit – compare values in php (and other c-like languages) use == (comparison operator)

cocoa - Can I receive a callback whenever an NSPasteboard is written to? -

i've read apple's pasteboard programming guide , doesn't answer particular question have. i'm trying write cocoa application (for os x, not ios) keep track of written general pasteboard (so, whenever application copies , pastes, not, say, drags-and-drops, makes use of nspasteboard). (almost) accomplish polling general pasteboard on background thread constantly, , checking changecount . of course, doing make me feel dirty on inside. my question is, there way ask pasteboard server notify me through sort of callback time change made general pasteboard? couldn't find in nspasteboard class reference, i'm hoping lurks somewhere else. another way imagine accomplishing if there way swap out general pasteboard implementation subclass of nspasteboard define myself issue callback. maybe possible? i prefer if possible public, app store-legal apis, if using private api necessary, i'll take too. thanks! unfortunately available method polling (booo!...

java - If I make my login page use 'https' in Spring, how do I avoid Error 102 (net::ERR_CONNECTION_REFUSED)? -

the homepage spring mvc 3.0 app is: http://localhost:8080/ if make login page use https: https://localhost:8443/login i error when try navigate login page: error 102 (net::err_connection_refused): unknown error. what's correct way configure spring app doesn't happen? are sure server listening port 8443? check wit following command netstat what results in list of active connections proto local adres externnal adres status tcp pc04566:1040 localhost:1041 established

debugging - Not working - Hover on variable to see value in debug prespective in Eclipse -

i using classic eclipse 3.6.1. have java project throwing exception because of stack overflow. unlike other editors, when hover mouse pointer on variable not show me value of variable. here settings in window->preferences->java->editor->hovers combined hover - shift variable values - ctrl source - shift+ctrl but doesn't seem working. have seen threads others same problem not find solution. bug hasn't been fixed yet? thanks! go window - preferences - java - editor - hovers. is "combined hover" selected? uncheck it; apply; close window; restart debugging session; go back; check again; apply. if above doesn't help, can check "variable values" option , specify modifier key it. not convenient "combined", should work. the problem gets "fixed" renaming package. for whatever reason, refactoring triggers in eclipse, , able view variable values during debugging. also, when go preferences under hovers, can se...

sql server 2008 - How to configure SQL Native Client with powershell? -

i have been tasked write script enable tcp , named pipes protocols sql server 2008 express r2 instance. have found out how enable these protocols sql server instance itself, haven't found way control sql native client powershell. my script part of installer, , code installing expects these protocols enabled. thanks [reflection.assembly]::loadwithpartialname("microsoft.sqlserver.sqlwmimanagement") $wmi = new-object ("microsoft.sqlserver.management.smo.wmi.managedcomputer") "$env:computername" $wmi.serverinstances["sqlexpress"].serverprotocols["tcp"].isenabled = $true $wmi.serverinstances["sqlexpress"].serverprotocols["np"].isenabled = $true $wmi.clientprotocols["tcp"].isenabled = $true $wmi.clientprotocols["np"].isenabled = $true

jquery offset() and position() -

i need position of element relative parent. position() suppose looks doesn't. <!doctype html> <html> <head> <style> body{padding: 0px; margin: 0px;} div { margin-left: 200px; padding: 30px; border: 1px solid red;} p { margin: 0px; padding: 0px; border: 1px solid black } </style> <script src="http://code.jquery.com/jquery-1.5.js"></script> <script> $(document).ready(function() { var p = $("p.paragraf"); var position = p.offset(); $("p.zadnji").text( "left: " + position.left + ", top: " + position.top ); }); </script> </head> <body> <div class="container"> <p class="paragraf">hello</p> </div> <p class="zadnji"></p> </body> </html> result: left: 231, top: 31 if p.paragraf inside #container #con...

jquery - Validate HTML Textbox -

i have textbox: <%= html.textbox("effectivedate", model.effectivedate.hasvalue ? model.effectivedate.value.tostring("dd-mmm-yyyy") : "", new { @class = "economictextbox", propertyname = "effectivedate", onchange = "parseandsetdt(this); ", datatype = "date" })%> i need js validation help. if user has permission, can enter date. if user doesn't, can enter present date, or dates in future. here controller method have can if user has permission or not. [nocache] public actionresult hasadvanced() { if (chatham.web.ui.extranet.sessionmanager.displayuser.isinrole("hasicadvanced")) { return json( new { value = "true" }); } else{ return json( new { value = "false...

mod rewrite - url masking mod_rewrite -

i surely learning php, , going until now. i looking url rewrite, db relatively indepth , typical url like: players.php?position=1&teamid=4&playerid=129 basically want return /defender/arsenal/thomas-vermaelen/ names associated id's in database. 1 page generates lots of different pages , wanted workout how use name in url instead of id number. im 99% sure can done have been looking in detail @ joomla cms system, , wondered if shed light on please? thanks in advance richard :) i think easiest map requested uri /defender/arsenal/thomas-vermaelen/ onto /players.php?position=defender&teamid=arsenal&playerid=thomas-vermaelen : rewriterule ^/([a-za-z]+)/([\w-]+)/([\w-]+)/$ /players.php?position=$1&teamid=$2&playerid=$3 then in php script can check whether parameter value numeric or alphabetic , fetch the numeric id in case of latter.

c++ - How do I see what a file looks like after preprocessing? -

how can check results of preprocessing? example, have following code: #define concatenate(x, y) x ## y #define string_1 first #define string_2 second #define string_3 concatenate(string_1, string_2) is there way make sure string_3 expanded firstsecond later in program? each compiler should provide switch keep preprocessed code gcc: -e ms visual studio: keep preprocessed files in settings or /p switch for other compilers bet you'll find suitable switch in documentation

Rails 3 - Displaying submit errors on polymorphic comment model -

fairly new rails 3 , have been googling every way no avail solve following problem, tutorials stopping short of handling errors. i have created rails 3 project multiple content types/models, such articles, blogs, etc. each content type has comments, stored in single comments table nested resource , polymorphic associations. there 1 action comments, 'create' action, because there no need show, etc belongs parent content type , should redisplay page on submit. now have of working , comments submit , post fine, last remaining issue displaying errors when user doesn't fill out required field. if fields aren't filled out, should return parent page , display validation errors rails typically mvc. the create action of comments controller looks this, , first tried... def create @commentable = find_commentable @comment = @commentable.comments.build(params[:comment]) respond_to |format| if @comment.save format.html { redirect_to(@commentable, ...

debugging - How do I track down where a R package function fails? -

possible duplicate: general suggestions debugging r? i've encountered error when calling function r package. briefly, > library(treemap) > ... > tmplot(x,index=c("r1","r2","r3","r4"),vsize="size") error in if (maxi == 1) { : missing value true/false needed this so question gives more details. i examined source code of tmplot typing tmplot @ r prompt, line fails doesn't appear in function. means, assume, it's failing in function called tmplot . what's best way track down? example, can generate stack trace somehow? there interactive debugger allow me step through , see error happens? traceback print call stack. traceback() also, have @ on-line debug function. although have seen better interactive debuggers, there basic functionality provided debug(), debugonce() , undebug() ?base::debug

sql - MySQL trigger in order to cache results? -

i have query takes second execute pre-cache. post-cache fine. here's description of problem: mysql: nested set slow? if can't solution problem, creating trigger loop through , execute possible queries table might have (i.e. if there 100 records on table, execute 100 queries) idea? way, when application execute such query, can depend on cached results. it feels bad solution, can't afford 1 second response time query. since using myisam table, can try preload table indexes key cache. http://dev.mysql.com/doc/refman/5.0/en/cache-index.html http://dev.mysql.com/doc/refman/5.0/en/load-index.html

vba - Iterating 100 cells takes too long -

in excel vba code, need move data range sheet. as of now, i'm iterating through range , copying values this: for offset = 0 101 activeworkbook.sheets(sheet).range("c3").offset(offset, 0).value = activesheet.range("d4").offset(offset, 0).value next offset however, takes minute iterate , copy values 100 cells. would better off using copy-paste programatically, or there way copy entire range @ once? like: activeworkbook.sheets(sheet).range("c3:c102").value = activesheet.range("d4:d104").value you can read entire range @ once variant array, , write range. quick, flickerless, , has added bonus can code operations on data if inclined. dim vardummy variant vardummy = activesheet.range("d4:d104") ' can insert code stuff vardummy here workbook.sheets(sheet).range("c3:c103") = vardummy this learned hard way: avoid copy/paste if @ possible! copy , paste use clipboard. other programs may rea...

xcode - zooming in and out of a UIView -

what best way zoom in , out of uiview simple method buttons. (e.i (ibaction)zoomin:(int)distance { method here } (ibaction)zoomout:(int)distance { , here } it can done using 2 finger gesture recognizer: have write down:- -(void)viewdidload { uipinchgesturerecognizer *twofingerpinch = [[[uipinchgesturerecognizer alloc] initwithtarget:self action:@selector(twofingerpinch:)] autorelease]; [[self view] addgesturerecognizer:twofingerpinch]; } by have initialized instance take care of 2 finger sensations on screen (or view on applying method) define if have recognized 2 fingers: - (void)twofingerpinch:(uipinchgesturerecognizer *)recognizer { nslog(@"pinch scale: %f", recognizer.scale); cgaffinetransform transform = cgaffinetransformmakescale(recognizer.scale, recognizer.scale); // can...

c++ - Search HTML lines and remove lines that don't start with </form></td><td><a -

i have html file bad formatted code website, want extract small pieces of information. i interested in lines start this: </form></td><td><a href="http://www.mysite.com/users/user897" class="username"> <b>user897</b></a></td></tr><tr><td>housea</td><td>2</td><td class="entriestablerow-gamename">housea type12 <span class="entriestablerow-moredetails"></span></td><td>1 of 2</td><td>user123</td><td>10</td><td> and want extract 3 fields: a:housea b:housea type12 c:user123 d:10 i know i've seen people recommend html agility pack , lib2xml don't think need that. app in c/c++. i using getline start reading lines, not sure what's best way proceed. thanks! std::ifstream data("home.html"); std::string line; while(std::getline(data,line)) { ...

Qt Creator causes an endless compilation loop on Ubuntu -

i got project folder on mac, , works nicely. moved folder ubuntu, opened qt creator in ubuntu, loaded project , build build never ends, getting endless loop of message project file having modifications "in future", "entering folder/leaving folder" , on forever... what's going on? i guess have take things literally. "modifications in future" resolved got *.pro file under text editor , saved back. it's strange , annoying bug, resolved. thanks.

html - How do you input 2 files then output them in python? -

i have code written webpage , need know how take 2 data files , import them array output data in table on html site. the 2 data files txt files on computer well i'm going take guess want create html table has 1 line per data line in text file. file1=open("input1.txt",'ru') file2=open("input2.txt",'ru') lines = file1.readlines() + file2.readlines() html = "<html>\n<body>\n<table>" line in lines: html += "<tr><td>" + line + "</td></tr>\n" html += "</table>\n</body>\n</html>" output = open('output_file.html','w') output.write(html) i don't know if looking for, said above.

ios - Scrollview with images still crashes even lazy load? -

i have scroll view holding few images, each 1 around 100kb. add them uiscrollview creating uiviewcontrollers hold them. controllers stored in scrollview. remove view superview , replace string when image scrolls out of visible area. think i'm doing fine. still got crash after scrolling few times(even scroll forth , on same 5 images). i noticed every controller's dealloc called when it's removed scroll view, not viewdidunload. any appreciated. viewdidunload called when viewcontroller released view. not called if you released view (which means viewdidunload relevant in memory warning situation). in order delete view , view controller, should remove view superview, release view controller. it's normal viewdidunload not called. it's hard understand how implemented this, , why went wrong. let me suggest few things. the view controller's methods such viewwillappear , viewdidappear , viewwilldisappear , viewdiddisappear , etc. not useful here...

linux - How do I set the default application for xdg-open on a callto: or skype: URL? -

i'm writing chrome extension links phone numbers in page can click them , make skype call. chrome on linux uses xdg-open delegate external url handling, , doesn't understand callto: or skype: urls. know if can figure out appropriate mime-type can use xdg-mime default set skype handler, i've searched , can't find on topic. how can set xdg-open callto:+1234567890 , instance, place call using skype? "integrating new uris scheme handler gnome , firefox"

php - Removing an array result -

[5] => array ( [id] => 29372 [product_id] => array ( [0] => stdclass object ( [id] => 1469 [type_id] => 1 [title] => hearth 2 hearth [cover] => 21cf9d7d09d403251ba5d01ff33cd089.jpg [coverid] => 1178 [inserted_by] => 0 [inserted_date] => 2011-02-11 13:55:23 [status_id] => 0 ) ) [variable_id] => 9 [variable_value] => 2011-02-11 [master_value] => [released_date] => 2011-02-11 [price] => array ( [0] => array ( [product_id] => 1469 [media_format] => vcd [price] => 29000 ...

Rails - CanCan - accessible_by -

can explain me how cancan's accessible_by works? how know relationship between user , thing needs restricting? there great railscast cancan (made creator): http://railscasts.com/episodes/192-authorization-with-cancan

Help writing flexible splits, perl -

a couple weeks ago posted question trouble having parsing irregularly-formatted data file. here's sample of data: 01-021412 15/02/2007 207,000.00 14,839.00 18 -6 2 6 6 5 16 6 4 4 3 -28 -59 -88 -119 -149 -191 -215 -246 atraso promedio ---> 2.88 i need program extract 01-021412, 18, count , sum digits in subsequent series, , store atraso promedio, , repeat operation on 40,000 entires. received helpful response , , able write code: use strict; use warnings; #create output file open(out, ">outfull.csv"); print out "loanid,npayments,atrasopromedio,atrasoalt,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72\n"; open(myinputfile, "<datos historico aspire2.txt...

mysql - Relating authors real names to pen names in database -

i'm kicking around small database project (sqlite or mysql) learning purposes... figured i'd work on cataloging of many books ;) thought had of tables , relationships worked out, until started going thru , populating sample data particular book series. 1 of authors writes under pen name in series/genre, under different name genre, , 'actual' name else entirely. add fun reader (me) may not aware authors name on cover is pen name or not. any ideas or suggestions how deal sort of thing in practice? tia, monte the answers @adam , @mellamokb not take account of other complications: pen names can used authors an author may have zero-many pen names a pen name can belong author a pen name can house (publisher) pen name, used zero-many authors a pen name adopted, when author starts collaborating 1 or more other authors, collaboration. as say, not obvious name pen name, have make assumption name real unless know otherwise. obviously, dealing the...

c# - In WPF, How to apply style to UserControl in design view? -

i define style , control template in app.xml under tab. so, while designing ui, can see ui style applied in design view in visual studio 2008 .net3.5. however, in case, make usercontrol project , in case, there's no app.xml ui appeared default appearance in design view. it's hard know actual looking in runtime. is there way apply style usercontrol, too? if there's way share same style , template between application project , usercontrol project, perfect! please let me know if there's solution. you can keep styles in separate resourcedictionary in control project. need merge dictionaries in resources block @ top of every user control. problem approach of course lose benefit app-level styles give (like styling differently different applications) because styles determined underlying control.

javascript - call generic handler in aspx without jquery -

can call generic handler in aspx without using jquery? yes, jquery javascript, can call writing own script. benefit of using jquery don't need worry browser compatability, have write less code, can advantage of using jquery plugins etc, cost of adding jquery.js. example: <script type="text/javascript"> // intialize xmlhttp object function getxmlhttpobject() { var a; if (window.xmlhttprequest) { = new xmlhttprequest(); } else { var msxmlhttp = new array( 'msxml2.xmlhttp.6.0', 'msxml2.xmlhttp.3.0', 'msxml2.xmlhttp', 'microsoft.xmlhttp'); (var = 0; < msxmlhttp.length; i++) { try { = new activexobject(msxmlhttp[i]); break; } catch (e) { = null; } } } return a; } function senda...

ios - deleting a contact from address book using personViewController -

i getting hand on address book , created without option of 'deleting contact' address book. is there method delete contact address book. i got i os reference library . i using personviewcontroller methods take @ abpersonviewcontroller+delete category not use private methods: https://github.com/shrtlist/abdelete

html - Handle <nobr> tag in python sgmllib -

i'm trying parse page using python script. <nobr> tag along '&' giving me trouble. here actual html. <a href="http://enpass.in/algo/c12.html" class="style"> <nobr>simulation 1st & 2nd path</nobr></a> now handle_data function of parser(using sgmllib) not able handle data properly. here handle_data code. def handle_data(self, data): self.datainfo.append(data) i expect datainfo array have 1 element namely "simulation 1st & 2nd path" however, when print datainfo array, actual contents of datainfo array 7 in number. datainfo -> ['', '', 'simulation 1st', '&', '2nd path', '', ''] whats happening? you need encode ampersand, &amp; become valid html.

jquery - how to do only this div -

<div id="container"> <div class="slides"> <div class="slides_container"> <p>1</p> <p>2</p> <p>3</p> </div> <a href="#" class="prev">prev</a> <a href="#" class="next">next</a> </div> </div> <div id="container"> <div class="slides"> <div class="slides_container"> <p>1</p> </div> <a href="#" class="prev">prev</a> <a href="#" class="next">next</a> </div> </div> var n = $(".slides_container > p").length; if (n == 1) { $(".prev", ".next").hide(); } else { $(".prev", ".next").show(); } if "p" = 1 , hide .prev & .next (only d...

How to check if a particular version of flash player is installed or not in C#.? -

i want check code if particular version of flash player installed or not. used following code using microsoft.win32 registrykey rk = registry.currentuser.opensubkey("hkey_local_machine\\software\\macromedia\\flashplayer"); if (rk != null) { // it's there } else { // it's not there } in registry if search flash player version 10.2.161.23, location "hkey_local_machine\software\macromedia" is having 2 folders: flashplayer and flashplayeractivex. but, above code not working. kindly let me know how check if particular version of flash player installed in system or not using c#.net . adobe's old (pre 10) ie flash detection code used test in vbscript if instantiate object shockwaveflash.shockwaveflash.<major version>. if it's major version want test, can check keys under hkcr, e.g. hkey_classes_root\shockwaveflash.shockwaveflash.10 . swfobject instantiates version-less object name, shockwaveflash.shock...

iphone - Play 2 videos from url one after another -

in application want play 2 url videos 1 after another. this code: `- (void)viewdidload { nslog(@"viewdidload"); player = [[mpmovieplayercontroller alloc] initwithcontenturl:[self movieurl]]; [nsnotificationcenter defaultcenter]addobserver:self selector:@selector(moviefinishedcallback:) name:mpmovieplayerplaybackdidfinishnotification object:player]; [player play]; [super viedidload]; } - (nsurl *)movieurl { return [nsurl urlwithstring: @"https://s3.amazonaws.com/adplayer/colgate.mp4"];//first video url after video complete.i want play next url video. } - (void) moviefinishedcallback:(nsnotification*) anotification { nslog(@"moviefinishedcallback"); player = [anotification object]; [[nsnotificationcenter defaultcenter] removeobserver:self name:mpmovieplayerplaybackdidfinishnotification object:player]; [pl...

c# - Server.MapPath - Physical path given, virtual path expected -

i'm using line of code: var files = directory.getfiles(server.mappath("e:\\ftproot\\sales")); to locate files in folder error message saying that "physical path given virtual path expected". am new enough using system.io in c# wondering if it's possible enter physical path this? if know folder is: e:\ftproot\sales not need use server.mappath, last 1 needed if have relative virtual path ~/folder/folder1 , want know real path in disk...

hosting - Domain A record -

i've added record domain point ip address relating website resides under different domain - own both domains , website. the record works in if enter domain goes correct ip address - in safari , ie dialog box pops asking enter username/password (specifically in safari says "to view page, must log in area x site x:80") , there should no logon - if cancel don't see website , have no logon can't see website. if enter websites original domain there no prompt , works fine - if enter ip address directly in browser asks login. the website (static pages) hosted fasthosts , doesn't appear have security settings around or can set. anyone know why 1 domain works , other domain , ip address result in logon dialog ? thanks adam your problem not related dns, rather web server configuration. configuration of name-based virtual hosting .

How can I replace space with another string in JavaScript? -

i have code: var str = ' abc'; str.replace(" ",""); but not working. first, have spelling error : replce you should do: var str = ' abc'; str = str.replace(/ /g,""); the /g global modifier replace specified text throughout given string. alternatively, can use split , join this: var str = ' abc'; str = str.split(" ").join("");

c - How can I allocate a 2D array using double pointers? -

i want know how can form 2d array using double pointers? suppose array declaration is: char array[100][100]; how can double pointer has same allocation , properties? typical procedure dynamically allocating 2d array using pointer-to-pointer:: #include <stdlib.h> ... t **arr; // type t arr = malloc(sizeof *arr * rows); if (arr) { size_t i; (i = 0; < rows; i++) { arr[i] = malloc(sizeof *arr[i] * cols); if (arr[i]) // initialize arr[i] else // panic } } note since you're allocating each row separately, contents of array may not contiguous.

how to get the env variables set inside an apache server process -

i using apache server. have written few modules run when apache service started apachectl. i have set env variables in envvars @ /usr/local/apache2/bin/envvars now start httpd process /usr/local/apache2/bin/apachectl -k start. now apache process initiate child apache process. know enviroment variables set in both these processes? how can see that? ok sorry, found it. cat /proc//environ

php - How can I add a link to a table in Smarty? -

i have requirement output table using smarty , have user select row take them page. i can display table fine: {html_table cols="job title,salary,sector,location" loop=$results} which gives: <table border="1"> <thead> <tr> <th>job title</th> <th>salary</th> <th>sector</th> <th>location</th> </tr> </thead> <tbody> <tr> <td>dog walker</td> <td>20000</td> <td>none</td> <td>london</td> </tr> <tr> <td>f1 driver</td> <td>10000000</td> <td>financial services</td> <td>scotland</td> </tr> </tbody> </table> but not sure i...

iphone - How to disable or configure clipping when rendering to texture using FBO in OpenGL? -

i have question way fbo clips visible scene. happens in iphone's opengl es. i'm rendering in 2d , using render-to-texture fbo. i find when part of scene passes side of rectangle of screen size (480*320) appears clipped fbo generated texture. why that? how disable or configure it? i've tried disabling scissor test ldisable(gl_scissor_test); i've tried set needed section by `glenable(gl_scissor_test); glscissor(0, 0, 100, 100);` i've tried adjust viewport by glviewport(0,0, 512,512); it doesn't work needed. instead of extending render area needed 512*512 looks still clips area 480*320 , stretches afterwards 512*512 all these didn't bring needed result. in code: create texture gluint textureid; glenable(gl_texture_2d); glenable(gl_blend); glgentextures(1, &textureid); glbindtexture(gl_texture_2d, textureid); gltexparameteri(gl_texture_2d,gl_texture_min_filter,gl_linear); gltexparameteri(gl_texture_2d,gl_texture_mag_fi...

How to get the total incoming call duration and total outgoing call duration in Android -

how total incoming call duration , total outgoing call duration in android. anyone's appreciated. thanks all, madan. you should use android.provider.calllog.calls . class can content of call log (incoming, outgoing, missed calls) contains duration of every call. here a tutorial it.

.net - C# Syntax explanation -

i saw few days ago syntax , wondered if tell me how called, how work , useful. when ask how work mean setters property readonly(get), , second braces mean: "setters = {". http://msdn.microsoft.com/en-us/library/ms601374.aspx thanks datagrid.cellstyle = new style(typeof(datagridcell)) { // cancel black border appears when user presses on cell setters = { new setter(control.borderthicknessproperty, new thickness(0)) } // end of setters } // end of style it call object initializer , collection initializer , allows set properties in { .. } block when calling constructor. inside block, you're using setters = { ... } collection initializer - allows specify elements of collection (here, don't have create new instance of collection - adds elements in curly braces). more information see msdn page . in general, syntax of object initializers has few options: // without explicitl...

java - Why is this an infinite loop? -

possible duplicate: java problem-whats reason behind , probable output int i=0; for(a=0;a<=integer.max_val;a++) { i++; } system.out.println(i); why result in infite loop? every possible integer <= integer.max_value . condition in for loop can never false . when a reaches max_value , a + 1 overflow , wrap around min_value .

Passing Query string to silverlight -

i have silverlight project has many xaml pages. have external website call silverlight website e.g. http://mysilverlightproject:1230.com?querystring1=page1.xaml . i want change page passing values query string. is possible change main xaml page page query string? thanks string val = string.empty; if (htmlpage.document.querystring.containskey(”foo”)) {val = htmlpage.document.querystring["foo"];}

Reading a file in, then writing out a file with similar name in R -

in r, read in data file, bunch of stuff, write out data file. can that. i'd have 2 files have similar names automatically. e.g. if create file params1.r can read in with source("c:\\personal\\consults\\elwinwu\\params1.r") then lot of stuff then write out resulting table write.table , filename similar above, except output1 instead of params1. but doing many different params files, , can foresee making careless mistakes of not changing output file match params file. there way automate this? that is, set number output match number params? thanks peter if idea make sure outputs go in same directory input try this: source(file <- "c:\\personal\\consults\\elwinwu\\params1.r") old.dir <- setwd(dirname(file)) write.table(...whatever..., file = "output1.dat") write.table(...whatever..., file = "output2.dat") setwd(old.dir) if don't need preserve initial directory can omit last line.

asp.net - What hurts less: Ruby on Rails 3 or ASP .NET MVC 3 -

i wonder whether should lern ruby on rails 3 (ror) or asp .net mvc 3. java web development has frustrated me , i'm looking better. i'm looking framework , programming environment lets me concentrate on essential things. as far know ror seems mature , better direct competitors grails. rails looks bit magic me (read: don't understand happens). on other hand asp .net helps me static typing , larger ecosystem. seems not ready go system, because need separate db development, separate orm , on. the rails slogan "web development doesn't hurt". hurts less: rails 3 or asp .net mvc 3? why not learn both? sure, it'll take more time , effort. go along you'll able identify aspects of each prefer , gravitate toward 1 on other. that's decision better made after you've started using them rather asked (subjectively) on stack overflow. they're tools. might ask if hammer more useful wield screwdriver. people may have opinions eithe...

(Multiple datasources) Mirror data using hibernate+spring -

using hibernate+spring+as400 database in web application: there 3 datasources (one per region), ds australia, ds uk , ds usa. schemas same in datasources. now data needs persisted datasource, rule primary region (selected end user using ui) should used primary datasource save data. in addition, if primary region not usa (say user selected uk region) data should persisted both uk datasource , usa datasource. i aware of simple manual approach of opening session factories , managing manually. http://www.java-forums.org/database/867-hibernate-multiple-databases.html what other alternates available , best way implement ? does needs acid? if not, first idea add @postpersist adds entity jms topic, read 3 clients, each representing 1 database. each client would, then, verify if entity updated in database (by checking optimistic locking column, instance). with approach may have data consistency problems , need act on each failure each client. on other hand, you'd avoi...

php - htaccess access to file by ip range -

how allow access file users ip in range of ip addresses? for example file admin.php. , range 0.0.0.0 1.2.3.4. i need configure access 1 file not directory. just add filesmatch or files directive limit specific script. the following block acces scripts ending in "admin.php" : <filesmatch "admin\.php$"> order deny,allow deny allow 10.0.0.0/24 </filesmatch> the following block admin.php : <files "admin.php"> order deny,allow deny allow 10.0.0.0/24 </files> for more information refer apache docs on configuration sections .

javascript - jquery/js : best way to have an image fading in and out? (recursion?) -

is there better way this, 2 images positioned on each other #state_2 top image. function recursive_fade(){ $('#top_img').delay(4000).fadeout(400).delay(4000).fadein(400); recursive_fade(); }; $(function(){ recursive_fade(); }); when dynatrace this, seems use fair bit of cpu... you should use continuation-style here: let fx system call recursive_fade when last animation has finished: function recursive_fade(){ $('#top_img') .delay(4000) .fadeout(400) .delay(4000) .fadein(400, recursive_fade ); }; edit 2 - meanwhile, seems (long liveth jquery forum ) effects implemented using queue , settimeout function - making edit 1 obsolete. edit - since have no idea if jquery allows recursion (i didn't find convincing proof), think it's best combine "timeout" suggestions continuation technique so: function recursive_fade(){ $('#top_img') .delay(4000) ...

Android :- Second activity not getting started? -

my second activity not starting. below code :- first activity :- package infy.route; import android.app.activity; import android.content.context; import android.content.intent; import android.os.bundle; import android.widget.toast; public class main extends activity { /** called when activity first created. */ context mctx; final static int start =0; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.welcomescreen); mctx = this; thread splashthread = new thread() { @override public void run() { try { int waited = 0; while (waited < 2500) { sleep(100); waited += 100; } } catch (interruptedexception e) { // nothing } { finish(); intent = new intent(mctx,infyrouteplanner.class); ...

installation - Limitation on Subscription contract error log -

i've encountered issue while monitoring failed message in integration broker. when @ details , click on error messages i've got 50 lines ... i'm not able check what's going on in there during process. ( peopletools -> integration broker -> service operations monitor -> monitoring -> asynchronous details ) i've tried retrieve log directly form psiberrp , expect , there's 50 lines 1 transaction id in it. i'm on tools 8.50.06 , checked in books , request on google, asked around me , , no 1 have idea how unlock limit. does know settings remove limit ?

uiactionsheet - Porting an iPhone app on iPad to make a universal app -

i have similar question uiactionsheet on ipad, actionnaly have iphone app want port on ipad, xib there no problem auto-resizing doing well, uiactionsheet , alertviews i'm using call uidatepickers have troubles, first problem alertview: displays in portrait mode doesn't rotate view (perhaps replace popovercontroller?) second problem uiactionsheet containing uidatepicker, when i'm on ipad simulator shows me little empty rectangle inspite uidatepicker should port uiactionsheet on ipad? i'm waiting thank much in both cases seems uipopovercontroller seem appropriate. main difference uipopovercontroller expects viewcontroller control it. beyond that, it's implementation similar both actionsheet , alertview.

language agnostic - Is there anything between key-value-stores and full SQL databases? -

i run problem, have arrays of simple (pod) objects , need save disk, search contents 1 column , retrieve it. let's take simple cache example: id: integer expires: date query: string result: string the common operations saving object (#1), retrieving object id (#2) , deleting after specific date (#3), without using dsl has parsed @ runtime (#4). since know format data has don't need support storing arbitrary documents (#5). this should common enough lead flood of libraries doing this, i'm seeing key-value-stores bdb, tokyocabinet, etc. (which don't work, because of #3), full-fletched sql-databases including sqlite, mysql etc. (#4), , schemaless databases couchdb, mongodb , on (#5). storing plain csv/xml/json works reasonably well, doesn't #2 , #3 well. i'm looking boost's multi-index (but using disk storage) or squeryl using native backend instead of glorified dsl-to-sql-compiler. there or damned either parse csv hand or write massive amou...

Enumerate a property list item array using AppleScript -

i attempting enumerate recentapplication > customlistitems property-list item's array of property-list file (.plist), having difficulty syntax: tell application "system events" set plist_path "~/library/preferences/com.apple.recentitems.plist" set plist_file property list file plist_path set itemnodes property list item "customlistitems" of property list item "recentapplications" of plist_file repeat 1 number of items in itemnodes set itemnode item of itemnodes display dialog text of property list item "name" of property list item itemnode end repeat end tell i error reads: "system events got error: can’t make every text of property list item \"name\" of property list item (property list item \"customlistitems\" of property list item \"recentapplications\" of contents of property list file \"macintosh hd:users:craibuc:library:preferences...

android - Can some explain this InputMethod classes in OpenSudoku source code? -

i trying understand opensudoku source code. understand how board drawn , how ontouch event processed. problem there whole inputmethod package , 8 classes in package. why need package in first place? inputmethod class has initialize() function. why that? can disable touch or keyboard input app? thanks help. still learning android dev , of help. p read creating input methods on android developer site. i'm not familiar opensudoku assume created inputmethod numbers or input numbers textviews in grid. inputmethod doesn't have initialize method think method added setup inputmethod.

How can I fix encoding errors in a string in python -

i have python script subversion pre-commit hook, , encounter problems utf-8 encoded text in submit messages. example, if input character "å" output "?\195?\165". easiest way replace character parts corresponding byte values? regexp doesn't work need processing on each element , merge them together. code sample: infocmd = ["/usr/bin/svnlook", "info", sys.argv[1], "-t", sys.argv[2]] info = subprocess.popen(infocmd, stdout=subprocess.pipe).communicate()[0] info = info.replace("?\\195?\\166", "æ") i same things in code , should able use: ... u_changed_path = unicode(changed_path, 'utf-8') ... when using approach above, i've run issues characters line feeds , such. if post code, help.

c++ - populating char** -

i'm trying read in list of files file. file reading works populating array of char* isn't. works first iteration gets bad pointer on next line. tried vector of strings having problems, think due destructor trying free argv. char **datafiles = (char**)malloc(0); int filecount = 0; master.adddatafiles(argv[1],datafiles,filecount); int manager::adddatafiles(char *filename, char **filelist, int &filecount) { const int linemax = 64; struct stat info; std::ifstream is(filename); if (is.fail()) return 1; char buffer[linemax]; while(!is.eof()) { is.getline(buffer,linemax); realloc(filelist,sizeof(char**) * (filecount + 1)); filelist[filecount] = (char*) malloc(std::strlen(buffer) + 1); std::strcpy(filelist[filecount],buffer); filecount++; } return 0; } using realloc correctly bit tricky -- can (and sometimes, not always, will) return different pointer 1 passed it, have this: char *...

javascript - Building a slideout image gallery w/ jquery-- seeking suggestions for plugins or code snippets -

i'm trying build image gallery (or, ideally, find jquery plugin) meets following specifications: full-size images in #left div, thumbnails wrapped in links in #right div. clicking #right div thumb causes corresponding full-size image slide out right side of #left frame center after full-size image loads, thumbnails in #right fade out reveal description of each image-- possibly stored in alt tag, more stored in span within link when #right thumbs fade, button appears allows user click , fade thumbnails in. i don't know javascript, i'm @ loss begin this. expertise front-end, unfortunately find myself de facto developer these days. such life. your best bet use this: http://playground.marmaladeontoast.co.uk/jquery/galleria/demo/demo_02.htm but without javascript knowledge, struggle plugin want... but! i have given couple of lectures on introduction javascript, might find slides useful introduction javascript javascript development in fact have ...

web services - JAXWS problem without namespace prefix using Jboss 4.2.3ga -

i have java service published jaxws webservice using @webserviceannotation. service deployed on jboss application server 4.2.3ga (with jax-ws implementation provided application server). the service works when soap message this: <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pref="mynamespace"> <soapenv:header/> <soapenv:body> <pref:mymethod> <arg0>value</arg0> </pref:mymethod> </soapenv:body> </soapenv:envelope> and failed when soap message this: <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="mynamespace"> <soapenv:header/> <soapenv:body> <mymethod> <arg0>value</arg0> </mymethod> </soapenv:body> </soapenv:envelope> by fail mean "mymethod" invoked, arg0 null. does know if ...

objective c - Zooming axes in CorePlot -

i have app use coreplot plot graph. have implemented zooming of graph pinch gestures, still can't make labels near axis (which contain numbers 1, 2 etc.) zoom properly, instead of 1 major interval changes 5 or 0.5 (or other number) depending on pinch gesture. -(void) viewdidappear { uipinchgesturerecognizer* rec = [[uipinchgesturerecognizer alloc] initwithtarget:self action:@selector(scalepiece:)]; // set options recognizer. [self.view addgesturerecognizer:rec]; ... xmajorinterval = 1; ymajorinterval = 1; axisset = (cpxyaxisset *)graph.axisset; axisset.xaxis.majorintervallength = cpdecimalfromfloat(xmajorinterval); axisset.xaxis.minorticksperinterval = 4; axisset.xaxis.minorticklength = 4.0f; axisset.xaxis.majorticklength = 8.0f; axisset.xaxis.labeloffset = 1.0f; axisset.yaxis.majorintervallength = cpdecimalfromfloat(ymajorinterval); axisset.yaxis.minorticksperinterval = 4; axisset.yaxis.minorticklength = 4.0f; axisset.yaxis.majorticklength = 8.0f; axisset.yaxis.labelo...

OpenGL ES Tiled Texture Mipmap problem - iPad/iPhone -

Image
i'm running traditional tile/mipmap problem on ipad using opengl es. basically, if have large texture (larger 1k x 1k), can break pieces , map pieces onto individual polygons. can clamp texture coordinates edges , works, artifacts along boundaries. now know why , know traditional solution is. wit, make border around outside of each littler texture (say 6 pixels). sample little textures big 1 you're using inside pixels (say 256-2*6). smear valid pixels out border area. lastly, map texture coordinates use valid inside pixels. works okay. if you're not nodding along @ point, don't try answer. :-) anyway, opengl introduced clamping modes way in day solve this. don't see modes in opengl es (at least on hardware) , see other references problem. i'm wonder if i'm missing something. there newer way solve tile/edge problem i'm not aware of? [update] screen shot of result attached here. visible line @ end of 1 texture , start of another. u...