Posts

sql - How to write the quantile aggregate function? -

i have following table: create table #temp (cola varchar(max), colb varchar(max), date date, value int) insert #temp values('a','b','7/1/2010','11143274') insert #temp values('a','b','7/1/2010','13303527') insert #temp values('a','b','7/1/2010','17344238') insert #temp values('a','b','7/1/2010','13236525') insert #temp values('a','b','7/1/2010','10825232') insert #temp values('a','b','7/1/2010','13567253') insert #temp values('a','b','7/1/2010','10726342') insert #temp values('a','b','7/1/2010','11605647') insert #temp values('a','b','7/2/2010','13236525') insert #temp values('a','b','7/2/2010','10825232') insert #temp values('a','b','7/2/2010...

pygame - Compiled python script returns WindowsError: [Error 3] after using py2exe -

so have been writing game while , have finished. due fact game meant class , used libraries teacher isn't going bother installing need make single executable run independent of python , games dependencies. ran py2exe , completed when run exe error: traceback (most recent call last): file "main.pyw", line 1, in <module> file "zipextimporter.pyo", line 82, in load_module file "libs\__init__.pyo", line 3, in <module> windowserror: [error 3] system cannot find path specified: 'c:\\users\\matt\\workspace\\cos125\\src\\dist\\includes.zip\\libs/*.*' i have figured out cause of error is. stems auto importer have installed each package. in init .py files packages use following code simple "from libs import *" import files in lib package. make each file loaded if loaded each 1 "from libs.module import *". the code in init file follows: import os, sys path = os.path.dirname(__file__) dirlist = os.listdir(...

jQuery draggable and invoke function -

i have table of games laid out in grid , want drag square anther square, , invoke function. game squares must have id corresponding game represent (or contain div id). i want drag table cell other table cell , invoke ajax action both id numbers, can swap game bookings. i don't know start , can't find close. yes, have how to, doesn't show me how extract id number each element. you should able need when drop performed. if basic set is: <table><tr><td id="cell_1"></td><td id="cell_2"></td></tr></table> just set cells draggable , droppable in drop event: $('td').draggable().droppable({ drop: function(event, ui) { var dragged_id = ui.draggable.attr('id'); // cell dragged var dropped_id = $(this).attr('id'); // cell dropped $.ajax(...); } });

r - Inverse of which -

am missing obvious here? appears inverse function of which missing base r (googling , search on "r inverse which" returns myriad of unrelated links)? well, not can't write one, relieve frustration being missing , r-muscle flexing challenge: how go writing one? what need function like: invwhich<-function(indices, totlength) that returns logical vector of length totlength each element in indices true , rest false . there's bound lot of ways of accomplishing (some of low hanging fruit), argue why solution 'best'. oneliner anyone? if takes account of other parameters of which ( arr.ind ??), that's better... one-liner solution: invwhich <- function(indices, totlength) is.element(seq_len(totlength), indices) invwhich(c(2,5), 10) [1] false true false false true false false false false false

Rename default branch in TortoiseHG -

is possible rename 'default' 'production' in tortoisehg? you cannot directly tortoise2.0+ settings , through command-line hg . documented in hgbook : mercurial lets assign persistent name branch. there exists branch named default. before start naming branches yourself, can find traces of default branch if them. to start working named branches , use hg branches command $ hg branch production marked working directory branch production $ hg branch production check if change reflected in tortoisehg

Get back my java source code from .war file? -

i lost netbeans project folder of project working on @ time. somewhere on server here @ company work at, deployed it. means (hopefully) can still hold of .war file. is possible 'unpack' .war , .java source files working on @ time? thanks in advance! if .java sources aren't in war (and should not be), you'll have take additional step of decompiling them using tool jad. this time set version control system, subversion or git or mercurial, never happens again. habit of using source code management, if you're sole developer working on project.

c# - Select Top(x) while x.Kind = "value" -

how select top of list long items @ top of list have property specific value. i need linq statement see there break in sequence , return top 2 items. problem don't know how many items going have correct property value. i have been working through problem linqpad 4. code below copy , past linqpad 4. results, "q", should not contain somedata effectivedate of 4/5/2011 because kind property on hsc2 "kindtwo". i trying find value resent value of "kind" , take top records match value until record doesn't match value. void main() { var hsc1 = new somedata {effectivedate = new datetime(2011,4,5), kind = "kindone"}; var hsc2 = new somedata {effectivedate = new datetime(2011,4,10), kind = "kindtwo"}; var hsc3 = new somedata {effectivedate = new datetime(2011,4,20), kind = "kindone"}; var hsc4 = new somedata {effectivedate = new datetime(2011,4,25), kind = "kindone"}; var = new [] {hsc1,...