Posts

Showing posts from February, 2013

c++ - How to find a lower bound in a sorted vector -

i'm pretty new c++ , not understand concepts of stl library, bear me. wrote following code snippet (pasted below) find lower_bound in sorted vector. although code works fine in release mode, asserts in debug mode (vstudio-8). believe because less_equal<int> not strictly weak ordering . from following thread: stl ordering - strict weak ordering i sort of understand weak ordering imposed stl, i'm still not clear why? in case below need use less_equal<int> since i'm trying find nearest element given value in sorted vector. is code snippet below valid? also, there better way it? insights/references weak , partial ordering helpful. int main() { vector<int> dest; for(int = 0;i <6;i++) { dest.push_back(i); } vector<int>::iterator = std::lower_bound(dest.begin(),dest.end(),4,less_equal< int >()); return 1; } the stl uses strict weak orderings because given swe (let's denote < ), can define

include - Where does autoconf's AC_CHECK_HEADERS verify the header files? -

i having trouble compiling 1 of open source libraries (libopekele openid lib). the problem don't have sudo access on system need compile this. ran configure. complained of missing htmltidy lib. installed htmltidy @ non-standard path /home/geekgod (as dont have access /usr , /usr/local) now problem how make configure script of libopekele pick the headers /home/geekgod/include. poking configure.ac script of libopkele, it using ac_check_headers search tidy.h or tidy/tidy.h pretty sure looking these @ standard location (/usr/include) how add /home/geekgod standard include dir try this: ./configure cppflags=-i/home/geekgod/include --prefix=... --etc

css float - Css positioning columns -

i'm trying make simple css framework allows me switch layouts sidebar-content, sidebar-sidebar-content etc.. problem i'm facing sidebar-content-sidebar layout. html code looks like <div class="content"> <h2>content</h2> </div> <div class="sidebar-alt"> <h2>sidebar-alt</h2> </div> <div class="sidebar"> <h2>sidebar</h2> </div> i've tried using floats can't seem content div in centre of 2 sidebars. using bit of css able achieve it body.sidebar-content-sidebar #container.width-960 .content { width: 460px; position: relative; left: 160px; top: 55px; } body.sidebar-content-sidebar #container.width-960 .sidebar { width: 300px; margin: 0 0 0 0; position: absolute; top: 55px; left: 639px; } body.sidebar-content-sidebar #container.width-960 .sidebar-alt { width: 140px; margin: 0 0 0 0; position: absolute; top: 55

c# - advice on displaying graphs and charts -

seeking advice: i in visual studio 2008 asp c# environment , present charts/graphs users. looking free solution displying charts/graphs based on data ms database. some of products thought of : cacti,ganglia,fusion(not free) if possible please note advantage/disadvantage of recommended way go. thanks behrouz have looked @ microsoft's free chart controls ? it's built in framework 4.0 , available as separate download framework 3.5.

Error:Unable to resolve target 'android-2' -

[2011-02-10 00:14:34 - newproject] unable resolve target 'android-2' and newproject java , xml files does't have error project in error when import problem in it problem not in java or xml code. have change target in default.properties file in project. here have change following line: target=android-2 here digit 2 represents api level of platform want run application. so use value of api want run. like if run application on android 2.3 use target=android-9 refer : api levels

google play - Procedure for licensing Android market -

on android compatibility page stated that: once you've built compatible device, may wish include android market provide users access third-party app ecosystem. unfortunately, variety of legal , business reasons, aren't able automatically license android market compatible devices. inquire access android market, can contact us. does know actual procedure android market on own device, assuming cdd followed , cts passed. hear have experience on licensing android market? also, hear google has relaxed restrictions on licensing android market after version 2.3, cannot find sources supporting statement. have additional information on this? thanks it's easy, on page linked (http://source.android.com/compatibility/index.html), there's contact link on left side. find contacts information @ http://source.android.com/compatibility/contact-us.html good luck!

how to create a vertical calendar in php -

how create calendar in php.. vertical, mean dates of month 1 after another.. 1 row contain 1 date of month.. there 4 column.one column contain date of month , other 3 columns 3 different rooms (each room show availability status-booked or not against specific date particular month..) trying not able create this.. help/suggestion/link appreciated.. thanks.. at first, need number of days current month $num_days = date('t', mktime(0, 0, 0, $desired_month, 1, $desired_year)); for explanation see php manual: date next step be, go through days , create 4 columns ($index = 1; $index <= $num_days; $index++) { echo "<tr><td>" . $index . "." . $desired_month . "." . $desired_year . "</td> <td>col2</td><td>col3</td><td>col4</td></tr>"; } this should serve need.

opengl - How to create viewer for JT 3D file format -

i want create viewer can view/render jt file format. know there 1 viewer available jt2go want create 1 own, jt2go not open source. my requirement not high , don't require features jt2go has, want render 3d file, no layering or selecting of individual components required. plane viewer. start getting spec at: http://www.plm.automation.siemens.com/en_us/images/jt_v95_file_format_reference_rev-a_tcm1023-111987.pdf and write library read file. spec looks big straight forward implement. think should possible access elements of file without keeping whole datastructure in memory. when programming viewer part, don't use opengl directly, use scene graph library. (openscenegraph first 1 pops mind)

Custom SharePoint Designer (SPD) workflow activity sentence not visible in SPD -

i created custom workflow activity (action) sharepoint designer. deployed assembly gac, added entry in web.config file , created .actions file in 12hive (sub)folder. when open spd , create new workflow can see workflow action when select "sentence" not shown. checked cannot find i'm doing wrong. highly appreciated! download sourcecode , config-files here i found answer this! updating wrong web.config file; needed update 1 sits on port 80. for me here: \inetpub\wwwroot\wss\virtualdirectories\80 i udpating 1 here: \program files\common files\microsoft shared\web server extensions\12\config not sure why picked one; maybe because nearby templates , other stuff editing. found answer here: http://social.msdn.microsoft.com/forums/en/sharepointworkflow/thread/4e7a77f4-c29b-47b2-a1de-79470f0bb1c9 (hate steal credit :-p)

ios4 - How to save .jpg image as .png or .jpeg in iphone -

i saving images in doc dir..i dont have problem .png or .jpeg images.i able display them in iphone.but coming .jpg,i not able display.please me in this.thanks in advance +(void)downloadimage:(nsstring*)imagepath{ if ([imagepath isequaltostring:@""]) { return; } uiimage *dimage = [[uiimage alloc] initwithdata:[nsdata datawithcontentsofurl:[nsurl urlwithstring:[nsstring stringwithformat:@"http://1xyz/uploads/%@",imagepath]]]]; nsstring *docdir = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]; nslog(@"pathimagepaths:::::::%@",imagepath); nslog(@"path:::::::%@",docdir); nsarray *patharr=[imagepath componentsseparatedbystring:@"."]; nsstring* ext=[nsstring stringwithformat: @"%@",[patharr objectatindex:1]]; nsstring *filepath = [nsstring stringwithformat: [nsstring stringwithformat:@"%@/%@",docdir,imagepath]]; nslog(@"%@/%@",docdir,imagepath); if([ex

objective c - How do I pass arrays of values to SudzC-generated webservice classes? -

i have sudzc service class generated wsdl accepts arrayofint , arrayofstring objects parameters. service method signature this: - (soaprequest*) search: (id <soapdelegate>) handler filters: (nsmutablearray*) displayedattributes: (nsmutablearray*) displayedattributes; my question is, how pass values parameters expect nsmutablearrays? in above method signature, "displayedattributes" parameter expecting arrayofint object (which should populated several integers in int tag, e.g., <int>1</int><int>2</int><int>3</int> etc). however none of these things i've tried have worked: directly passing nsarray/nsmutablearray of (int) objects directly passing nsarray/nsmutablearray of nsnumber objects passing array of strings containing @"1", @"2", @"3" etc passing array of strings contain @"<int>1</int>" , @"<int>2</int>" , etc constructing cxmldocument

php - How to avoid duplicate content? redirect 301/404? -

lets have link: http://www.domain.com/content/view/1/seo-url now, lets user misspeled link - http://www.domain.com/content/view/1/seo-urll now, dont want him 404 page, want redirect him right page right seo url, - dont want create duplicate content (on google's side). what do? header("...."); header("location: righturl"); 303 see other , i'd say. either or canonical url in <meta /> tag. actually i'm in doubt since 302 referred 302 found [elsewhere] : it example of industry practice contradicting standard http/1.0 specification (rfc 1945), required client perform temporary redirect (the original describing phrase "moved temporarily"), popular browsers implemented 303 see other, i.e. changing request type regardless of had been originally. therefore, http/1.1 added status codes 303 , 307 disambiguate between 2 behaviours. ( wiki )

RUBY Programming - Help? -

i'm following guide ruby programming, requires me create new folder use main programming library. i ran problem guide requires right-clicking in folder , select new , new drop window choose option new ruby program. the thing is, after installing ruby , looking on net answers, cannot life of me figure out why option not appear in new section when right clicking create documents etc. can me appear in new menu? just create new text file, , make end in .rb . can write ruby code in file.

c++ - std::atomic | compare_exchange_weak vs. compare_exchange_strong -

i'm still unsure if it's me don't understanding or documentation isn't formulated. following excerpt has been taken newest draft (n3126, section 29.6): bool atomic_compare_exchange_weak(volatile a* object, c * expected, c desired); bool atomic_compare_exchange_weak(a* object, c * expected, c desired); bool atomic_compare_exchange_strong(volatile a* object, c * expected, c desired); bool atomic_compare_exchange_strong(a* object, c * expected, c desired); bool atomic_compare_exchange_weak_explicit(volatile a* object, c * expected, c desired, memory_order success, memory_order failure); bool atomic_compare_exchange_weak_explicit(a* object, c * expected, c desired, memory_order success, memory_order failure); bool atomic_compare_exchange_strong_explicit(volatile a* object, c * expected, c desired, memory_order success, memory_order failure); bool atomic_compare_exchange_strong_explicit(a* object, c * expected, c desired, memory_order success, memory_order failure); bo

jquery countdown get minutes and seconds -

hi able embed countdown timer here but here in "miscellaneous" tab there gettime section. said "periods" array , able pick minutes , seconds "periods[5]" minutes , "periods[6]" form seconds (please see documentation here ). used same code . able fetch data not behaving array. code: var min=10; var sec=30; $('#eachqtimer').countdown({ until: '+' + min + 'm +' + sec + 's', format: 'yowdhms', significant: 2 }); var periods = $('#eachqtimer').countdown('gettimes'); alert(periods); // tried :alert(periods[5]); / alert(periods[5].val()); it showing me out put : 0,0,0,0,0,10,30. on alert box. fine. why unable 5 indexed value ? not executing latter single line of code after line , if use : alert(periods[5].value); getting undefined . add click function. var min = 10; var sec = 30; $('#eachqtimer').countdown({ until: '+' + min + 'm +' + sec + &#

C# XmlSerializer ignores xs:attribute with types other than xs:string -

my problem seems odd , did not find other problem, guess simple , stupid mistake, can't seem find out. i have xsd, generate class structure using xsd.exe. "fill" object values, when serializing xml ignores class-properties not of type string . var mygraph = new graph(); mygraph.mystring = "hallo"; mygraph.myint = 80; var serializer = new xmlserializer(typeof(graph)); textwriter writefilestream = new streamwriter(path.combine(outfolder, outfile)); serializer.serialize(writefilestream, mygraph); writefilestream.close(); i expected: <graph xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" mystring="hallo" myint="80" /> the actual output is: <graph xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" mystring="hallo" /> the attribute myint has been ignored

c++ - Is the value of RAND_MAX always (2^n)-1? -

i'm interested c++, though suspect imports c standard definition. believe answer no standard says, i'm interested in in-practice answer. if rand_max (2^n)-1, simplifies dealing issue turned moving code mingw gcc linux gcc. rand_max seems bigger (i didn't check, possibly equal int_max or whatever symbol is), old naively written rand_max-isn't-big-enough-so-work-around-it code backfired. need decide how general need library be, considering fiddliness of writing code copes correctly possibility of overflow without making assumptions e.g. width of int. anyway, there reasonably used c++ compilers use other (2^n)-1 rand_max? also, correct ((rand_max | (rand_max >> 1)) == rand_max) , true if rand_max equal ((2^n)-1) unsigned integer n. believe rand_max technically int, makes no sense have negative or fractional value, think can safely discount those. bit-fiddling doesn't bother me, keep thinking expression looks wrong, , can't figure out why. finally,

networking - How force windows XP to only send traffic via chosen VPN -

we using vpn's in our network , encounter following problem: when vpn crashes during connection remote host applications automatically send subsequent requests host directly (using internet connection given computer have) avoid situation. ie: if vpn crashes windows should prevent applications sending traffic on , wait vpn reconnect. we can't switch off internet connection given computer because it's needed connect vpn in first place. help please :) now i'm bad @ windows-related questions , haven't used ages, me seems routing problem. try setting routing table on pcs without default route, add route vpn gateway via default router on local network. way vpn gateway can reached outside local network. once vpn up, should configure default route via vpn interface.

asp.net - refresh update panel at certain interval -

how can trigger update panel refresh after period of time. you can use asp.net ajax timer control in order fire event after period of time. checkout video asp.net official website find out how use timer: http://www.asp.net/ajax/videos/how-do-i-use-the-aspnet-ajax-timer-control

asp.net mvc - Defining inline row style in System.Web.Helpers.WebGrid -

i moving application mvc 3 , try use system.web.helpers.webgrid. html code like: <table> <tr style="background-color: <%= item.color %>"> </tr> <tr style="background-color: <%= item.color %>"> </tr> <tr style="background-color: <%= item.color %>"> </tr> </table> there rowstyle property, allows define css class every row, there different style every row. achieveable easily? so had finish hack. first, include color part of column. had returned mvchtmlstring avoid additional encoding: <% var grid = new webgrid(model); %> <%= grid.gethtml( tablestyle: "table_class", columns: grid.columns( grid.column("importance", ctres.importance, (item) => new mvchtmlstring(html.encode(item.importance) + "<div class='color' style='display: no

php - jquery ajax post - not working first time page loads -

i have ajax/jquery code in 1 of pages , problem i'm having doesn't work first time page loaded. if refresh page works no prob. work in firefox first time. variables i'm using ok i've alerted them out. don't success or error message. justr doesn't appear anything? any ideas? $('.window .request').click(function (e) { var itm = document.getelementbyid('txtitm').value; var qty = document.getelementbyid('txtqty').value; var msg = document.getelementbyid('txtmessage').value; var op_id = document.getelementbyid('txtop_id').value; $.ajax({ type: "post", url: "do_request.php?msg="+msg+"&itm="+itm+"&qty="+qty+"&op_id="+op_id, contenttype: "application/json; charset=utf-8", datatype: "json", success: function (msg) { document.getelementbyid('div_main').style.display='none';

SQL 2005 get data from file -

i have data in simple txt file, trying query (to put in table) when use select * openrowset('msdasql', 'driver={microsoft text driver (*.txt; *.csv)};defaultdir=c:\db\;extensions=txt;', 'select * data.txt '); i rows null because (i think) there no field terminator , in utf-16le format, in txt fields know character count, example: field1field2field3field4field5field6 field1field2field3field4field5field6 field1field2field3field4field5field6 field1field2field3field4field5field6 to make things worse, the file in utf-16le need in utf-8 (or change format within sql 2005) openrowset work and when use select * openrowset ( bulk 'c:\db\data.txt', single_nclob) binfile i data in single row :( thanks in advance ps: used sp_addlinkedserver , didnt work have tried use bulk insert this? bulk insert dbo.mytable 'c:\temp\myfile.txt' ( fieldterminator = ',') msdn bulk insert syntax

ipad - Loading a new UIView over the rootUIView on UIButton click from UIPopovercontroller -

my application simple , not using splitview controller. question .. how can load new uiview on root view controller on uibutton click popovercontroller view. you'll need have root view controller first dismiss popover when button pressed in popover , can present new view root view controller. for details on how dismissal of popover using button inside popver, see previous answer "how setup popover views dismiss properly" . the main idea is: to dismiss popover manually, you'll need keep reference it. place in view controller shows popover. to have button inside content view controller tell original view controller (that presented popover) dismiss popover, 2 of possible ways delegate+protocol or nsnotificationcenter. in previous answer, presenterviewcontroller root view controller (the 1 presents popover). the difference in case in contentfooviewcontrollerdone method (which put in root view controller): - (void)cont

php - Wordpress custom loop problem -

i using events manager in wordpress. i have display current month events in home page, using below code. get_row(“select * chip_em_events event_category_id=’2′ , event_id=’4′”, array_a); echo “”; echo “$row2[event_name]“; echo “$row2[event_notes]“; ?> i can on event_name , event_notes id=”4″ need display events under event_category_id=’2′ current month. in query, ask "and event_id=’4′", if want other ids, don't ask specific 1 ;)

xcode - How to get this app into my iPhone (Ad Hoc) -

i have iphone app have developed want have ad hoc testers use. have file "xx.ipa" , "xx.mobileprovision" in directory on imac, has been uploaded private website. it built xcode, have of provisioning profiles downloaded (dev, dist , ad hoc). my tester tells me won't load, want load on iphone (it 1 of "devices", iphone other), can see wrong , fix it. how do this? drop both of files onto itunes , sync. long device syncing listed in provisioning profile, there should no issues. if trying test ad hoc installation, same. remove build installed xcode during development though.

android - Not possible to click a Button -

i'm having weird issue button being shown on screen, can't click. not onclick event not firing, seems physically not react clicks, if had transparent layer on top of it. the main activity built on: public class musiclist extends activity implements onclicklistener { ... @override public void oncreate(bundle bundle) { super.oncreate(bundle); setcontentview(r.layout.mymusic); this.mytabhost = (tabhost)this.findviewbyid(r.id.th_set_menu_tabhost); this.mytabhost.setup(); tabspec ts = mytabhost.newtabspec("tab_tag_1"); ts.setindicator("media item",getresources().getdrawable(r.drawable.music)); ts.setcontent(r.id.media_item_tab); try { relativelayout = (relativelayout) mytabhost.findviewbyid(android.r.id.tabcontent).findviewbyid(r.id.media_item_tab); } catch (nullpointerexception e) { log.e(this.getclass().getsimplename(),"

c# - Encrypt from server, decrypt on client (but not encrypt on client)? -

is there way server can provide encrypted string can decrypted on client, not re-encrypted on client? know seems kind of backwards... here's need is. i have software key needs activated against our remote server. server needs provide client says "you active" , contain info such date it's valid until, how many licenses, etc. however, need prevent being tampered increase license count or dates (i.e, re-encrypt value new date using key found in de-compiled binary or w/e). is such thing possible using public/private keys? or perhaps hashes? edit alternatively, can server provide hash client can validate server without giving client ability spoof or generate hash on it's own? thanks in advance. public/private key encryption should need. hashes 1 way functions; hash function make impossible retrieve original value. in case, server has public/private key pair , client has public/private key pair. server's public key embedded client, , server

Where are the Java preferences stored in Windows 7? -

we use java preferences in of our apps , haven't noticed since utility makes calls old , written in windows xp days. seems java preferences no longer stored in registry in windows 7 - or stored somewhere different. i'm expecting in: hkey_local_machine\software\javasoft\prefs but don't see there. what makes wierder, when run app: public static void main( final string[] args ) throws backingstoreexception { preferences systemroot = preferences.systemroot(); preferences preferences = systemroot.node( "com/mycompany/settings" ); systemroot.put( "foo", "bar" ); systemroot.put( "baz", "lolz" ); system.out.println( "-------------------------------" ); string[] keys = preferences.keys(); for( string key : keys ) { system.out.println( key ); } system.out.println( "-------------------------------" ); keys = systemroot.keys(); for( string key : k

jsp - Can you package a WebFilter into a library -

and if how do it?. yes sounds last question. , same problem. have @javax.servlet.annotation.webfilter works fine when packaged directly war. move filter in library. if won't called more. any pitfalls have out or plain impossible? set <web-app metadata-complete="false"> . this means metadata web application not limited particular xml (and classes of webapp), can use metadata 3rd party libraries. also take @ "web fragments". can define web-fragment.xml in meta-inf of jar, , map servlets , filters there. take @ demo .

visual studio - VSX - Is it possible to edit a already defined command/toolbar/funcionality? -

is possible extend visual studio 2008/2010 add options "pending window" toolwindow team foundation server? as in check-in | shelve unshelve | my feature | workspace: foobar thanks in advance yes, possible place command anywhere in visual studio menu system. see my answer similar question how can this.

Sending message to viewController in Tab Based Application (iphone iOS) -

i have method called getcurrentcycle in 1 of viewcontrollers use in tab based application. call method applicationdidbecomeactive app delegate method. can me out this? check out nsnotification class reference . in controller has getcurrentcycle method, add following: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(getcurrentcycle:) name:@"getcurrentcycle" object:nil]; when want call getcurrentcycle , add this: [[nsnotificationcenter defaultcenter] postnotificationname:@"getcurrentcycle" object:nil]; also, need change getcurrentcycle to: - (void)getcurrentcycle:(nsnotification *)notification

sql server - I am learning SQL and work for a school system -

my quest 1 line per employmentassignment row if staff member has multiple rows in employment table. (include fields existing staffmember view come person, identity, employmentassignment, school , department. include new field alias "districtstart" reporting person's earliest employment.startdate.) question exam , can not figure out how make pull 1 assignment. have , says correct but... pulling more 1 assignment. keep me banging head against wall anymore. select p.personid, p.stateid, p.staffnumber, p.staffstateid, i.identityid, i.effectivedate, i.lastname, i.firstname, i.middlename, i.suffix, i.alias, i.gender, i.birthdate, i.ssn, i.raceethnicity, ea.assignmentid, ea.startdate, min(e.startdate) districtstart, ea.enddate, ea.title, ea.type, ea.teache, ea.specialed, ea.behavior, ea.health, ea.advisor, ea.supervisor, ea.foodservic

c# - K-Nearest Neighbor in Image Recognition -

i researching projects or guide/tutorial research. have determine 3 leaf different species , using 100 samples each(300 specific), professor requires me imply k-nearest neighbor algorithm in classifying uploaded image in system using 100 samples uploaded in database reference. i have done uploading of samples , image processing system, still have apply knn algorithm in classifying them, suggestions or step-by-step tutorials? is there need study in coding algorithm or there existing libraries applying knn in image classifying in c# language ? , having 100 image samples each leaf specie enough? more info.: reply martijin_himself's answer yes, talking tree leaves. well, problem is, feature consider tree leaf's shape. neglecting other features such color, size,..etc. , don't know when or how extract these "feature vectors", put them , how image samples used reference leaf classified about image processing part of system, image undergoes process of b

c# - Adding Delay in application (for debugging) -

i'd add delay between 2 lines of code because i'm testing updateprogress template. ideally, one-liner. thanks. try sleep method. example: thread.sleep(3000); //3 seconds you need add using directive: using system.threading; to access method. the parameter pass number of milliseconds want suspend current thread.

database - Foreign Key from tables that exists in two different DBs on the same server -

in sybase, possible create a foreign key table in archive database reference table in main database? can assume databases both running on same sybase server. yes. see "using cross-database referential integrity constraints" in http://manuals.sybase.com/

jquery event handler: div becomes visible/hidden -

i have div , i'd have event handler listen when becomes visible , hidden. how do that? thanks. you can use callback parameter in show() , hide() methods this: $('#mydiv').show(0, ondivshow); $('#mydiv').hide(0, ondivhide); function ondivshow() { //your code here } function ondivhide() { //your code here } see working example here: http://jsfiddle.net/n7unu/

How do you use weak linking in an iPhone application? -

how weak link frameworks when developing iphone? once you've weak-linked framework, how use classes , methods may not present on os versions? what want use weak linking for? a common use use class defined in newer version of sdk. framework exists on older systems, class defined in framework doesn't. if case use nsclassfromstring(). if returns nil, class doesn't exist, otherwise return class object can used. this recommended way according apple in document:

How to rotate excel data -

this general question popped head have wondered. there have been several times when i've needed rotate data in excel, example: starting with: | | b | c | ---------------------- 1 | abc | def | ghi | ---------------------- 2 | omg | lol | xyz | ---------------------- 3 | | | | ---------------------- transform into: | | b | c | ---------------------- 1 | abc | omg | | ---------------------- 2 | def | lol | | ---------------------- 3 | ghi | xyz | | ---------------------- i have never found reasonable way this. solutions can think of right are: write macro (yuck) manually copy / paste (yuck) maybe pivot table magic? (i doubt possible) clever formulas using index are there other solutions, maybe hidden built-in feature? use of transpose() function

android - Can't get my ListView items to be highlighted when they are selected -

i have app hits rest service, gets json , places listview. main activity extends activity , not listactivity. can scroll through list items, cannot select (at least touch). listview through findviewbyid , have adapter extends simpleadapter. have set convertview inside adapter's getview() clickable. when this, can no longer click on list items in listview? did wrong? public class app extends activity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); jobslistview = (listview) findviewbyid(r.id.jobs_list); jobslistview.setadapter(new jobitemadapter(jobslistview.getcontext(), jobslist, r.layout.list_item, new string[] {"title","location"}, new int[] {r.id.job_title, r.id.job_location})); jobslistview.setonitemclicklistener(new adapterview.onitemclicklistener() { @overrid

perl and mysql, creating dynamic tables -

i wondering if there example coding create dynamic tables x columns? worried column names having funny characters. regards, gordon i guess want escape these characters in table names. use quote_identifier dbi method

php - Different outputs from mysql -

i have 2 sql query outputs table , orders.. one sql order directly table , data showing right, last first. when try same way show data but, time use post method, when click submit data being shown, time showup begin first last query . why that.the mysql simple . select * smt order smtorde you append way want mysql sort ordered asc or desc // ascending select * smt order smtorde asc // descending select * smt order smtorde desc

nginx - Rails Routing w/ Passenger - How to get passenger to pay attention to root route? -

i have root route setup in app, works fine on local webrick server. (localhost:3000/ brings home page). on nginx/passenger server, though, it's looking inside public folder, , not paying attention route have setup redirect root - instead i'm getting not-found error. any appreciated.

validation - JavaScript return false not stopping form submission -

we've got code has been working time. it's button submits html form, unless nearby textbox empty. i've taken snippet directly our code; i've changed contents of fields, haven't deleted anything. <input type="image" name="inputname" id="inputid" src="someimage" alt="alttext" onclick=" javascript:var obj = document.all ? document.all[&quot;atextinputformfieldid&quot;] : document.getelementbyid(&quot;atextinputformfieldid&quot;); if(obj.value.length == 0) { alert('it 0!'); return false; };" style="somestyle" /> (the original code on 1 line, linebreaks have been added here clarity). it seems work in firefox. in ie, fails in way can't understand: if input field (atextinputformfieldid) empty, puts alert, submits form anyway after user clicks okay button on

svn - Subversion - Branching / Merging -

i have basic grasp of branching , merging in svn. branch, whatever, merge trunk. do have merge trunk? my scenario: i have small applications in asp.net mvc2, using linq sql. mvc3 out, i'm gonna either upgrade mvc3 or redo scratch (using ef 4). in either case, next "version" going different have now. i'm wondering how should handle svn part. should put in svn branch of current repository (/svn/project/trunk/mvc3) or should start new repository(/svn/project_mvc3/trunk). keep in same repository. source code history doesn't respect “versions” (releases) humans. once app reaches routine maintenance period in life cycle it's usual scenario create branch for maintenance of stable version, , keep developing upcoming version in trunk . generally, every time make public release, should make branch.

exe - Does a C# console app run under current user account? -

before open big mouth , default way console app works in c# wanted few of folks opinion. essentially, have c# console app create folder full of files byte streams. pretty simple. want have write directly shared drive few people have read/write privilages. i think long kick of exe while logged in as privelaged user copy share drive. unfortunately, want information without creating folder , share first. sigh b/c have been easy test blasted thing. to answer question in title of question, yes, c# console app runs under whatever account run as. note, should able right click on executable , click "run as" or "run administrator" instead of logging on user. i hope i'm not missing point of question.

javascript - jqmodal, trying to display modal on click with text from php file -

first time user of jqmodal here , trying display modal when click button. however, text want put on modal in php file, in href attribute. how can information in php file modal when click button? i lost here, great. let's say: .json (button) /folder/file.php (php file) thank help! http://dev.iceburg.net/jquery/jqmodal/#examples example 2

html - Blackberry Webworks (Widget) JavaScript & XML/JSON Help -

here scenario... builing blackberry webworks (widget) used portal remote website. of pages remote. user customizable homepage users can add information , links. the way in using jde have xml properties file add/edit/remote nodes desired information , everytime app run process file. however, webworks app work, need accomplish via adding information html page. i believe need via javascript, have little javascript experience , less blackberry api experience. so looking beginning end example of how load saved properties file either xml or json via javascript can dynamically build homepage of widget. in addition, looking examples of how add/edit/remove xml or json objects config file via javascript well. i have searched , searched, not sure if on right track or not, have had no luck. have seen examples of how edit xml in microsoft/mozilla broswers, not sure if same or not... if looking confirmation. basically here outline of head tells me needs happen... <html> ... &

C# how to lock the file -

we using application reads file , inserts database. reason, set creation time particular time. , when create file application picks file before change creation time. there anyway can lock file until change creation time. the error getting @ file.setcreationtime file being used other process or file archived. //copy signal file s = filepath + "s"; news = targetfullpath2 + "s"; file.copy(s, news, true); // //new creation ts dtfilecreation = file.getcreationtime(s); //retain creation time file.setcreationtime(news, dtfilecreation); please advice. the common solution create file (and set timestamp) in different directory or under different name first, , move or rename when it’s ready other process can pick up. move/rename atomic operation on ntfs (unless of course move files between separate partitions). for example: s = filepath + "s"; news = targetfullpath2 + "s"; file.copy(s, news + "_", true); // add _ other pr

oop - Anyone knows a good implementation of file size as a value object in PHP? -

in project came across lot of references disk or file sizes(in bytes, kilo, mega etc) though candidate value object money or quantity. wonder if has ever done before in php. thanks. you can use zend_measure_binary ... $measure = new zend_measure_binary($size, zend_measure_binary::byte); $size = $measure->convertto(zend_measure_binary::megabyte);

c - Bug in OS X 10.5 malloc? -

i'm writing program in c. have 2 main development machines, both macs. 1 running os x 10.5 , 32bit machine, other running os x 10.6 , 64 bits. program works fine when compiled , run on 64bit machine. however, when compile exact same program on 32bit machine runs while , crashes somewhere inside malloc . here's backtrace: program received signal exc_bad_access, not access memory. reason: kern_invalid_address @ address: 0xeeb40fe0 0x9036d598 in small_malloc_from_free_list () (gdb) bt #0 0x9036d598 in small_malloc_from_free_list () #1 0x90365286 in szone_malloc () #2 0x903650b8 in malloc_zone_malloc () #3 0x9036504c in malloc () #4 0x0000b14c in xmalloc (s=2048) @ common.h:185 ... xmalloc custom wrapper calls exit if malloc returns null , it's not running out of memory. if link same code -ltcmalloc works fine, suspect it's bug somewhere inside os x 10.5's default allocator. may program causing memory corruption somewhere , tcmalloc somehow do

How do I display a simple text box in objective-c/cocoa? -

i display box containing text user while code continues run , close box @ later time. nsrunalertpanel open , close later. pseudo-code: opentextbox *box = opentextbox("please wait.") various commands [box close] i wonder if you're asking wrong question. if want show ui says "please wait", typical mac os x way progress indicator. see "progress indicators" and/or nsprogressindicator reference -- can display both bar fills blue , gear spins around. if think need show modal dialog, @ "sheet programming topics" .

inversion of control - Setting ASP.NET MVC ControllerFactory has no effect -

i'm trying have asp.net mvc2 controllers built using structuremap asp.net doesn't seem remember i've called controllerbuilder.current.setcontrollerfactory in global.asax file. specifically error controller has no parameterless constructor. stack trace reveals custom controllerfactory never executed. here call method should tell asp.net controllerfactory use: sub application_start() registerroutes(routetable.routes) controllerbuilder.current.setcontrollerfactory(gettype(structuremapcontrollerfactory)) bootstrapper.registerdependencies() end sub and here's exception receive. [targetinvocationexception: exception has been thrown target of invocation.] system.runtimetypehandle.createinstance(runtimetype type, boolean publiconly, boolean nocheck, boolean& canbecached, runtimemethodhandle& ctor, boolean& bneedsecuritycheck) +0 system.runtimetype.createinstanceslow(boolean publiconly, boolean fillcache) +86 system.runtimetype.c

homescreen - How to increase icons size on Android Home Screen? -

i trying make changes default android home screen (like changing cell dimensions, number of elements per row etc) , wondering if there way can change apps icon sizes placed on home screen? i know platform takes care of picking right dimension image ldpi (36x36), mdpi (48x48) or hdpi (72x72) directory based on screen density, know if there way increase icon sizes when application icons put on home screen irrespective of screen density? unless write own homescreen launcher or use existing 1 goolge play, there's "no way" resize icons. well, "no way" not mean impossible: as said, can write your own launcher discussed in stackoverflow. you can resize elements on home screen, these elements appwidgets . since api level 14 can resized , user can - in limits - change size. widgets not shortcuts launching icons.

php - What is the easiest/most secure way to allow admins to become other users -

i have control panel allows admins enter in search criteria user moderation purposes. afraid admit on here due backlashing surely receive, on page admins can users passwords, can sign in them moderation purposes. before tear me new one, let me finished hashing everyones password sha1 , unique salt! that being said. want allow admins able "become" user or login user choose. i looking easiest secure method on how this. please let me know information may need me able better answer question. thanks in advance. i did when designed high school site. allowed staff "proxy" in user. however, enter username, , emulate session user. never access password @ point. i had $user object , $session object. $user stored active user, , $session stored actual logged in user. normally, same, if user proxied in user, $user->username not equal $session->username , allow me display banner said "you proxied in user, resume session, click here"

browser - Enable Javascript for local files in VBA WebBrowser Control -

i find rather perplexing ie7 enables javascript default on internet zone, disables local html files [my computer zone] (the internet more secure local computer?), anyway... i have application in vba using webbrowser control open local html file (say, file:///c:\somefile.html) has javascript in it. i'd javascript executed. there way (from vba code) force browser allow javascript? (taking consideration it's disabled default) it ideal if wouldn't have rely on registry editing of sorts, or tell user of application change internet explorer settings. i've tried setting localhost webserver , serving file there. works since ie considers internet zone, i'd if didn't have try coding webserver vba either. system windows xp ie7. thanks okay, not "true" solution, enough needs. 1 can use webbrowser.document.parentwindow.execscript function inject javascript page. guess may possible implement similar prototype's evalscripts function her

c++ - What data structure can you use to store elements dynamically and access them efficiently? -

what data structure can use store elements dynamically , access them efficiently?this interview question. should answer std::list (i mean in c++)? or others? as follow-up question, complexity of finding element in linked list in worst case? thank opinions. first question hash table. putting , getting elements using hash table o(1) in average case. linked list have worse case of storing in o(n) , worse case of access in o(n). array has worse case of storing o(1) , worse case of access in o(1). linked list can grow dynamically fast, array need allocate new , bigger array, , copy existing element on achieve dynamically growing capability. for question 2, complexity of finding element in linked list o(n) since have iterate through elements in list in worse case (consider case element not in list).

Add text to every line in text file using PowerShell -

i'd add characters end of every line of text in .txt document. #define variables $a = c:\foobar.txt $b = get-content $a #define functions function append-text { foreach-object { add "*" } } #process code $b | append-text something that. essentially, load given text file, add "*" the end of every single line of text in text file, save , close. soemthing should work: function append-text { process{ foreach-object {$_ + "*"} } }

iis 7 - Troubleshooting 404 WCF Service error -

i've upgraded asp.net application .net framework 3.5 4.0. application includes wcf service , after upgrade it's returning 404 error. the error message below: server error in '/' application. -------------------------------------------------------------------------------- resource cannot found. description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable. please review following url , make sure spelled correctly. requested url: /ws/providerservice.svc -------------------------------------------------------------------------------- version information: microsoft .net framework version:2.0.50727.42; asp.net version:2.0.50727.42 the web.config has <error statuscode="404" redirect="common/pages/404b.htm"/> and should redirecting 404's custom page. if try access non existent .asmx service correctly redirects 404b.htm page. it looks .net framework 4.0 isn&#

jquery selectors - fetch links using the value -

in jquery, how can links value user% (ie) user23 & user 24 in example. <tbody> <tr> <td class="box6b"> <a href="mytestpage.htm#79391606">79391606</a> </td> <td class="box2b"> <a href="mytestpage.htm#79391606">user23</a> </td> </tr> </tbody> <tbody> <tr> <td class="boxt7b"> <a href="mytestpage.htm#79391607">79391607</a> </td> <td class="box2b"> <a href="mytestpage.htm#79391607">user24</a> </td> </tr> </tbody> .. depending on trying do, this: $('a:contains("user")')

uiview - ipad programming question -

how add uitableview uiview contain uitextboxes , uibutton and initialize data any suggestion please i have found easier add additional views uitableviewcontroller rather nest uitableview inside view. i use uitableviewstylegrouped , provide customised uiview within uitableviewdelegate for; - (uiview *) tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section - (uiview *) tableview:(uitableview *)tableview viewforfooterinsection:(nsinteger)section

java - Why does Eclipse showing errors when I load my workspace on a different computer? -

i have eclipse compiler saved , booting portable hdd it's workspace. working on assignment @ school , had leave. saved work , checked make sure on drive. disconnected drive , left. i'm home, load workspace , has errors everywhere. import codes showing errors. does know or have idea what's going on , how fix it? loading , running portable hdd actual computer shouldn't have it. assignment due , need have fixed asap. thanks in advance assistance. could drive registering different labels on different computers (eg g: on 1 , h: on other)? maybe there hard coded paths causing problems.

Split function not working in UNIX -

i'm trying run split on file filename has spaces in it. i can't seem work. have following source_file="test file.txt" split -l 100 $source_file now i've tried enclosing $source_file in " no luck: split -l 100 "\""$source_file"\"" or even split -l 100 '"'$source_file'"' i'm still getting: usage: split [-l line_count] [-a suffix_length] [file [name]] or: split -b number[k|m] [-a suffix_length] [file [name]] you're trying hard! single set of double quotes suffice: split -l 100 "$source_file" you want arguments split this: -l 100 test file.txt the commands trying both yield these arguments: -l 100 "test file.txt" as in, equivalent incorrect command: split -l 100 '"test' 'file.txt"'

php - PHP5 SOAP : how to keep an instance? -

i'm playing around soap , php. can't figure out why returned object seems not keep instance. let me show first example code , explain: client.php : $client = new soapclient("http://myhost/remote.wsdl"); try { if($client->login("root","toor")) { echo $client->gettotal()."\n"; } } catch (soapfault $exception) { echo $exception; } server.php : class remote { private $auth = false; public function login($user, $pass) { if($user == "root" && $pass == "toor") { $this->auth = true; return true; } else throw new soapfault("server","access denied '$user'."); } public function gettotal() { if($this->auth) { return rand(1000,9999); } else throw new soapfault("server","error: not authorized."); } } $server = new soapserver("remote.wsdl"); $server->setclass(&qu

php - Zend Session Fatal error -

i'm having following zend session error zend project: fatal error: uncaught exception 'zend_session_exception' message 'zend_session::start() - /home/besthomes/public_html/zend/session.php(line:426): error #2 session_start() [<a href='function.session-start'>function.session-start</a>]: cannot send session cache limiter - headers sent (output started @ /home/besthomes/public_html/zend/exception.php:1) array' in /home/besthomes/public_html/zend/session.php:432 stack trace: #0 /home/besthomes/public_html/index.php(47): zend_session::start() #1 {main} thrown in /home/besthomes/public_html/zend/session.php on line 432 i have wrote code in bootstrap file: include('include.php'); include "zend/loader.php"; zend_loader::registerautoload(); zend_session::start(); i couldn't know reason error. please out of problem. thanks. check if don't have additional characters in files. example - code won't trigger

php - Looping through a drop down, how to select value? -

when displaying form on page user edit information, , form consists of drop down box, how loop through selections in dropdown box select predefined mysql entry? for example users country: australia how go searching through list of countries ie: http://snipplr.com/view/4792/country-drop-down-list-for-web-forms/ make: <option value="au">australia</option> become <option value="au" selected="selected">australia</option> you like: <?php $countries = array('au' => 'australia', 'af' => 'afghanistan', ...); $selected = 'au'; foreach ($countries $code => $label) { echo '<option value="' . $code . '"'; if ($selected == $code) { echo ' selected="selected"'; } echo '>' . $label . '</option>'; } ?> not prettiest idea. shakti suggests, it's easier maintain if val

javascript - How do i provide new line between two tab using tabber class -

Image
hii all, new javascript , don't know tabber class ,i have page tabs in 2 differnet line attached system property page tabs in 2 different line . <div class="tabber"> <div class="tabbertab"> <h2>tab1</h2> form stuff goes here... </div> <div class="tabbertab"> <h2>tab2</h2> form stuff goes here </div> <div class="tabbertab ${tab_default}"> <h2>tab3</h2> form stuff goes here submit button here... </div> suppose these 2 tabs come 2 different line... you'll need use code support such feature, quick jquery has several plugins: http://plugins.jquery.com/plugin-tags/tabcontrol for example this one have "vertical" tabs you'

cocoa - Autoscroll problen -

1.create cocoa application (not document-based) 2.create new class "stretchview"(subclass nsview) 3.open interface builder , drag "scroll view" main window 4.choose "scroll view" , set class "stretchview" (in class identity window) the size of contentview 500*500 , size of strechview 500*500 (horizontal scroll enabled). then start draw numbers(1,2,3,4......) horizontally 1 after other. when number out of ranger(the x pos larger 500) increase width of stretchview. (everything works fine till point) then tried make horizontal scroller automatically scroll end everytime increase width of stretchview last number coulde seen. here's code: //the timer called every sec -(void)mytimeraction:(nstimer *) timer { nslog(@"mytimeraction"); //...... int = _myarray.count; nsrect rect = [self frame]; int width = rect.size.width; //the width between 2 number 10 //when x pos of current num