Posts

Showing posts from May, 2012

iphone - Passing variable to another view (using Utility template) -

okay, i'm newbie, need passing variable view. i'm using utility template in xcode. i think have linking (including proper header files , whatnot). don't know proper syntax. here's i'm trying: nsdate *time =[flipsideviewcontroller.datepicker date]; if run in rootviewcontroller.toggleview works fine. any would appreciated! there different ways pass 1 variable view as: 1) crate global variable in appdelegateclass: in appdelegate.h crate vriable nsstring *str property in appdelegate.m syntheses it. in view1 set variable as: yourappdelegate *appdelegate= [[uiapplication sharedapplication] delegate]; appdelegate.str= @"some string"; in view2 again crate same object , retrieve value. nsstring *mystr= appdelegate.str; the way define property in view2 , access view one.

build process - Building Flex projects in ant/nant -

we have recurring problem @ company build breaks in our flex projects. problem occurs because build developers on local machines fundamentally different build occurs on build machine. devs building projects using flexbuilder/eclipse , build machine using command line compilers. inevitably, {projectname}-config.xml and/or batch file runs build out of sync project files used eclipse, the build succeeds on dev's machine, fails on build machine. we started down path of writing utility program convert flexbuilder's project files {projectname}-config.xml file, it's a) undocumented , b) horrible hack. i've looked -dump-config switch config files, has couple of problems: 1) generated config file has absolute paths doesn't work in our environment (some developers use macs, windows machines), , 2) works right when run ide, can't build build process. tomorrow, going discuss couple of options, neither of i'm terribly fond of: a) add post check-in event s...

wpf - Silverlight treeview. Cannot bind "IsExpanded" property -

i have treeview control , want bind tree nodes' isexpanded property datasource items! but have exception: system.windows.markup.xamlparseexception occurred message=set property '' threw exception. stacktrace: @ system.windows.application.loadcomponent(object component, uri resourcelocator) @ silverlighttree.bstreeview.initializecomponent() @ silverlighttree.bstreeview..ctor() innerexception: system.notsupportedexception message=cannot set read-only property ''. stacktrace: @ ms.internal.xamlmemberinfo.setvalue(object target, object value) @ ms.internal.xamlmanagedruntimerpinvokes.setvalue(xamltypetoken intype, xamlqualifiedobject& inobj, xamlpropertytoken inproperty, xamlqualifiedobject& invalue) innerexception: inner exception: {system.notsupportedexception: cannot set read-only property ''. xaml: <grid x:name="layoutroot"> <controls:...

javascript - Validaiton on Phone no for multiple countries -

i have application has records of multiple countries' users.and recording phone no. of each user.and want apply validation on phone no country wise format. thanks! phoneformat.com has javascript library looking for. can pass phone number in format, , return country code, , convert e164 , can format too.

c++ - Programmatically change combobox -

i need update combobox new value changes reflected text in it. cleanest way after combobox has been initialised , message. so trying craft postmessage hwnd contains combobox . so if want send message it, changing selected item nth item, postmessage like? i guessing involve on_cbn_selchange , can't work right. you want combobox_setcursel : combobox_setcursel(hwndcombo, n); or if it's mfc ccombobox control can do: m_combo.setcursel(2); i imagine if you're doing manually want sendmessage rather postmessage. cbn_selchange notification control sends back you when selection changed. finally, might want add c++ tag question.

c++ - App does not run with VS 2008 SP1 DLLs, previous version works with RTM versions -

since our switch visual studio 6 visual studio 2008, we've been using mfc90.dll , msvc[pr]90.dlls along manifest files in private side-by-side configuration not worry versions or installing them system. pre-sp1, working fine (and still works fine on our developer machines). we've done testing post-sp1 i've been pulling hair out since yesterday morning. first off, our nsis installer script pulls dlls , manifest files redist folder. these no longer correct, app still links rtm version. so added define _bind_to_current_vclibs_version=1 of our projects use sp1 dlls in redist folder (or subsequent ones new service packs come out). took me hours find this. i've double checked generated manifest files in intermediate files folder compilation, , correctly list 9.0.30729.1 sp1 versions. i've double , triple checked depends on clean machine: links local dlls no errors. running app still gets following error: the application failed initialize (0xc01500...

Determine Installed Compact Frameworks (and SP) Version -

what's best way determine version of .net compact frameworks (including service packs) installed on device through .net application. neil cowburn maintains list of version numbers on blog . of right list looks this: version release ---------- ------------------ 1.0.2268.0 1.0 rtm 1.0.3111.0 1.0 sp1 1.0.3226.0 1.0 sp2 (recalled) 1.0.3227.0 1.0 sp2 beta 1.0.3316.0 1.0 sp2 rtm 1.0.4177.0 1.0 sp3 beta 1.0.4292.0 1.0 sp3 rtm 2.0.4037.0 2.0 may ctp 2.0.4135.0 2.0 beta 1 2.0.4317.0 2.0 november ctp 2.0.4278.0 2.0 december ctp 2.0.5056.0 2.0 beta 2 2.0.5238.0 2.0 rtm 2.0.6103.0 2.0 sp1 beta 2.0.6129.0 2.0 sp1 rtm 2.0.7045.0 2.0 sp2 rtm 3.5.7066.0 3.5 beta 1 3.5.7121.0 3.5 beta 2 3.5.7283.0 3.5 rtm

command line - Is there replacement for cat on Windows -

i need join 2 binary files *.bat script on windows. how can achieve that? windows type command works unix cat . example 1: type file1 file2 > file3 is equivalent of: cat file1 file2 > file3 example 2: type *.vcf > all_in_one.vcf this command merge vcards one.

hta - Take a screenshot of a webpage with JavaScript? -

is possible to take screenshot of webpage javascript , submit server? i'm not concerned browser security issues. etc. implementation hta . possible? i have done hta using activex control. pretty easy build control in vb6 take screenshot. had use keybd_event api call because sendkeys can't printscreen. here's code that: declare sub keybd_event lib "user32" _ (byval bvk byte, byval bscan byte, byval dwflags long, byval dwextrainfo long) public const captwindow = 2 public sub screengrab() keybd_event &h12, 0, 0, 0 keybd_event &h2c, captwindow, 0, 0 keybd_event &h2c, captwindow, &h2, 0 keybd_event &h12, 0, &h2, 0 end sub that gets far getting window clipboard. another option, if window want screenshot of hta use xmlhttprequest send dom nodes server, create screenshots server-side.

web config - ASP.Net - How to determine if web request is to a resource that allows anonymous users or not -

i have denied anonymous access entire application using following web.config setting: <authorization> <deny users="?" /> </authorization> then, various paths, have allowed anonymous access using web.config settings such this: <location path="home/showlogin"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> i'd able determine during processing of given request whether requested url path allows anonymous users or whether request path denies anonymous users. what elegant way of determining this? you can use following code collection of location elements: configuration config = webconfigurationmanager.openwebconfiguration("~"); foreach (configurationlocation location in config.locations) { // work location object }

c# - List <Class> New Class takes up memory? Do I need C=null; in the code? -

list new class takes memory? do need c=null; in code below? //class category public list<category> selectall() { list<category> lv = new list<category>(); string command = "select * categories"; sqlcommand sc = new sqlcommand(command, new sqlconnection(globalfunction.function.getconnectionstring())); sc.connection.open(); sqldatareader dr = sc.executereader(); using(dr) { while (dr.read()) { // question cause memory problem... category c = new category(); c.categoryid = convert.toint32(dr["categoryid"]); c.name = dr["name"].tostring(); c.displayorder=convert.toint32(dr["displayorder"]); lv.add(c); // told add because if not cause memory leak. c=null; } } sc.connection.close(); return lv; } gridview1.datasource = list<category>; gridview1.allowpaging = true; gridview1.pagesize = 5; ...

performance - Find out how much memory is being used by an object in C#? -

does know of way find out how memory instance of object taking? for example, if have instance of following object: testclass tc = new testclass() ; is there way find out how memory instance tc taking? the reason asking, although c# has built in memory management, run issues not clearing instance of object (e.g. list keeps track of something). there couple of reasonably memory profilers (e.g. ants profiler) in multi-threaded environment pretty hard figure out belongs where, tools. if not trying in code itself, i'm assuming based on ants reference, try taking @ clrprofiler (currently v2.0). it's free , if don't mind rather simplistic ui, can provide valuable information. give in-depth overview of kinds of stats. used while 1 tool finding memory leek. download here: http://www.microsoft.com/downloads/details.aspx?familyid=a362781c-3870-43be-8926-862b40aa0cd0&displaylang=en if want in code, clr has profiling apis use. if find information in clrpr...

javascript - Help with JQuery conditional statement -

i trying run jquery script on particular page if page loads. the scenario: have 1 page loads (i.e., webpage.aspx) , loads different content based on referring click. (i.e., webpage.aspx?contentid=1, webpage.aspx?contentid=2, webpage.aspx?contentid=3, etc). here problem. need have particular part of page removed if 1 specific contentid pulled. trying in jquery , can't seem figure out. here's have been working far. realize it's not correct gives starting point work with. thanks. code: $(window).load(function() { var $deletenewrow = $("div.col.w140 tbody:first").find("td:first").parent().remove(); if($('#dealer-info h1').indexof('ferrari') != -1) { $deletenewrow } }); what store in $deletenewrow variable isn't jquery method, method execute. want method in if statement, (note missing .text() in if statement): $(window).load(function() { if($('#dealer-info h1').text().indexof('...

c# - RSA private key encryption -

is there way perform private key encryption in c#? i know standard rsacryptoserviceprovider in system.security.cryptography , these classes provide public key encryption , private key decryption . also, provide digital signature functionality, uses internally private key encryption , there not publicly accessible functions perform private key encryption , public key decryption . i've found this article on codeproject , start point performing kind of encryption, however, looking ready-to-use code, code in article can hardly encrypt arbitrary-long byte arrays containing random values (that means values, including zeroes). do know components (preferably free) perform private key encryption ? use .net 3.5 . note: i know considered bad way of using asymmetric encryption (encrypting using private key , decrypting using public key), need use way. additional explanation consider have var bytes = new byte[30] { /* ... */ }; and want use 2048bit rsa ensure no 1 ...

javascript - Google Maps V3 StreetView not displaying on second setVisible() call -

edit: heard google, they've confirmed issue on end. edit2: contact @ google has informed me they've fixed bug. i've got troublesome bug using google maps v3 api. if set map, switch streetview, close streetview, reopen, imagery appears blank (though controls still display). if click on controls move camera, imagery returns. what causes this? can see code below simple, can't think i've gone wrong. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> </head> <body> <div id="map" style="width:500px;height:300px"></div> <script type="text/javascript"> var ma...

java - How can I customize the render of JRadioButton? -

i've created jradiobutton subclass in override paintcomponent method so: @override protected void paintcomponent(graphics g) { g.drawimage( isselected() ? getcheckedimg() : getbasicimg() , 0, 0, this); } but seems once button drawn, that's image uses forever. isselected test doesn't seem have effect. graphics cached or java? how provide custom jradiobutton selected , unselected image? have write custom ui? read api. there methods like: seticon() setselectedicon() among others can use instead of doing custom painting.

javascript - jQuery outside of a asp.net update panel -

i have asp.net page using , update panel , including javascript via {script src=abc.js} tag. have tried loading javascript using both $(document).ready , $(window).load. both fire on initial load fail fire on update panel postback. is there can wire client side fire regardless of update panel? know can inject script server side ideally want client side , wire ever needed first time around. if want register code run on updatepanel postback, need register function called when update occurs. can register javascript function run doing following: // javascript function initializescripts() { var prm = sys.webforms.pagerequestmanager.getinstance(); prm.add_pageloaded(yourjavascriptfunctionyouwanttorun); } the pagerequestmanager call javascript function when updatepanel refreshes. i have used in past cause trigger when updatepanel fired refresh due timer. when refresh completed, scripts automatically run update other controls based on data displayed. see ms...

navision - What technology(ies) and language(s) is Microsoft Navison implemented with/in? -

navision known microsoft dynamics nav. navision's application logic written using proprietary language called c/al, loosely based on pascal. offers both native database option ms sql server. the next version (nav 2009) use .net assemblies served via iis. c/al logic translated c# code , deployed server.

C++ variable scope error inside for loop -

//constructing set of places in conflict each other int l_placevec, l_placevec1,p; for(sp_listlistnode::const_iterator iter = m_posttransitionsset.begin(),l_placevec=0; iter != m_posttransitionsset.end(); iter++,l_placevec++) { for(sp_listlistnode::const_iterator inneriter = m_posttransitionsset.begin(),l_placevec1=0; inneriter != m_posttransitionsset.end(); inneriter++,l_placevec1++) { if((iter != inneriter) && ((**inneriter) == (**iter)) && (((int)((*iter)->size()))>1)) { //when 2 lists same sp_listnode* temper = new sp_listnode; temper->clear(); for(sp_listnode::const_iterator iterplaces = m_placenodes->begin(),p=0; iterplaces != m_placenodes->end(); iterplaces++,p++) { if((p == l_placevec) || (p == l_placevec1)) { temper->push_back(*iterplaces); } } m_conflictingplaces.push_back(temper); } } } the above code ...

Dealing with SVN keyword expansion with git-svn -

i asked keyword expansion in git , i'm willing accept design not support idea in git. for better or worse, project i'm working on @ moment requires svn keyword expansion this: svn propset svn:keywords "id" expl3.dtx to keep string up-to-date: $id: expl3.dtx 803 2008-09-11 14:01:58z $ but quite use git version control. unfortunately, git-svn doesn't support this, according docs: "we ignore svn properties except svn:executable" but doesn't seem tricky have keyword stuff emulated couple of pre/post commit hooks. first person want this? have code this? what's going on here: git optimized switch between branches possible. in particular, git checkout designed not touch files identical in both branches. unfortunately, rcs keyword substitution breaks this. example, using $date$ require git checkout touch every file in tree when switching branches. repository size of linux kernel, bring screeching halt. in general, ...

c# - Task.Factory.StartNew() Taskscheduler parameter -

see: taskfactory when want make task long-running , cancellable, if calling method ui, how pass taskscheduler parameter? it's not obvious problem is. why can't call: cancellationtoken token = new cancellationtoken(false); taskscheduler scheduler = taskscheduler.default; task task = taskfactory.startnew(action, token, taskcreationoptions.longrunning, scheduler);

Best Practice for Model Design in Ruby on Rails -

the ror tutorials posit 1 model per table orm work. db schema has 70 tables divided conceptually 5 groups of functionality (eg, given table lives in 1 , 1 functional group, , relations between tables of different groups minimised.) so: should design model per conceptual group, or should have 70 rails models , leave grouping 'conceptual'? thanks! i cover in 1 of large apps making sure tables/models conceptually grouped name (with 1:1 table-model relationship). example: events event_types event_groups event_attendees etc... that way when i'm using textmate or whatever, model files nicely grouped alpha sort. have 80 models in app, , works enough keep things organised.

c++ - Exceptions not passed correctly thru RCF (using Boost.Serialization) -

i use rcf boost.serialization (why use rcf's copy when use original?) works ok, when exception thrown in server, it's not passed correctly client. instead, rcf::serializationexception quoting archive_exception saying "class name long". when change protocol bstext, exceptions "unregistered class". when change protocol sfbinary, works. i've registered remoteexception on both server , client this: boost_class_version(rcf::remoteexception, 0) boost_class_export(rcf::remoteexception) i tried serializing , deserializing boost::shared_ptr<rcf::remoteexception> in same test, , works. so how can make rcf pass exceptions correctly without resorting sf? here's patch given jarl @ codeproject : in rcfserver.cpp, before line rcfserver::handlesession() defined (around line 792), insert following code: void serialize(serializationprotocolout & out, const remoteexception & e) { serialize(out, std::auto_ptr<remoteexcepti...

database - MS Access 2007 - OpenArgs not passing the value to next form? -

so pass id value 1 form next using docmd.openform "secondform",,,,,, mainid docmd.close acform, "firstform", acsaveyes and check value on second form's load event: mainid = val(me.openargs) and when debug , step through hover on , can see contains value then have button click event on second form supposed repeat process, when run following dim rs dao.recordset dim dbs dao.database set dbs = currentdb set myrs = dbs.openrecordset("tblmain") if myrs!mainid = mainid after rs.edit, etc stuff....the routine not making far. once same debug , hover, value here empty. there missing because can see value on forms load event, once try use in action mia thanks justin sounds scope problem. mainid declared? if declare within form open procedure, it's gone once procedure finishes. consider changing button's click event procedure. if myrs!mainid = val(me.openargs) openargs doesn't "go away" after form load...

Scheduler library in C++ similar to Java Quartz -

i'm looking cross-platform library in c/c++ can schedule jobs, function calls, etc. nice if closer java quartz. prefer bsd style licenses, lgpl okay too. libevent: http://www.monkey.org/~provos/libevent/ heavyweight use case, can decide if works you. edit: more scheduling functions after timeouts within program. looking @ quartz, appears broader. doubt if libevent looking for.

How do you extend Linq to SQL? -

last year, scott guthrie stated “you can override raw sql linq sql uses if want absolute control on sql executed”, can’t find documentation describing extensibility method. i modify following linq sql query: using (northwindcontext northwind = new northwindcontext ()) { var q = row in northwind.customers let ordercount = row.orders.count () select new { row.contactname, ordercount }; } which results in following tsql: select [t0].[contactname], ( select count(*) [dbo].[orders] [t1] [t1].[customerid] = [t0].[customerid] ) [ordercount] [dbo].[customers] [t0] to: using (northwindcontext northwind = new northwindcontext ()) { var q = row in northwind.customers.with ( tablehint.nolock, tablehint.index (0)) let ordercount = row.orders.with ( tablehint.holdlock).count () select new { row.contactname...

localization - Access Global .resx file in ASP.Net View Page -

i building in version 3.5 of .net framework , have resource (.resx) file trying access in web application. have exposed .resx properties public access modifiers , able access these properties in controller files or other .cs files in web app. question this: possible access name/value pairs within view page? i'd this... text="<%$ resources: namespace.resourcefilename, name %>" or other similar method in view page. <%= resources.<resourcename>.<property> %>

agile - Scrum Process Management - Tips, Pitfalls, Ideas -

i've been doing scrum team while, things seem messy reasons. i've been thinking on how changed , have couple of questions raise here. first, should role of testers, designers , non-developers whole in scrum process? if equal other team members couple of issues arise. designers , testers work on task after development done, cannot adequately plan sprint because of dependency. second, have deadlines. these strict , have lot of impact on prioritization. end result backlog changes in middle of sprint because of deadline changes, or bad results in end of sprint. have lot of non-technical work customer support has done in meantime , cannot planned varies lot. i'm thinking team structure, culture , practices kind of not compatible scrum. scrum me process management tool teams working on development of single software product. what guys think applying in more specific , complicated scenarios? have experience share? in general testers , documenters (and other n...

dns - Blocking part of a website -

i trying block google reader: reader.google.com www.google.com/reader the hard part blocking reader directory i blocked reader.google.com changing /etc/hosts file (this mac) is there way block www.google.com/reader without buying software? note safari greasemonkey won't work, , leopard's parental controls throttle cpu when turned on. also i've tried opendns, awesome, doesn't work this... any thoughts? update: laptop travels lot. router or home proxy server won't work. firefox work, don't think can uninstall safari mac. you can use privoxy filter anything.

javascript - 'console' is undefined error for Internet Explorer -

i'm using firebug , have statements like: console.log("..."); in page. in ie8 (probably earlier versions too) script errors saying 'console' undefined. tried putting @ top of page: <script type="text/javascript"> if (!console) console = {log: function() {}}; </script> still errors. way rid of errors? try if (!window.console) console = ... an undefined variable cannot referred directly. however, global variables attributes of same name of global context ( window in case of browsers), , accessing undefined attribute fine. or use if (typeof console === 'undefined') console = ... if want avoid magic variable window , see @tim down's answer .

optimization - Optimizing Sqlite query for INDEX -

i have table of 320000 rows contains lat/lon coordinate points. when user selects location program gets coordinates selected location , executes query brings points table near. done calculating distance between selected point , each coordinate point table row. query use: select street locations ( ( (lat - (-34.594804)) *(lat - (-34.594804)) ) + ((lon - (-58.377676 ))*(lon - (-58.377676 ))) <= ((0.00124)*(0.00124))) group street; as can see clause simple pythagoras formula calculate distance between 2 points. problem can not index usable. i've tried create index indx on location(lat,lon) also with create index indx on location(street,lat,lon) with no luck. i've notice when there math operation lat or lon, index not being called . there way can optimize query using index gain speed results? thanks in advance! the problem sql engine needs evaluate records comparison (where ..... <= ...) , filter points indexes don’t speed query. 1 approach so...

php - Should Nginx Be Combined With Language Supporting Asynchronous Programming Model? -

i found there lot of articles comparing nginx , apache in internet. however, these comparisons based on stress test web server running php code. suppose due apache deployed php lamp architecture. in understanding, nginx created solve c10k problem event-based architecture. is, nginx supposed serve m concurrent requests n threads/processes. n supposed less m. big difference apache needs m threads/processes serve m concurrent requests. for php code, programming model not asynchronous. each web request occupy 1 thread/process php handle it. so, don't understand meaning compare nginx , apache php code. the event-based architecture of nginx must excels apache when requests involves i/o operations. example, requests need merge results multiple other web services. apache+php, each requests might takes seconds waiting i/o operation complete. consume lot of threads/processes. nginx, not problem, if asynchronous programming used. would make more sense deploy nginx language suppo...

javascript - jQuery alternative for document.activeElement -

what wanted figure out whenever user engaged input or textarea element , set variable flag true... , set flag false after user no longer engaged them (ie. they've clicked out of input/textarea elements). i used jquery's docuemnt.ready function add onclick attribute body element , assign getactive() function. the code getactive() function follows: function getactive() { activeobj = document.activeelement; var infocus = false; if (activeobj.tagname == "input" || activeobj.tagname == "textarea") { infocus = true; } } i'd keep project withing jquery framework, can't seem find way of accomplishing same logic above using jquery syntax. you want focus , blur event handlers. example... var infocus = false; $('input, textarea').focus(function() { infocus = true; }); $('input, textarea').blur(function() { infocus = false; }); i'm pretty sure comma input or textarea, idea if doesn't pan out ...

c# - BackgroundWorker questions -

i have ui wpf application. may 1 have ideas why code not working? case 1: backgroundworker worker = new backgroundworker(); worker.dowork += delegate { //some logic }; worker.runworkerasync(); in case getting exception calling thread cannot access object because different thread owns it. changed this: backgroundworker worker = new backgroundworker(); worker.dowork += delegate { this.dispatcher.begininvoke( new action(() => { //my code here }), null); }; after ui getting frozen during executing code. executing in same thread case 2: backgroundworker worker = new backgroundworker(); worker.runworkerasync(new action(() => { //some code here })); in case code inside action not executed. //----------------------------------updated--------------------------------------// thank guy's reason why code didn't work mentioned below. did access ui elements in background thread. getting values ui elements before call backgroundworker. declare ...

ASP.NET MVC Tracing Issues -

question how asp.net mvc trace information consistent in-page trace output trace.axd? may missing obvious, please call out if see it. background info traditional asp.net so in regular asp.net days, add following web.config: <system.diagnostics> <trace> <listeners> <add name="webpagetracelistener" type="system.web.webpagetracelistener, system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a"/> </listeners> </trace> </system.diagnostics> ... <system.web> <trace enabled="true" pageoutput="true" writetodiagnosticstrace="true"/> ... <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" warninglevel="1" compileroptions="/d:trace" type="microsoft.csharp.csharpcodeprovider, system, version=2.0.0.0, culture=neutral, publicke...

What is a good PHP library to handle file uploads? -

i looking use php library uploading pictures web server can use has been tested , not have design 1 myself. know of such library? edit: aware file uploads built php, looking library may make process simpler , safer. i use http_upload pear. works pretty our purposes (uplaoding media files development system , uploading arbitrary files educational system)

c# - Hide a gridView row in asp.net -

i creating gridview allows adding new rows adding controls necessary insert footertemplate , when objectdatasource has no records, add dummy row footertemplate displayed when there data. how can hide dummy row? have tried setting e.row.visible = false on rowdatabound row still visible. you handle gridview's databound event , hide dummy row. (don't forget assign event property in aspx code): protected void gridview1_databound(object sender, eventargs e) { if (gridview1.rows.count == 1) gridview1.rows[0].visible = false; }

c# - Given a DateTime object, how do I get an ISO 8601 date in string format? -

given: datetime.utcnow how string represents same value in iso 8601 -compliant format? note iso 8601 defines number of similar formats. specific format looking is: yyyy-mm-ddthh:mm:ssz datetime.utcnow.tostring("yyyy-mm-ddthh\\:mm\\:ss.fffffffzzz"); this gives date similar 2008-09-22t13:57:31.2311892-04:00 . another way is: datetime.utcnow.tostring("o"); which gives 2008-09-22t14:01:54.9571247z to specified format, can use: datetime.utcnow.tostring("yyyy-mm-ddthh:mm:ssz") datetime formatting options

login - Facebook javascript/ fbconnect ifuserconnected causing problems -

well i'm reading fb connect tutorial here http://wiki.developers.facebook.com/index.php/facebook_connect_tutorial1 the problem i'm having near end of tutorial, it's saying do <script type="text/javascript"> fb.init("apikey","xd_receiver.htm", {"ifuserconnected" : update_fbuser}); </script> as oppose <script type="text/javascript"> fb.init("apikey","xd_receiver.htm"); </script> now problem is, when use first one, login facebook button have stops showing, notice wrong first one, second 1 works fine (just doesnt use ifuserconnected) thanks :) first of looking @ old api deprecated. if starting better start current one. can read here . as code. need declare callback function update_fbuser() called when user login status changes. don't have breaks. can find more examples here (but again old api, things different).

ldap - Modify entry in OpenLDAP directory -

i have large openldap directory. in directory display name property every filled need modify these entry , make "givenname + + sn". there way can directly in directory sql queries (update query). have read ldapmodify not find way use this. any in regard appreciated. there no way single ldap api call. you'll have use 1 ldap search operation givenname , sn attributes, , 1 ldap modify operation modify displayname attribute. if use command line ldaptools "ldapsearch" , "ldapmodify", can shell scripting, you'll have careful: ldapsearch(1) can return ldif data in base64 format, utf-8 strings contain characters beyond ascii. instance: 'sn:: base64data' (note double ':') so, if use simple script in language of choice, has ldap api, instead of using shell commands. save me troubles of base64 decoding ldaptools impose. for instance, php-cli, script roughly (perhaps more error checking appropriate): <?php $ldap = l...

java - Hadoop job fails when invoked by cron -

i have created following shell script invoking hadoop job: #!/bin/bash /opt/hadoop/bin/hadoop jar /path/to/job.jar com.do.something <param-1> ... <param-n> & wait %1 status=$? if [ $status -eq 0 ] echo "success" | mailx -s "status: "$status -r "mail@mysite.com" "mail@mysite.com" exit $status else echo "failed" | mailx -s "status: "$status -r "mail@mysite.com" "mail@mysite.com" exit $status fi when run above script manually this: $ ./path/to/job.sh hadoop job executes sucessfully , returns exit status "0". now, automate job execution everyday, have configured cron job run above script this: 0 22 * * * /path/to/job.sh but, job not submitted hadoop , exit status "1". few things note here: the user account under cron job configured usera usera hadoop system user the cluster dedicated running job the script executable i know why...

php - Overriding fetch() for PDO when fetching using foreach -

i have extended pdostatement , modified fetch() method typecast values of types timestamp , arrays, in postgresql, datetime , native array. works intended can't override behaviour when using statement in foreach. i have solved returning rows object implementing arrayaccess, iteratoraggregate , countable. i'm not satisfied solution , want pure array back. example: class extendedstatement extends pdostatement { protected function __construct() { $this->setfetchmode(pdo::fetch_assoc); } public function fetch( $fetch_style = pdo::fetch_assoc, $cursor_orientation = pdo::fetch_ori_next, $cursor_offset = 0) { $r = parent::fetch($fetch_style, $cursor_orientation, $cursor_offset); if (is_array($r)) { $r["extradata"] = true; } return $r; } } $db = new pdo("sqlite::memory:"); $db->setattribute( pdo::attr_statement_class, array("extendedstatement...

How can i access javascript functions from ajax loaded content on the same page? -

1) on main page have javascript function function editsuccess(data) { alert("editsuccess called"); } 2) main page load content div using ajax need call javascript function loaded content it's don't see editsuccess function this should work long editsuccess available in global scope. remember javascript has function scope, if define editsuccess inside function, available within function. consider example: // javascript window.onload = function() { function editsuccess() { alert("hello"); } }; // html <div onclick='editsuccess()'>..</div> // or <script>editsuccess()</script> will not work since editsuccess not exist in global scope.

How should I install Linux on Windows Vista PC? -

i doing .net programming in addition c , c++ development , want more flexibility on home machine. want able have both linux (probably ubuntu) , windows vista on home computer. there way can install both , on boot prompted 1 start? there way set windows default? i have seen before in cs labs in undergrad. also, assume there no problem if use windows 32-bit along ubuntu 64-bit. advise? the latest versions of ubuntu include installer called wubi , installs ubuntu windows application (ie: can uninstalled add/remove programs) , sets dual boot you! it's great want give linux try without system overhaul!

c# - WCF: Windows service cannot find endpoint when hosted in Winforms application -

i require windows service make wcf calls service hosted in winforms application. unfortunately when attempting call windows service fails discover endpoint. i have tried changing log on properties windows service allow interaction desktop, did not help. i have used exact same hosting code (as used winforms app) in console application , windows service finds endpoint no problem. any appreciated... code host service in winforms app. _myservicehost = new servicehost(typeof(myservice); _myservicehost.addserviceendpoint ( typeof (imyservice), new netnamedpipebinding(), @"net.pipe://localhost/myservice" ); _myservicehost.open(); code client proxy... _servicefactory = new channelfactory<imyservice> ( new netnamedpipebinding(), "net.pipe://localhost/myservice" ); ... imyservice clientproxy = _servicefactory.createchannel(); clientproxy.somemethod(); this problem appear to security context in windows services run ...

powershell - An example of using the 'from' and 'data' keywords? -

thanks this article, able come script sorts , displays keywords powershell provides: $bindingflags = [system.reflection.bindingflags]::nonpublic -bor [system.reflection.bindingflags]::static -bor [system.reflection.bindingflags]::getfield $keywordtokenreader = [system.type]::gettype("system.management.automation.keywordtokenreader") $keywords = $keywordtokenreader.invokemember("_keywordtokens", $bindingflags, $null, $null, $null) $keywords.getenumerator() | sort-object -property name i looking @ list , understand class , define , using , var reserved keywords, out of curiosity, have example using from , data keywords? can't seem find anything. thanks edit use of from keyword results in this: ps h:\> 'from' keyword not supported in version of language. @ line:1 char:1 the topic about_language_keywords useful. the topic about_data_sections explains data keyword, run: help about_data_sections as fro...

sql - Individual indexes vs multiple field indexes -

currently have table use track inivitations. have email field indexed have 3 optional keys user can specify when adding new record emails. don't allow duplicates have query if email plus optional keys exists. keys added select statement if specified. normal case email specified , using index works quickly. when keys added performance drops. would adding 3 indexes affect performance other operations? keys used infrequently wouldn't want impact performance case. email, key1 email, key1, key2 email, key1, key2, key3 the other idea add 1 key. email, key1, key2, key3 then use 3 keys in lookup (eg. key1 = mykey , key2 null , key3 null) see also exact duplicate post personally recommend approach. try method single index covers everything, if recall correctly still perform if query on first of included columns. once have index in place, run index advisor. then try other route , repeat. it depends on data. i typically have been able 1 covering i...

c++ - Is there a way to detect when all child items within a QTreeWidgetItem have been marked 'hidden'? -

is there preferred way detect when of qtreewidgetitem 's children marked hidden? currently, i'm iterating on of them every time of them hidden. keep counter of hidden items , change value of counter if item changed state of hidden-ness. each time use information not iterate on items!

ASP.NET MVC ready for business applications (integrating 3rd party controls/components)? -

my company has developed (and still continues develope) large asp.net business application. our platform asp.net 2.0 using asp.net ajax. we're extensively using third-party components , webgrids, comboboxes, treeviews, calendar , scheduling controls etc. now, don't know lot of asp.net mvc , i'd know if there is way use these third-party-controls in asp.net mvc model . or vendors have rewrite products in order make them suitable asp.net mvc? if use asp.net control model (that 99,9% of controls written asp.net control vendors), have rewrite controls. how work there in that, different depending of there arhitecture of controls - more ajax use, more posible can change mvc. asp.net ajax control toolkit exsample can work mvc. can see how in video on www.asp.net: http://www.asp.net/learn/mvc-videos/video-373.aspx

Silverlight control to group other controls together for data binding -

is there control in silverlight group controls data binding. instance, have person object , want display fname, lname, age, height, etc. in textblocks. there control can use group these textblock controls , set itemsource on control similar how set itemsource on datagrid , bind each column? group textblocks in layout control , bind control's datacontext person. if not explicitly set, each textblock's context relative parent. <usercontrol datacontext=""> <usercontrol.datacontext> <someviewmodel /> </usercontrol.datacontext> <grid datacontext="{binding theperson}"> <textblock text="{binding fname}"/> <textblock text="{binding lname}"/> <textblock text="{binding age}"/> <textblock text="{binding height}"/> </grid> </usercontrol> view model class... public class someviewmodel { ...

PHP: preg_match_all - Couldn't write a working RegEx -

i have example string \try tester234 want find word (partially digits) (regex => (\w|\d) ) after \try . var_dump($match) outputs that: array 0 => array empty 1 => array empty preg_match_all('/^\\try ((\d|\w)*)/i', "\try tester", $match); what doing wrong? you need 4 backslashes insert literal 1 in regular expression: preg_match_all('/^\\\\block ((\d|\w)*)/i', "\block tester", $match); which maybe better written this: preg_match_all('/^\\\\block (\w+)/i', "\block tester", $match);

c# - Specifying A DateTime, Double PointPairList? -

i want graph data date vs value. problem don't know how make pointpairlist accept datetime values , double values. what version of framework using. if it's .net 4 can use tuple: var datapoints = new list<tuple<datetime, double>>(); if using earlier framework version, can instead create simple class hold data points: public class datapoint { public datetime datetime { get; set; } public double value { get; set; } } ...and use instead: var datapoints = new list<datapoint>();

flex - Making DateTimeAxis with weekly labels set ticks on an arbitrary day of the week -

i'm using cartesianchart datetimeaxis display weekly data in flex application. when set dataunits="weeks" , labelunits="weeks" on datetimeaxis, automatically places each major tick on sunday. however, provide users option of beginning week on sunday or monday. how can ask datetimeaxis instead place major ticks on monday (or other day of week)? for example, if user looking @ total sum of on week, , requests weeks start on sunday, series data like: x: date(july 11, 2010) y: 25 x: date(july 18, 2010) y: 30 x: date(july 25, 2010) y: 32 etc. if weeks start on monday, series data instead like: x: date(july 12, 2010) y: 22 x: date(july 19, 2010) y: 33 x: date(july 26, 2010) y: 29 etc. with second data set, major ticks still on july 11, july 18, july 25, etc. bars shifted off-center major ticks. thanks! i looked @ code of datetimeaxis class , i'm sure can't want. if "alignlabelstounits" property set true (default) labels ...

c# - .NET Web Service & BackgroundWorker threads -

i'm trying async stuff in webservice method. let have following api call: http://www.example.com/api.asmx and method called getproducts() . i getproducts methods, stuff (eg. data database) before return result, want async stuff (eg. send me email). so did. [webmethod(description = "bal blah blah.")] public ilist<product> getproducts() { // blah blah blah .. // data db .. hi db! // var mydata = ....... // moar clbuttic blahs :) (yes, google clbuttic if don't know is) // ok .. send me email no particular reason, prove async stuff works. var myobject = new myobject(); myobject.senddataasync(); // ok, return result. return mydata; } } public class trackingcode { public void senddataasync() { var backgroundworker = new backgroundworker(); backgroundworker.dowork += backgroundworker_dowork; backgroundworker.runworkerasync(); //system.threading.thread.sleep(1000 * 20); }...

I'm about to open source a C++ project on Sourceforge. Can I get some tips on code organization? -

i'm upload project i've been working on onto sourceforge under gpl, , hoping advice on how organize code in fashion easy understand , use developers might @ it, works git, , way sourceforge presents things. my projects cross-platform c++ application, , consists of following: a library portion, actual work a separate gui portion, uses library portion open source libraries, include paths needed compile library modified open source libraries, have been altered, , hence in sense direct part of project well compiled output of of libraries what's best way organize this? while working on myself, project root have this: /libportion /guiportion /libs/open source libraries /libs/modified open source libraries /libs/compiled/ hold compiled libraries, including when compiling windows aren't open source libraries, such cygwin library files is sensible way organize things? match conventions , expectations? when checking in project, make sense check in open ...

memory management - How can I get the size of an array from a pointer in C? -

i've allocated "array" of mystruct of size n this: if (null == (p = calloc(sizeof(struct mystruct) * n,1))) { /* handle error */ } later on, have access p , , no longer have n . there way determine length of array given pointer p ? i figure must possible, since free(p) that. know malloc() keeps track of how memory has allocated, , that's why knows length; perhaps there way query information? like... int length = askmalloclibraryhowmuchmemorywasalloced(p) / sizeof(mystruct) i know should rework code know n , i'd rather not if possible. ideas? no, there no way information without depending on implementation details of malloc . in particular, malloc may allocate more bytes request (e.g. efficiency in particular memory architecture). better redesign code keep track of n explicitly. alternative at least redesign , more dangerous approach (given it's non-standard, abuses semantics of pointers, , maintenance nightmare come after you): ...

c++ - How to convert (not necessarily programmatically) between Windows' wchar_t and GCC/Linux one? -

suppose have windows wchar_t string: l"\x4f60\x597d" and l"\x00e4\x00a0\x597d" and convert (not programmatically; one-time thing) gcc/linux wchar_t format, utf-32 afaik. how do it? (a general explanation nice, example based on concrete case helpful well) please don't direct me character conversion sites. convert l"\x(something)" form , not "end character" form. one of used libraries character conversion icu library http://icu-project.org/ e.g. used boost http://www.boost.org/ libraries.

keyboard - Set global hotkey with Python 2.6 -

i wanna setup global hotkey in python 2.6 listens keyboard shortcut ctrl + d or ctrl + alt + d on windows, please me tim golden's python/win32 site useful resource win32 related programming in python. in particular, example should help: catch system-wide hotkeys

sql - MySQL Query - SELECT (average of a category) AS "CATEGORY AVERAGE" -

objective: when user browses particular seller, display average along average of sellers similar category easy comparison. example data: seller | category | qty | sales -------------------------------------------- harry | mango | 100 | 50000 john | apple | 75 | 50500 max | mango | 44 | 20000 ash | mango | 60 | 35000 lingo | apple | 88 | 60000 required output: (when user browses ash) quantity sold ash: 60 average quantity sold other mango sellers: 68 (avg of 100, 44 & 60) average price of ash: 583.33 (35000 / 60) average price of other mango sellers: 514.70 (weighted average of prices) skeleton code: select 'qty' 'qty', (some code) 'avg qty', ('sales' / 'qty') 'price', (some code) 'avg price' 'sales table' 'seller' = 'ash' use: select yt.qty, x.cat_avg, yt.sales/yt.qty avg_price, ...

linux - How to programmatically set custom folder icon in GNOME? -

because know simple api call handles setting custom folder icons in windows, looked api method set custom folder icons in linux. but in this thread , saw there no such way. learnt each desktop environment has own way set custom folder icons. way of kde described there. for gnome looked similar way; no file created when setting folder's icon properties panel. think there should registry-like file in somewhere in user home or /etc. i glad, if kill pain. thanks. i figured out how this! here's python script works in standard gnome environment: #!/usr/bin/env python import sys gi.repository import gio if len(sys.argv) not in (2, 3): print 'usage: {} folder [icon]'.format(sys.argv[0]) print 'leave out icon unset' sys.exit(0) folder = gio.file.new_for_path(sys.argv[1]) icon_file = gio.file.new_for_path(sys.argv[2]) if len(sys.argv) == 3 else none # file info object info = folder.query_info('metadata::custom-icon', 0, none) ...

visual studio 2005 - How to suppress compiler warning for specific function in VS2005 (VB.Net) -

i have class inherits base class , implements following... public function compareto(byval obj object) integer implements system.icomparable.compareto now base class inherits implements system.icomparable.compareto i'm getting following compiler warning: warning: 'system.icomparable.compareto' implemented base class. re-implementation of function assumed. i'm fine question how can suppress warning function (i.e. not such warnings). clarifications: here link error on msdn. i've tried both shadows , overrides , neither eliminates warning. the warning isn't on method (unless shadows or overrides omitted), rather it's on "implements system.icomparable.compareto" specifically. i not looking suppress warnings of type (if crop up), one. solution: hoping use system.diagnostics.codeanalysis.suppressmessage attribute or c#'s #pragma looks there's no way suppress warning single line. there way turn message off project...

sql - How to create an MySQL query alias? -

for example use this select * tab1; every 5 minutes. is there way set alias p can do p instead , query executed? this calls view , in case isn't shorter: create view p select * tab1; you'd use as: select * p it more interesting more complex queries though.

php - How can I extract the title and description of a TED.com video? -

i have project need add many many videos, of ted.com videos. there easy way can perform ajax, json, or curl request obtain information? information not seem in embed object. the site has rss feed contains lot of information, covering last 112 lectures. example, list direct links videos this: $url = 'http://feeds.feedburner.com/tedtalks_video'; $sxml = new simplexmlelement(file_get_contents($url)); foreach ($sxml->xpath('//item') $item) { $video_link = $item->enclosure->attributes()->url; echo date('y-m-d', strtotime($item->pubdate)) . '<br />' . $item->title . '<br />' . $item->description . '<br />' . '<a href="' . $video_link . '">' . $video_link . '</a><br />' . '------------------<br />'; }