Posts

Showing posts from August, 2015

Linux C - Get Lock Keys Status' -

how 1 find out status of lock keys on linux (2.6.x), using c? (i have crappy keyboard without led's stuff, , need write x11 app this) if such app exists ( and de agnostic - run e16), i'd hear well. you can use led addon gkrellm. if want develop own app, can gkrellm-led sources (ubuntu). and, of course, can go xkbvleds (source) . anyway, can use xkbgetindicatorstate read indicators keyboard.

Installing weborb for rails - permission denied -

i'm trying install weborb rails on windows xp, rails 2.3.8 i type in project directory: ruby script plugin install http://themidnightcoders.net:8089/svn/weborb , error: ruby: permission denied -- script (load error) any ideas out there? in advance. sorry guys, must have been long day. didn't realize until after posting , reading few times left "/" out between script , plugin. wow...

questions on copying SQL Server database -

subquestioning [2] while copying resource.mdf [1], noticed that: 1) possible copy resource.mdf without stopping sql server instance (i attached 1 having copied running instance , works after attaching) . 1a) should understand general possibility read-only databases or in versions (mine 2008 r2 on windows xp pro sp3)? 1b) conceptually, cannot understand why developing (dev ed) sql server on isolated/workgroup desktop windows (in case - xp pro sp3) should stopped in order copy user-defined non-used (for ex., sample database) database. 1c) when 1 should copy .ldf .mdf file , when copying .ldf can skipped? why read-only database have (transaction log? understood) file ldf? 2) resource.mdf (in sql server 2008 r2 on default unnamed instance, windows xp pro sp3) in %programfiles%\microsoft sql server\mssql10_50.mssqlserver\mssql\binn\ and not in %programfiles%\microsoft sql server\mssql10.sql2008\mssql\binn\ [2] i curious - location differing due sql serv...

sql server - import data using ssis? -

trying set import form live database our development database. i trying using ssis, import failing because of constraints. e.g. have following tables: * customers * products * orderlines * orders importing customers , products fine, because not depend on anything. when importing orderlines fails because order not yet created. how change order of how ssis imports tables? or maybe i'm not supposed use foreign key constraints? it sounds have foreign key constraints. want load orders table before load orderlines table. i'm assuming have single ssis package contains 1 data flow task each target table. need create connection between data flow loads orders , data flow loads orderlines. connection called precedence constraint. select orders data flow , should see green arrow. click , drag arrow orderlines task. creates precedence constraint indicates orders data flow must complete before orderlines dataflow can start.

c# - Multiple messages in one BeginReceive -

if client sends multiple messages server on same socket, endreceive on server side keep messages seperated, or possible the server receive partial messages 2 seperate sends in single beginreceive? assuming tcp, there're no message boundaries on socket. 1 send might consumed multiple receives , other way around, , partially. treat tcp socket stream. either send fixed-size messages know how many bytes read, or embed message size message (preferably @ beginning of message) can find out go. edit: to answer questions in comment - it's not "ms os" that's doing - it's tcp/ip stacks on both sides of connection. bytes written socket buffered inside kernel , sent on wire when network stack thinks it's best time (in-kernel timeout up, output queue reached tcp window size, etc. - it's in details of how tcp works). tcp (but not udp) kernel not keep track of application write boundaries, of how many bytes there send, how many have been ack-ed, etc. ...

c# - How to obtain the current time differences between two timezones -

i want calculate current time differences between us/central timezone , british summer time. mean, these both timezones have daylight savings going on, have 6 hours time difference. after sunday october 31 2010, daylight savings off british summer time, @ moment there 5 hours time differences between these 2 timezones. is there way can calculate these varying time differences? you can create 2 datetime object different timezones, example: creating datetime in specific time zone in c# fx 3.5 and calculate delta between them.

iphone - Is there any control that can show photos like "Photos" in iOS? -

does ios have control show photos photos application? i'd control manage albums, photos, show album list, , show photos, built-in photos, or facebook app. you can download latest sample code photoscroller contains similar implementation of photos app. here swipe & individual photo zoom has been implemented both orientations using uiscrollviews , catiledlayer. it doesn't contain thumbnail view code it's relatively easy create using simple uiscrollview coding. , per comment of jesse naugher, can use three20 static library written joe hewitt. scrolling madness relatively easy use both of above mentioned. another library on github - fgallery-iphone

ssas - Microsoft Analysis Services Resources -

can recommend primer on analysis services? website or book recommendations appreciated the chapters on analysis services of programming microsoft sql server 2008 lobel-brust-forte http://www.amazon.com/programming-microsoft-server-2008-pro-developer/dp/0735625999/ref=sr_1_1?ie=utf8&qid=1286428641&sr=8-1 useful when starting on subject, it's readable, simple, starting point.

Can someone explain this JavaScript mystery? -

i writing simple recursive function in javascript , encountered weird behavior. @ first thought it's bug in browser, tried in firefox, chrome , ie9 , behave same way. the html file below runs simple js function on page load. function recursive (calling once). function creates new array object , returns it. weird thing after function calls recursively, x , y reference same object, far understand should not happen. if uncomment last line before return x , alert "x == y" alert not shown. <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>javascript weirdness...</title> <script type="text/javascript" language="javascript"> function recursivef(n) { x = [ n ]; if (n > 0) { y = recursivef(n - 1); if (x == y) alert('x == y'); } //if (n == 0) return [ n ]; return x; } </script> </head><body...

mapreduce - Map-Reduce count number of documents in each minute MongoDB -

Image
i have mongodb collection has created_at stored in each document. these stored mongodb date object e.g. { "_id" : "4cacda7eed607e095201df00", "created_at" : "wed oct 06 2010 21:22:23 gmt+0100 (bst)", text: "something" } { "_id" : "4cacdf31ed607e0952031b70", "created_at" : "wed oct 06 2010 21:23:42 gmt+0100 (bst)", text: "something" } .... i count number of items created between each minute, can pass data google charts generate this: how do map reduce function, or there fancy mongodb aggregate function use instead? map function should emit timestamp object, adjusted minute, , count of 1. reduce function should sum counts: map = function() { var created_at_minute = new date(this.created_at.getfullyear(), this.created_at.getmonth(), this.created_at.getdate(), ...

Oracle Data Archiving & Purging -

can please tell me tech should use archiving & purging historic data. as justin said in comment broad question. broad answer use oracle partitioning . in general allow treat subsets of data ddl (truncating, moving, or dropping partitions) instead of more resource-intensive dml.

update in Eclipse with CVS recursively! -

i'm trying run update on project in eclipse cvs. when choosing: team -> update it executes following command: cvs update -l -d -p "/xxx/www" "/xxx/www" i want update recursively, -l option should removed. problem is, don't know how. i'm using extssh , it's not possible set options in: team -> cvs -> ext connection method where remove -l option?

Access 2003 - Capitalize first letter using queries -

hi how can capitalize first letter , other letters in lower case? need using queries own access . example, if have stored countries: spain, france, italy, ....i want change them to: spain, italy, france,.... thanks in advance solution update country set co= strconv ([co], 3) have @ ms access: strconv function

asp.net mvc 2 - How can we Route something like {calendar}/{controller}/{action}/{id} -

as beginner in mvc i'm trying figure out what's best way accomplish route needs, , i'm getting no luck @ all , i'm kindly ask help my webapp driven calendars , , per each calendar there bunch of actions subscribe edit calendar view winners daily challenge etc... and avoid passing like mydomain.com/calendar/2 my idea hide id no 1 can have logical access other calendars , example mydomain.com/q2tst where q2tst 10 char random generated string , i have routes such as: mydomain.com/q2tst/subscribe mydomain.com/q2tst/daily-challenge mydomain.com/q2tst/winners mydomain.com/q2tst/prizes how set route perform this? something like: routes.maproute( "calendarroute", "{calendar}/{controller}/{action}/{id}", new { calendar = "empty", controller = "frontend", action = "index", id = urlparameter.optional } ); but calendar ? pick up can convert id ...

Unable to re-define a function in my javascript object -

i have object defined using literal notation follows (example code used). in external script file. if (rf == null) var rf = {}; rf.example= { ondosomething: function () { alert('original definition');} , method1 : function(){ rf.example.ondosomething(); } } in .aspx page have following .. $(document).ready(function () { rf.example.ondosomething = function(){ alert('new definition'); }; rf.example.method1(); }); when page loads document.ready called alert('original definition'); ever shown. can point me in right direction. want redefine ondosomething function. thanks, ben. edit thanks comments, can see working. matter method1 calling method takes ondosomething() function callback parameter? e.g. method1 : function(){ rf.example2.callbackfunction(function() {rf.example.ondosomething();}); } your code quoted should work (and does: http://jsbin.com/uguva4 ), other what's in questi...

c# - correct code for sending an email, asp.net -

i have form allows user send email on mailing list (linq table). i'm having trouble correct code , syntax linking smtp server. using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.web.profile; using system.web.security; using system.web.mail; using system.configuration; using system.web.configuration; using system.net.configuration; using system.net.mail; public partial class massemail : system.web.ui.page { protected void page_load(object sender, eventargs e) { } protected void button1_click(object sender, eventargs e) { mailinglistclassdatacontext class = new mailinglistclassdatacontext(); var emaillist = emails in class.mailinglistmembers select emails.email; foreach (var subcriber in emaillist) { mailmessage objmail = new mailmessage(); objmail.from = "test@test.com"; ...

c# - How to test a directory path that matches a specific pattern/regex? -

i have following test aims ensure file path generated of specific format. using nunit's fluent interfaces, how can go this? i having trouble regex. [test] public void assetcontrolpath_shouldhaveformat_basedir_yyyy_mmm_yyyymmmdd() { //arrange var basedir = "c:\\basedir"; var fpbuilder = new filepathbuilder(new datetime(2010,10,10), basedir ); //act var destinationpath = fpbuilder.assetcontrolpath(); //assert // destinationpath = c:\basdir\2010\oct\20101010 assert.that(destinationpath, is.stringmatching(@"c:\\basedir\\d{4}\\[a-za-z]{3}\\d{8}")); } the unit test error xxx.filepathbuildertests.assetcontrolpath_shouldhaveformat_basedir_yyyy_mmm_yyyymmmdd: expected: string matching "c:\\basedir\\d{4}\\[a-za-z]{3}\\d{8}" was: "c:\basedir\2010\oct\20101010" edit: have switched test use @chrisf's approach. question still stands. @...

c# 4.0 - how to get url of the current page in c# (it has # symbol inside) -

how full url using c#? example of url-yes has # symbol http://domain.com/dude#hello i've tried can't #hello. ideas? i've used link no luck http://www.cambiaresearch.com/c4/dfdb20ae-b335-48ae-a201-f2a5a8329342/how-do-i-get-paths-and-url-fragments-from-the-httprequest-object.aspx url fragments purely client-side thing. they're not supposed used on server side, why they're not passed through - not usable anyway.

What is the different between stringvariable != NullValue.String and !string.IsNullOrEmpty(stringvariable) in asp.net? -

is there different between stringvariable != nullvalue.string , !string.isnullorempty(stringvariable) in asp.net ? best ? the first tests string isn't "". as strings can null (because references) test fail. by using isnullorempty wrapping: if (string != null && string.length > 0) in 1 test.

xslt - xml not showing in Browser -

below input xml : <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="value-of.xsl"?> <memeberdetails> <employee> <name>madhu</name> <sex>male</sex> <dob>2/10/1982</dob> <address>jp nagar ,bangalore</address> <memberid>094631</memberid> <designation>sse</designation> <department>sg</department> </employee> </memeberdetails> where, referring value-of.xsl file using href in above xml. , file residing in same folder. below value-of.xslt file: <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:output indent="yes"/> <xsl:template match="/"> <cgiemplo...

function - Difference between returns and printing in python? -

this question has answer here: how returning output of function different printing it? 4 answers in python don't seem understanding return function. why use when print it? def maximum(x, y): if x > y: print(x) elif x == y: print('the numbers equal') else: print(y) maximum(2, 3) this code gives me 3 . using return same exact thing. def maximum(x, y): if x > y: return x elif x == y: return 'the numbers equal' else: return y print(maximum(2, 3)) so what's difference between two? sorry mega noob question! the point return not function. control flow construct (like if else constructs). lets "take data between function calls". break down print : gives value user output string. print(3) give string '3' screen user view. progr...

boost::python: howto call a function that expects a pointer? -

i have function takes int-pointer , exposed via boost::python. how can call function python? in c++ boost::python: void foo(int* i); ... def("foo", foo); in python: import foo_ext = 12 foo_ext.foo(i) results in traceback (most recent call last): file "<stdin>", line 1, in <module> boost.python.argumenterror: python argument types in foo(int) did not match c++ signature: foo(int* i) so how pass pointer? short answer is : can't. python not have pointers long answer is: there assorted workarounds depending on use-case. i notice using int , int* in example. int (along float, str, , bool) special case because immutable in python. lets object passing in not int. have wrapper function takes argument reference, takes address , passes on actual function. work seamlessly in python. ok, int. have problem. can not change int passed in. if try same solution, boost::python complain l-values @ runtime. there still several ...

jquery - IE document.ready() not triggered after ajax request -

document.ready() not triggered after ajax request in ie work charm in ff , chrome. have 2 files. first file(test.jsp) has submit button. onclick loads struts second file(result.jsp). . 2 files test.jsp <html> <head> <script type="text/javascript" src="/js/jquery-1.2.6.min.js"/></script> <script type="text/javascript" src="/js/api.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#test").click(function() { var path = "/testajax.do" $.get(path,function(data) { document.write(data); }); }); }); </script> </head> <body> <div><h3>hello world</h3><br/> <input type="button" id="test" value="submit"/> </div> </body> </html> result.jsp <html> <head> <script type="tex...

optimization - How to list directories faster? -

i have few situations need list files recursively, implementations have been slow. have directory structure 92784 files. find lists files in less 0.5 seconds, haskell implementation lot slower. my first implementation took bit on 9 seconds complete, next version bit on 5 seconds , i'm down bit less 2 seconds. listfilesr :: filepath -> io [filepath] listfilesr path = let isdodd "." = false isdodd ".." = false isdodd _ = true in allfiles <- getdirectorycontents path dirs <- form allfiles $ \d -> if isdodd d let p = path </> d isdir <- doesdirectoryexist p if isdir listfilesr p else return [d] else return [] return $ concat dirs the test takes 100 megabytes of memory (+rts -s), , program spends around 40% in gc. i thinking of doing listing in writert monad sequence monoid prevent concats , list creation. helps? else should do? edit: have edited function...

wpf - BitmapSource.CopyPixels -what's a good value for stride? -

i'm trying pixel data wpf bitmapsource object. understand, can accomplished calling copypixels method. method needs stride parameter, don't know how obtain. far know, stride value that's used when stepping in array during reading or copying. appropriate stride value bitmapsource? you can use stride = pixel_size * image_width value. example, rgba bitmap 100 pixel width, stride = 400. some applications may require special line alignment. example, windows gdi bitmaps require 32-bits line alignment. in case, rgb bitmap width = 33, stride value 33*3=99 should changed 100, have 32-bits line alignment in destination array. generally, should know destination array requirements. in there no special requirements, use default pixel_size * image_width.

linux - Can wget be used to get all the files on a server? -

can wget used files on server.suppose if directory structure using django framework on site foo.com and if directory structure /web/project1 /web/project2 /web/project3 /web/project4 /web/templates without knowing name of directories of /project1,project2.....is possible download files you use wget -r -np http://www.foo.com/pool/main/z/ -r (fetch files/folders recursively) -np (do not descent parent directory when retrieving recursively) or wget -nh --cut-dirs=2 -r -np http://www.foo.com/pool/main/z/ --cut-dirs (it makes wget not "see" number remote directory components) -nh (invoking wget -r http://fly.srk.fer.hr/ create structure of directories beginning fly.srk.fer.hr/. option disables such behavior.)

android - min height fill_parent and height wrap_content in ScrollView? (or just the email app compose layout's code) -

question if have following: <scrollview android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout android:layout_width="fill_parent" android:layout_height="?" android:orientation="vertical"> <edittext android:layout_width="fill_parent" android:layout_height="?" android:hint="subject" android:id="@+id/subject" /> <edittext android:layout_width="fill_parent" android:layout_height="?" android:id="@+id/body" /> </linearlayout> </scrollview> how can body (second edittext) fill rest of screen, still have scrollview kick in when contents of body long? height="wrap_content" , minheight="fill_parent" layout_height="fill_parent" seems not if put them in scrollview a working example of want email app compose window i tried this , edittext elemen...

iPhone Browser simulator for Windows? -

note: question simulating browser on iphone, not simulating whole device. know iphone-device simulation not possible on windows, discussed @ length here . i have web site looks weird when viewed on iphone - sort of css issue. the same issue not occur when view site in safari windows (or other windows browser matter). so, there iphone browser simulators run on windows? i.e. render site in same way iphone browser does. bonus points if there's way of inspecting css in detail, chrome's 'inspect element' developer feature. edit: curious, rendering problem i'm trying solve described here: css background image rendering differently on iphone you can simulate iphone user agent in safari 5 if set developers menu item in preferences>advanced. webkit engine in safari 5 similar iphone's browser of html 5 stuff works same. bonus developer's tab allows debug javascript , css (not supported).

Drag a label from a view to a window in iphone? -

i trying implement feel drag , drop of label in iphone.i able drag , drop inside single view.but if try to drag label view view added on window, label goes below second view(added window).but want drag label on second view(added window).how can achieve this? please me out.thanks. instead of having label , second view subviews of window, make them both subviews of view add window. within view, [self bringsubviewtofront: label];

php - Can I use the Facebook graph api to get user's friends profiles pictures? -

i'm new facebook development, after testing adobe api in flash game decided test using graph api communicating flash game. after doing basic stuff connecting , getting user's data, wondering if it's posible user's friends profile pcitures, can pass them uiloaders inside flash game , show them. if can point me examples of basic actions use facebook graph api, invite friends or posting wall example, wonderful. thanks. update: using nathan's suggestion tried friends , worked: $friends= $facebook->api('/me/friends?token='.$session['access_token']); var_dump($friends); then tried friend's pictures with: foreach ($friends['data'] $friend) { $picture= $facebook->api('/'.$friend['id'].'/photo'); } but didn't work. idea ? thanks. you first have list of friends https://graph.facebook.com/me/friends?access_token= ... each of friends can request http://graph.facebook.co...

Android: How to hook into Eclipse Build Project? -

i run custom shell script upon clicking build project in eclipse. tried modifying "compile" section in build.xml, script not getting run. invoking ant debug on commandline works, however. you needn't involve ant unless want to. somewhere in menus there thing builders. add 1 , customize it. gives typical ide run-external-command type capability assorted variables project path, name, etc can use in constructing command line. note: while answer intended state general approach rather specifics, user149408 suggests @ least in eclipse versions, achieved navigating menus project > properties , choosing builders .

Flex + custom component + design-time + binding -

i'm trying create simple custom component 2 labels mxml: <mx:canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="250" height="30"> <mx:string id="result" /> <mx:label x="5" y="7" id="titlelabel" text="{label}" width="120"/> <mx:label x="125" y="7" id="resultlabel" text="{result}" width="120" textalign="right" color="#a41d00"/> </mx:canvas> it working @ runtime, bud have troubles making working @ design-time. how can make databinding work @ design time? if impossible, how should code label text assignements? try text={data.label} , text={data.result} instead of mere label , result .

java - How to run a .class file that is in another directory -

my question how run .class java file in directory using exec() or processbuilder class. works if .class file in same directory (as java program). problem solved guys replies... :) solution i've used string path = "d:\work"; //path program execute string program = "test"; //my program name processbuilder pb = new processbuilder("java","-classpath",path, program);

Why do I get "version (5.12.2) doesn't match executable version" with Perl's PAR? -

when run following create executable out of perl script: pp -o process_target_mode_data process_target_mode_data.pl i following error output: perl lib version (5.12.2) doesn't match executable version (v5.12.0) @ /home/neil/activeperl-5.12/lib/config.pm line 50. compilation failed in require @ /home/neil/activeperl-5.12/lib/errno.pm line 8. begin failed--compilation aborted @ /home/neil/activeperl-5.12/lib/errno.pm line 8. compilation failed in require @ /home/neil/activeperl-5.12/lib/file/temp.pm line 148. begin failed--compilation aborted @ /home/neil/activeperl-5.12/lib/file/temp.pm line 148. compilation failed in require @ /home/neil/activeperl-5.12/lib/archive/zip.pm line 14. begin failed--compilation aborted @ /home/neil/activeperl-5.12/lib/archive/zip.pm line 14. compilation failed in require @ -e line 459. /home/neil/activeperl-5.12/site/bin/pp: failed extract parl 'par::strippedparl::static' file 'parlenrp2xi' @ /home/neil/activeperl-5.12/site/...

performance - Deleting data in a sql server table takes much time -

i have table has more 380 million records. have stored procedure which: deletes records. insert something. the total procedure takes around 30 minutes execute. out of delete takes 28 minutes. delete simple statement, along these lines: delete condition_1 , condition_2 , condition_3 can me? firstly have @ indexing , query..it should in first place not take 28 mins ? it maybe worth taking @ database tuning , query optimization ...maybe can try delete records incrementally..something suggested here ..

MySQL, Using a Subquery to get Rank of Score -

i trying find out particular player ranks among shooting guards in nba. using this post on stackoverflow guide. i error "invalid use of group function". select first, last, team, pos, sum(points) scoresum, round(avg(points), 2) avgpoints, (select count(*) nbaboxscore bpnb (bpnb.first, bpnb.last, sum(bpnb.points)) >= (bpn.first, bpn.last, sum(bpn.points))) rank nbaboxscore bpn bpn.pos = 'sg' , bpn.date >= '2009-10-01' , first = 'joe' , last = 'johnson' group bpn.first, bpn.last, bpn.team order scoresum desc i'm not sure if it's possible way? your subquery wrong, cannot use sum without group by , in where , have use having . let check : http://dev.mysql.com/doc/refman/5.0/fr/select.html

iphone - UIDatePicker & NSDateFormatter returning incorrect date -

i have allready tryed solutions few posts, no luck. problem i'm facing whit time zones. both on device , simulator uidatepicker , nsdateformatter returning incorrect dates, adding or substracting difference gmt 0, selected date (according current time zone set on device or mac). i have allready tried setting locale , time zone nothing worked. idea wellcomed! thanks. (haven't posted code sample because both initialized without setting properties right now.) update 1: here code snippet: datepicker = [[uidatepicker alloc] initwithframe:cgrectmake(0.0, frame.size.height - 216.0, frame.size.width, 216.0)]; [self addsubview:datepicker]; .... nsdateformatter *formatter = [[nsdateformatter alloc] init]; [formatter setdateformat:@"eee, mmm d, y h:mma"]; nsstring *datestring = [formatter stringfromdate:datepicker.date]; [formatter release]; found solution, time zone difference should added in following way. - (nsdate *)dat...

language agnostic - Burstable Output for Long running scripts -

script <?php include('time.php'); //time script echo "first 100 users of so<br/>"; for($i=0; $i<100;$i++){ $contents=file_get_contents("https://stackoverflow.com/privileges/user/".$i); preg_match('!<div class="summarycount al">(.+?)</div>!', $contents, $matches); $rep = $matches[1]; echo "<br/>".$i.") ".$rep."<br/>"; include('timetaken.php'); //script outputs time difference } ?> output first 100 users of 0) 0 2.3584280014038 1) 14,436 4.469074010849 2) 875 10.651238918304 3) 2,431 12.991086959839 4) 8,611 15.451638936996 5) 14,988 17.535580873489 6) 0 19.686461925507 7) 0 21.796992063522 8) 218 23.931365013123 9) 2,569 26.419286966324 10) 101 28.540382862091 11) 232 30.755586862564 12) 0 32.960548877716 13) 33,898 35.163224935532 14) 0 37.280658006668 15) 6,388 39.425274848938 16) 143 41.541421890259 17) 14,366 43.655340909958 18) 0 45.771246910095 19)...

mapreduce - Does CouchDB really split views across servers? -

i'm delving couchdb, , puzzled distribution of map-reduce computations in views. see lot of resources mentioning map-reduce inherently distributed, because can process 1 half of data on server a, other half on server b, , reduce both results. 1 example slide 16 of presentation: http://www.slideshare.net/gabriele.lana/couchdb-vs-mongodb-2982288 this seems logical, but: couchdb not seem provide api dispatching computations several servers. distribution appears provide replication of entire data set other servers (which then, assume, compute own view data). couchdb uses b-tree store view data based on keys generated in map step of view algorithm, precludes appropriate partitioning of documents based on server should on. so, couchdb distribute map-reduce computations @ all? or map-reduce property used merely cache values in b-tree nodes? you looking bigcouch , enables couchdb cluster , uses distributed mapreduce.

Is there any mapping between feature detection and current browsers? -

here's problem. have 3 days update company's javascript browser detection. i'd love take time , implement feature detection that's not feasible in allotted time. i'd best possible solution given constraints. in mind, javascript library identifies browser based on feature detection best solution. example, features a, b, , c work, ie6. there library has taken approach? i know mootools , dojo have properties set, tell browser they're running in. suppose lot of others do, too.

automation - automate installation + running of iphone app in simulator outside of xcode -

i'd install + run app built outside of xcode (through xcodebuild) through similar sort of command line tool. how on simulator? i've looked @ few related posts: where iphone simulator store data? cleaning iphone simulator none of these posts describe uuid is, nor other files in directory. so how replicate xcode's installation + starting app through command line tool?

java - JAX-WS vs SAAJ Style, Which to Use -

what difference, philosophical or otherwise, between calling web service java code using service , dispatch classes, vs soapconnection class? for example, this: soapconnectionfactory scf = soapconnectionfactory.newinstance(); soapconnection soapconnection = scf.createconnection(); soapmessage reply = soapconnection.call(soapmessage, url); vs along these lines? svc = service.create(url, servicename); dispatch<soapmessage> dispatch = svc.createdispatch(portname, soapmessage.class, service.mode.message); soapmessage reply = (soapmessage)dispatch.invoke(soapmessage); what difference between these, , why select 1 approach on other? the following line excerpt java soa cookbook - o'reilly "the soap connection allows send soap message resource @ end of url. convenient use in situation, necessary if service not have defined wsdl. that’s because calling service.create requires passing in location of wsdl. may rare don’t have wsdl soap-based service, happen...

php - Current line-/col-number in phpQuery? -

how can line-/col-number of current element in phpquery? i use phpquery framework validation tool custom errors. thanks! __line__ the above code current line number of php script. far know, there no way character number.

ruby on rails - Accessing controller in Cucumber to test sign-in -

first off - know horrible practice, because cucumber meant test outputs. want 1 veryveryvery specific case. i have app handles user authentication using cookie set app maintain. i'd write simple integration test authentication: given have logged "some_user" on sso server when visit page should logged in "some_user" my current step definition follows: then /^i should logged in "([^"]*)"$/ |username| user = user.find_by_username(username) assert_equal @controller.current_user, user end obviously, failing "undefined method 'current_user' nil:nilclass". in case it's not obvious - applicationcontroller#current_user returns either user logged in or nil. you can visit page logged on user's name displayed. like: when go account page then should see "welcome user" within "div#login"

Special character use in Python 2.6 -

i more bit tired, here goes: i doing tome html scraping in python 2.6.5 beautifulsoap on ubuntubox reason python 2.6.5: beautifulsoap sucks under 3.1 i try run following code: # dataretriveal html files detherm # -*- coding: utf-8 -*- import sys,os,re,csv beautifulsoup import beautifulsoup sys.path.insert(0, os.getcwd()) raw_data = open('download.php.html','r') soup = beautifulsoup(raw_data) numdiv in soup.findall('div', {"id" : "sec"}): currenttable = numdiv.find('table',{"class" : "data"}) if currenttable: numrow=0 numcol=0 data_list=[] row in currenttable.findall('td', {"class" : "datahead"}): numrow=numrow+1 ncol in currenttable.findall('th', {"class" : "datahead"}): numcol=numcol+1 col in currenttable.findall('td'): col2 = ''.join(c...

Linq to SQL Weird Error -

i getting error: could not format node 'column' execution sql when trying make anonymous type: select new { nountypename = nt.name, attributes = ( in nt.nountypeattributes group a.attribute g select new { nountypeid = nt.nountypeid, key = g.key + " (" + g.count() + ")", nountypeattributeid = (from in g select i.nountypeattributeid) .take(1).singleordefault(), count = g.count() } ) }); the problem comes when add nountypeid property in anonymous type. might recommend loading nountypes , nountypeattributes local memory, , shaping? customdatacontext mydc = new customdatacontext(); dataloadoptions myoptions = new dataloadoptions(); myoptions.loadwith<nountype>(nt => nt.nountypeattributes); mydc.loadoptions = myoptions; list<nountype> thenountypes = ( nt in mydc.nountypes //todo filterexp...

silverlight - KeyDown not fired in SketchFlow -

i'm trying add keydown event handler layoutroot of view in silverlight sketchflow project, doesn't seem fire. the event fires if change event type mouseleftbutton, want demonstrate using keyboard-shortcut. does know how accomplish both? well, reasons not obvious uninvited, keydown event did not fire when specified in xaml. found hooking onto the application.current.rootvisual.keydown in code-behind trick.

php - how can show error or warning in the page -

i have site in server. because of settings, no error or warning displaying in page how can change setting, using .htaccess file simple, can add line php so: <?php ini_set('display_errors','on'); ?> or add following lines htaccess: php_flag display_errors on php_flag html_errors on i try stay away modifying htaccess file if part of site in production. hope helps

iphone - Using va_list and getting EXC_BAD_ACCESS -

similar how nslog takes variable argument list, want create own method. i have method declared when try access 'args' variable, exec_bad_access. i'm not doing correctly here? - (void)info:(nsstring *)formatstring, ... { va_list args; va_start(args, formatstring); nslog(@"formatstring value: %@", formatstring); // following line causes exec_bad_access nslog(@"args value: %@", args); // i'm trying do: nslog(formatstring, args); va_end(args); } i following 'va_list in cocoa' section blog: http://cocoawithlove.com/2009/05/variable-argument-lists-in-cocoa.html there couple of mistakes in code. firstly, args cannot printed directly is. reference several arguments, , trying print using nslog("%@") not work. can use nslogv() print (e.g. nslogv(format, args); ) instead. or can do, , use function: void print (nsstring *format, ...) { va_list args; va_start...

sql - Efficient database searching for LIKE '%something%' -

i'm trying search through phone numbers phone number containing series of digits. obviously following going slow: select * customer phone '%1234%' i need wildcards, because users allowed enter data in database, might have country codes, leading 1 (as in 1-800) or trailing extension (which separated space. note: i've created 'cleaned' phone numbers removing non-digit characters, don't have worry dashes, spaces, , like. is there magic search run in reasonable time? if you're using mysql, you're looking full text search functionality http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html it optimizes queries 1 have listed, , pretty darn fast once set up. you'll need data in mysql, , must in myisam table (not innodb or other.) i've used in production , works pretty well.

switch case in python doesn't work; need another pattern -

i need code here, wanted implement switch case pattern in python tutorial said , can use dictionary here problem: # type can either create or update or .. message = { 'create':msg(some_data), 'update':msg(other_data) # can have more } return message(type) but it's not working me because some_data or other_data can none (it raise error if it's none) , msg function need simple (i don't want put condition in it). the problem here function msg() executed in each time filling dict unlike switch case pattern in other programming language don't execute code in case unless it's match. is there other way or need if elif ... update: thank replies, it's more message = { 'create': "blabla %s" % msg(some_data), 'update': "blabla %s" % msg(other_data) 'delete': "blabla %s" % diff(other_data, some_data) } ...

python - Tuple to string -

i have tuple. tst = ([['name', u'bob-21'], ['name', u'john-28']], true) and want convert string.. print tst2 "([['name', u'bob-21'], ['name', u'john-28']], true)" what way this? thanks! tst2 = str(tst) e.g.: >>> tst = ([['name', u'bob-21'], ['name', u'john-28']], true) >>> tst2 = str(tst) >>> print tst2 ([['name', u'bob-21'], ['name', u'john-28']], true) >>> repr(tst2) '"([[\'name\', u\'bob-21\'], [\'name\', u\'john-28\']], true)"'

What is the difference between "Real Types" and "Arithmetic Types" in C? -

the c99 standard describes them so: the integer , real floating types collectively called real types. integer , floating types collectively called arithmetic types. does mean they're same thing in c? or there differences between them? complex types arithmetic types, not real types.

ruby - Sinatra Mongoid String not valid UTF-8 -

i wrote little application : require 'rubygems' require 'sinatra' require 'bson' require 'mongoid' mongoid.configure |config| name = "articles" host = "localhost" config.master = mongo::connection.new.db(name) config.persist_in_safe_mode = false end class article include mongoid::document field :title field :content end '/' @articles = article.all end '/show/:id' @article = article.find(params[:id]) end '/new' haml :new end post '/create' @article = article.new(params['article']) if @article.save redirect '/' else redirect '/new' end end the following error occur when post article content "test d'un article en français" bson::invalidstringencoding @ /create string not valid utf-8 how can fix error ? thanks this known issue ruby 1.9 , sinatra. wait sinatra 1.1 released or use sinatra edge version gi...

arguments - Why does initializing a variable via a python default variable keep state across object instantiation? -

i hit interesting python bug today in instantiating class repeatedly appears holding state. in later instantiation calls variable defined. i boiled down issue following class/shell interaction. realize not best way initialize class variable, sure should not behaving this. true bug or "feature"? :d tester.py: class tester(): def __init__(self): self.mydict = self.test() def test(self,out={}): key = "key" in ['a','b','c','d']: if key in out: out[key] += ','+i else: out[key] = return out python prompt: python 2.6.6 (r266:84292, oct 6 2010, 00:44:09) [gcc 4.2.1 (apple inc. build 5664)] on darwin >>> import tester >>> t = tester.tester() >>> print t.mydict {'key': 'a,b,c,d'} ...

embed short video clips directly in wordpress site -

i'm new working video. put tiny video clips wordpress 3.0 site. each 1 last few seconds , small. they're pronunciation. need way of getting them wordpress page. i'd visitor able click , right away hear pronunciation , see shape of mouth. wouldn't him have go site, or open special video player. want work this: click, 5 seconds of little audio-visual no fanfare, , page way was. if wants play again, fine, should click on again. i'm thinking quick time? software used make test video clip (debut video capture software) produced wmv file. test file 800 kb. maybe need convert other format? running vista. for heck of tried plopping on page upload video button, found in order view video, had save or open, , video clip played in windows media player. not have in mind. thanks! you can embed video in many different easy ways. upload video youtube , copy embedding code blog. if video encoded in flv (or can encode it), use flowplayer clients, i...

c - Double pointers are also sometimes employed to pass pointers to functions by reference -

" double pointers employed pass pointers functions reference " can can explain me above statement, point function reference means ? i believe example makes clearer : //double pointer taken argument void allocate(int** p, int n) { //change value of *p, modification available outside function *p = (int*)malloc(sizeof(int) * n); } int main() { int* p = null; //pass address of pointer allocate(&p,1); //the pointer has been modified point proper memory location //hence statement work *p=10; //free memory allocated free(p); return 0; }

c++ - operator overload -

i working on project trying keep c++ knowledge. anyways, getting many, many errors when try implement operator overload. not sure why. #include "students.h" #include <iostream> #include "quack.h" using namespace std; void main() { quack* classmates = new quack; classmates->pushfront(students("corey", "9081923456", 4.0)); cout << "\noriginal data set -- " << *students; and getting errors operator. oddly enough if comment out overloaded operator , leave in students.cpp compiles find. #ifndef students_h #define students_h #include <iostream> class students { // causing errors friend ostream& operator << (ostream& out,const students& student); public: students(); students(char * name, char* oitid, float gpa); students(const students& student); // copy constructor; ~students(); const students& operator=(const students& student); void getname(char* name) const;...

iphone - NSDate from string...? -

i working on calendar application. in have issues date format.. i conflicting 2 types of date formats.. one -- 02-10-2010 second - 02 oct, 2010 but want these formats same.. any methods convert 1 format second or second first.. searched date string..but cannot understand... check out nsdateformatter .

javascript - Converting String to DOM -

my ajax functions gives me html-elements string back, , string want append in document dom element. something like parentnode.appendchild(responsetext); what best way this. parentnode.innerhtml += responsetext;

java me - How to draw a transparent rectangle? -

how draw transparent rectangle in j2me? transparency supported in immutable images, i.e. images loaded files. can create appropriate image. or create transparency via filling transparency parts background color.

MySQL: Set user variable from result of query -

is possible set user variable based on result of query in mysql? what want achieve (we can assume both user , group unique): set @user = 123456; set @group = select group user user = @user; select * user group = @group; please note know it's possible not wish nested queries. yes, need move variable assignment query: set @user := 123456; select @group := `group` user user = @user; select * user `group` = @group; test case: create table user (`user` int, `group` int); insert user values (123456, 5); insert user values (111111, 5); result: set @user := 123456; select @group := `group` user user = @user; select * user `group` = @group; +--------+-------+ | user | group | +--------+-------+ | 123456 | 5 | | 111111 | 5 | +--------+-------+ 2 rows in set (0.00 sec) note set , either = or := can used assignment operator. inside other statements, assignment operator must := , not = because = treated comparison operator in non-set statements. ...

vb.net - How to open a frmWindow a second time wothout refreshing a grid in the first one? -

i have window grid making select mysql, , using .show() function insted of showdialog() . i can open same window second time have 2 instances of same window. now, when open second instance grid populates new selection in first window. how can make window open second time without refresing grid in again in first one? if creating new instance of same form, based on variable "myform" different locations, in effect going "refresh" both forms. one way around create second variable instance of frmmain in seperate function. (ie... not @ vb @ all, forgive vb programming skills.) in 1 function: dim myform new formmain() myform.show(); in second function dim frmtwo new frmmain() frmtwo.show(); then make calls frmtwo, second form opened. i hope helps.

scripting - Writing to a file through a bash script -

i want write bash script takes 2 arguments, a , b . based on argument, writes in section a or section b of text file. output file txt file this: common content.... section a: <everything should written here when specify option "a"> section b: <everything should written here when specify option "b"> i new bash. #!/bin/bash if [ "$#" -eq 2 ];then seca="$1" secb="$2" elif [ "$#" -eq 1 ];then seca="$1" fi awk -v s1="$seca" -v s2="$secb" ' /section a/ && s1{ $0=$0"\n"s1 while(getline line){ if (line~/section b/) { $0=$0"\n"line;break} } } /section b/ && s2{ $0=$0"\n"s2} 1' file

java - IllegalArgumentException: com.sun.xml.internal.messaging.saaj.soap.LocalStrings != com.sun.xml.messaging.saaj.soap.LocalStrings -

in web-application, contacting web-service (using jax-ws) following error: java.lang.exceptionininitializererror @ com.sun.xml.ws.message.attachmentunmarshallerimpl.<clinit>(attachmentunmarshallerimpl.java:55) @ com.sun.xml.ws.client.sei.responsebuilder$doclit.readresponse(responsebuilder.java:500) @ com.sun.xml.ws.client.sei.syncmethodhandler.invoke(syncmethodhandler.java:242) @ com.sun.xml.ws.client.sei.syncmethodhandler.invoke(syncmethodhandler.java:210) @ com.sun.xml.ws.client.sei.seistub.invoke(seistub.java:103) ... caused by: java.lang.illegalargumentexception: com.sun.xml.internal.messaging.saaj.soap.localstrings != com.sun.xml.messaging.saaj.soap.localstrings @ java.util.logging.logger.getlogger(logger.java:314) @ com.sun.xml.messaging.saaj.soap.attachmentpartimpl.<clinit>(attachmentpartimpl.java:71) ... 189 more this happen on machine, when run application in eclipse... what can source of error? i suspecting oracl...

linq to xml navigate through xml c# -

i have xml , need able read data within. a sample of xml <?xml version="1.0" ?> <consumeleadrequest xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <leadtype>mortgage</leadtype> <leadxml> <ns1:leadassigned xmlns:ns1="http://yaddayadda" xmlns:ns0="http://yaddayadda" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <ns0:lead> <reference>1234</reference> <product> <mnemonic>mortgage</mnemonic> <description>mortgage leads</description> <subtype>other</subtype> </product> <extendedinfo> <mortgage> <mortgagevalue>75000</mortgagevalue> <mortgagevaluelowerbound>1</mortgagevaluelowerbound> <mortgagevalueupperbou...

eclipse - Android installer installs 2 instances? -

the problem have whenever export appto apk, , install on device, or debug in eclipse, 2 instances of app installed(?). 2 icons added menu. how stop happening? i had activity intent set in androidmanifest.xml removing resolved problem

HTML validation/fix in C# -

i need check if html document correct, if tags , attributes ok (in c#). if not, try fix malformed tags and/or attributes. suggestions library or tool can use? thanks. tidy managed solved problems. tool knows repair broken tags , close tags. build tidymanaged app , download libtidy.dll file , place in bin/debug file.

tsql - Understanding locking behavior in SQL Server -

i tried reproduce situation of question [1]. on table, taken , filled data wiki's "isolation (database systems)" [2], in sql server 2008 r2 ssms, executed: 1) first in first tab (window) of ssms -- transaction isolation level in first window not influence results (?) -- thought second transaction in 2) runs @ level set in first window begin transaction insert users values ( 3, 'bob', 27 ) waitfor delay '00:00:22' rollback 2) after, in second window -- commented/uncommented -- set transaction isolation level serializable -- set transaction isolation level read repeatable -- set transaction isolation level read committed -- set transaction isolation level read uncommitted select * users --with(nolock) update: sorry, results corrected. my results, depending on isolation level set in 2), select returns: immediately (reading uncommitted inserted row) for cases of select nolock for read uncommitted (select either or witho...

operating system - what is the difference between memory mapped io and io mapped io -

pls explain difference between memory mapped io , io mapped io on x86 there 2 different address spaces, 1 memory, , 1 i/o ports. the port address space limited 65536 ports, , accessed using in/out instructions. as example, video card's vga functionality can accessed using i/o ports, framebuffer memory-mapped. other cpu architectures have 1 address space. in architectures, devices memory-mapped.

java - How can I distinguish between "run all tests" and "run just this test"? -

i have tests run very slow, test exports large database test exporting code memory leaks. i'd have these tests in usual test suite should ignored unless 1 of these conditions fulfilled: the test running on ci server the user has selected test in ide , runs it the solution #1 simple: use property , skip test if it's not set. but how implement #2? [edit] java specific. i'm using junit 4 eclipse. i have tests run slow, test exports large database test exporting code memory leaks. while useful, these not unit tests , denoted unit-test tag. a test not unit test if: it talks database it communicates across network it touches file system it can't run @ same time of other unit tests you have special things environment (such editing config files) run it. tests these things aren't bad , worth writing. can written in using unit test framework. however, important able separate them true unit tests can keep set of tests can run fast whe...

xslt - XSL - Removing the filename from the path string -

i've got sharepoint problem need with. i'm creating custom itemstyles format output of content query webpart (cqwp) need insert "view all" button output. view needs point to: http://www.site.com/subsite/doclibrary1/forms/allitems.aspx all individual files in document library have link of: http://www.site.com/subsite/doclibrary1/filename.doc so need xsl functions strip filename.doc end of string. i've tried using substring-before($variable, '.') rid of .doc, need find way use substring-after search last forward slash in series , truncate orphaned filename. using @mads hansen's post, code resolved problem: template in itemstyle.xsl <xsl:template name="impdocs" match="row[@style='impdocs']" mode="itemstyle"> <xsl:variable name="safelinkurl"> <xsl:call-template name="outertemplate.getsafelink"> <xsl:with-param name="urlcolumnname...