Posts

Showing posts from May, 2012

django - How to include "None" in lte/gte comparisons? -

i've got complex filtering mechanism... d = copy(request.get) d.setdefault('sort_by', 'created') d.setdefault('sort_dir', 'desc') form = filtershipmentform(d) filter = { 'status': shipmentstatuses.active } exclude = {} if not request.user.is_staff: filter['user__is_staff'] = false if request.user.is_authenticated(): exclude['user__blocked_by__blocked'] = request.user if form.is_valid(): d = form.cleaned_data if d.get('pickup_city'): filter['pickup_address__city__icontains'] = d['pickup_city'] if d.get('dropoff_city'): filter['dropoff_address__city__icontains'] = d['dropoff_city'] if d.get('pickup_province'): filter['pickup_address__province__exact'] = d['pickup_province'] if d.get('dropoff_province'): filter['dropoff_address__province__exact'] = d['dropoff_province'] if d.get('pickup_c...

Alternative to Dialog.setOnShowListener in Android api level 7 -

does have idea of alternative using new (as of api level 8) dialog.setonshowlistener. adjust things in calling activity based on measured height of dialog, in order work, need access measured height of dialog. works fine in onshowlistener() callback, i'd find solution work on api level 7. the approach ended taking override onlayout root layout object in dialog, , perform necessary adjustments in there. works fine.

geospatial - Need a standalone Java library for performing spatial calculations on lat/lon data -

i'm looking java library capable of performing spatial calculations on sets of lat/lon data. here of functions i'm looking for: calculate great circle distance between 2 points determine if point lies within simple closed polygon, polygon defined ordered list of points determine if line between point "a" , point "b" intersects simple closed polygon, polygon defined ordered list of points determine if point "a" within radius of point "b" what i'm not looking for: i don't want library dependent upon database geospatial component, such oracle spatial, , cannot function independently. i don't want library purpose generate graphics/maps/etc. building analysis module existing application , end goal not create pretty pictures. i don't want library searching large amounts of spatial data. if happens this, that's ok, i'm not going use feature. the organization planning acquire license oracle spatia...

c# - XElement not declared when using Service Reference Proxy with XmlAnyElementAttribute -

i working on windows phone 7 app talks 3rd party soap service. used add service reference wsdl generate proxy class. calls work, outbound calls make use of ' sobject ' class result in error "the type system.xml.linq.xelement not expected. use xmlinclude or soapinclude attribute specify types not known statically" the relevant part of sobject class defined (as autogenerated) [system.codedom.compiler.generatedcodeattribute("system.xml", "4.0.30319.1")] [system.diagnostics.debuggerstepthroughattribute()] [system.xml.serialization.xmltypeattribute(namespace="urn:sobject.partner.soap.sforce.com")] public partial class sobject : object, system.componentmodel.inotifypropertychanged { <snipped ....> [system.xml.serialization.xmlanyelementattribute(namespace="urn:sobject.partner.soap.sforce.com", order=3)] public system.xml.linq.xelement[] { { return this.anyfield; } set {...

client - Why should I use CSS3 buttons? -

i built website recently, , decided create buttons depress on click css3, pretty cool. but there valid reason use css3 on sprite, modern browsers show css3 buttons? the client asked me question, , think of less http requests, loading faster. can see clients point of view pretty week answer. is there better reason? or there fallback method able move sprites background-position, or change gradient , add box shadow on hover / focus? just writing made me wonder if modernizer challenge... this more ethical , business question tech question, let's see points. first, think client should not know tech details implementation. he/she should know he/she needs know, , that's enough. you shouldn't "i'll make site css3, new html5 elements, , nice javascript eye-candy effects" non-tech folk. "i can make site you." if question using or why think best approach, reply benefits. it lightweight, brings less problems compatibility, , easier...

iPad - Is it possible to send SMS? -

recent ipads having provision insert sim card in that. latest ios sdk, possible send in-app sms application. know in-app sms possible iphone. how ipad? to me, documentation seems bit ambiguous on this. mfmessagecomposeviewcontroller's cansendtext method returns no if ipad doesn't support text messages or if not configured send messages. i no makes me wonder 1 configures ipad 3g send messages? or if ipad wifi & 3g support sms? i tried apple example code , read 2010-10-15 "system messaging programming topics ios". this makes me wonder if iphones can send sms messages? ciao

Javascript conflict with jQuery plugin - working on test page -

i attempting use smooth scroll smoothdivscroll dot com/#quickdemo , getting js conflict. have working on test page, http://www.visfire.com/scroll.html , not work on live page viwfire dot com /design/logo-corporateiddesign.aspx . according firebug, "$("div#makemescrollable").smoothdivscroll not function." should replace "$" else? also latest work module on same page quit working. you need replace $ jquery if have conflict javascript libraries, say, prototype in use on same page. reference i issue seems more corrupted jquery plugin, can use firebug inspect actual page , check if smoothscroll plugin loaded?

c - Confusion about the output -

#include<stdio.h> int main(void) { int i=1,j=-1; if((printf("%d",i))<(printf("%d",j))) printf("%d",i); else printf("%d",j); return 0; } as printf() returns number of characters printed, condition if(1<1) false if part executed , output 1 -1 1 . why happening? i think rather obvious: '1' 1 character, '-1' two. 1 less two.

php - Can custom decorator access parts of $content -

in custom decorator, i'm wrapping element content div. code creates div around both <dt> label , <dd> element public function render($content) { return '<div class="test">' . $content . '</div>'; } is there way can further access 2 parts, dd , dt. such maybe wrap div around <dt> or <dd> . how access different parts of $content ? if not necessary create custom decorator want achieve, can try decorating element directly following: $elementdecorators = array( 'viewhelper', array(array('element'=>'htmltag'), array('tag' => 'dd')), array('label', array('tag' => 'dt')), array(array('wrapper'=>'htmltag'), array('tag' => 'div')), ); that shud produce markup so: <div> <dt><label/></dt> <dd><input/></dd> </div> and if ...

iphone - View not updating, but everything on the main thread -

i'm trying show uiprogressview on top of table view after user interactions. in table view, if user taps 1 particular cell, slide uiview contains toolbar bar items , picker view (it behaves action sheet). when this, i'm adding view offscreen current view, , animating slide-in. when user makes selection , taps "done", view slides out. @ point, progress view supposed appear , update things happening in background. the problem i'm having after "alert sheet" uiview slided out of current view, nothing happens in ui while. when show sliding view, this: [[[uiapplication sharedapploication] keywindow] addsubview:slidingview]; cgrect newframe = cgrectmake(...); [uiview animatewithduration:0.3 animations:^{ slidingview.frame = newframe; }]; when user taps 'done' button in sliding view, action method invoked: - (void) done { nsnumber *row = getselectedrowsomehow(); [self dismiss:@selector(donecallback:) withobject:...

.net - Loading aspx page on tab switching using jquery -

hi have jquery tab. on each tab click want load fresh page . using iframe, while tab switching source changed loading event not takes place. how can solve this? code...... function loadiframepage(url) { document.getelementbyid("ifrforms").src= url; } <div style="float: none; height: 800px" onload="test"> <div id="tabs" style="font-size: 12px; width: 100%; height: 100%; visibility:hidden" onload="selectatab(2);"> <ul> <li><a href="#fragment" onclick="loadiframepage('cashreceipt.aspx')"><span>cash receipt</span></a></li> <li><a href="#fragment" onclick="loadiframepage('cashpayment.aspx')" ><span>cash payment</span></a></li> <li><a href="#fragment" onclick="loadiframepage('bankde...

clickonce - Change build output type from .dll to .dll.deploy through MSBuild -

i writing script mimic behaviour of visual studio publish target clickonce applications. have got working except part build output executable , config files renamed ..deploy (e.g..exe.deploy). when manually rename files (using ren command), warnings when generate application manifest - e.g "lib.dll.deploy has mismatched identity 'lib', expected file name lib.deploy" does know of way mimic behaviour when use ".deploy" file extension checked in visual studio? i found post http://www.windowsdevelop.com/clickonce-setup--deployment-projects/clickonce-mage-tool-command-line-mageexe-11437.shtml helped me along finding solution. basically, have rename application files .deploy extension after you've created application manifest before creating deployment manifest. i found using mage.exe create deployment manifest leads other problems, ended using generatedeploymentmanifest msbuild task.

how to write date in this format in c# -

i have date 9/27/2010 8:17:28 pm want write them in format 27 september 2010 8:19 pm how can write in format using c# use custom datetime format string : string res = mydate.tostring("d mmmm yyyy h:mm tt", cultureinfo.invariantculture); update: as @jon hanna mentions, format month title case ( september ), if want in example ( september ), can add tolowerinvariant() method call.

actionscript - How to implement click and pause/resume in flash? -

most flash video tutorials have kind of feature,1st click pauses video,while 2nd click resumes it. how's implemented in flash? var on:boolean; function clickhandler(event:mouseevent):void { on = !on; dowhatever(); } function dowhatever():void { if(on) play(); else pause(); }

c++ - #define file type -

is #define lbitmap std::list < cbitmap *> a practice? edit: allright, can convince boss bad practice? no, not practice use #define in c++. its use typedef has defined scope typedef scope defined , compiler interprets definition each time meet not in case of #define. #define interpreted compile time itself. here msdn definition of typedef , #define a typedef declaration introduces name that, within scope, becomes synonym type given type-declaration portion of declaration when using define statements, instances of statement replaced value of statement during preprocessing phase. #define lbitmap std::list < cbitmap *> // bad typedef std::list < cbitmap *> lbitmap // to convince boss #define charptr char* charptr a, b ; after preprocessing, line expands to char* a, b; here, variable of type char * whereas b char if use typedef typedef char* charptr; charptr a, b; here both , b both of type char *

datetime - MySQL Get latest record by date from mutiple tables with values from lookup tables -

i want latest mainnumber, serial, bartype , notes given mainnumber , if exist. note bartype stored in lookup table , referenced barid. unreason came this: select @mainnumber, coalesce(n.notes, 'none') numbers left join notes n on numbers.mainnumber = n.mainnumber left join notes n2 on n.mainnumber = n2.mainnumber , n.date < n2.date n2.date null , numbers.mainnumber = @mainnumber this fine whether notes null or not, need serial , bartype. mainnumber may have been assigned multiple serials during lifetime, want latest serial. (i'll need 15 other fields in other tables, performant answer appreciated possible) tables numbers table: create table `numbers` ( `id` int(10) unsigned not null auto_increment, `mainnumber` varchar(11) not null, `serial` varchar(20) not null, `date` timestamp not null default current_timestamp on update current_timestamp, primary key (`id`), unique key `serial` (`serial`) ) engine=myisam auto_increment=460 d...

c# - What's wrong with my IF statement? -

i'm creating auditting table, , have easy insert , delete auditting methods done. i'm bit stuck on update method - need able current values in database, new values in query parameters, , compare 2 can input old values , changed values table in database. here code: protected void sqldatasource1_updating(object sender, sqldatasourcecommandeventargs e) { string[] fields = null; string fieldsstring = null; string fieldid = e.command.parameters[5].value.tostring(); system.security.principal. windowsprincipal p = system.threading.thread.currentprincipal system.security.principal.windowsprincipal; string[] namearray = p.identity.name.split('\\'); string name = namearray[1]; string querystringupdatecheck = "select vaxcode, reference, costcentre, department, reportingcategory nominalcode id = @id"; string querystring = "insert audit (source, action, itemid, item, userid, timestamp) va...

c - access ARP header in socket buffer -

embedded system (kernel 2.4.20). in driver need access arp header fields, including mac addresses; unfortunately in include/linux/if_arp.h specific fields commented . i've tried define own 'arp_hdr' structure in code necessary fields: struct arp_hdr { /* fields taken include/linux/if_arp.h */ /* , additionaly these*/ unsigned char ar_sha[eth_alen]; unsigned char ar_sip[4]; unsigned char ar_tha[eth_alen]; unsigned char ar_tip[4]; } int my_func(struct sk_buff *skb) { struct arp_hdr *arph; arph = (struct arp_hdr *)skb->nh.raw; /* print out contents of arp header, garbage */ } why garbage , right way want? thanks in advance!

c# - How can I pass a runtime method to a custom attribute or viable alternative approach -

basically @ top of class (i know doesn't work isn't constant).... [xmlstorage(issinglestoragefile = false, issubordinate = true, storagelocation = "posts" + getblogid()] where getblogid() static utility method. i'm building xml storage framework blogging engine writing (partly learning excercise, partly want give open source) , thought tidiest way determine storage location use custom attributes since use datacontractserializer anyway. my problem @ present determining location subordinate type location determined id of parent. e.g post < blog. my storage path this... posts\blogid\postid.xml where blog id determined parsing url , returning associated blog. allow me host multiple blogs in 1 installation whilst keeping post storage files separate reduce memory overheads when loading posts. is straight no or there better way me attempting? edit: following john answer tried this.... private static string getsubordinatepath(type type) ...

javascript - jquery simple modal and insert on database -

i using jquery.simplemodal-1.1.1 , jquery-1.2.6.min create modal popup. problem: can display windows, can insert values, fiels, ecc. have 2 buttons, save , close. when click on save button, triggers event execute, code behind, store procedure insert dates on db. problem is, when click on close button. open modal windows, don't , click on cancel. close modal windows. open again modal windows, fill fields , click on save. program execute 2 times event of save button , insert 2 times same information on db. javascript code using: $(document).ready( function() { $("#nuovot").click(function(ev) { ev.preventdefault(); $("#textboxprenot").val(""); $("#msg").text(""); //open popup container $("#addtrasport").modal({ onopen: modalopenaddcustomer, onclose: modalonclose, persist: true, containercss: ({ width: "500px", height: "275px", marginleft: "-250px" }) ...

c# - Remove entity in NHibernate only by primary key -

i'm trying implement repository method removing entities using primary key, because webapp aware of primary key when invoking "delete request" web page. because of orm, option today entity database, , deleting it, gives me roundtrip. i use hql delete, since want create generic delete method entities, won't fly unless use reflection find out field primary key (doable, doesn't feel correct). or in nature of nhibernate need entity in order correctly handle cascades? i tried approach, assumption not load entity unless explicitly necessary, haven't had time test yet. maybe can shed light on how handled? var entity = session.load<t>( primarykey ); session.delete( entity ); edit: have tested , seems still full select on entity before deletion. load may return proxy object isn't guaranteed. mapping may contain cascade deletes force nhibernate load object database in order determine how delete object , graph. i implement using load...

iphone - createDirectoryAtPath:attributes: alternative -

[nsfilemanager createdirectoryatpath:attributes:] gives me warning depreciated. what alternative? or there better way of doing this? thanks tom use createdirectoryatpath:withintermediatedirectories:attributes:error: p.s. createintermediates if yes, method create necessary intermediate directories; if no, method fails if parent of directory created not exist. in addition, if pass no parameter, directory must not exist @ time call made.

how to sync the offline database with online database using an application built in adobe air -

i newbie , ask question regarding adobe air. my client wants desktop based application. wants application run standalone on machine of user has downloaded application website. he requires ever data has been stored in desktop application can synced online database, if required. i want build desktop application in adobe air. can please guide me how can sync offline , online data using application built in adobe air?? possible?? as have studied adobe air uses sqlite defult, have use same server or can go mysql also. newbie. my client wants desktop based application. wants application run standalone on machine of user has downloaded application website. he requires ever data has been stored in desktop application can synced online database, if required. i want build desktop application in adobe air. can please guide me how can sync offline , online data using application built in adobe air?? possible?? as have studied adobe air uses sqlite defult, have use same s...

C#: SSL with SocketAsyncEventArgs? -

i'm developing socket server using c# .net. i'm using async model provided socketasynceventargs class, because must high performance server support many connections in short periods of time. next, want secure communication between clients , server, , think use ssl. is there way of using ssl socketasynceventargs model? know .net has sslstream class ssl securing, need use socketasynceventargs high performance. is possible use ssl in upper level, without implementing in server code? thanks in advance. not sure if cares anymore since old needed week , not find on internet met needs. maybe there new in framework unable find... regardless, post source code since wrote company , tend frown on that, i'll outline approach took: since sslstream takes stream in constructor, implemented own stream subtype underlying memorystream reads , writes. pass in tcpclient object well. i used tcpclient handshake setting ssl connection. after authenticating server or cli...

bash - Find which drive corresponds to which USB mass storage device in Linux -

i have several usb mass storage flash drives connected ubuntu linux computer (ubuntu 10.04.1, kernel 2.6.32-25-386), , need tell them apart programatically (from bash if possible, i'm not afraid of compiling either) - need find block device corresponds physical device (e.g. /dev/sdb1 -> device in usb port 1; in case, 1 device ~ 1 volume). in other words, know have 3 hardware devices plugged usb ports; each of them shows in system usb mass storage device (as seen lsusb), created block device ( /dev/sdb1 ) , automounted uuid ( /media/1234-5678 ). usb device block device mountpoint usb device in port 2.2 <-> /dev/sdb1 <-> /media/1234-5678 i'm not trying find relationship between block device , mountpoint; i'm trying find relationship between block device , usb device, there way? why? there writes on disks, unpredictable time of completion. need give operator indication "you can remove disk in port 2 (which second left)...

How can I implement binary search in Perl? -

i implement binary search algorithm in perl. 'array' sorted in decreasing order (not actual array, function gets index , returns values). problem there might stretches of identical values. if searched value in such stretch, want return first index contains it. this have written: # get_val should *decreasing* function idexes $i in min..max, # formally: $i,$j s.t. $max>=$i>$j>=$min : # $get_val_subref($i, $extra) <= $get_val_subref($j, $extra) # min , max inclusive boundaries search # get_val sub should index in min..max , data reference, , return # value given index # returns smallest index $i in min..max $get_val_subref($j, $extra) # returns $searched_val, or undef if no such index exists sub binary_search { ( $min, $max, $searched_val, $get_val_subref, $get_val_sub_extra_data ) = @_; ( $mid, $val ); while ( $min <= $max ) { $mid = $min + int( ( $max - $min ) / 2 ); $val = $get_val_subref->( $mid, $get_val_sub_extra_...

Removing extra commas from string after using String.Join to convert array to string (C#) -

quick question here. i'm converting array string using string.join. small issue have that, in array index positions blank. example below: array[1] = "firstcolumn" array[3] = "thirdcolumn" by using string.join(",", array);, i'll following: firstcolumn,,thirdcolumn note ,. how can remove commas string, or ideally not include blank indices when using string.join? try :): var res = string.join(",", array.where(s => !string.isnullorempty(s))); this join strings not null or "" .

asp.net mvc - Hacking attempts yields "The controller for path '...' was not found or does not implement IController" -

we notified of every error on our mvc2 web application. , we've receiving errors controller path not found files know don't exist , therefore believe hacking attempts system.web.httpexception: controller path '/zencart/install.txt' not found or not implement icontroller. what's best way avoid errors come when people try hack our website trying request files such install.txt? thanks... you preventing them: 404 error sent instead of real file.

html - Trying to understand the Post/Redirect/Get design pattern (implemented with PHP) -

all, sorry in advance - i'm not php expert or knowledgeable in design patterns, question might little basic... anyway, i'm working on web app require login. my plan have this: index.php: page contain simple form allows users enter username , password. form post inputs to... login.php: page receive inputs index.php, , check credentials against database. if of inputs missing, or credentials check fails, php script redirect user index.php using: header('location: http://www.mydomain.com/index.php'); if credentials valid, login.php creates session establish user's authenticated status: session_start(); $_session['authenticated'] = true; then, determines access type user has. if has "level 1" access, script redirect user level1.php using: header('location: http://www.mydomain.com/level1.php'); if user has "level 2" access, script redirect user level2.php using: header('location: http://www.mydomain.com/...

sql server - FULLTEXT search with a multi-language column -

is there way use fulltext in multi-language table without giving each language own column? i have 1 column need search, language in column varies: productid int description nvarchar(max) language char(2) language can 1 of: en , de , it , kr , th currently build concordance , use searching. english, german , italian, , doesn't support stemming. else uses like '%searchterm%' , , i'm trying improve on that. i'm using sql server 2005. instead of separate column per language, if know rows contain language create indexed view filtered include rows of single langauge per language , fti each of those. you'll need query each view individually though.

javascript - div open itself in a new window from a jsp? -

i have jsp "template" view in including content several other jsp's. content other jsp's being included <div> in template file. inside included jsp's want have hyperlink called "popup" (or whatever). when link clicked, content of included jsp "popped out" of template jsp , opened own window. e.g.: template.jsp: <body> <div> //include jsp-1.jsp </div> <div> //include jsp-2.jsp </div> </body> jsp-1.jsp: <p> ... <a href="">pop out</a> //clicking open new window //containing contents of jsp-1.jsp </p> this shouldn't hard. i'm not sure if have set browser requests jsp files directly, if so, should work you: jsp-1.jsp: <p> ... <a href="/jsp-1.jsp" target="_blank">pop out</a> </p> edit: re: comment losing css , js files, here's h...

Django query performance using FOO_set -

does django hit database again when making queries following relationships backwards using foo_set manager? thought read somewhere not can't find in docs anywhere. j yes, does. see my blog discussion of issue , 1 possible way of optimising it.

Storing unknown datatype in MS SQL Server Database -

does 1 has idea of whats best practice store unknown data type in table. need store types bit, smallint, int, real , nvarchar in same "value" column, later interpretation .net application. i trying achieve best possible solution not compromise performance or growth of database. any suggestions? thanks in advance! varchar(max) easiest way this. sql_variant designed purpose use it, read books online entry ensure it's going want. http://msdn.microsoft.com/en-us/library/ms181071.aspx

xml - Android gesture detect problem -

i have main.xml viewflipper imports 5 views program. if wrap whole main.xml in gestureoverlayview can detect gestures fine listener, however, displays gesture on screen. i don't want gestures shown want them detected tried applying touch listener viewflipper doens't detect gestures. is because viewflipper hidden behind 5 imported layouts displayed? how apply gesture detection app without having overlayview show gestures on screen? thanks i found solution i'm not applying gesture detection strictly of layouts, programmatically applying activity. gesturedetector gesturelistener = new gesturedetector(this); once gives error tell implement unimplemented methods , code inside them necessary.

php - phpunit runs test twice - gets two answers. Why? -

this phpunit test file <?php // demotest - test prove point function __autoload($classname) { // pick file current directory $f = $classname.'.php'; require_once $f; } class demotest extends phpunit_framework_testcase { // call same test twice - det different results function test01() { $this->controller = new demo(); ob_start(); $this->controller->handleit(); $result = ob_get_clean(); $expect = 'actions array'; $this->assertequals($expect,$result); } function test02() { $this->test01(); } } ?> this file under test <?php // demo.php global $actions; $actions=array('one','two','three'); class demo { function handleit() { global $actions; if (is_null($actions)) { print "actions null"; } else { print('actions array'); } } } ?> the resul...

haskell - Authentication for hackage downloads? -

is there way ensure authenticity of downloads hackage? far can see, there's nothing. no https hackage, , neither (strong) checksums tarballs, , neither signed. so: how can verify authenticity of downloads hackage? there's been significant work on new hackage server real now. matt worked on summer of code. take @ blog: http://cogracenotes.wordpress.com/ there's been thought put managing contributor logins in new , better ways, not yet verifying authenticity of downloads. https support, on other hand, slated part of hackage 2, recall. signed tarballs sound potentially useful, there hasn't been work done think implementing them. hackage open source, , helpful either contributions, or thought through feature proposals.

Ruby on Rails 2 - Complex forms for Lesson, Questions & Answers -

i have 4 models - users, lessons, questions & answers. each user can create lesson questions , ask other users answer questions , submit form. ran problem creating view display lesson list of questions , blank answer field underneath each question. have working code (shown here) loops through questions , shows text field each question , answer. trying change questions shown headers , answers shown editable fields. hope makes sense. noob ror. couldn't find answer online. thank much. --view <% form_for @lesson |f| %> <%= f.error_messages %> <% f.fields_for :questions |builder| %> <%= render "question_fields", :f => builder %> <% end %> <p><%= f.submit "submit answers"%> <% end %> --partial _question_fields.html.erb <%= f.text_area :prompt, :rows => 1 %> <br /> <% f.fields_for :answers |builder| %> <%= render "answer_fields", :ff => builder %> <...

C#: Get Single Item from a List<Custom_Class> If an item exist with one Property value="somevalue" in the list -

i have list of custom class(which has properties name,age,address).how can check whether have item "name" value "shyju" exist in list , return if exist.name unique.no 2 items have same name. the solution thinking of go for each loop , loop thru each item , check name of each item "shyju" , return it. is there other way ? the following return item provided name if there 1 instance in list (it throw if there more 1 element). var item = list.singleordefault(x => x.name=="shyju"); if ( item != null ) { ... } it bit of work guarantee there 1 item in list name. if have established can speed bit using firstordefault instead var item = list.firstordefault(x => x.name=="shyju"); if ( item != null ) { ... }

unit testing - Gallio: Cannot run tests because the MSTest executable was not found -

i installed newest gallio release 3.2.603 on box without visual studio our ci server. nant script built .net 4.0 projects when tries run mstest tests following error occurs. [gallio] gallio nant task - version 3.2 build 601 [gallio] [error] assembly xxxxxxxxxxxxxx [gallio] cannot run tests because mstest executable not found am wrong expect gallio able run mstest tests without mstest executable or other visual studio components installed? ok, got answer gallio support requires mstest.exe present on box. i'll test package aseem suggested whether provides enough stuff run tests. update : installed microsoft visual studio test agent 2010 package. had add string value installdir [hklm\software\microsoft\visualstudio\10.0] , set value “c:\program files\microsoft visual studio 10.0\common7\ide” now ci box runs tests perfectly.

r - Classify or cut dataframe by list of class range and summarize it with ddply -

i have question ddply , subset. i have dataframe df : df <- read.table(textconnection( " id v_idn v_seed v_time v_pop v_rank v_perco 1 15 125648 0 150 1 15 2 17 125648 0 120 2 5 3 18 125648 0 100 3 6 4 52 125648 0 25 4 1 5 17 125648 10 220 1 5 6 15 125648 10 160 2 15 7 18 125648 10 110 3 6 8 52 125648 10 50 4 1 9 56 -11152 0 250 1 17 10 15 -11152 0 180 2 15 11 18 -11152 0 110 3 6 12 22 -11152 0 5 4 14 13 56 -11152 10 250 1 17 14 15 -11152 10 180 2 15 15 22 -11152 10 125 3 14 16 18 -11152 10 120 4 6 "), header=true) step 1 : i have list of equal interv...

iphone - iOS: FTP TLS Connection -

i need ftp tls connection iphone-app. normal ftp-connection works fine. need secure tls connection. used code apple´s simpleftpsample iphone: ftpstream = cfreadstreamcreatewithftpurl(null, (cfurlref) url); self.networkstream = (nsinputstream *) ftpstream; [self.networkstream retain]; self.networkstream.delegate = self; cfreadstreamsetproperty((cfreadstreamref)self.networkstream, kcfstreampropertyftpusername, (cfstringref)@"ftpuser"); cfreadstreamsetproperty((cfreadstreamref)self.networkstream, kcfstreampropertyftppassword, (cfstringref)myftppassword); [self.networkstream scheduleinrunloop:[nsrunloop mainrunloop] formode:nsdefaultrunloopmode]; [self.networkstream open]; this works fine normal ftp connection. but how setup tls connection? i´m not sure need , if tls connection works? i tried code: nsmutabledictionary *settings = [nsmutabledictionary dictionarywithcapacity:5]; [settings setobject:(nsstring *)nsstreamsocketsecurityleveltlsv1 forkey:(nsstring *)k...

ruby on rails - Not being able to order by includes on Rails3 -

i have following expression: user.clocks.includes(:users, :runs => :user_runs).find_by_id(params[:id]) which seems work fine. when add orders, this: user.clocks.includes(:users, :runs => :user_runs).orders("users.names").find_by_id(params[:id]) it breaks following error: activerecord::configurationerror: association named 'user_runs' not found; perhaps misspelled it? app/controllers/clocks_controller.rb:19:in `show' test/functional/clocks_controller_test.rb:21:in `__bind_1286475263_942556' any ideas why? the model looks this: class clock < activerecord::base has_and_belongs_to_many :users has_many :runs end class run < activerecord::base belongs_to :clock has_many :user_runs has_many :users, :through => :user_runs end class userrun < activerecord::base belongs_to :run belongs_to :user end continuing investigation i've tried this: ubiquitous_user.clocks.includes(:runs => :user_runs).find_by_id...

javascript - Google Analytics - how to track clicks on a screen? -

can track click of every link, button, dropdown select, etc. on screen , have tracked in google analytics? i want create page , collect data on widget users use most. what ajax stuff? if you're using jquery or mootools...can functions register fake url ga based on user interaction? use flash. everytime click button, can initiate fake url request. make urls such ".../customize/eyes/" or ".../customize/nose", etc. wondering if can javascript on page. i've posted @ webmaster stackexchange . yes, can this, it's not recommended practice, , google might throttle usage if there many clicks. rather overloading pageviews, should use events. you bind event call every click, (assuming jquery) $(document).delegate('*', 'click submit', function(){ _gaq.push(['_trackevent', 'category', 'action', 'label', numeric_value]); }); you insert whatever custom event-driven javascript info parameters. ...

CWD of an Node.js application started with upstart (Ubuntu) -

i've coded node.js app when executed need return cwd process able read files on disk. when start app directly node in actual app directory... #!sh node app.js everything working fine , "process.cwd()" return path. when script started upstart or directly node other directory "process.cwd()" return "/" in case of upstart , whatever directory witch directly start app node. process.cwd() seem output directory witch command executed. why? do? node.js provides global variable "__dirname" provide actual path of application.

python - Is it possible to use a USB flash drive to serve files locally to a browser? -

using python, possible possible use usb flash drive serve files locally browser, , save information off online web? ideally need python. where start? you can use portable python on flash drive. portable python , code sort of little python webserver, handling , post extending basehttprequesthandler class.

jQuery count that includes all chars including ENTER, etc? -

i know want strip these out, need true char count , can't find out how it... thanks help use length property on string character count. e.g. 'this example string'.length // == 26 or, jquery: $('#my_textarea').html().length n.b. use html() not text() avoid having jquery things removing line-breaks.

jquery - jqGrid data stored in browser cache? -

does jqgrid store grid data on file system? if so, need clear browser's cache remove it? or stored in memory javascript (and browser)? closing browser remove data? do answers these questions change depending on whether using loadonce ? per default data loaded server (json or xml data) will saved in browser cache, not used @ next request. reason per default jqgrid implement same behavior of ajax requests cache:false parameter of jquery.ajax . means requests has additional parameter nd nd=1286296925096 timestamp. makes url of requests unique , local saved data not used twice. if want jqgrid not use data local browser cache need nothing . if want additionally deny saving data locally (for example because of security reason or reduce filling of local cache information never used) can include no-store directive in http header of server response. if want cache server requests , use data should prmnames: { nd:null} jqgrid option . data next requests local bro...

Google's AJAX CDN -

does 1 know how access claro css file version 1.3.2 tried link did not work? http://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dijit/themes/claro/claro.css looking @ older releases of dojo, there isn't claro theme 1.3 branch - see here: http://download.dojotoolkit.org/release-1.3.3/dojo-release-1.3.3/dijit/themes/ in fact, looks new theme added in release 1.5: http://docs.dojocampus.org/releasenotes/1.5#claro-theme

javascript - css is getting overridden by .js inserted styles (Alloy UI) -

i have situation .css in head tag getting overridden css that's being inserted dynamically head javascript library. the .js library automatically appends new .css link end of head tag put on top of styles. you have several options: use different javascript library make sure rules have higher specificity ones added library learn !important

jQuery find attribute from url hash -

trying find attribute value url hash. // url http://url.com/index.html#link // html <a href="#link" rel="3">some link</a> // js var anchor = window.location.hash.substring(1); // need finding attribute value finding anchor var attribute = .find('#+anchor').attr('rel'); //this needs have value of 3 all appreciated. :) you can using attribute-equals selector , this: $('a[href="'+window.location.hash+'"]').attr("rel") or .filter() , this: $("a").filter(function() { return this.hash == location.hash; }).attr("rel") the .hash starting # consistent, no need remove/add back, use as-is.

html - Decrease the vertical height between text and horizontal rule -

i need show text horizontal rule touching text. vertical height between text , hr should less. should displayable in mobile safari browser. http://pastie.org/1206301 set padding/margin 0 of hr: (note put hr inside because don't want hr's assuming style. give < hr/> it's own css class too. <html> <head> <style type="text/css"> body {color:red;} h1 {color:#00ff00;} p.ex {color:rgb(0,0,255);} .new{vertical-align:text-bottom;} .new hr{padding:0;margin:0;} </style> </head> <body> <div class="new"> test text <hr/> <div> </body> </html>

visual studio - "Test with debugger" in ReSharper? -

"testdriven.net" has great feature called "test debugger". there in resharper? tried googling this, can't find anything. resharper not have exact feature. have stick testdriven.net feature. or better add full-blown tests project, , you'll able run them in debugger (via resharper).

Java: Outputting text file to Console -

i'm attempting output text file console java. wondering efficient way of doing so? i've researched several methods however, it's difficult discern least performance impacted solution. outputting text file console involve reading in each line in file, writing console. is better use: buffered reader filereader, reading in lines , doing bunch of system.out.println calls? bufferedreader in = new bufferedreader(new filereader("c:\\logs\\")); while (in.readline() != null) { system.out.println(blah blah blah); } in.close(); scanner reading each line in file , doing system.print calls? while (scanner.hasnextline()) { system.out.println(blah blah blah); } thanks. if you're not interested in character based data text file containing, stream "raw" bytes. inputstream input = new bufferedinputstream(new fileinputstream("c:/logs.txt")); byte[] buffer = new byte[8192]; try { (int lengt...

asp.net mvc - Set the value of an ExtJS ComboBox to an Object, not an object property -

i have combobox in editorgrid. populating (trying) using json, produced serializing ilist<fertilizertype> . i want valuefield of combobox equal fertilizertype objects , displayfield equal fertilizertype.name here crop : {\"id\":1300,\"active\":true,\"code\":\"ammonium bicarbonate\",\"description\":\"ammonium bicarbonate\",\"groupname\":\"fertilizertype\",\"name\":\"ammonium bicarbonate\",\"ordinal\":1} why want set valuefield object might ask? well, data in grid part of crop object. combobox needs return fertilizertype crop.fertilizertype can populated. here column definition: { header: 'fertilizer type', dataindex: 'fertilizertype', width: 170, editor: new ext.form.combobox({ store: new ext.data.store({ proxy: new ext.data.httpproxy({ ...

php/mysql open source customer service ticketing system? -

i have simple form customer feedback / customer issues, form send email support@ourwebsite.com , check , reply inquiries. i'd implement proper ticketing system ticket opened each issue, , replies can done via email or via form (that displays previous replies), etc. does know of such beast ? php/mysql based , not heavy - don't want full crm or so, ticketing really. here's complete list of open source e-ticket systems: http://www.opensourcehelpdesklist.com/ i use e-ticket support . it's scary simple gets, business needs. simple entry, file attachments, email notifications, stored responses, , simple dashboard. beware, though, customization can bit of bear because developers include files include files include other files.......however, it's fine out of box if don't plan hacking.

c++ - Why would connect() give EADDRNOTAVAIL? -

i have in application failure arose not seem reproducible. have tcp socket connection failed , application tried reconnect it. in second call connect() attempting reconnect, got error result errno == eaddrnotavail man page connect() says means: "the specified address not available local machine." looking @ call connect(), second argument appears address error referring to, understand it, argument tcp socket address of remote host, confused man page referring local machine. address remote tcp socket host not available local machine? if so, why be? had have succeeded calling connect() first time before connection failed , attempted reconnect , got error. arguments connect() same both times. would error transient 1 which, if had tried calling connect again might have gone away if waited long enough? if not, how should try recover failure? check link http://www.toptip.ca/2010/02/linux-eaddrnotavail-address-not.html edit : yes meant add more had cut ther...

Use jQuery to apply styling to all instances of clicked element -

what i'm aiming jquery @ element i've clicked on (for example p or li tag), apply styling instances of element (so p tags on page). this code far, applies styling single element has been clicked on. $("article *", document.body).click(function (e) { e.stoppropagation(); selectedelement = $(this); $(selectedelement).css("border", "1px dotted #333") }); would appreciate or advice! $('article *',document.body).click( function(e){ e.stoppropagation(); var selectedelement = this.tagname; $(selectedelement).css('border','1px dotted #333'); } ); demo @ js bin , albeit i've used universal selector (since posted couple of lists (one ol other ul ). above code edited in response comments @peter ajtai, , linked js bin demo up-dated reflect change: why run around block once before @ tagname? how var selectedelement = this.tagname;. it's e.stoppropagation(), since you're calling metho...

mysql - Table Recovery Question -

suppose have table following schema: tableid field1 field2 ..... i have 2 copies of database (backup , production). on production instance, query accidentally run did following: update table set field2 = null field1 = 'x'; i trying undo query based on data stored in backup instance (where bad update statement not run). what sql statements need run on backup db retrieve tableid , values of field2? how convert appropriate update statements fix production? there quite few rows impacted query. i think select erased values backup following query: select tableid, field2 field1 = 'x'; however, i'm @ loss how convert easy update statement. insight (or better ideas) appreciated. you'll need data update in same database, when select backup field1 = 'x', save temporary table , copy production table. you'll need sort of primary key between 2 tables -- if don't have that, how know field2 needs updated? for instance, if ...

objective c - NSString get -characters -

i want characters of nsstring. this: nsstring *data; const char * typein = [[data characters] utf8string]; but nsstring won't respond -characters. how characters of nsstring? thanks, elijah you can use function: for(int =0 ;i<[mystring length]; i++) { char character = [mystring characteratindex:i]; } or nsstring *str = @"astring"; const char *cstring = [str utf8string];

drupal - How do I decide between theme('node', $node) and drupal_render($node->content) for programmatic $node output -

given $node , i'm trying decide between following 2 ways of outputting $node. either $output = theme('node', $node); or node_build_content($node); $output = drupal_render($node->content); they both seem give similar results, there should consider before choose 1 way on other? your output similar if there no other modules , themes altering output via theme layer. but! if bypass theme layer, you'll start experiencing unexpected behaviour when install modules or themes , change config settings use theme layer alter node's output. in short, bypassing theme layer, you're building error application. these error occur after hand application on (a client perhaps) starts changing settings in admin/ see decorator pattern if you're interested. drupal uses extensively. http://en.wikipedia.org/wiki/decorator_pattern

How to automatically copy text out of excel files -

i have 250 microsoft excel (.xls) files, in folder. need following: for each file: open file switch specific tab in file extract text rows 15-100 on tab save text in text file somewhere i assume can automated somehow, have no idea how. start looking figure out how this? don't want open 250 excel files , copy text out hand, take hours. :( since have excel, can create excel macro in separate worksheet this; make sure worksheet outside of directory parsing. you'll need add reference filesystemobject, should found in c:\windows\system32\scrrun.dll. option explicit sub extractdata() dim fso new filesystemobject dim ofile file dim ofolder folder dim sfileoutput string dim fnum dim excelfile excel.workbook dim excelworksheet excel.worksheet dim integer sfileoutput = "c:\foldertoscan\exceloutput.txt" set ofolder = fso.getfolder("c:\foldertoscan") each ofile in ofolder.files ...

compression - Reading and Writing Bits to Text Files in Java -

i'm trying implement compression algorithms, , need deal bits in java. what need when write value 1 value 2, numbers stored in file bits, file size 1 byte instead of 2, 1 stored in 1 bit , 2 stored in 2 bits. is possible? much all i/o methods have byte lowest granularity. can write bits, have pack them bytes yourself. maybe one-byte buffer write out file once fills appropriate. also note there no way know length of file in bits (you not know if last byte "full"). application needs take care of somehow. you can google "bitoutputstream", of there few, though not in libraries common. maybe use 1 of those. finally, file creating not "text" file, binary (even more usual...)