Posts

php - Get last record of each month in MySQL....? -

i have problem in writing query mysql. have following fields in db id created_on status 1 2011-02-15 12:47:09 1 2 2011-02-24 12:47:09 1 3 2011-02-29 12:47:09 1 4 2011-03-11 12:47:09 1 5 2011-03-15 12:47:09 1 6 2011-03-22 12:47:09 1 7 2011-04-10 12:47:09 1 8 2011-04-11 12:47:09 1 i need select last record of each month . month feb record # 3 month march record # 6 , month april record # 8 please me..... thanks in advance..... select * table created_on in (select distinct max(created_on) table group year(created_on), month(created_on))

.net - COM interop interface casting -

following this article , have translated c++ com class/interface declaration c# this: [interfacetype(cominterfacetype.interfaceisiunknown), guid(ifaceguid)] public interface ifoo { void bar(); } [comimport, guid(classguid)] public class foo { } i use this: var foo = new foo(); var ifoo = (ifoo)foo; ifoo.bar(); my question is, how can possibly work, considering foo doesn't implement ifoo (even @ runtime, typeof(foo).getinterfaces() empty) , user-defined conversions interfaces forbidden? is special handling reserved com? c# specification have this? comimport types treated differently compared "normal" .net classes, constitute runtime-callable wrapper around underlying com coclass. casting instance of 1 of these com interface type transparently mapped call object's implementation of com interface method iunknown.queryinterface . if qi requested interface succeeds @ com level, c# cast succeed.

ruby on rails - undefined method `salt=' -

i trying add password thing website. when sign account, page shows after press sign button error page showing: undefined method salt=' #<user:0x37f8168> app/models/user.rb:34:in encrypt_password' app/controllers/users_controller.rb:19:in `create' in user.rb have: def encrypt_password self.salt = make_salt if new_record? self.encrypted_password = encrypt(password) end def encrypt(string) secure_hash("#{salt}--#{string}") end in users_controller.rb have def create @user = user.new(params[:user]) if @user.save sign_in @user flash[:success] = "welcome penntwit" redirect_to @user else @title = "sign up" render 'new' end end the error lines: if @user.save self.salt = make_salt if new_record? i tried changing self.salt @salt gave me error saying salt in secure_hash("#{salt}--#{string}") not found. any ideas? thanks! ...

tfs2010 - What are the Implementation or All Links tab differences in TFS? -

what main differences between implementation tab , link tab in tfs 2010? ask, because have need requirement work items have affects/affected (or maybe predecessor/successor) link type task work items...instead of parent/child link type limited in implementation tab. essentially, want ability given task able have links multiple requirements. as extensible , free-form tfs 2010 is...i still hesitate bit go route without knowing kind of possible negative impact approach have when comes future reporting needs or else. any thoughts? thanks! the implementation tab constrained task work items children of requirement. links tab shows every link associated requirement (including tasks). form section of wit definition defines layout... , links controls. can adjust these tabs (or add new ones) there. as particular change, tread carefully. having tasks "multiple parents" can lead lot of confusion , over-engineering. i've seen many teams try approach abandon in ...

mysql - information_schema tables and update_time behaviour -

i'd have explanation information_schema , behaviours. let's want know when myisam table has been modified. write query select update_time information_schema.tables table_schema = 'my_db' , table_name = 'my_table' even though apply change table nothing happens in until run flush tables . unluckily seems me update_time stores date , time of moment run flush tables, not 1 when table changes occur. true? in advance. i prefer add last_change timestamp each of tables, define "default current_timestamp on update current_timestamp", means mysql automatically update each time row modified. with this, query table directly , know not table touched, rows touched. it doesn't work detect deleted rows though.

operator overloading - Weird characters appear in ostream in C++ -

i have program should emulate simple filesystem, want print structure of directories, have overloaded << operator, , called function goes through structure in rectursion. works, there weird hex values before of lines in output. there wrong way manipulate iwth ostream ? (i did not include class definition, shouldnt matter) thanks all, answers! std::ostream& printtree(std::ostream& os, const cfilesystem::tdir* x, int nmbtabs) { int k; const cfilesystem::tdir * nxt = x; //cout << pocettabu<<endl; while(nxt){ os<<"--"; for(k=0;k<nmbtabs;k++){ os << '\t' ; } os<<"--"; os << nxt->m_name << endl; if(nxt->m_sub){ os << printtree(os,nxt->m_sub,nmbtabs+1); } nxt=nxt->m_next; } return os; } std::ostream& operator <<(std::ostream& os, const cfilesystem& x) ...

wpf - Strange out of order behavior for TreeView and compound data -

the follow code loads hierarchical collection of compoundobjects of strings. unfortunately inserts strings @ top of tree instead of @ bottom(which behavior i've seen. i've tried change order of enumerators, notifiers, etc , produce same results. i've pre-load list looks normal(using same code in thread). any ideas whats going on? compoundobject.cs using system; using system.collections.generic; using system.collections.objectmodel; using system.collections.specialized; using system.linq; using system.text; namespace complextreeviewlazyloadingtest { public class compoundobject : ienumerable<object>, inotifycollectionchanged { public string name { get; set; } public observablecollection<compoundobject> objects { get; private set; } public observablecollection<string> items { get; private set; } void onchanged(object sender, notifycollectionchangedeventargs e) { if (collectionchanged ...