Posts

sql - How should I write query for this? -

i have table columns employee_id, effective_date, salary. ie each employee, have multiple records based on when salary got changed. want print each employee salary latest effective_date. how this? select employee_id, effective_date, salary employees t not exists (select 1 employees tt tt.employee_id = t.employee_id , tt.effective_date > t.effective_date) this may work?

dynamic class creation in python -

i want create class dynamically: class createagent(show.showone): """create compute agent command""" log = logging.getlogger(__name__ + ".createagent") def get_parser(self, prog_name): parser = super(createagent, self).get_parser(prog_name) parser.add_argument( "os", metavar="<os>", help="type of os") parser.add_argument( "architecture", metavar="<architecture>", help="type of architecture") parser.add_argument( "version", metavar="<version>", help="version") parser.add_argument( "url", metavar="<url>", help="url") parser.add_argument( "md5hash", metavar="...

keyboard shortcuts - How to cut/paste multiple lines with Eclipse? -

i assigned alt+x shortcut cut line command in eclipse. on windows, can press alt+x 3 times. when paste (either in eclipse or in application), 3 lines yanked. prefer behavior. on ubuntu, after cutting 3 lines, paste yanks last line. how can consistent eclipse behavior when cutting/pasting multiple lines on both windows , ubuntu? i'm running eclipse kepler.

vb.net - Type '' is not defined on a list -

i error type 'address' not defined on <lists> , on get/set . have looked around cant find why happening. , happens on 1 page other pages used get\set there no errors. suggestion. don't mind c# help. my code sample: inherits resource private const path string = "listings" public sub new() buildings = new list(of building)() 'error @ building features = new list(of feature)() 'error @ feature images = new list(of listingimage)() 'error @ listingimage end sub public property address() address 'error @ address return m_address end set (value address) 'error @ address m_address = value end set end property private m_address address 'error @ ddress and public property buildings() list(of building) 'error @ building return m_buildings end set (value list(of building) 'error @ building m_b...

r - "read.table" converts every '+' in a column names to '.' -

i'm reading text file in r, using "read.table" function. text file table columns name. when try read text file, "read.table" converts every '+' in columns name '.'. example if in text file name of column is: "cd34+", after reading "read.table", converted to: "cd34.". tried set stringasfactors false, did not work. does have idea solution? thanks you want use option check.names=false . read.table(header=true, check.names=false, text="a+b c+d 0 1") ## a+b c+d ## 1 0 1 using option allows syntactically-invalid names.

python - How do I return a urllib2 response object from within a Django view? -

i know can use shortcuts module make easier see if manually tried create , return response object myself not work: import urllib2 def djangoview(request): data = '<byte string>' open('body.txt', 'wb').write(data) headers = {'content-type' : 'something', 'accept' : 'somethingelse'} newresponse = urllib2.request('file:body.txt', none, headers) return httpresponse(newresponse) i don't understand trying do. it's contract of view returns instance of django.http.httpresponse - not allowed return else. doing not shortcut, it's necessity.

javascript - Change DOM element CSS with jquery Not -

i have 2 clickable headings. when click one, changes blue. if click other one, changes blue, should "unclick" other heading , change black. i'm trying using jquery not ... $("#pal1, #pal2").click(function(event) { $(this).css({"color" : "blue"}); var pal1 = $(this).attr('id'); var pal2 = $(this).next().attr('id'); $(this).not(pal2).css({"color" : "black"}); //if selected heading not pal1, or not pal2, changed 1 not == $(this) black. }); or that. edit: know can way... wanted use jquery functions reduce code size. plus isn't efficient. $("#pal1, #pal2").click(function(event) { $(this).css({"color" : "blue"}); if ($(this).attr('id') !== $("#pal1").attr('id')) { $("#pal1").css({"color" : "black"}); } else { $("#pal2").css({"color...