Posts

Showing posts from May, 2010

java - How to convert POJO to JSON and vice versa? -

i want know if there java api available convert pojo object json object , vice versa. yes, there json.org. take @ http://www.json.org/java/index.html [edited] imagine have simple java class this: public class person { private string name; private integer age; public string getname() { return this.name; } public void setname( string name ) { this.name = name; } public integer getage() { return this.age; } public void setage( integer age ) { this.age = age; } } so, transform json object, it's simple. this: import org.json.jsonobject; public class jsontest { public static void main( string[] args ) { person person = new person(); person.setname( "person name" ); person.setage( 666 ); jsonobject jsonobj = new jsonobject( person ); system.out.println( jsonobj ); } } hope helps. [edited] here there other example, in case using jackson: https://brunozambiazi.wordpress.com/201

virtual machine - What are ODEX files in Android? -

after android apps installed, found change odex file (not apk ) in smartphone. how happens? can teach me, interested it. the blog article right, not complete. have full understanding of odex file does, have understand little how application files (apk) work. applications glorified zip archives. java code stored in file called classes.dex , file parsed dalvik jvm , cache of processed classes.dex file stored in phone's dalvik cache. an odex pre-processed version of application's classes.dex execution-ready dalvik. when application odexed, classes.dex removed apk archive , not write dalvik cache. application not odexed ends 2 copies of classes.dex file--the packaged 1 in apk, , processed 1 in dalvik cache. takes little longer launch first time since dalvik has extract , process classes.dex file. if building custom rom, it's idea odex both framework jar files , stock apps in order maximize internal storage space user-installed apps. if want theme, deodex

memcached - How to periodically set a global variable in django -

so want have feature like: "random post of hour" website, post object model. having db choose random post per request can expensive don't want pick row on every request. don't mind if different users have different "random post of day". i go , cache query, getting memcache involved feels hacky overkill. creating table , job 1 value. is there way have global variable periodically set in django? thank you! went eduardo's solution use memcached: https://docs.djangoproject.com/en/1.3/topics/cache/#the-low-level-cache-api

asp.net - Oracle query/ stored procedure to return multiple resultsets -

i using oracle database. when tried fetch data using single select query, returned single table in dataset. how write select query or procedure in oracle, can dataset 2-3(multiple) tables? as far understood question reduce round trips database. can done stored procedure in following way: http://msdn.microsoft.com/en-us/library/ms971506.aspx#msdnorsps_topic6 package header: create or replace package select_job_history type t_cursor ref cursor; procedure getjobhistorybyemployeeid ( p_employee_id in number, cur_jobhistory out t_cursor ); end select_job_history; package: create or replace package body select_job_history procedure getjobhistorybyemployeeid ( p_employee_id in number, cur_jobhistory out t_cursor ) begin open cur_jobhistory select * job_history employee_id = p_employee_id; end getjobhistorybyemployeeid; end select_job_history; client: // create connection oracleconnection conn = new oracleconnection("data source

io - How to use Pascal code in R-project? -

i using r-project deal statistics, due amount of resources needed, r struggling while pascal way faster. there way use pascal code in r-project? if can compile dll (windows) or .so (unix) file might able use same mechanism used c , fortran. load dll/.so dyn.load() function , call .c("functionname"). however, dependent on operating system, compiler, , code. r helps fortran , c programmers providing shlib command. 1 does: r cmd shlib foo.f and gets foo.so back. dyn.load("foo.so") , can call fortran code .c("subname",as.integer(1),as.double(pi)) , on. perhaps if can convert pascal c (is there 'p2c' converter?).

sql - Retrieve descendant (path) of tree base of multiple values -

i have self reference table store hierarchical values in order show them in treeview or on ,according james crowley article ( tree structures in asp.net , sql server ) our table this: id parentid name depth lineage 1 null root node 0 /1/ 2 1 child 1 /1/2/ 3 1 child b 1 /1/3/ 4 1 child c 1 /1/4/ 5 2 child d 2 /1/2/5/ to path of node (for example id=5) suggest following query against table select * dftree (select lineage dftree id = 5) lineage + '%' result : id parentid name depth lineage 1 null root node 0 /1/ 2 1 child 1 /1/2/ 5 2 child d 2 /1/2/5/ and acceptable but how have result set when there multiple ids want have path ? therefore example in above example instead of id=5 pass multiple values : select * dftree

jQuery function has to repeat to work -

i'm getting jquery , notice strange behavior in way of code executed. when execute function based on click action, function runs twice, first time "undefined" value click , second expected value. end result code "works" want understand i'm doing wrong causing unexpected behavior. here's jquery code: $(function() { //$('#venue').buttonset().click(function(event, ui) { //$( '#venue' ).buttonset().live('click', function (event, ui) { $('#venue').buttonset().unbind('click').bind('click', function(event, ui) { var venuename = $("input[name='venue']:checked").val(); if (venuename == "venue2") { alert("about deselect, venue: " + venuename); $("#meallist option[value='dinner']").removeattr("selected"); } else { alert("doing nothing, venue: " + venuename); } }); }); note 3 different w

Loading dialog BlackBerry Browserfield -

how can add loading dialog browserfield when page loading? thanks use gaugefield: net.rim.device.api.ui.component.gaugefield, following example at: http://docs.blackberry.com/en/developers/deliverables/18125/gauge_field_1303006_11.jsp

c++ - An error: expected constructor, destructor, or type conversion before '(' token -

i getting error in *insert_nodes function: error: expected constructor, destructor, or type conversion before '(' token i have problem in same function, sais have redeclare 'int nodes' parameter in function. think it's not necessary write this: *insert_nodes(start, int nodes) instead of being this: *insert_nodes(start,nodes) another error in getch(). while compiling in netbeans, shows error on place doesn't mention type of error. struct tree_traversal { int data; tree_traversal *left; //left subtree tree_traversal *right; //right subtree }; tree_traversal *insert_nodes(tree_traversal *start, int nodes); void preordertraversal(tree_traversal *start); void postordertraversal(tree_traversal *start); void inordertraversal(tree_traversal *start); int counter = 1; int main(int argc, char **argv) { int choice, nodes; { switch(choice) { case 1: cout<<"\n\t\a\a enter valu

java - Maven, GWT, Google Eclipse plugin, can not copy jar to WEB-INF/lib when dependency project is war -

i have maven project, project depends on project b, gwt web project, in project a's pom: <dependency> <groupid>com.mydomain</groupid> <artifactid>b</artifactid> <version>0.0.1-snapshot</version> </dependency> and b project's packaging jar. works fine till now. need add integrated test on project b, need turn project b's packaging war, can setup web environment can run integrated test cases. then when run/debug project using google eclipse plugin, project b's jar never copied project a's target/a-0.0.1-snapshot/web-inf/lib, , runtime class not foundexception thrown. questions how solve problem this, need integrated testcases in b , debug in project a. appreciated. hmm, not sure understand-- suggest packaging b jar used a , , independently package , deploy b war . this separation allow both a , b.war depend on b.jar opp

git - How can I remove a binary from history? -

this question has answer here: completely remove file git repository commit history 11 answers i found out wasn't such idea keep tracking binary. size of our repository growing @ faster rate like. possible purge file git? no 1 needs know existed. see these fine questions , answers, explain how use git filter-branch want do: drop old commit: `git rebase` causes merge conflicts , update development team rewritten git repo history, removing big files . for storing new big files in future, i'd recommend using git-annex

shell - How to control a cisco IP-Phone from the CLI? -

i've cisco ip-phone 7945 , want control cli. example want start command like call start 12345 #12345 number want call or call cancel anybody knows tool or similiar? i'm writing rails app , want start call within app after action. the 7945 has web interface permits execution of commands, including "dial" command, authenticated users. your rails app connect phone @ http://phone-ip-address/cgi/execute , post xml looks this: <ciscoipphoneexecute> <executeitem url="dial:12345" /> </ciscoipphoneexecute> the authentication done http basic auth , back-end authenticator determined phone system 7945 connected to. if cisco call manager, uses assigned call manager user information. look ip phone services guides on cisco.com details. quick links: http requests , header settings ciscoipphone xml objects internal uri features short answer: it's not cli straightforward program dialer interacting phone on http

sql - How can I insert a row for each day within a date range? -

i have table , every row have id , date , , value column. want every time person accesses page on web site, stored procedure run insert row each day within range if day doesn't exist. the date range 01/01/2012 until saturday before current day (the day page accessed). id auto-generate , value field remain null/blank. for example, if accessed page today, want record in table every day between 01/01/2012 until 03/03/2012. this gets days don't exist yet, , excludes rows after previous saturday. ;with d ( select top (366) d = dateadd(day, row_number() on (order object_id), '20111231') sys.all_objects ) insert dbo.[a table]([date]) select d d d not in (select [date] dbo.[a table]) , d <= dateadd(day, 0-datepart(weekday, getdate()), getdate()); note assumed "reset" once calendar year rolled over.

java - How to use String array in another activity -

i have 2 activities. each extends activity. tried ways found here, none of them working. need send string array 1 other activity, stay in first activity. try this: intent intent = new intent(activityfrom.this, activityto.class); intent.putextra("string-array", array); activityfrom.this.startactivity(intent); and recive: intent intent = getintent(); string[] array = intent.getextras().getstringarray("string-array"); any idea? bundle b=new bundle(); b.putstringarray("key", strarray); intent intent=new intent(this, nextactivity.class); intent.putextras(b); startactivity(intent);

MySQL and PHP multiple checklist db insert -

i trying insert value of multiple checklist db column. code not working. can spot problem? my database consists of table called "colors" , 1 column called "color". <?php // connect database require "mysql_connect.php"; ?> <?php // value form $color = $_post['color']; foreach($_post['color'] $colors){ $insert = mysql_query("insert colors (color) values ('$color')"); } ?> <form action="add_color.php" method="post" enctype="multipart/form-data" name="colorform" id="colorform"> <input type="checkbox" name="color[]" value="black" /> black <input type="checkbox" name="color[]" value="red" /> red <input type="checkbox" name="color[]" value="blue" /> blue <input type="checkbox" name="color[]" value="white" /&

mysql - Rails 3.1 Migrate to PostgreSQL locally -

i want use postgresql locally since have use on heroku. have app built , need convert have using mysql now. i have group :development, :test gem 'pg' end group :production gem 'pg' end and did brew install pg . ran rake db:setup , receive error couldn't create database {"adapter"=>"sqlite3", "database"=>"db/test.sqlite3", "pool"=>5, "timeout"=>5000} db/development.sqlite3 exists rake aborted! please install sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 not part of bundle. add gemfile.) what's wrong? have updated database.yml file use pg adapter? development: adapter: postgresql database: cookbook username: uid password: pwd host: localhost it looks database.yml still configured use sqlite.

Sending array from PHP to javascript through ajax -

i have php code return many arrays javascript through ajax. <?php ini_set('display_errors', 1); error_reporting(e_all); function get_events_data() { // load simplexml $nodes = new simplexmlelement('my_events.xml', null, true); $event_id = array(); $channel_id = array(); $channel_name = array(); $channel_onclick = array(); $event_site = array(); $event_url = array(); $start_date = array(); $start_time = array(); $end_date = array(); $end_time = array(); $event_notes = array(); $n = 0; foreach($nodes $node) { $event_id[$n] = $node['id']; $channel_id[$n] = $node->channel['id']; $channel_name[$n] = $node->channel->name; $channel_onclick[$n] = $node->channel->onclick; $event_site[$n] = $node->event_site->name; $event_url[$n] = $node->event_site->url; $start_date[$n] = $node->

ruby on rails - Multiple servers or everything in a single server? -

i have rails app uses mysql, mongodb, nodejs (and socketio). right now, app (everything) hosted inside 1 box. know should when number of users grow. factors should take account determine whether need host separate element in box (like mysql, node, mongo in each of separate box). should make 1 single box bigger? there best-practice method can go with? if guys can provide me reference, guides, research regarding topic. please do. super noob @ deployment , server configuration. the short answer move own box. longer answer is: depends on app's usage. i recommend use nagios or similar monitor app's resource utilization -- is, how cpu , ram each of services use. when 1 starts each resources (and page load speed negatively affected), move own box. then continue monitor box, beef when necessary or shard out. the high scalability blog reading on other people have done.

java - How can I map my Spring URL to a JSP file in /WEB-INF/views? -

i'm having trouble doing spring (using 3.0.5.release) mapping. want map url http://mydomain/context-path/user/registrationform.jsp jsp page at /web-inf/views/user/registrationform.jsp but i'm getting 404. have controller setup … @controller @requestmapping("registrationform.jsp") public class registrationcontroller { private static logger log = logger.getlogger(registrationcontroller.class); … public void setregistrationvalidation( registrationvalidation registrationvalidation) { this.registrationvalidation = registrationvalidation; } // display form on request @requestmapping(method = requestmethod.get) public string showregistration(map model) { final registration registration = new registration(); model.put("registration", registration); return "user/registrationform"; } here dispatcher-servlet.xml … <beans xmlns="http://www.springframework.org/s

alfresco - Publish Subscribe Content Notifications -

i came across site in alfresco discussing publish/subscribe notifications within alfresco , wondering if there progress on or had created add-on http://wiki.alfresco.com/wiki/publish_subscribe_content_notifications only type of notification i've read far wiki or forums email or using rss feeds. cmis specifications not encompass , alfresco web services not include such methods. we have several web applications need download content once document has been uploaded , transformed in alfresco. develop action push documents appropriate app, require me know every endpoint. @ point there 3 application there requirements add additional ones in future. having publisher/subscriber model make solution more scalable , easy maintenance in future what if wrote custom action adds message queue. have queue/topic name configurable when configures rule on folder, can specify queue put message on. apps can subscribe queue , act appropriately. you similar step in workflow. mayb

android - Why does ScaleModifier make sprite flicker? -

i'm playing around in andengine , learning non-documented while making splashscreen. i'm aware there's class splashscene, i'm learning i'm trying kind of ways. however, can't seem 1 right. screen 240x320 (w x h) , splash screen texture 480x640 i'm scaling down fit screen. texture loading etc working fine, when sprite shown first see large texture 0.1secs, gets scaled down. want scaled down prior shown. been trying everything, moved call attachchild() onloadcomplete(), using setvisible(false), etc see texture getting scaled down everytime. why? here's code: @override public scene onloadscene() { this.scene = new scene(); // texture sizes final int sx = msplashtextureregion.getwidth(); final int sy = msplashtextureregion.getheight(); // center on camera final int cx = (camera_width - sx) / 2; final int cy = (camera_height - sy) / 2; // scale factor according camera final float scalefactor = math.min((float) camera_width / s

c++ - app.exe has triggered a break point, followed by Access violation writing location -

Image
i have qt c++ application huge code base. i'm kinda familiar architecture don't know of code. every time application closed, shows message "app.exe has triggered break point" , if hit continue, "unhandled exception @ 0x6701c95d (qtcored4.dll) in app.exe: 0xc0000005: access violation writing location 0x0c3e9fd8." with stack trace looking this i have app verifier hooked , dumps in output window =========================================================== verifier stop 0000000000000013: pid 0x2654: first chance access violation current stack trace 000000000c3e9fd8 : invalid address being accessed 000000006701c95d : code performing invalid access 000000000008eb40 : exception record. use .exr display it. 000000000008e650 : context record. use .cxr display it. =========================================================== verifier stop continuable. after debugging use `go' continue. ===========================================

How to convert a string read from input to a list of lists in prolog -

i'm trying write program converts mayan arabic numerals , vice versa in prolog. although i'm still running trouble i've managed working. i'm wondering how if read example: ....| 0 .| ||| from user input, how can convert list this: l = [ ['.','.','.','.','|'], [0], ['.','|'], ['|','|','|'] ] i have algorithm written getting l arabic value, have no clue how convert string list. take @ this answer . code i've written there splits prolog string on spaces generate list of atoms. small modification, can alter code create strings instead of atoms. here relevant code previous post, necessary modification case: data([a|as]) --> spaces(_), chars([x|xs]), {string_to_list(a, [x|xs])}, %% using string_to_list/2 instead spaces(_), data(as). data([]) --> []. chars([x|xs]) --> char(x), !, chars(xs). chars([]) --> []. spaces([x|xs]) --> spa

how to avoid this duplicate code using templates in C++ -

i eliminate duplicity of code in problem: class populationmember { public: vector<int> x_; vector<int> y_; } class population { vector<populationmember*> members_; void docomputationforx_1(); // uses attribute x_ of members_ void docomputationforx_2(); void docomputationforx_3(); void docomputationfory_1(); // same docomputationforx_1, void docomputationfory_2(); // uses attribute y_ of members_ void docomputationfory_3(); edit: // there functions use members_ simultaniously double standarddeviationinx(); // computes standard deviation of x_'s double standarddeviationiny(); // computes standard deviation of y_'s } the duplicity causing me have 6 methods instead of 3. pairwise similarity striking, can implementation of docomputationfory_1 out of docomputationforx_1 replacing "x_" "y_". i thought remaking problem in way: class populationmember { public: vector<vector

Speech recognition in android? -

possible duplicate: is there speech text api google? i wish develop application can english speech recognition android mobile phone.is there open source tool that?is possible use julius or sphinx in android? you can run cmusphinx on android. see tutorial http://cmusphinx.sourceforge.net/wiki/tutorialandroid

r - Changing standard error color for geom_smooth -

i'm plotting data using geom_smooth , looking way change color of standard error shading each line match line (ie., red line have it's standard error shaded red). i've looked through official ggplot2 documentation list of opts() @ https://github.com/hadley/ggplot2/wiki/%2bopts%28%29-list . advice (or confirmation of whether or not it's possible) appreciated. your (understandable) mistake think should changing color rather fill . standard error shadings made geom_ribbon essentially, , 2d area, "color" "filled" determined fill , not colour . try: geom_smooth(aes(...,fill = variable)) where variable same 1 map colour elsewhere.

javascript - MSIE is making my slidejs code look horrible -

i building web page uses slidejs image slider show series of images. when run page firefox , safari page looks way should. however, when run same code within msie 9, looks horrible. ie putting borders around slidejs images , buttons. went through css , turned off every border find, still msie makes terrible. page: http://107.22.173.10/print.html user: test2 login: abc111 any ideas why happening , how can fix it? remove border in css b/c ie typically adds borders image href's... below should work: a img {border: none; } most people use reset stylesheet correct issues , others before using own css.

Trying to understand this lua snippet -

i trying understand function does. can explain me? function newinstance (class) local o = {} setmetatable (o, class) class.__index = class return o end it called this: self = newinstance (self) this function apparently serves provide variant of oop in lua (a bit sloppy in opinion). this factory class. it may rewritten follows, clarity: c = { } c.foo = function(self) -- method, class not empty print("foo method called", tostring(self)) end c.__index = c -- (a) function newinstance(class) return setmetatable({ }, class) -- (b) end now if create 2 new instances of c, see both have method foo(), different self: o1 = newinstance(c) o1:foo() --> foo method called table: 0x7fb3ea408ce0 o2 = newinstance(c) o2:foo() --> foo method called table: 0x7fb3ea4072f0 the foo methods same: print(o1.foo, o2.foo, o1.foo == o2.foo , "equal" or "different") --> function: 0x7fb3ea410760 function: 0x7fb3ea4107

java - "ClassCastException: $Proxy0 cannot be cast" error while creating simple RMI application -

i creating first, simple rmi client-server application. here code: interface "icommunication" package itu.exercies.rmi.server; import java.rmi.remote; import java.rmi.remoteexception; public interface icommunication extends remote { public string docommunicate(string name) throws remoteexception; } interface implementation "communicationimpl": package itu.exercies.rmi.server; import java.rmi.remoteexception; import java.rmi.server.unicastremoteobject; public class communicationimpl extends unicastremoteobject implements icommunication { /** * */ private static final long serialversionuid = 1l; public communicationimpl() throws remoteexception { super(); } @override public string docommunicate(string name) throws remoteexception { return "hello server , whats " +name+ " ?!\n"; } } here main class of server "communicationserver": package itu

apache - Moving CodeIgniter install to a subdomain causes a 500 Internal Server Error -

on new subdomain homepage works fine, else throws 500 internal server error. i'm sure .htaccess issue. have codeigniter-based web app @ giftflow.org , working fine. web root /var/www/vhosts/giftflow.org/httpdocs from hosting control panel, created subdomain favorece.giftflow.org , cloned it. web root /var/www/vhosts/favorece.giftflow.org/httpdocs when call favorece.giftflow.org browser, index page comes fine, css included, when try navigate other page 500 internal server error. apache error log says: request exceeded limit of 10 internal redirects due probable configuration error. use 'limitinternalrecursion' increase limit if necessary. use 'loglevel debug' backtrace. here base_url in codeigniter's application/config/config.php $config['base_url'] = 'http' . ((isset($_server['https']) && $_server['https'] == 'on') ? 's' : '').'://'.$_server['http_host'].str_r

classpath - Java cannot find .class file, or class -

i have directory structure thus: project/ src/ videoserver/ *.java storeclient/ *.java bin/ videoserver/ *.class storeclient/ *.class my current working directory project/src/ , i'm using command java -cp "../bin/" videoserver.main this seems right me, java telling me cannot find class ivideoserver . can see ivideoserver.class in correct folder, , seems able find main class fine. what causing java unable find ivideoserver ? the method appears causing problem one public static void main(string[] args) { try { videoserver server = new videoserver(); videoserver.ivideoserver stub = (ivideoserver)unicastremoteobject.exportobject(server, 0); // bind remote object's stub in registry registry registry = locateregistry.getregistry("server-url", 9090); registry.

php - Memcached::getStats not working with Couchbase -

i set server i'm running apache, php, , couchbase on. however, i've been having problems testing couchbase installation. in past, way test working simple script run getstats on couchbase: <?php $memcache = new memcached(); $memcache->addserver('127.0.0.1', 11211); $result = $memcache->getstats(); print_r($result); ?> this used return normal array of statistics. lately, though, doesn't return , there aren't errors being produced in of logs. @ same time, can still get/set key->values , use couchbase hearts content. did change in php, memcached module, or somewhere else or missing in order have getstats work again? i'm running: - pecl memcached 2.0.1 - php 5.3.10 - couchbase 1.8.0 thanks! sounds issue moxi. may want kill moxi process, automatically respawn. if starts working it's moxi issue. it'd have bug report . note can go around moxi official couchbase php client . designed pretty close api wise

git - If I fork someone else's private Github repo into my account, is it going to appear in my account as a public repo? -

someone gave me access 1 of private repo on github. want fork project own account, make use of github's pull request feature. i have basic account on github, cannot make private repos on own, if fork else's private repo account, going appear in account public? no. can fork , still remains private. private collaborators may fork private repository you’ve added them without own paid plan. forks not count against private repository quota. https://github.com/plans

javascript - How to hide div on mouse over of another div? -

i have html this: <table> <tr> <td><div class='record'>record link</div></td> <td><div class='delete' style='display:none;'>delete link</div></td> </tr> <tr> <td><div class='record'>record link</div></td> <td><div class='delete' style='display:none;'>delete link</div></td> </tr> </table> delete link hidden in above html. want show delete link when mouseover on related record div after trying basic tutorials of prototypejs , able write following code working me not completed. document.on('mouseover', 'div.record', function(event, element) { event.target.hide(); // testing: hides record }); following codes not working me: $('delete').setstyle({ display: 'block' }); $$('div.delete').setstyle({ display: 'block' }

c# - Passing arguments, does unboxing occur -

what have read, passing arguments default valuetypes. in example first function test1 takes reference type , unbox, decrease performance if got right. have never read test2 increase performance. so whats best practice? public main(){ string test = "hello"; test1(test); // line perform boxing? it's not performance? test2(ref test); // passing reference reference } public string test1(string arg1) { return arg1; } public string test2(ref string arg1) { return arg1; } there's no boxing or unboxing involved @ here. string reference type - why boxed? mean? even if used int instead, there'd no need boxing, because there's no conversion of value actual object. i suspect understanding of both boxing , parameter passing flawed. boxing occurs when value type value needs converted object, in order used variable (somewhere) of interface or object type. this boxes: int value = 10; foo(value); ... public void foo(object

java - What happened to springmodules package in spring 3 -

recently while updating project spring 2.5.6 3, couldn't find relavent org.springmodules package... because of using spring 2.5 dependency cannot use org.springmodules 0.8 version... can please tell me happened classes in org.springmodules module , place find more changes.. ? thanx.. if don't find substitution exclude spring 2.5 dependency of springmodules shown here .

php - Creating ZIP archive on fly from PHPExcel Objects -

i'm developing small api in php , need create zip archive on fly contents (files) created on fly phpexcel library, know how it? it seems can this: <?php $zip = new ziparchive; $res = $zip->open('test.zip', ziparchive::create); if ($res === true) { $zip->addfromstring('test.txt', 'file content goes here'); $zip->close(); echo 'ok'; } else { echo 'failed'; } ?> so have content phpexcel in string use addfromstring method. for more information have here: http://php.net/manual/en/ziparchive.addfromstring.php

xamarin.ios - Why does UITabBarController sometimes call ViewDidLoad during its construction? -

i'm working class derived uitabbarcontroller @ present. when load tab bar topmost view during appdelegate setup constructor called first, , then, after construction complete, viewdidload invoked. however, if create tab view controller later in app (e.g. second or third "page"), virtual viewdidload call made during construction of uitabbarcontroller. isn't causing virtual function table problems (the child class being invoked) causing particular problems me because can't access construction parameters in viewdidload. as workaround, i'm detecting firing of viewdidload() , adding later call during own constructor. i'd quite understand going on: why uitabbarcontroller call viewdidload during construction?

ant - How to run tomcat with -D system property for doc -

in tomcat config have docbase this: <context path="/" docbase="webapps/rootexample"/> is possible provide docbase property @ runtime @ tomcat startup external properties file or -d system property? system properties global entire jvm, answer no. what provide <context-param> in web.xml similar thing. another alternative use jndi each webapp has sort of mechanism of checking configuration setting in there.

reverse geocoding - does windows phone API have geocoder? -

how transform geo coordinate address in windows phone? in android possible via android.location.geocoder. this should definetly going :) made extract blog @ botton of message know if for. http://www.dizzey.com/development/net/getting-started-windows-phone-7-getting-location-reverse-geocoding-weather/ get system.device.dll holds geocode api. //instantiate geocoordinatewatcher watcher = null; watcher = new geocoordinatewatcher(geopositionaccuracy.default); watcher.positionchanged += new eventhandler<geopositionchangedeventargs<geocoordinate>>(onpositionchanged); watcher.start(); //use void onpositionchanged(object sender, geopositionchangedeventargs<geocoordinate> e) { //stop & clean up, don’t need anymore watcher.stop(); watcher.dispose(); watcher = null; location = e.position.location; } and geocoding: var reversegeocoderequest = new reversegeocoderequest(); // set credentials using valid bing maps key

Does PostgreSQL allow running stored procedures in parallel? -

i'm working etl tool, business objects data services, has capability of specifying parallel execution of functions. documentation says before can this, have make sure database, in our case postgres, allows "a stored procedure run in parallel". can tell me if postgres that? sure. run queries in different connections, , run in parallel transactions. beware of locking though.

what's the most efficient emacs workflow for compilation and interactive execution cycles (C++/makefile) -

what's preferred practice compile-run cycle in emacs? previously, used m-x compile (mapped f12 ) make compile command. within makefile had entry run program compiled. worked fine when programs non-interactive, compilation buffer non-interactive. of course open shell , run executable, i'd automate compile-run cycle as possible , assume there must standard practice , i'm guessing executing-from-the-makefile method kluge... c-u f12 works, i'm wondering if that's best approach doing (and if so, how can bind f12 equivalent c-u m-x compile instead of m-x compile ?). it can't simpler c-u m-x compile . have makefile task defined. you're asking how map f12? try this: (defun compile-interactive () (interactive) (setq current-prefix-arg '(4)) (call-interactively 'compile)) (global-set-key (kbd "<f12>") 'compile-interactive) you should read interactive options , optional arguments sections of manual.

ios5 - ios 5 UIWebView show rows from UITableView -

Image
this week started learning ios coding i'm getting strange error have made little script witch have on main page list of names made uitableview , when select row it's open relative url, when load webpage goes wrong webpage have rows 'uitableview'. did u know why it's generate kind of error? that it's generate; update have re-writed app proble still present, don't understand why show rows on webpage in rootviewcontroller.m call webpage class - (void) tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{ nsdictionary *game = [[self.sections valueforkey:[[[self.sections allkeys] sortedarrayusingselector:@selector(localizedcaseinsensitivecompare:)] objectatindex:indexpath.section]] objectatindex:indexpath.row]; [tableview deselectrowatindexpath:indexpath animated:yes]; //svanisce il blu nslog(@"%@", [[self.games objectatindex:indexpath.row ] objectforkey:@"url"]); // funge webpage *newweb

mysql - Quickly getting rid of � -

i'm copying html old website new one. i'm getting bunch of issues this: city�s the apostrophe wrong. i know when, copying text microsoft word, need strip garbage pasting notepad copying stripped version site. there way can reformat pages need moved? thanks! did change encoding of website? maybe had <meta http-equiv="content-type" content="text/html;charset=utf-8"> , didn't include <meta> tag new site. there many encoding possibilities (iso-8859-1, utf-8, windows-1250 , several others...) have choose correct 1 site. general it's decision use utf-8 without bom, since every browser understands utf-8 , many text editors (e.g. notepad++, vim) provide command convert ansi or iso-8859-1 documents utf-8.

Gibberish coming from ASIO SSL Server code after the first message -

i'm trying write ssl-based async server using boost asio example code here . i first message , response correctly @ client side. then, send second message received fine @ server, when response sent client. comes gibberish. i have uploaded server code pastebin . also, find below: // file - server.h class server { public: explicit server(const std::string &address, int port, std::size_t threadpoolsize); // run io_service loop void run(); // stop server void stop(); private: //handle async accept operation void handleaccept(const boost::system::error_code &e); // number of threads in thread pool std::size_t _threadpoolsize; // io_service boost::asio::io_service _ioservice; // acceptor listen incoming connections boost::asio::ip::tcp::acceptor _acceptor; std::string get_password() { return "password"; } // ssl context boost::asio::ssl

java - Handling tasks with different priorities in a thread pool -

i have many incoming tasks of priority a , b , c , want handle tasks thread pool on multicore cpu. 70% of cpu should used process 'type a ' tasks, 20% of cpu 'type b ' tasks , 10% of cpu 'type c ' tasks. if however, tasks of 'type c ' arrive, 100% of cpu should devoted them. if task b , c arirve 66% proccess task b , 33% task c , etc... how implement in java? p.s: priority queue won't work because type tasks processed. also, assigning priorities threads wont work because not accurate. maybe should use 3 pools of threads then. 1 pool of 7 threads tasks, 1 pool of 2 threads b tasks, , 1 pool of 1 thread c tasks. edit: have parallelism if there c tasks (or, if have many processors, if have b , c tasks), multiply number of threads in each pool number of processors, or number of processors + 1, or other bigger factor like.

c++ - Using struct as KEY and VALUE for map. find() operation giving error -

code in c++: #include <iostream> #include <map> #include <string> using namespace std; struct keyinfo { string key1; string key2; bool keyinfo::operator <(keyinfo &a) const { return ((this->key1<a.key1)&&(this->key2<a.key2)); } }; struct valueinfo { int value1; int value2; int value3; valueinfo(const int a,const int b,const int c) : value1(a),value2(b),value3(c) {} }; typedef std::map<keyinfo, valueinfo> maptype; int main() { maptype tmap; keyinfo k; k.key1="main"; k.key2="i"; valueinfo v(-2,-3322,9000); tmap.insert(maptype::value_type(k,v)); maptype::iterator it1=tmap.find(k); it1=tmap.find(k); if(it1!=tmap.end()) std::cout<<"success(k): "<<it1->second.value2<<std::endl; keyinfo e; e.key1="main"; e.key2="j"; //tmap.insert(std::pair<keyinfo,valueinfo>(e,v)); maptype::iterator it2=tmap.f

Why can't I save this SalesForce Batchable class? -

i using apex workbook refresh knowledge of salesforce. tutorial #15, lesson 1: offers following code: global class cleanuprecords implements database.batchable<object> { global final string query; global cleanuprecords (string q) {query = q;} global database.querylocator start (database.batchablecontext bc) { return database.getquerylocator(query); } global void execute (database.batchablecontext bc, list<sobject> scope) { delete scope; database.emptyrecyclebin(scope); } global void finish(database.batchablecontext bc) { asyncapexjob = [ select id, status, numberoferrors, jobitemsprocessed, totaljobitems, createdby.email asyncapexjob id = :bc.getjobid() ]; // send email apex job's submitter // notifying of job completion. messaging.singleemailmessage mail = new messaging.singleemailmessage(

Xcode upload a plist file on a server (iPhone) -

i have simple (i think) question : i got iphone. create plist file , save it. want upload file on server. then, 3 others iphone, download plist file , decrypt informations. my question : how can upload plist file server !! don't have ftp server or others ... can use instead dropbox exemple ? or other way communicate between iphone (private - not appstore) ? thanks answers ! yes, can use dropbox api upload plist on dropbox user's folder. check first this link setup project you can use these snippets ( from page ): nsstring *localpath = [[nsbundle mainbundle] pathforresource:@"info" oftype:@"plist"]; nsstring *filename = @"info.plist"; nsstring *destdir = @"/"; [[self restclient] uploadfile:filename topath:destdir withparentrev:nil frompath:localpath]; then implement callbacks - (void)restclient:(dbrestclient*)client uploadedfile:(nsstring*)destpath from:(nsstring*)srcpath metadata:

java - How can I get array of elements, including missing elements, using XPath in XSLT? -

given following xml-compliant html: <div> <a>a1</a> <b>b1</b> </div> <div> <b>b2</b> </div> <div> <a>a3</a> <b>b3</b> <c>c3</c> </div> doing //a return: [a1,a3] the problem above third column data in second place, when not found skipped. how can express xpath elements return: [a1, null, a3] same case //c , wonder if it's possible get [null, null, c3] update: consider scenario no common parents <div> . <h1>heading1</h1> <a>a1</a> <b>b1</b> <h1>heading2</h1> <b>b2</b> <h1>heading3</h1> <a>a3</a> <b>b3</b> <c>c3</c> update: able use xslt well. there no null value in xpath. there's semi-related question here explains this: http://www.velocityreviews.com/forums/t686805-xpath-query-to-return-null-values.html r