Posts

Showing posts from September, 2014

eclipse - Android: Issues transitioning to the next .java? -

i'm little confused... after animation, splash screen supposed start intent function operate next .java activity file... when runs after splash screen in emulator, wont work. opened logcat , said extent of java.lang.nullpointer , runtime exception running @ pause feature... can explain me? thanks. package com.unicorn.test.whee; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.animation.animation; import android.view.animation.animation.animationlistener; import android.view.animation.animationutils; import android.widget.imageview; public class splashscreenpear extends activity { imageview pearfade; /** called when activity first created. */ public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.pear); } private void startanimating(){ animation pearfadeact = animationutils.loadanimation(this, r.anim.fadein); imageview pearfade = (imageview) findview...

How to run another Java project from a running project specially in NetBeans and in case of a desktop application? -

i have database applications (crud), , want create desktop application buttons such clicking on them lead run applications. how this? i have tried adding crud projects class path desktop application, didn't work out, exception in crud's lines indicating class can not found or something. i'm using netbeans , database applications created automatically netbeans mysql server. ok, found solution on although not wanted, it's working. first, built database applications jar files. next, in event handler of buttons added line of code in order execute jar file: runtime.getruntime().exec("java.exe -jar crudapp1.jar"); so every time click button application runs. although working fine me, seems not right solution. rather prefer solutions adding classpaths or similar, because of conflict in class name, don't know come from, classpaths didn't work.

c# - ASP.NET MVC 3 Client Validation -

i have following viewmodel: public class viewmodel { [display(name = "firstname", resourcetype = typeof(views.validation))] public string firstname { get; set; } [required(errormessageresourcename="required", errormessageresourcetype = typeof(views.validation))] [display(name="lastname", resourcetype = typeof(views.validation))] public string lastname { get; set; } ... } and html view: ... <div class="row valid showmsg"> <div class="itemwrap clearfix"> <label>@html.labelfor(model => model.firstname)<span class="iconreq">&nbsp;</span>:</label> @html.editorfor(model => model.firstname) </div> <div class="info"> <p class="errormsg">@html.validationmessagefor(model => model.firstname)</p> <p class="infomsg">info message here</p> ...

boost - windows service to run a method at definite time interval in C++ -

i want call method periodically in windows service built in c++. calling method in svcmain(). int main(int argc, char* argv[]) { // services run have added in table. // takes service name , name of method called sc manager. // add additional services process table. service_table_entry servicetable[]= {{svcname,(lpservice_main_function)svcmain},{null,null}}; // call returns when service has stopped. // process should terminate when call returns. startservicectrldispatcher(servicetable); return 0; } void winapi svcmain(dword argc, lptstr *argv) { connecttoserver(); } q1. going fire connecttoserver() time or once? don't know how win service works. q2.i want connecttoserver() fired every 15 mins. how can ? edit: how can create installer service? it's going call svcmain once. you're not doing should in svcmain. there's example on msdn writing servicemain function . if copy example, you'd write code call con...

android - Can I use ACTION_VIEW to view a JPG I've downloaded? -

i'm having terrible time trying view jpg file i've downloaded using action_view in android app. can verify file present , correct size. can pull file emulator , open on computer, know jpg not corrupt. i've tried code in view image in action_view intent? . my code follows: // start intent view file string filename = "test.jpg" string downloadsdirectorypath = getfilesdir().getpath() + "/downloads"; file file = new file(downloadsdirectorypath + "/" + filename); intent = new intent(); i.setaction(intent.action_view); i.setdataandtype(uri.fromfile(file), "image/*"); startactivity(i); this seems should straight forward, whenever run above code, error/uriimage(336): got exception decoding bitmap error/uriimage(336): java.lang.nullpointerexception error/uriimage(336): @ com.android.camera.util.makeinputstream(util.java:336) error/uriimage(336): @ com.android.camera.util.makebitmap(util.java:307) error/uri...

sql server - how to iterate over an cursor -

i have select statement returns single row. after have written cursor me @@fetch_status -1 not go inside cursor now open cur_mkt print @init while (@init = 0) begin fetch next cur_mkt @desc, @divisions print @@fetch_status if (@@fetch_status =-1) break is there way can go inside cursor, please me out. it doesn't sound need cursor (which should try avoid anyway). if you're determining presence of result do: select @desc = desc, @divisions = divisions yourtable id = 1 if ( @@rowcount > 0 ) begin -- row found end so recommend not using cursors. to directly answer question, way use cursors/iterate round results follows: declare @a integer declare cur_mkt cursor select 1 union select 2 open cur_mkt fetch next cur_mkt @a while (@@fetch_status = 0) begin print @a fetch next cur_mkt @a end close cur_mkt deallocate cur_mkt

XSLT - Transform XML to a different XML -

i need create xsl file use transform 1 xml xml. problem is, dont know xpath nor xslt. question is, there tool can me or need sit , start reading xpath & xslt? thanks, you need sit , start reading xpath , xslt. i find tutorials on zvon quite good. this page quite playing around xpath , xslt , trying things out. see this answer more tutorials , books xslt.

indexing - how to addClass to its equal index .....(JQUERY) -

<ul> <li>index 0</li> <li>index 1</li> <li>index 2</li> </ul> <div> <a>index 0</a> <a>index 1 (if click this want addclass li same index of )</a> <a>index 2</a> </div> you can invoke jquerys .index() help method purpose. returns index relative the siblings of current node. find li node according index, use .eq() help $('a').click(function() { $('ul li').eq($(this).index()).addclass('your_new_class'); }); demo : http://www.jsfiddle.net/2rfn3/ referring comment $('a').click(function() { $('ul li').eq($(this).index()).addclass('your_new_class').siblings().removeclass('your_new_class'); }); demo : http://www.jsfiddle.net/2rfn3/1/

How do you change text to bold in Android? -

how change text/font settings in android textview ? example, how make text bold ? to in layout.xml file: android:textstyle examples: android:textstyle="bold" android:textstyle="italic" programmatically method is: settypeface(typeface tf) sets typeface , style in text should displayed. note not typeface families have bold , italic variants, may need use settypeface(typeface, int) appearance want.

asp.net - Repeater Item Command Causes Validation -

i seem have bit of bug, have asp.net repeater control link buttons in , link button has have causes validation property set false. however; when clicking makes panel visible on web page, asp.net required field validator controls trigger , shows error messages. on controls have validator controls on. any ideas might cause ignoring causes validation property set false? on opinion, should set different validationgroup properties values repeater control , control source required field validator. possible container repeat control has raised event can heared required field validator. if mentioned above cannot try disable client validation requiredfieldvalidator using enableclientscript="false" it. , activate requiredfieldvalidator when usefull. example in button event handler can apply such code: mybutton.validate(); if (mybutton.isvalid) { want... }

architecture - How to send progress updates from a business/model class? -

let's have application has layered architecture. on view use mvc or mvvm. model treated domain, has part of business logic. now let's have, in model, method takes time. complicated calculation or treatment has done each items of object example. in ui, display progress bar , text display current step of calculation (for example listbox process history). how that? how send model information of progress of process , how hook controller or viewmodel update progress? i implement in following manner. business-layer process, takes long time run, raises events every indicate it's hitting specific "milestones". decide milestones signal through events , how many of them. if time-consuming process plain loop, may choose, example, raise same event again , again every 10% of items in loop. if process distinct phases, may choose raise different event each phase completed. now, presentation layer subscribes events , acts in consequence, updating progress bar...

c++ - Suppose i created three or four object of a class study then memory will be created seperatly or not? -

here class study { data member; member function; }; main() { study s1, s2, s3; } it create 3 object of class study memory created seperatly seperate object or not in c++ not quite sure you're asking here but... obviously s1,s2 , s3 each occupy different areas of memory. however, memory allocated them on stack, there no calls malloc()/new() 'allocate' memory. allocating memory off stack fast (just subtraction stack pointer) allocate 3 'studys' there typically single assembler instruction sub 3*sizeof(study) sp.

ruby - Many nested `for` cycles depending on a variable -

i want put many for cycles in themselfs depending of value in variable. example, if variable @var = 1 , need perform: for letter1 in @range end if variable @var = 2 : for letter1 in @range letter2 in @range end end if variable @var = 3 for letter1 in @range letter2 in @range letter3 in @range end end end is there smarter/less code way code below? don't wanna repeat myself on again. if @var == 1 letter2 in @range end elsif @var == 2 letter1 in @range letter2 in @range end end elsif @var == 3 letter1 in @range letter2 in @range letter3 in @range end end end end that do something part same in each case. difference how cycles in. you should read recursion: http://en.wikipedia.org/wiki/recursion_(computer_science) like: def f(depth,letters=[]) if depth == 0 someting letters else letter in @range f(depth-1,letters+[letter]) end end end f(@va...

java - JSoup not translating ampersand in links in html -

in jsoup following test case should pass, not. @test public void shouldprinthrefcorrectly(){ string content= "<li><a href=\"#\">good</a><ul><li><a href=\"article.php?boid=1865&sid=53&mid=1\">" + "boss</a></li><li><a href=\"article.php?boid=186&sid=53&mid=1\">" + "heavent</a></li><li><a href=\"article.php?boid=167&sid=53&mid=1\">" + "hellos</a></li><li><a href=\"article.php?boid=181&sid=53&mid=1\">" + "mr.jackson!</a></li>"; document document = jsoup.parse(content, "http://www.google.co.in/"); elements links = document.select("a[href^=article]"); iterator<element> iterator = links.iterator(); list<string> urls = new arraylist<stri...

javascript - Overriding history.pushState leads to error in opera 11 -

i'm injecting following code webpage via greasemonkey script/opera extension trap history.pushstate command, can processing whenever it's fired , still allow pushstate command continue afterwards. (function(history){ var pushstate = history.pushstate; history.pushstate = function(state) { if (typeof history.onpushstate == "function") { history.onpushstate({state: state}); } alert('pushstate called') return pushstate.apply(history, arguments); } })(window.history); the code works fine in ff4 , chrome, in opera 11, following error, if page calls history.replacestate command: uncaught exception: typeerror: 'window.history.replacestate' not function does know how can fix above code work opera chrome , firefox? in opera 11.00, revision 1156, history api supported these >>> history. back, current, forward, go, length, navigationmode the full html5 history api not yet cov...

background - Android - scaling image after I did it programmatically -

strange thing happens - @ least don't it. i have image (w: 120px, h: 63px) presented on 1 imagebutton. variant of image have placed in drawable-hdpi (and there no other drawable directory). ok image , every resolution (density), android takes care of nicely. but, trouble when take photo album (some big photo, example), scale dimensions of button (previously mentioned, w: 120px h: 63px) , set small image imagebutton background. in case when testing on emulator medium density (160) ok, when testing on device high density button gets resized since scaled image appears smaller. does has idea happening , why size of image changed once more after scaled it? any clue highly appreciated. here code use resizing image: public static void resizeandsaveimage(string pathtoresize, int newwidth, int newheight, fileoutputstream output) { try { bitmapfactory.options options = new bitmapfactory.options(); options.insamplesize = 8; bitmap bitmap = bitmapfactory.decodestr...

objective c - How to open "Paid" app page in iPhone's AppStore by clicking button in "Lite" app? -

i have 2 versions of app. lite , paid. want have button in lite version when clicked opens app store application on iphone , shows page paid version of app. how do this? dont want open paid version itunes page in safari. should open in app store application only. thanks! this should work (all os): http://itunes.apple.com/app/idyour_paid_app_id code snippet (you can copy & paste it): #define your_paid_app_id 553834731 // replace paid app id static nsstring *const iosappstoreurlformat = @"http://itunes.apple.com/app/id%d"; // general link app store [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:[nsstring stringwithformat: iosappstoreurlformat,your_paid_app_id ]]]; // open right link

java - Hibernate: Entities vocabulary(in-memory storage) -

vocabularies common thing when using pure sql. store static tables(rarely updated entries - such types, cities list, etc.) in memory , update when needed - nice approach because haven't create tonns of connections , property binding... but hibernate it's sessions, transactions, versions, etc. ? allows create such vocabulary ? p.s . interesting thing - transient objects. because of number of different sessions , transactions vocabularies used. each time object vocabulary have invoke merge() wouldn't perform communication db ? hibernate provieds readonly mapping: mutable=false (or add @immutable class) should result in less memory consumtion. and can enable caching class.

Amazon S3 Upload Whats does Key do -

i confused key value should when using amazon s3 here code. <form action="http://bucket.s3.amazonaws.com" method="post" enctype="multipart/form-data"> <input type="text" name="key" value="{filename}" /> <input type="text" name="acl" value="public-read" /> <input type="text" name="content-type" value="text/plain" /> <input type="hidden" name="awsaccesskeyid" value="amazon key" /> <input type="hidden" name="policy" value="ewogicjlehbpcmf0aw9uijogijiwmtitmdetmdfumti6mda6mdaumdawwiisciagimnvbmrpdglvbnmioibbciagicb7imj1y2tldci6icjpcihsiywnsijoginb1ymxpyy1yzwfkiib9laogicagwyjlcsisicika2v5iiwgintmawxlbmftzx0ixswkicagifsic3rhcnrzlxdpdggilcaijenvbnrlbnqtvhlwzsisicj0zxh0lyjdlaogif0kfqo=" /> <input type="hidden" name="signature" value="fgwi1jku+hkz...

php - Propogating a function to parents -

i have php object consists of set of classes. sake of simplicity lets call object of class c extends class b in turn extends class a. @ point in code want clean object calling docleanup() function inherits interface i: interface { public function docleanup(); } class implements { ... } class b extends { ... } class c extends b implements { ... } in docleanup function in class c want execute cleanup function in parent classes (in case, docleanup() in class a). however, objects not sure whether of parent classes implement interface i, not sure whether can simpley call parent::docleanup() . my question therefore if there way check whether of ancestors implement interface example using sort of instanceof call? you can nicely get_parent_class , is_subclass_of (which works interfaces parent classes): <?php interface { public function docleanup(); } class implements { public function docleanup() { echo "done cleanup\n"; } } class b ...

long running processes - MySQL - can I limit the maximum time allowed for a query to run? -

i'm looking way limit max running time of query on mysql server. figured done through my.cnf configuration file, couldn't find relevant in docs. knows if done? thanks. there no way specify maximum run time when sending query server run. however, not uncommon have cron job runs every second on database server, connecting , doing this: show processlist find connections query time larger maximum desired time run kill [process id] each of processes

java - For a HashMap that maps from a custom class, how to make it so that two equivalent keys will map to say value? -

i have custom class, example's sake let's it's tuples without order. public class unorderedtuple { integer i1 = null; integer i2 = null; unorderedtuple(integer int1, integer int2) { i1 = int1; i2 = int2; } boolean equals(unorderedtuple t) { return t.i1 == i1 && t.i2 == t2 || t.i2 == i1 && t.i1 == i2; } } like said, dumb example. now, let's have map<unorderedtuple, integer> m = new hashmap<unorderedtuple, integer>(); ideally, i'd functionality: unorderedtuple ut1 = new unorderedtuple(1,2); unorderedtuple ut2 = new unorderedtuple(2,1); m.put(ut1,2); m.put(ut2,3); system.out.println(m.get(ut1)==3); //ideally returns true is there need implement or extend such can have functionality? in same way if use 2 different, equal strings, or integers, or whatever key map properly, if implement written, treats ut1 , ut2 separately. if construct ut1 , ut2 identically, same thing. thanks help. you need override...

Zend Framework switching views in action -

i have action in controller supposed display different types of output depending on value in dropdown on form. i have written templater object (extends zend_view_abstract) different view types. i have tried running following code: public function generatedocumentaction() { //...some code set $view depending on post data // e.g. $view = new templaterodt(); //view openoffice document $this->_helpers->gethelper('viewrenderer')->setview($view); $this->view->myvar = $form->getvalue('some_value'); } but $this->view still default 1 (a smarty templater) which set in /public/index.php i've looked in documentation , says can set view in init() function in controller http://framework.zend.com/manual/en/zend.view.scripts.html set view entire controller don't want. how can change output type action? if want change template rendered, use: $this->_helper->viewrenderer('viewscripthere'); ...

c# - How to remove more than one dot (.) from text? -

how remove more 1 dot (.) text ? for example: 123..45 = 123.45 10.20.30 = 10.2030 12.34 = 12.34 12.. = 12 123...45 = 123.45 how ? thanks in advance it not necessary use regex, can achieve need in way: string s = "10.20.30"; int n; if( (n=s.indexof('.')) != -1 ) s = string.concat(s.substring(0,n+1),s.substring(n+1).replace(".",""));

How to convert a string to RTF in C#? -

question how convert string "européen" rtf-formatted string "europ\'e9en"? [testmethod] public void convert_a_word_to_rtf() { // arrange string word = "européen"; string expected = "europ\'e9en"; string actual = string.empty; // act // actual = ... // how? // assert assert.areequal(expected, actual); } what have found far richtextbox richtextbox can used things. example: richtextbox richtextbox = new richtextbox(); richtextbox.text = "européen"; string rtfformattedstring = richtextbox.rtf; but rtfformattedstring turns out entire rtf-formatted document, not string "europ\'e9en". stackoverflow insert string special characters rtf how output unicode string rtf (using c#) output rtf special characters unicode convert special characters rtf (iphone) google i've found bunch of other resources on web, nothing quite solved problem. answer brad christ...

reporting services - SSRS Draft Font -

dear all, have epson printer.i want print ssrs report in draft fonts,like draft 10cpi,draft 12 cpi,draft 15 cpi available in printer. is possible? yes, can set own fonts ssrs reports. you need fonts installed on machines involved - development, web server , on client machines report accessed from. if not want distribute font, have export pdf embedded fonts , send out.

jquery - Should I implement "drafts" of content in my application? -

if design robust data-entry oriented web application asp.net mvc, consider implementing drafts content being edited? holds data while being edited , how manage user logins/logouts/session timeouts/navigating content being edited? also if happen know jquery plugin handles , works fine asp.net mvc, feel free mention it. should implement "drafts" of content in application? only can answer question depending on customer's requirements. what holds data while being edited , how manage user logins/logouts/session timeouts/navigating content being edited? i recommend sending ajax requests @ regular intervals server side script associate draft logged in user , post being edited , save in datastore. while data being edited hold inside client browser (usually inside html <form> element input fields). when user submits data no longer considered draft , delete corresponding entry in drafts table , persist final revision. when user navigates page h...

ajax - YES or NO: Can a server send an HTTP response, while still uploading the file from the correlative HTTP request? -

if website user submits html form with: (1) post method; (2) multipart/form-data enctype; and, (3) large attached file, can server upload posted file, , send server generated http response before file upload completed, without using ajax? that's pretty dense. so, wrote example illustrate mean. let's there image upload form caption field. <form action="upload-with-caption/" method="post" enctype="multipart/form-data"> <input type="hidden" id="hiddeninfo" name="hiddeninfo" /> file: <input type="file" name="imgfile" id="imgfile" /><br /> caption: <input type="text" name="caption" id="caption" /> <input type="submit" /> </form> i want store caption in database table the definition: [files_table] file_id [uniqueidentifier] file_caption [varchar(500)] file_statu...

.net - Windows Forms very slow under Windows7? -

today colleague of mine said gdi+ , windows forms slow under windows 7. mentioned gdi+ not longer accelerated hardware. unfortunatly not have win7 machine here , results got google not clear. question is: gdi+ slow under windows 7? thank help. gdi+ has never been hardware accelerated. no significant complaints after win7 introduced, fud.

Oracle SQL: Detecting breaks in continual spans -

i have following table , i'm trying detect products have break in spans. product | unit_cost | price start date | price end date -------------------------------------------------------------------------- product 1 15.00 01/01/2011 03/31/2011 product 1 15.00 04/01/2011 06/31/2011 product 1 15.00 07/01/2011 09/31/2011 product 1 15.00 10/01/2011 12/31/2011 product 2 10.00 01/01/2011 12/31/2011 product 3 25.00 01/01/2011 06/31/2011 product 3 25.00 10/01/2011 12/31/2011 so here want report product3 because missing span 07/01/2011 - 09/31/2011 any ideas on how can this? edit: oracle ver: 10g create table statement create table sandbox.tbl_product ( product_id varchar2(13 byte), product varchar2(64 byte), unit_cost number, price_start_date date, price_end_date date ) edit 2 start dates , end da...

MATLAB: How do I fix subscripted assignment dimension mismatch? -

new_img ==> new_img = zeros(height, width, 3); curmean this: [double, double, double] new_img(rows,cols,:) = curmean; so wrong here? the line: new_img(rows,cols,:) = curmean; will work if rows , cols scalar values. if vectors, there few options have perform assignment correctly depending on sort of assignment doing. jonas mentions in answer , can either assign values every pairwise combination of indices in rows , cols , or can assign values each pair [rows(i),cols(i)] . case assigning values every pairwise combination, here couple of ways can it: break assignment 3 steps, 1 each plane in third dimension: new_img(rows,cols,1) = curmean(1); %# assignment first plane new_img(rows,cols,2) = curmean(2); %# assignment second plane new_img(rows,cols,3) = curmean(3); %# assignment third plane you in loop jonas suggested , such small number of iterations kinda use "unrolled" version above. use functions reshape , repmat on curmean reshape...

validation - Error Identification in Xerces Perl -

i have set xerces validate xml versus schema. want able change output of error message based on type of error make more user friendly. such string not being in enumeration. xerces have of of error codes passed c++ libraries perl. have search , can not find this.

c# - Removing an event from a DynamicObject -

i have added event handlers dynamic object. however, not able remove them. dynamic d = new mydynamicobject(); d.myevent += new eventhandler(this.myhandler); d.myevent -= new eventhandler(this.myhandler); when add event handler, call trysetmember handler argument, however, when removing value null. if it's null, how supposed know handler remove internal storage of handlers particular event? hard guess problem might without snippet at. i'll post simple works: using system; using system.dynamic; class program { static void main(string[] args) { dynamic obj = new mydynamicobject(); obj.myevent += new eventhandler(handler); obj.myevent(null, eventargs.empty); obj.myevent -= new eventhandler(handler); } static void handler(object sender, eventargs e) { } } class mydynamicobject : dynamicobject { private eventhandler dlg = new eventhandler(delegate { }); public override bool trygetmember(getmemberbinder binder, ...

intellij idea - Weird error while installing Android app? -

in intellij idea exported signed application (created new key, etc.), entered command adb install <my_app>.apk , got error: 1990 kb/s (745096 bytes in 0.365s) pkg: /data/local/tmp/myapp.apk failure [install_parse_failed_unexpected_exception] google doesn't seem know error. found solution application version in manifest file not integer, not case me. could making mistake during creation of new sign key??? edit: here manifest file. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.example.app" android:versioncode="1" android:versionname="1.0" > <application android:icon="@drawable/icon" android:label="@string/app_name" > <activity android:name=".app" androi...

sql - Oracle 10g Import Export question -

i new oracle. have 2 oracle 10g systems running. need export database in 1 system , import dmp file oracle system using exp , imp commands i cannot use data pumps. questions 1- when exporting , importing databases, must stop databases running ? need exp , imp them while databases running. cannot stop dbs running. 2- sql query find out a) db system priviledges user has. need find out if user has priviledge imp , exp. b) how create , add new user able exp , imp databases 3- in using imp command, can fromuser , touser values same user value ? 4- must drop db on target box before import prevent object duplication errors ? any appreciated. thank you. sincerely. no don't need stop database. might want use consistent=y select * user_sys_privs though user doesn't need special privileges export own schema or import own schema. in latter may need create table etc. if fromuser , touser same don't need specify either you don't want drop database (unless ...

sql - MS Access: How to use calculated field in a sub query? -

i have problem following query select a.pname, (b.hours+c.hours) totalhours, (select top 1 grade tabled tabled.hoursrequire >=**totalhours**) tablea left join tableb b on a.pname=b.pname left join tablec c on a.pname=c.pname my problem calculated field "totalhours" not recognized in sub query, appreciated. will want using field expression (b.hours+c.hours) in subquery instead of alias totalhours? select a.pname, (b.hours+c.hours) totalhours, (select top 1 grade tabled tabled.hoursrequire >= (b.hours+c.hours)) tablea left join tableb b on a.pname=b.pname left join tablec c on a.pname=c.pname however you're using left joins, , suspect rows either b.hours or c.hours null, nothing subquery because b.hours+c.hours null , tabled.hoursrequire >= null never evaluate true. nz() function useful here. edit: @cyberwiki spot on re top 1 without order by. sorry missed that. why have hours split between 2 tables (tableb , tablec)? show sam...

debugging "failed to launch in time" with xcode -

can me setup debug environment things make more sense? at point simulator stopped loading app i'm working on. app loads if run instruments , works on device (ipad). the application tries load , of sudden 'debugging terminated' message @ bottom left of xcode. running 'tail -f /var/log/system.log' found following message: " myapp failed launch in time". poking around , experimenting breakpoints, able pin point culprit method: - (bool)application:(uiapplication *) application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions; this method part of app delegate naturally, , first thing execute: [window addsubview:viewcontroller.view]; so questions - how can figure out hell going on here , part of app hanging? moreover, kind of setup can used useful information debugger... whenever there error, cannot figure out line of code generated it. thanks. if app failed launch in time, means app doing time consuming @ launch tim...

command line - How do I run a batch script from within a batch script? -

how call batch script within batch script? i want execute in if statement. use call in call nameofotherfile.bat this block (pause) execution of current batch file, , wait until call ed 1 completes. if don't want block, use start instead. get nitty-gritty details using call /? or start /? cmd prompt.

java - Collections.copy(dest, src) still Referencing Source Collection -

i have searched forum handling deep-copying of collections in hands, collections.copy(dest, src) isn't working expected. did miss something? list<column> mergedstudies = new arraylist<column>(arrays.aslist(new column[studycolumns.size()])); collections.copy(mergedstudies, studycolumns); (iterator itrstudyreccolumns = mergedstudies.iterator(); itrstudyreccolumns.hasnext();) { column studyreccol = (column) itrstudyreccolumns.next(); (iterator itrstudyvalcolumns = studyvaluecolumns.iterator(); itrstudyvalcolumns.hasnext();) { column studyvalcol = (column) itrstudyvalcolumns.next(); if (studyreccol.getcolumnname().equals(studyvalcol.getcolumnname())) { // note: method dereferences copies existing destination collection items appended end of collection. cellvalue[] cellvalarray = studyvalcol.getcellvalues().toarray(new cellvalue[studyvalcol.getcellvalues().size()]); studyre...

Php strtotime "rounding" end of month -

any idea why strtotime round end of month next month? for($i=1;$i<12;$i++) { $d = "y-$i-t 00:00:00"; echo "date string: " . $d = date($d) . "\n"; echo "date unixtime: " . strtotime($d) . "\n"; echo "unixtime string: " . $d = date('y-m-d 00:00:00', strtotime($d)) . "\n"; echo "string unixtime: " . strtotime($d) . "\n\n"; } results: date string: 2011-1-31 00:00:00 date unixtime: 1296450000 unixtime string: 2011-01-31 00:00:00 string unixtime: 1296450000 date string: 2011-2-31 00:00:00 date unixtime: 1299128400 unixtime string: 2011-03-03 00:00:00 string unixtime: 1299128400 date string: 2011-3-31 00:00:00 date unixtime: 1301544000 unixtime string: 2011-03-31 00:00:00 string unixtime: 1301544000 date string: 2011-4-31 00:00:00 date unixtime: 1304222400 unixtime string: 2011-05-01 00:00:00 string unixtime: 1304222400 date string: 2011-5-31 00:00:00 date unix...

Optimal Database fullness? -

lets have relational database of arbitrary finite capacity, , database holds historical event information online system generating new events. database should hold event information reporting purposes, should purge events older (n) number of days. given have enough historical information deduce rate of event generation relatively constant , not increasing or decreasing on time, there optimal percentage (60%, 70%, 80%,...) fullness design database? if so, why did choose percentage? it depends. well, more helpful, said rate of event generation "relatively constant". need enough margin deal inconstancies in rate, both statistical , emergency. statistics can history, emergencies can guessed at. the actual amount of space used depends on how stored. on related note, many filesystems become slow if exceed degree of fullness; want include percentage part of total margin. also, consider things granularity of event purge: how happen? also, consider consequen...

asp classic - IE creating a phantom div in a listing loop -

i've been working on few days , cannot find solution. http://mri.sniperdyne.com/inventory.asp?catid=c547e3b5-44f4-4bb5-bf2d-ce51bb8e8da6 in ff loop works fine. in ie8 creates phantom div @ top. has seen before? the background programming language asp vb. i'm not sure if caused cross browser compatibility. when have problems this, it's indication forgot close div somewhere. or closed 1 many. if it's not obvious when eyeball code, try running page through w3c validator service find , fix markup problems.

php - Retrieve a single row from Codeigniter -

if need retrieve single row of data database, why can't when want insert id table: 'user_id' => $query->row()->id is there way without foreach loop if want single piece of data? the full code is: $this->db->where('username', $this->input->post('username')); $query = $this->db->get('members'); $data = array( 'first' => $this->input->post('first'), 'last' => $this->input->post('last'), 'email' => $this->input->post('email'), 'phone' => $this->input->post('phone'), 'address' => $this->input->post('address'), 'city' => $this->input->post('city'), 'state' => $this->input->post('state'), 'zip' => $this->input->post(...

bash - How to update one file in a zip archive -

is possible replace file in zip file without unzipping deleting old file adding new file , rezipping back? reason have zip file big there 1 xml inside zip file have update sometimes. unzipping zip , rezipping takes long time. i'd able replace 1 xml inside zip through script. have checks updates on xml have. so possible replace 1 xml without unzipping , rezipping ? sorry use zip command things problem script android phone , zip not command can use unfortunately sorry left out. have used zip definately if have unzip droid , there tar in busybox tar doesn't need from zip(1) : when given name of existing zip archive, zip replace identically named entries in zip archive or add entries new names. so use zip command create new .zip file containing 1 file, except .zip filename specify existing archive.

WPF dock control to cell in grid -

if have 2 2 grid how button fill entire cell? have use trigger? how column's width in case? thanks ian the button default consume entire cell. <grid> <grid.rowdefinitions> <rowdefinition height="100"></rowdefinition> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="200"></columndefinition> </grid.columndefinitions> <button></button> </grid> you can columns width accessing columndefinitions collection. grid g = new grid(); g.columndefinitions[0].width;

Can I catch APPCRASH of command line app launched with C#'s System.Diagnostic.Process()? -

i need write c# application calling command line tool (probably written in c), of know it's unstable. wonder if it's possible catch random crashes of tool in application. it enough handle these crashes terminating app , writing log message indicating tool has crashed. this how call (details process.startinfo settings omitted): process exeprocess = new process(); exeprocess.start(); exeprocess.waitforexit(); exeprocess.close(); i can reproduce 1 particular kind of crash due bad input data (c0000005 access violation exception), check preconditions before starting process. i'm sure in production other kinds of crashes occur. there's not whole lot predictable process crashes violently. if due hardware exception, accessviolation, there reasonable odds process exit code indicator. use process.exitcode after waitforexit() read it. value of 0 indicates success, although that's app well.

java - TextEdit Text Input Issues in my game -

i working on android game , trying text input working. want prompt player enter or name , have name added high score list. i trying through edittext can work if put code in oncreate method, not if call game loop. the method using: public static void getinput(context context) { final alertdialog.builder alert = new alertdialog.builder(context); final edittext input = new edittext(context); alert.setview(input); alert.setpositivebutton("ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { string value = input.gettext().tostring().trim(); } }); alert.setnegativebutton("cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { dialog.cancel(); } }); alert.show(); } if call gameloop game crashe...

objective c - Fastest way to copy or create a CCNode game object in cocos2d-iphone? -

background: i'm developing game iphone/ipad using cocos2d-iphone. our engine provides ability level designer create new bad-guys defining number of properties such speed, ai, weapons , main sprite texture in .plist files. problem: currently, build nsdictionary of of prototypes before level starts. each entity store class name , nsdictionary describing parameters required build new instance of entity. create instance of each prototype @ load time precache textures destroy immediately. when new bad guy spawns, use stored nsdictionary , pass init method (stripped of error checking brevity); ikprototype* prototype = [prototypes objectforkey:prototypeid]; ikbaseentity* entity = [[[nsclassfromstring([prototype prototypeclass]) alloc] init] autorelease]; [entity setprototypeid:prototypeid]; [entity parseparameters:[prototype parameters]]; return entity; now, works treat - creating number of bullets in same frame causes noticeable slow down (a frame or 2 dropped) engine parses...

apache - Can I use paster on production site? -

i trying set mediacore (which pylons app) on production server. docs suggest either apache mod_fastcgi or mod_wsgi webserver try avoid apache @ cost because of being ram-monger. on other hand mediacore works fine when use paster, wondering pros/cons of ignoring apache , use paster production web server? as load grows, may hit cpu or db limit. typical answer using several parallel backends. nginx or lighttpd or whatever light http server come in handy , allow distribute load several paster servers , serve static files cheaply. up until you're safe run paster, if have excess cpu waste on serving static files.

.htaccess - htaccess rewrite subdirectory name to querystring param -

i have specific needs directory of website. need change /thisdirectory/subdirectory to come through as /thisdirectory?param=subdirectory i'm having issues creating htaccess file that. i've tried several different things, think closest: rewriteengine on rewriterule ^/directory/(.*)\??(.*)$ /directory/?page=$1&$2 i've been facing kinds of 500 server errors, infinite redirect loops, etc etc. appreciated, thanks! i’m surprised work @ in per-directory context have strip per-directory path prefix pattern: when using rewrite engine in .htaccess files per-directory prefix (which same specific directory) automatically removed rewriterule pattern matching , automatically added after relative (not starting slash or protocol name) substitution encounters end of rule set. in case of document root directory leading / , rule this: rewriterule ^directory/(.*)\??(.*)$ /directory/?page=$1&$2 but besides that, rewriterule can check uri path...

android - custom roms vs apps -

does making custom roms involve same skill set making apps? 1 in same? no. custom rom's require understanding of lower level programming making app. virtually can make app using cs, or zde or netbeans matter custom rom expectes pretty full understanding of linux core.

asp.net - Escaping backslashes in string.replace -

i have image control following string http://test.site.com\content\images\productimages\73\700-4aad-be94-e0b79982951f_0_chrysanthemum__product_search.jpg i want replace string cleartext=imagepath.replace("\","/"); backslash causes problem -- how can replace backslash? you can escape string characters individually "\" or can change string string literal prefixing @ . documentation available @ msdn: http://msdn.microsoft.com/en-us/library/aa691090(v=vs.71).aspx . another resource understanding how strings work in c# is: http://csharpindepth.com/articles/general/strings.aspx .

Command line tool in Java gets run many times in a row, JRE keeps opening/closing, slow -

i wrote command line tool in java , gets run many times in row bat script. right it's runnable jar (which in hindsight isn't right choice here...). jre seems loaded , unloaded every time program run, seems inefficient. overall, seems lot slower should be. do java gurus out there know more proper way handle situation? as there no easy fix, might consider more radical approaches: actually porting what's in bat in java (easy if it's loop on files kind of filter). compiling jar exe (e.g. gcj) if maximum portability not issue.

c++ - Parse failure using Boost datetime library with time zone string -

i'm trying parse date/time string in custom format using boost's date time library. format i'm trying use rather unusual because includes posix time zone description string. docs library clearly state there flag ( %zp ) usable both input , output handles posix time zone string. value i'm trying parse coming web browser, , rather write js perform transformation specified in zone string , send server in utc, i'd rather server-side (since boost should easily). wouldn't posting here if worked. code throws boost::bad_lexical_cast value of "source type value not interpreted target". using namespace boost::posix_time; using namespace boost::local_time; using namespace boost::gregorian; std::istringstream ss("1989-11-09t15:30:42.005;pst-8pdt,m3.2.0,m11.1.0"); ss.exceptions(std::ios_base::failbit); local_time_input_facet* facet = new local_time_input_facet("%y-%m-%dt%h:%m:%s%f;%zp"); ss.imbue(std::locale(ss.getloc(), facet)); ...

html5 - Read Local Registry with Browser Based Javascript - Google Desktop API -

can use javascript in google chrome packaged app (a.k.a. browser extension) read user's local registry key (i.e. stored query url, a.k.a. search_url key google desktop)? if so, example code access appreciated! background / detail i trying write browser plugin opens users google desktop homepage in chrome browser. url is: http://127.0.0.1:4664/&s={search_url key} according google desktop api docs, can accomplished using http/xml-based query api . i'm hoping there html5 specification (e.g. file api) provides standard procedure read local files, given users permission. in order this, need read access local search_url key . depending on user's os, api doc offers 2 possible local file locations contain search_url key : windows hkey_current_user\software\google\google desktop\api\search_url mac os x cfstringref val = cfpreferencescopyvalue( cfstr("search_url"), cfstr("com.google.desktop.webserver"), kcfpreferencescurren...

solr - How to transform SimpleOrderedMap into JSON string or JSON object? -

is there standard way so? in short: no, because json doesn't have primitive ordered map type. the first step determine requirements of client, far decoding json string goes. since json specification doesn't have ordered map type, you'll have decide on representation use. choice make depend on decoding requirements of client. if have full control on decoding of json string, can encode object map in order, using json library guaranteed serialize things in order of iterator pass in. if can't guarantee this, should come representation on own. 2 simple examples are: an alternating list: "[key1, value1, key2, value2]" a list of key/value entry objects: "[{key: key1, val:value1}, {key: key2, val:value2}]" once you've come representation, it's easy write simple function loops on simpleorderedmap. example : jsonarray jarray = new jsonarray(); for(map.entry e : simpleorderedmap) { jarray.put(e.key()); jarray.pu...

javascript - How to make dynamic widgets in PHP -

i want make dynamic widget show votes on particular topic. i want make copy/paste widget other site can show vote via copy/paste html/js/css code provided me. it's similar how use js/html code showing bookmark & share tool. can give ideas how ? thanks in advance. to nead use swf file. javascript deny security reasons. view link: zero clipboard

sql - ORA-12545: Connect failed because target host or object does not exist -

have encounter error before? tried refer link: http://www.ardentperf.com/2007/04/02/local_listener-and-ora-12545/ but doesn't resolve our issue. our scenario able connect database encounter error when try select data view. i have enabled client-side sqlnet trace unable interpret exact cause of issue. any ideas anyone? thanks for me problem host not being detected name in tnsnames.ora, using ip address instead resolved (i think due domain controller issue): xyzd = (description = (address = (protocol = tcp)(host = 123.45.67.89)(port = 1521)) (connect_data = (service_name = xyzd)) ) do command: “ping host” find servers ip address. ping host telnet host port tnsping tns_alias edit: just ran again, time firewall blocking tcp via port.

Rails serialization. Does it apply well here? -

i have 2 models attackreport , attackreportround. each report can have many rounds. describes how attack made. how have designed wanted @ first. however, if attack has, 30 rounds, attackreportround table can become way big. therefore, thinking of way store in single row if possible, or in efficient way. attack round keeps information attacker hit, damage, defender health , stuff that. i thinking of serializing data every round in single attackreport entry, maybe using comma separated values or sort of rails serialization. what in case ? database tables can hold lot of rows before performing badly, if using indices properly. have considered 'archiving' old attackreport , attackreportround entries in other tables? assuming attackreport year ago isn't queried -- depends on app doing. if go serialization, i'd use built-in rails 1 (it serializes yaml , requires little coding on part) before doing own csv solution.

iphone - Tracking variable or memory change in Xcode? -

is there way track variable changes or memory changes in xcode? i'm looking functionality visual studio's data breakpoint. i want know object's view frame being changed. want set breakpoint @ member variable , run it. determine it's changed. xcode uses gdb (or lldb , that's story) implement debugging functionality. gdb has ability set hardware watchpoints , hence xcode. this useful page generic debugging of memory errors. xcode's debugging console window gdb shell, can type in commands please. ever-helpful quinn taylor explains how in this related post. if you'd rather avoid interacting gdb directly, can right-click variable in xcode's debugging window , select "watch variable". xcode alert whenever variable's value has been changed.

python - How to sort a dict by values and return a list of formatted strings? -

i've got dict: text_to_count = { "text1": 1, "text2":0, "text3":2} i'd create list of formatted strings sorting dict's values (in descending order). i.e., following list: result = ["2 - text3", "1 - text1", "0 - text2"] any ideas? edit: while waiting responses, kept hacking @ , came with: result = map(lambda x: "{!s} - {!s}".format(x[1], x[0]), sorted(text_to_count.iteritems(), key = lambda(k, v): (v, k), reverse=true )) tho i'm still interested in seeing other solutions there are, possibly 1 better. how's this? result = ['{1} - {0}'.format(*pair) pair in sorted(text_to_count.iteritems(), key = lambda (_,v): v, reverse = true)]

c# - "Specified cast is not valid" error when saving LINQ-To-SQL entity -

app details: c#, asp.net mvc, sql server 2008 ( same version & sp level), linq-to-sql orm i'm trying diagnose exception i'm receiving: "specified cast not valid." @ system.data.linq.identitymanager.standardidentitymanager.singlekeymanage`2.trycreatekeyfromvalues(object[] values, v& v) @ system.data.linq.identitymanager.standardidentitymanager.identitycache`2.find(object[] keyvalues) @ system.data.linq.identitymanager.standardidentitymanager.find(metatype type, object[] keyvalues) @ system.data.linq.commondataservices.getcachedobject(metatype type, object[] keyvalues) @ system.data.linq.changeprocessor.getotheritem(metaassociation assoc, object instance) @ system.data.linq.changeprocessor.buildedgemaps() @ system.data.linq.changeprocessor.submitchanges(conflictmode failuremode) @ system.data.linq.datacontext.submitchanges(conflictmode failuremode) @ system.data.linq.datacontext.submitchanges() @ repository.save() @ etc....

windows - Why was sticky key introduced? -

when press shift many times pop comes if sticky key should activated.. whats use of it? disabled people cannot hold down 2 keys simultaneously. hit shift , hit key, boom! hitting shift +key, operated stick mouth. or 1 finger.

javascript - make data as per jquery ajax data method -

am doing doing, edit in place using jquery, if snippet complicated, refer easiest one, 'column2' => "rajangsfdgf" 'column3' => "srardhamgsdfgdf" 'column4' => "40043433" 'column7' => "23-01-2011 08:00:00" 'column5' => "400e" 'column6' => "1503" i want make somthing ( {column2 :"rajangsfdgf"},{column3 :"srardhamgsdfgdf"},{column4 :"40043433"},{column7 :"23-01-2011 08:00:00"},{column5 :"400e"},{column6 :"1503"}) some time values somthing also 'column2' => "rajangsfdgf" 'column4' => "40043433" 'column7' => "23-01-2011 08:00:00" 'column6' => "1503" then should form ( {column2 :"rajangsfdgf"},{column4 :"40043433"},{column7 :"23-01-2011 08:00:00"},{column6 :"1503"}) s...