Posts

Showing posts from April, 2010

php - Which MySQL datatype to use for an IP address? -

possible duplicate: how store ip in mysql i want ip address $_server['remote_addr'] , other $_server variables, datatype right 1 this? is varchar(n) ? since ipv4 addresses 4 byte long, use int ( unsigned ) has 4 bytes: `ipv4` int unsigned and inet_aton , inet_ntoa convert them: insert `table` (`ipv4`) values (inet_aton("127.0.0.1")); select inet_ntoa(`ipv4`) `table`; for ipv6 addresses use binary instead: `ipv6` binary(16) and use php’s inet_pton , inet_ntop conversion: 'insert `table` (`ipv6`) values ("'.mysqli_real_escape_string(inet_pton('2001:4860:a005::68')).'")' 'select `ipv6` `table`' $ipv6 = inet_pton($row['ipv6']);

code first - EF 4 CTP 5: Trouble trying to remove an entity -

i have created model poco class called recipe ; corresponding reciperepository persists these objects. using code first on top of existing database. every recipe contains icollection<recipecategory> of categories link recipes , categories table in many-to-many relationship. recipecategory contains corresponding 2 foreign keys. a simplified version of controller , repository logic looks (i have commented out checks authorization, null objects etc. simplicity): public actionresult delete(int id) { _reciperepository.remove(id); return view("deleted"); } the repository's remove method nothing following: public void remove(int id) { recipe recipe = _context.recipes.find(id); _context.recipes.remove(recipe); _context.savechanges(); } howevery, code above not work since receive system.invalidoperationexception every time run it: adding relationship entity in deleted state not allowed. what error message stand , how can solve ...

c++ - OpenCV and Eclipse CDT -

i have installed latest versions of opencv , eclipse cdt , not able make opencv used within eclipse cdt. any ideas on how can that? thanks lot. what platform? see http://opencv.willowgarage.com/wiki/eclipseopencvlinux ? otherwise run cmake in top of opencv source dir , select compiler want, eclipse that's possibly mingw (unless there eclipse specific version)

Get tree path in MySQL table -

perhaps easiest approach manage hierarchical data in mysql databases adjacency list model . is, give every node parent: create table category( category_id int auto_increment primary key, name varchar(20) not null, parent int default null); it easy parent node, or if there maximum tree depth, can whole tree using this: select concat_ws('/', `t3`.`name`, `t2`.`name`, `t1`.`name`) `path` category t1 left join category t2 on t2.parent = t1.category_id left join category t3 on t3.parent = t2.category_id left join category t4 on t4.parent = t3.category_id t1.name = 'xxxxx'; that's enough in many cases, how can generalize solution trees deeper 3 nodes? i.e. may have path "electronics/audio/transmiter/fm/motorola". is possible 1 query? here's simple non recursive stored procedure job: drop table if exists employees; create table employees ( emp_id smallint unsigned not null auto_increment primary key, name varchar(255) not null, boss_i...

android - Why doesn't the tabwidget remain modified? -

in android have tabactivity (a) in create single tab called loading activity b. from activity b modify tabwidget tabactivity add more tabs via static reference tabhost in tabactivity a. after start new activity c , press tabwidget has 1 single tab called loading. i've tried in onresume method of activity b recreate tabs doesn't work anymore. does know why , how can fix it? relying on static variables pointing ui components (like tabhost ) can lead produce memory leaks. don't it. instead register broadcastreceiver in tabactivity add new tabs. way, instead of modifying static variable, send broadcast ( context#sendbroadcast(intent) ) tell tab activity want new tab. also, make sure save state of tabactivity , can restore if android os destroys activity reason. recommend using onretainnonconfigurationinstance ... this: private state mstate; public void oncreate(bundle b){ // somewhere in oncreate mstate = (state) getlastnonconfigurationinstanc...

checkbox - Can I use radio buttons/checkboxes in place of textboxes in a Javascript calculator? -

i have javascript calculator in users can enter quantities of products/features, , multiply quantity set price. then, result shows in textbox below. 2 questions are: i can use <select> options , specify value each 1 this: <select name="site_em_4.99" onchange="calculatetotal(this.form)"> <option value=""> - select - </option> <option value="1">yes</option> <option value="0">no</option> </select> however, won't let me same checkboxes/radio buttons. how can that? two : can change script total shows actual text, vs in text field? thanks! p.s. script can found here . instead of having input total switch span (or else) id (let's "total"), , replace innerhtml <script> function calculatetotal(frm) { ... document.getelementbyid('total').innerhtml = round_decimals(order_total, 2); ...

radix sort in c on floating points numbers -

okay have create radix sort both unsigned ints , floating point numbers. unsigned ints version works should, having little trouble getting work floating points values though. sorts values of array whole number value of floating point number doesn't sort based on decimal value. (ex. 36.65234 appear before 36.02311 if comes first in unsorted array) code segment bit manipulations , masking, pretty sure problem is. /* loop create bin */ for(int i=0; i<n; i++){ temp_int = (((unsigned int)(list[i]))>>bitwise)&0xff; bin[temp_int] = bin[temp_int]+1; } /*for loop map */ (int i=0; i<256; i++) { map[i+1] = bin[i]+count; count = map[i+1]; } /* loop copy "sorted" values other array */ (int i=0; i<n; i++) { temp_int = (((unsigned int)(list[i]))>>bitwise)&0xff; int buf_loc = map[temp_int]; temp_arr[buf_loc] = list[i]; map[temp_int] = map[temp_int]+1; } thanks in advance! radix sort linear sort...

iphone - Framework used for Scandit -

i want know framework being used app scandit .secondly, best option go it,if want use bar code scanning functionality in app. thanks ! you can use scannerkit iphone/android barcode scanner sdk iphone , android supporting both 1d (upc , ean) , 2d (qr , datamatrix) barcodes. designed work on both fixed , variable focal length cameras, our barcode scanning library 1 of best in business , best of free!

java - Choose sorting order of methods in Eclipse's auto-completion proposals? -

when type . after writing object instance's name, eclipse shows list of methods available instance, including methods of superclasses object extends. if working object implementing interface, have search "interesting" methods among "boring" object-level methods such notify() or getclass() . can have eclipse sort methods ones declared in subclasses come first? to change sorting: go preferences > java > editor > content assist > sorting , filtering . to filter entries: go preferences > java > appearance > type filters .

Red5 and RTMPS self-signed certificate -

i trying configure rtmps using self-signed certificate, when try connect via red5pfone error: *** serverhellodone nioprocessor-2, write: tlsv1 handshake, length = 890 nioprocessor-2, read: tlsv1 alert, length = 2 nioprocessor-2, recv tlsv1 alert: fatal, unknown_ca nioprocessor-2, fatal: engine closed. rethrowing javax.net.ssl.sslexception: received fatal alert: unknown_ca nioprocessor-2, fatal: engine closed. rethrowing javax.net.ssl.sslexception: received fatal alert: unknown_ca [warn] [nioprocessor-2] org.red5.server.net.rtmps.rtmpsminaiohandler - exception caught ssl handshake failed. red5-0.9.1 red5phone-r47 i tried follow directions here: http://gregoire.org/2008/05/26/rtmps-in-red5/ , http://www.cb1inc.com/2007/05/12/creating-self-signed-certs-on-apache-tomcat-5-5/ did not give results. please help. self-signed certs difficult use flash , should avoided. assume using "localhost", if trying access external location suggest getting real ca...

Significance / Usefulness / purpose of new jQuery.ajax way which returns the jqXHR object -

as of 1.5/1.51 version of jquery can make ajax request this var jqxhr = $.ajax({ url: "example.php" }) .success(function() { alert("success"); }) .error(function() { alert("error"); }) .complete(function() { alert("complete"); }); // set completion function request above jqxhr.complete(function(){ alert("second complete"); }); 1> still looking example/ demos / info know significant purpose way of doing jquery.ajax serves previous way not serving 2> how useful jqxhr object. 3> iam looking practical usefulness well, jquery say : the $.ajax() function returns xmlhttprequest object creates. jquery handles creation of object internally, custom function manufacturing 1 can specified using xhr option. returned object can discarded, provide lower-level interface observing , manipulating request. in particular, calling .abort() on object halt request before completes. so if reason need create ...

java - ASTParser and dependency between methods -

i'm using astparser parse java source code in project. managed name , return type of methods in different classes of java project. i'm wondering if it's possible have dependencies between methods in main . in fact haven't read documentation class bit complicated. know if it's possible have idea interconnectedness of methods in main program? if it's not possible there api can use? thanks. this problem known difficult because of difficulty of determining specific methods called, since java allows overriding of methods. in worst case, undecidable, , best you're going able conservative approximation. accordingly, there no 1 algorithm solving problem, though many research papers have tried answer question degree. the bddbddb framework can used perform sort of analysis, , able accurate call graph program. however, require learn use new framework instead of astparser you're using now. this paper claims have developed type analysis j...

php - Calling Magento API from .Net and getting a "The HTTP service located at XYZ is too busy" error -

i working on integration between .net app , magento v 1.3.2.4. .net app has service reference magento api , seems working fine in cases. if try pull list of orders, following exception. "the http service located @ magento api busy." if set pagesize filter , limit request 500 records, works fine. request/response large , either server/client configuration needs updated? service reference config pasted below. i'm not sure on php/magento side check configuration of web services , haven't found in magento admin screens seems help. does have advice on start troubleshooting this? <basichttpbinding> <binding name="mage_api_model_server_v2_handlerbinding" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" allowcookies="false" bypassproxyonlocal="false" hostnamecomparisonmode="strongwildcard" maxbuffersize="524288...

ruby on rails - Is the use of hidden fields in forms insecure? -

for example imagine have following form <%= form_for(@comment) |f| %> <%= f.hidden_field :user_id%> <%= f.hidden_field :article_id%> <%= f.label :content %><br /> <%= f.text_area :content %> <%= f.submit %> <% end %> i got :user_id , :article_id values with: comment.new(:user_id => current_user.id, :article_id => @article.id) when display form in browser this: <form action="/comments" method="post"> <input some_rails_tokens_here /> <!-- area here--> <input id="comment_user_id" name="comment[user_id]" type="hidden" value="1" /> <input id="comment_article_id" name="comment[article_id]" type="hidden" value="1" /> <!-- area here--> <label for="comment_content">content</label><br /> <textarea id="comment_conten...

Superfish dropdown goes behind when published to server on IE -

its fine when run on visual studio goes behind if deployed web server on ie. works mozilla. i found technique ie supersede via z-index , making div @ position:relative. see code example below. given html. <div id="header"> <ul class="sf-menu"></ul> <div id="content"></div> </div> and, css.. #header{z-index:2;position:relative; } #content{z-index:1;position:relative; } then superfish dropdown in ie should on top of content.

How to add comments outside of a commit in Mercurial? -

if commit in mercurial , realise haven't added enough information commit message, there way add message or note without commiting else? best way info in there? i realise can rollback , commit again not possible. don't want rewrite history either, want add information. unless you're willing editing history using mq or histedit (and in mercurial that's not usual practice) or latest commit (rollback) need commit else able add changeset different commit message. mercurial built around concept of "immutable history" , intentionally restricts tools let alter past.

iis - Uploaded access database - running SSIS and virus vulnerability -

i have created process (registered) user can upload (after client-side , server-side validation) (zipped uncommon extension) access database server through asp.net webform, sit in nice secure location until scheduled ssis package comes along @ night, flow relevant data access db sql server. after that, access db deleted. there no other execution of db. access not installed on server. i've done research, of course, introducing vulnerability (script inside access db instance?) ssis might trigger? thank in advance. ssis uses odbc or oledb data in access/jet/ace database, there nothing there execute code -- odbc , oledb know nothing data , dangerous functions executed in sql statements blocked. so, without access installed, no, there's no real danger here. if you're concerned there is, process file dao before open , delete in querydefs collection , in modules document collection. or, use buffer database import nothing data tables, , pass ssis. but don...

c# - How to create custom login page in windows xp -

i create custom login page in windows server machine using c#.when login server remotely should have take user name , password current login.. first of know procedure change login page windows. not sure want achieve... seems starting point http://msdn.microsoft.com/en-us/library/aa380543%28v=vs.85%29.aspx

.net - Import excel file to sql using bulkcopy -

i have been able import excel file sql bulkcopy locally. when publish code server following error messages: exception message: 'c:\mytest.xls' not valid path. make sure path name spelled correctly , connected server on file resides. exception source: microsoft jet database engine here code: <%@ page language="vb" autoeventwireup="false" codefile="test.aspx.vb" inherits="test" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="head1" runat="server"> </head> <body> <form id="form1" runat="server"> <asp:fileupload id="txtfile" runat="server" /> <br /><br /> <asp:button id="button1" runat="server" text="button" /> </form> </body> </html> protected sub button1_click(byval sender object, byval e system.eventargs...

c# - how can i check if the process got output? -

is there way indicate if process standard calculator got output or not, need because have line : sr = p1.standardoutput; and need : s = sr.readline(); only if there's output p1 in calculator example there's no output program stuck after readline . all. the code : while (i < asprocesses.length - 1) { if ((i + 1) == asprocesses.length - 1 && soutredirect != "") break; p1.startinfo.redirectstandardoutput = true; p1.startinfo.filename = asprocesses[i]; p1.startinfo.useshellexecute = false; if(i==0) p1.start(); sr = p1.standardoutput; process p2 = new process(); p2.startinfo.redirectstandardinput = true; p2.startinfo.filename = asprocesses[i + 1]; p2.startinfo.useshellexecute = false; p2.start(); s...

Notification in Android -

i trying create android application allows users receive updates particular server/website. for example, whenever have piece of information want share, update or notice, post on website. whenever, there updates posted me, want phone receive notification , add information app. just gmail app on android. update when there mail , not have timer check @ every interval. does know how can go it? new programming, if answers in steps me follow. in advance. edit: the android application have login page define type of user. updates , information regarding type of user pushed. however users of application, may not login google account. you use c2dm - cloud 2 device messaging. it's relatively new tech though not lot of resources it. here's tutorial on it: http://www.vogella.de/articles/androidcloudtodevicemessaging/article.html edit: ps: , it's in beta might work best proof of concept more actual product.

android - Bluetooth Audio gateway problem; system slow to crawl after using serial over Bluetooth -

i'm developing application uses bluetooth connection proprietary device. seems work fine, except after while samsung tablet slows absolute crawl , unusable until next forced reboot. i'm seeing message in alogcat: e/bluetoothaudiogateway.cpp 2582 pollup detected audio gateway connect notification wrp_find_wsock: no entry found blz_wrapper (2582) btl_if_poll: wsock down, return pollhup pol fd 48, ev 1b any ideas on going on? seems "bluetooth audio gateway" has bug, can it? i'm not using bluetooth media, how can rid of this, etc.? thanks! does speed if disable bluetooth , re-enable it? how long "a while"? have verified don't messages if app not running? have tried app on different device? does settings...manage applications or battery use screens out indicating if particular process consuming lot of memory and/or cpu?

soap - Spring WS unavailable upon requesting connection -

i've got spring ws i'm able call 2 requests. here output: 2011-07-20 18:25:33,743 debug [org.springframework.ws.client.core.webservicetemplate] - opening [org.springframework.ws.transport.http.httpurlconnection@1696452] [http://mymachine:8080/test-service/historyservice] 2011-07-20 18:25:33,868 debug [org.springframework.ws.soap.saaj.support.saajutils] - soapelement [com.sun.xml.internal.messaging.saaj.soap.ver1_1.envelope1_1impl] implements saaj 1.3 2011-07-20 18:25:33,900 debug [org.springframework.ws.soap.saaj.support.saajutils] - soapelement [com.sun.xml.internal.messaging.saaj.soap.ver1_1.body1_1impl] implements saaj 1.3 2011-07-20 18:25:34,259 debug [org.springframework.ws.client.messagetracing.sent] - sent request [<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:header/><soap-env:body><ns2:getlistrequest xmlns:ns2="http://address_changed"><ns2:userid>ncc1@%<...

c# - WCF service not impersonating specified user in config? -

i have basic wcf service using basichttpbinding. have site project , services project. in site project, have regular services reference service in services project. in development environment, works fine. however, in our staging environment, have enabled impersonation on services application. service connects sql database using user, of course. the issue is, while other asmx services seem impersonate fine user defined in web.config, wcf service still running site's user, causing sql authentication fail. are there steps enable impersonation wcf service? have not done special beside adding: service.clientcredentials.windows.allowedimpersonationlevel = system.security.principal.tokenimpersonationlevel.delegation; after initialize service proxy website. thoughts? thanks. if mean asp.net impersonation account configured in web.config doesn't work wcf unless turn on aspnetcompatibility . wcf doesn't offer such configuration.

c++ compiling: error: expected constructor, destructor or type conversion before '*' -

i have been doing research , have found few similar questions on stackoverflow talking visibility of types, doesn't seem same problem (or @ least that's think after hours working on it). let's focus: the problem c++ compiler reports "abc.cpp:132: error: expected constructor, destructor, or type conversion before ‘*’ token" the code problem reported template <class c, class i> abc<c, i>::node * abc<c, i>::buscatreuiretornaminim(node **node) { if (*node == null) return null; if ((*node)->fesq != null) return buscatreuiretornaminim(&(*node)->fesq); node *q = *node; *node = *node->fdre; return q; } the problem reported on first line, function header. far, understand problem when specifying 'node *' it's qualified don't see where's problem. the rest of class definition class abc { public: abc(void) : arrel(null), numelements(0), altura(0) { } void inserir(c pclau, pinfo);...

Should I use Javascript SDK or PHP SDK for facebook connect in website -

i'm building website authenticate users via facebook connect , i'm torn between using php sdk/server-side flow or js sdk/client-side flow. here considerations: i want record users authorize app in database (userid's, email addresses) on server i want give users ability publish walls using attractive dialogues generated fb.ui() in js sdk i want able publish story on user's wall via server in response external event i want enable/disable functionality on website based on whether or not user logged facebook there prob few more can think of. based on these requirements i'm guessing i'm going need use both sdks. sdk should rely on initial application authorization/new user recording in database? my idea of how might work in both scenarios: js sdk: user selects login button, callback method fires ajax request server , passes along authenticated user's fbid via post. code on server determines if new user, , records in database if no existing re...

c# - is there OpenNETCF that can work with FrameWork 1.0 -

i work opennetcf.dll opennetcf.net.dll for mac address terminal. i dont have framework 3.5 on terminal , dont want install hem. is there opennetcf can work framework 1.0 ? thanks in advance i think smart device framework 1.4 last version worked .netcf 1.0 in version, feature need can found at: using opennetcf.net; ... adapterinfo[] infos = networkadapter.getadaptersinfo() if (infos != null && infos.length > 0) byte[] macaddr = infos[0].macaddress; ...

How to manually set the "default download" file in a Sourceforge project? -

when update files on sourceforge projects, last uploaded file automatically offered on download page "looking latest version? download..." , becomes default download project's front page. my problem that, on 1 project, there main source tarball have optional code components want add site. whenever add such optional component become "latest verison" of app. is there way force file become "latest version" of app stays default download on main project page? if wrong file linked download button, can change by: click files browse through folders until find preferred file click "i" icon @ right of file's entry in table of files in pop-up window, under default download for: heading, click select all press save give few minutes, refresh project page , check link

tsql - Can I select the data of a given row and column while executing a sql statement -

to clarify title, in select statement, in clause, need verify table on doing using select. in second select, have find secondary id. here have worked out far declare @id int --inserting values in temp table select rn = row_number() on (order adt_trl_dt_tm), * #temp dbo.evnt_hstry order adt_trl_dt_tm desc --searching items deleted , have not been restored select * dbo.evnt_hstry hstry evnt_hstry_cd '3' , adt_trl_dt_tm > (select adt_trl_dt_tm dbo.evnt_hstry evnt_id = evnt_id drop table #temp to clarify code, evnt_id foreign key. primary key evnt_hstry_id . evnt_hstry_cd 3 means deleted. trying see if field adt_trl_dt_tm (lastest date modified) of row being read latest comparing adt_trl_dt_tm fields have same evnt_id . the table doing select on table store history of events. when event has been added, modified, deleted , or restored. sadly, cannot application statement being run in ssis. overall, need compare adt_trl_dt_tm other adt_trl_dt_tm hav...

haskell - Understanding how Either is an instance of Functor -

in free time i'm learning haskell, beginner question. in readings came across example illustrating how either a made instance of functor : instance functor (either a) fmap f (right x) = right (f x) fmap f (left x) = left x now, i'm trying understand why implementation maps in case of right value constructor, doesn't in case of left ? here understanding: first let me rewrite above instance as instance functor (either a) fmap g (right x) = right (g x) fmap g (left x) = left x now: i know fmap :: (c -> d) -> f c -> f d if substitute f either a fmap :: (c -> d) -> either c -> either d the type of right (g x) either (g x) , , type of g x d , have type of right (g x) either d , expect fmap (see 2. above) now, if @ left (g x) can use same reasoning type either (g x) b , either d b , not expect fmap (see 2. above): d should second parameter, not first! can't map on left . is reasoning correct? this...

ios - Stop video after exiting fullscreen on Mobile Safari -

hey guys, i've got thumbnail on webpage when clicked, plays video in fullscreen using webkitenterfullscreen() method. but need video stop playing once users touches "done" button , leaves fullscreen mode. is there event fires once the user has exited fullscreen? thanks, drew i had email apple developer answered question me. the 2 events webkitbeginfullscreen , webkitendfullscreen. piece of sample code useful seeing order events fire (it logs message page whenever event emitted), , includes these 2 events: http://developer.apple.com/library/safari/#samplecode/html5videoeventflow/introduction/intro.html%23//apple_ref/doc/uid/dts40010085-intro-dontlinkelementid_2

java - NullPointerException while using Android's mediaplayer -

i have 2 button , play sound notify right choice, or wrong one. how it: mediaplayer playerror = mediaplayer.create(quizactivity.this, r.raw.error); playerror.start(); same correct sound. works fine of time, when click many times, @ random times error: basically says line playerror.start(); gives me nullpointerexception (only sometimes) 07-21 23:05:32.767: error/playerdriver(1287): command player_prepare completed error or info pvmferrresource, -17 07-21 23:05:32.767: error/mediaplayer(14449): error (1, -17) 07-21 23:05:32.767: error/mediaplayer(14449): media_error(mpreparesync) signal application thread 07-21 23:05:32.777: error/androidruntime(14449): fatal exception: main 07-21 23:05:32.777: error/androidruntime(14449): java.lang.nullpointerexception 07-21 23:05:32.777: error/androidruntime(14449): @ com.quiz.quizactivity.falseanswerpoints(quizactivity.java:148) 07-21 23:05:32.777: error/androidruntime(14449): @ com.quiz.quizactivity$5.onclick(quizactivity.java:...

jQuery events; prevent "siblings" from triggering eachothers events -

using jquery 1.6.1 , given have following html: <div class="control"> <label>my control</label> <input type="text" /> <input type="text" /> </div> when <input> in <div class="control"> ( hereafter control ) focused, <label> ( with position: relative; ) animates: $('.control :input').bind('focus', function(e){ $(this).prevall('label').animate({ 'left': '-50px' }, 250); }); and when blurred, <label> returns: .bind('blur', function(e){ $(this).prevall('label').animate({ 'left': '0px' }, 250); }); however, if 1 of <input> elements gains focus, , blurs focus switched <input> within same control ( via tab or mouse click ) events of course still fire, , <label> animates , forth. how can force blur event trigger when focus lost all inpu...

How to configure Wordpress and Rails app on a Mongrel + Apache server? -

i need add wordpress blog site same server (under same domain name), @ "/blog" path. is: my rails app @ mysite.com, want blog site @ mysite.com/blog. i tried putting wordpress files under rails app /public/blog folder. whenever access mysite.com/blog, got error saying "the page looking doesn't exist." however, can still access mysite.com/blog/wp-admin/index.php, seems can run php scripts fine. my rails app running on mongrel+apache2 configuration. any idea how can make blog work rails app? thanks. i figured out myself. if having similar problems, please check solution @ http://harryche2008.wordpress.com/2011/03/05/how-setup-wordpress-blog-under-railss-public-directory/

treeview - how to use dtree javascript tree -

i want turn ordinary nested list, collapsable tree structure such dtree . have list right html nested tags, want implement sort of tree need steps on how it. site doesn't job @ explaining it. thanks! tariq this code use after have included proper javascript files dtree provides: //create tree d = new dtree('d'); //add node , keep adding rest of nodes until in there d.add( 1, //unique id node -1, //parent node -- use -1 root 'my node', //text label node 'node.html', //url node 'node title', //title node 'mainframe', //target node when opening url 'img/musicfolder.gif' //icon image. uses default if not specified 'img/musicfolderopen.gif' //open icon image. uses default if not specified true //whether node open or not (optional) ); //write node html page document.write(d); i recommend using easier javascript tree 'simple tree menu' easier...

c++ - Static variable initialization over a library -

i working on factory have types added them, however, if class not explicitly instiated in .exe exectured (compile-time), type not added factory. due fact static call how not being made. have suggestions on how fix this? below 5 small files putting lib, .exe call lib. if there suggestions on how can work, or maybe better design pattern, please let me know. here looking for 1) factory can take in types 2) auto registration go in classes .cpp file, , registration code should go in class .cpp (for example below, randomclass.cpp) , no other files. baseclass.h : http://codepad.org/zgrzvizf randomclass.h : http://codepad.org/rqiz1atp randomclass.cpp : http://codepad.org/wqnqdwqd templatefactory.h : http://codepad.org/94yfusgc templatefactory.cpp : http://codepad.org/hc2tsfzz as general rule of thumb, application not include static or global variables library unless implicitly or explicitly used application. there hundred different ways can refactored. 1 method pla...

executing a custom init script for bash --login -i for example to change to a custom directory from a shortcut -

right i'm using msysgit on windows 7, started .bat file, calls bash.exe --login -i start shell. @ point executes .bashrc file (among others) in user's home directory. use script setup environment , cd starting directory. this works fine. change .bat file in way bash execute custom script @ startup in script perform different initialization , cd different starting directory. have 2 separate .bat files calling each script, make shortcut both on desktop , start whichever want. the thing i'm not sure how do, bash run custom init script on startup. command msysgit uses bash.exe --login -i . there way can modify use custom file? tried bash.exe --login --rcfile 01.txt -i didn't work. likewise nothing else tried worked either. try without --login : bash.exe --rcfile 01.txt -i

Ant installation -

this question has answer here: error installing ant: ant_home set incorrectly 30 answers when running ant command showing following output: ant_home set incorrectly or ant not located. please set ant_home. ant_home is environment variable can set temporary command line instance (window) calling set . example: set ant_home="c:\program files\apache-ant" for permanently setting environment variable open control panel , open system . on tab advanced should find button named environment variables

jquery - How to select an element which parent is not specified class? -

i want hide element if parent not have class: html <li class="current_page_parent"> <a href="parent.html">parent</a> <ul class="children"> <li>foo</li> <li>bar</li> </ul> </li> jquery jquery("ul.children").hide(); currently hides <ul class="children"> regardless of class. close if parent :not <li class="current_page_parent"> . i've tried: jquery("ul.children:not(:parent.current_page_ancestor)").hide(); with no luck. try this: jquery("li:not(.current_page_parent) ul.children").hide();

Ada Generic Averaging Function -

i have function averages numeric value array of records. value either natural or enumerated type delta. have summing values correctly question this: how length of array generic type, can divide both integers , delta type numbers? on array-of-records use 'length attribute; has advantage of working if bounds odd, -18..3, or enumeration, cheeses..fruits. something like: function average( input : in array_of_records ) return float -- have summation function, so... sum : natural:= summation( input ); begin return sum / input'length; end average; you may need convert numeric types, saying float(sum) or like, ada no automatic type "promotions."

How do I access call log for android? -

i receive call log. example number of calls made user, number of minutes called, etc. how achieve in android? this accessing phone call history: as of jellybean (4.1) need following permission: <uses-permission android:name="android.permission.read_call_log" /> code: uri allcalls = uri.parse("content://call_log/calls"); cursor c = managedquery(allcalls, null, null, null, null); string num= c.getstring(c.getcolumnindex(calllog.calls.number));// number string name= c.getstring(c.getcolumnindex(calllog.calls.cached_name));// name string duration = c.getstring(c.getcolumnindex(calllog.calls.duration));// duration int type = integer.parseint(c.getstring(c.getcolumnindex(calllog.calls.type)));// call type, incoming or out going.

NInject WCF extension not working with ninject 2.3 -

i using ninject wcf extension 2.2 in application, after upgrading ninject version 2.3, stops working , return serialization error. there upgraded version of wcf extension 2.3 or i've use ninject 2.2. thanks ninject 2.3 not released version. requires ninject.extensions.wcf 2.3 found @ github or on build server teamcity.codebetter.com

svn - Python dependencies? -

is possible programmatically detect dependencies given python project residing in svn? here twist adds precision, , might useful if find you're checking dependencies of miscellaneous code: catches import statements executed code being analyzed. automatically excludes system-loaded modules, don't have weed through it. also reports symbols imported each module. code: import __builtin__ import collections import sys in_use = collections.defaultdict(set) _import = __builtin__.__import__ def _myimport(name, globs=none, locs=none, fromlist=none, level=-1): global in_use if fromlist none: fromlist = [] in_use[name].update(fromlist) return _import(name, globs, locs, fromlist, level) # monkey-patch __import__ setattr(__builtin__, '__import__', _myimport) # import , run target project here , run routine import foobar foobar.do_something() # when finishes running, dump imports print 'modules , symbols imported "foobar...

iphone - UITextView displaying spaces after newline/wordwrap -

i using uitextview display arbitrary nsstrings, various font sizes (depending on length of string, , screen resolution of device). problem uitextview seems display these little "underscore like" characters, instead of spaces, if space character first character on newline (after text has been wrapped). know way turn off? ok, think problem font using. possibly text size of font important. perhaps fact displaying in italic thing. anyhow, have different font, different size, not italic, haven't noticed problem.

sql server 2005 - How to get fast result while Querying a very large database table? -

my client has large database. 2 tables contain patients record having more 10 million rows . when select patient record particular patient record in 2-3 seconds. if pass between date clause in where condition , not records before 25-30 minutes. query- select convert(varchar(12),[datetime],101) [datetime] , min(cast(response int)) [minfalltotal], max(cast(response int)) [maxfalltotal] nurqueryresults visitid = 'w3074332666' , queryid = 'nurfallz' group convert(varchar(12),[datetime],101) i result of upper query in 2-3 seconds not this- select visitid, min(cast(response int)) [minfalltotal], max(cast(response int)) [maxfalltotal] nurqueryresults queryid = 'nurfallz' , convert(varchar(12),[datetime],101)='12/23/2010' group convert(varchar(12),[datetime],101), visitid actual requirement is- select top 10 av.visitid [unit], av.accountnumber [account], av.name [patient name], convert(varchar(11),av.birthdatetime,101) [dob] , convert(varchar...

iphone - Using UIPickerView with CoreData -

how data core data entity , use in pickerview? i think should first learn core data , how use try link this link may understand coredata then second(populating pickerview) part not tough try this post

c# - The return value from a stored procedure gets the first character only in ASP.NET -

when getting return value stored procedure, returns first character, exec sp_auto_gen_ttbdbatno 'tt', '' in sql server gets whole string, in asp.net gets first character. how whole string value? create proc sp_auto_gen_ttbdbatno @prefix nvarchar(2), @result nvarchar(8) output begin declare @lastvalue int -- companycode = @companycode , bankcode = @bankcode , accountcode = @accountcode set nocount on if @prefix = 'bd' select @lastvalue = max(right(rtrim(isnull(batchno, '')),2)) dbo.cheque_issuerecord_secretary_review_bd isnumeric(right(rtrim(batchno),2))= 1 , len(right(rtrim(batchno),2)) = 2 else select @lastvalue = max(right(rtrim(isnull(batchno, '')),2)) dbo.cheque_issuerecord_secretary_review_tt isnumeric(right(rtrim(batchno),2))= 1 , len(right(rtrim(batchno),2)) = 2 set nocount off set @result = @prefix + right(rtrim(str(year(getdate()))),2)+right('0'+ltrim(rtrim(st...

html - Impossible to use dark background in IE? -

i have discovered problems when run page dark background , image element white borders in ie8. problems white flicker , flash apperas in top, middle or bottom part of image when reloading or load page. have serched lot , found kinds of code put inside of meta tags, nothing works me. bad, dark background , white borders create problems in ie , there nothing do? or rid of flicker , flashes? the thing can think resurrected ie6 bug . have tried fixing , seeing if works?

Microsoft Silverlight charting odd interval -

in simple microsoft chart control in silverlight have days of 1 month dates on x axis , double values on y axis. display every second day on x axis days should odd days . if set intervaltype="days" , interval="2" numbering starts day 2. if put dummy date in front or in end or both. instead of: __ 02 __ 04 __ 06 __ 08 __ 10 ... i need: 01 __ 03 __ 05 __ 07 ... how can achieve in simplest way? example set 31.01 -> 1.02 -> 3.02 instead of 31.01 -> 2.02 . in case 1 way write custom axis similar datetimeaxis . at first copy project following files: c:\program files\microsoft sdks\silverlight\v4.0\toolkit\apr10\source\source code.zip\controls.datavisualization.toolkit\enumerablefunctions.cs c:\program files\microsoft sdks\silverlight\v4.0\toolkit\apr10\source\source code.zip\controls.datavisualization.toolkit\valuehelper.cs copy these files same namespace, internal there not name conflict. next, add extended class datetimeintervalt...

bash - How to enable the up/down arrow keys to show previous inputs when using `read`? -

i'm waiting user input (using 'read') in infinite loop , have command history, being able show previous inputs entered, using , down arrow keys, instead of getting ^[[a , ^[[b. possible? thanks @l0b0 answer. got me on right direction. after playing time i've realized need following 2 features, haven't managed them yet: if press , add previous command have whole thing saved in history, not addition. example $ ./up_and_down enter command: hello enter enter command: up enter command: hello you enter enter command: up enter command: you (instead of "hello you") if can't keep going because i'm @ end of history array, don't want cursor move previous line, instead want stay fixed. this have far (up_and_down): #!/usr/bin/env bash set -o nounset -o errexit -o pipefail read_history() { local char local string local esc=$'\e' local up=$'\e[a' local down=$'\e[b' local clear_lin...

Call a custom document converter using Sharepoint Object Model -

how call custom sharepoint converter activated specific website. for example, below code used guid of converter foreach (spdocumentconverter converter in converters) { //console.writeline(converter.displayname); if (converter.convertfrom.tolower().equals("pdf") && converter.convertto.tolower().equals("jpg")) pdftojpgconverterid = converter.id; } and spfile.convert method used call converter usually. when trying call document converter using spfile.convert method, not calling it. my custom conveter takes 2 command line arguments. how can pass them converter when called using sharepointobject model or other. update: a document converter custom executable file, deployed specific website feature. want transform given pdf file images supplying file name document converter using sharepoint object model. spfile.convert method has argument "-config", third parameter pass required...

objective c - iPhone app login issue -

i have iphone application i'm working on , far have created login page application such phone's user can access application. login works fine , application works fine, when hit home button, app "minimized". , if accessed again task switcher doesn't prompt password. what best way go getting app request password. if helps use navigation controllers , have 1 view dedicated login. thanks help. can't check app activated in appdelegate? - (void)applicationdidbecomeactive:(uiapplication *)application { [self showloginwindow]; }

php - Zend Framework URL Route not adding domain -

got bit of problem zend not adding base url routes think. what have follows: application modules menu public menu css js index.php index.base.php i using function <?php echo $this->url(array('module' => 'module1'), 'menu-install'); ?> with route: $router->addroute('menu-install', new zend_controller_router_route('/install/:modulepath', array('module' => 'menu', 'controller' => 'install', 'action' => 'install'))); which outputting http://menu/install/module1/ instead of http://localhost:8888/menu/install/module1/ any ideas whats going on? try ro write this(in bootstrap example) zend_controller_front::getinstance()->setbaseurl('/');

ios - Accessing users iTunes Library without MPMediaPickerController -

is there way access users itunes library mpmediapickercontroller ? can uitableview used present mpmediapickercontroller customized? is there way access users itunes library mpmediapickercontroller ? sure, there's mpmediaquery query ipod library programmatically. once havwe data, can display way want. see ipod library access programming guide .

asp.net mvc - Return action does not work correctly -

i have simple create action save product db. after saving product have used return view(new product()); reset form fields form show old data(the data before submit form). use return view(new product(name="test")); not work too. problem? product saved db correctly (it means modelstate.isvalid true). don not want use redirecttoaction. [httppost] public actionresult new(product product) { if (modelstate.isvalid) { product.submitdate = datetime.utcnow; productrepository.add(product); productrepository.save(); //viewbag.message = "product saved"; return view(new product()); } return view(product); } i think recommended practice use redirecttoaction() if want try way, try modelstate.clear(); return view(new product());

javascript - how to copy another elements onclick function -

i have been able elements onclick function doing this: document.getelementbyid(this.options[this.selectedindex].text).getattribute('onclick') this gives me exact text want put different elements onchange event, thought this: <select onchange="document.getelementbyid(this.options[this.selectedindex].text).getattribute('onclick')"> this not work though. have ideas, stumped! in advance! you can't dump function attribute that. recommend start writing unobtrusive javascript . html <select id="myselect"> <!-- snip --> </select> javascript var select = document.getelementbyid('myselect'); select.onchange = function () { var id = this.options[this.selectedindex].text, clickhandler = document.getelementbyid(id).onclick; clickhandler.apply(this); }; demo → edit re: op's comment "is there easy way apply selects on page?" of course there is! need care...

Run Visual Studio 2002, 2003, and VB6 side-by-side on Windows 7 -

i upgrading machine windows 7 still supporting vs2002 (.net 1.0), vs2003 (.net 1.1) , , vb6 applications. is possible load these vs , vb6 applications, build, compile, edit code, , support source code in windows 7? best way answer question experiment. can setup virtualbox guest os windows 7, put whatever programs inside , test out. if run fine, it's okay real upgrades.

c# - Complex type inside custom control in ASP.NET 4.0 -

how can setup complex property inside custom control, have tried following. problem can't access complex property inside custom control class. example custom control code: public class mycustomcontrol : control, istylesheet { [ bindable(true), category("appearance"), defaultvalue(""), description("fullname"), designerserializationvisibility(designerserializationvisibility.content), persistencemode(persistencemode.innerproperty), ] public fullname myfullname {get; set;} protected override void render(htmltextwriter writer) { // want access myfullname .aspx here } } public class fullname { public string firstname {get; set;} public string lastname {get; set;} } .aspx markup <namespace:mycustomcontrol runat="server""> <myfullname firstname="abc" lastname="def...

java - No resource found that matches the given name (at 'text' with value '@string/continue_label') -

let me start off saying i'm brand new android programming. i'm using pragmatic's hello android book (3rd edition). i'm working on popular sudoku game example, , after copying code book placed in main.xml file, following errors: error: error: no resource found matches given name (at 'background' value '@color/background') . error: error: no resource found matches given name (at 'text' value '@string/main_title'). error: error: no resource found matches given name (at 'text' value '@string/continue_label'). error: error: no resource found matches given name (at 'text' value '@string/new_game_label'). error: error: no resource found matches given name (at 'text' value '@string/about_label'). error: error: no resource found matches given name (at 'text' value '@string/exit_label'). they're related, after doing searching, don't know problem is. suggestions? ...

c# - Is Rx under 3.5SP1 forward-compatible with Rx and TPL under 4.0? -

i want begin enabling our c# .net 3.5sp1 project's code asynchrony. primary use case invoke wcf services asynchronously. our wcf service layer entirely interface-based, interface method signatures imply implementations assumed execute synchronously (e.g. somedatacontract getsomedatacontractbyid(someid id); . i'd avoid retrofitting plethora of interfaces support asynchronous execution .net framework asynchronous pattern of iasyncresult , beginoperation / endoperation . want more manageable way this. we use t4 templates generate lot of code, i'd able generate asynchronous version of interface based on synchronous one. implementation of asynchronous interface invoke wcf service asynchronously, ideally using .net 4.0's tpl's task<t> represent operation task , returning caller . problem .net 3.5sp1 has no such tpl , hence no nice task<t> . what options here, keeping in mind compatibility between .net 3.5sp1 , .net 4.0? i'm open dropping task...

php - Field email not updating in MySQL table (using PDO) -

i have query running on site updates user's profile. updates every field but email field should. it's not doing @ email field. i define $email variable such: $email = str_replace(" ", "", trim($_post['email'])); and use database wrapper update it: mysql::do_query( $db, "update customer set email=?, firstname=?, surname=?, phonenumber=?, street_address=?, postcode=?, city=?, extra_2=?, ssn=?, password=? customer_id=? , password=?", array($email, $firstname, $surname, $phone, $address, $zip, $city, $extra_2, $ssn, stringconverter::generate_hash($email, $_post['pw']), $customer, stringconverter::generate_hash($email, $_post['pw'])) ); but, problem, doesn't update email field. every other field updates fine. i've tried running separate query updating just email, doesn't work either. i...

xml - USSD INTERFACE -> java web app communication -

need few infos please regarding communication of java web application via ussd interface! need implement reach our target customer base in poorer communities low end phones. i looking ussd, way communicate our current java ee web application. i believe have understood how can construct menu in ussd (via xml , parameters / tags.) however, not sure how give response. started reading on yesterday find lot of info google finds useless. our current web app has web services set up. imagine need ussd interface / xml file (parameter = - callback - "url request" )connected web service!? , send data of user (received input) equals url request? and how send response !? how data can displayed ?? , format or data need transmitted? it tough find out mobile provider here in south africa gateway using - not sure if right, seem wasp !? if gateway, thats providers seem use in sa . . have tried contacting vodacom sa in several ways, no reply. interested in gateway use, how const...

python - Uploading a Single Static File to GAE Using app.yaml -

greetings, i trying upload 2 single static files (a css & html) appspot. however, they're in root directory. i've tried static_dir , static_files don't work. what i'm trying upload page.html /site/ have on root directory because need on same dir app.yaml. here portion of app.yaml: - url: /page.html static_files: /\1.html upload: /page.html - url: /page.css static_files: /\1.css upload: /page.css thank taking time read this. \1 replaced first matched group in regular expression url. url has no groups, nothing. you can do: - url: /page.html static_files: page.html upload: /page.html - url: /page.css static_files: page.css upload: /page.css

haskell - About ++ to concate things -

given following function signature: concatthings :: (show a) => -> string -> string concatthings str2 = str2 ++ (show any) if run concatthings "there" "hi" , result be: "hi\"there\"" , want "hithere" . how can still "hithere" function signature? you wrap string in new type , provide simple show instance it: newtype partialstring = partialstring string instance show partialstring show partialstring str = str and pass in wrapped string concatthings function: let pstr1 = partialstring str1 in concatthings pstr1 str2