Jump to content

  • Log In with Google      Sign In   
  • Create Account

Emmanuel Deloget

Member Since 27 Aug 2003
Offline Last Active Jun 26 2014 01:47 AM

Topics I've Started

[web] [SQL] cannot come with a query that does what *I* want

04 April 2009 - 11:31 PM

... and what I want is supposed to take precedence over what MySQL wants. Here is the deal: I have two tables, named threads and posts. I simplify them up to the maximum so that they contain only meaningful information. Out of context information is stripped. threads * thread_id (INT, autoincrement, PK) * forum_id (INT) post * post_id (INT, autoincrement, PK) * thread_id (INT) * post_date (DATETIME) Now, I have a query to write: I want to retrieve the last post of each thread for a known forum_id. The best I cam with is:
  threads as t1,
  (SELECT * 
     posts as st1, threads as st2
   WHERE st2.forum_id=1
     AND st1.thread_id = st2.thread_id
   ORDER BY st1.post_id DESC 
   ) as t2
WHERE t1.forum_id=1
  AND t2.forum_id = t1.forum_id
  AND t2.thread_id = t1.thread_id

And this certainly doesn't give me what I want. Suppose that threads and posts contains the following information:
thread_id   |  forum_id
  1         |    1
  2         |    1
  3         |    2
  4         |    1
  5         |    2

post_id   |  thread_id  |  post_date
  1       |    1        | 2009-04-01 12:00:00
  2       |    2        | 2009-04-01 13:00:00
  3       |    2        | 2009-04-01 14:00:00
  4       |    1        | 2009-04-01 15:00:00
  5       |    3        | 2009-04-01 16:00:00
  6       |    1        | 2009-04-01 17:00:00
  7       |    4        | 2009-04-01 18:00:00
  8       |    5        | 2009-04-01 19:00:00
  9       |    5        | 2009-04-01 20:00:00
What I want is (for example, for forum 1)
  forum_id  |  post_id   |  thread_id  |  post_date
      1     |    6       |    1        | 2009-04-01 17:00:00
      1     |    3       |    2        | 2009-04-01 14:00:00
      1     |    7       |    4        | 2009-04-01 18:00:00
But I seem unable to find a request that does "just" that. Question can someone here help me? Thanks in advance (cookied are distributed accross teh intartube for every answer).

[web] When IE7 is messing up something... CSS problem

28 March 2009 - 09:12 AM

Hello everybody. Here is a testing webpage enclosed in a zip (with all the needed files). The web page has a correct behavior under Firefox 3, Safari and Google Chrome, but two major problem arise when using IE7: * the Applications popup menu (at the bottom) doesn't open correctly. It should open on the "Applications" menu item. Edit 2: problem solved with the help of Kippesoep. * "menu 2" (at the top) is a drop down menu. Under FF3 and the other browsers, it is displayed correctly and behave as intended. Under IE7, some strange spaces are added between each option, and of course the menu doesn't work as intended. Edit 1 : This problem is now fixed, thanks to WanMaster. Both problems can be traced back to the CSS code in the enclosed index.html, but my knowledge of CSS is a bit limited. So, can someone help me to overcome one or both problems ? Thanks for your help ! [Edited by - Emmanuel Deloget on March 29, 2009 11:31:20 AM]

GameDev.Net's xperteleven season is finished!

26 September 2007 - 03:36 AM

And of course, another one is to come! This season has been great - loads of fun, expectation and pleasure. Teams are getting stronger and stronger, but the plays are still fun and everyone is able to win something. Wait, I haven't described the game yet. XPertEleven is some kind of online soccer manager game. You can build your team, select your players, buy or sell them on the transfer market and play against other gdneters in our private league (or you can join some other league, including the Xpert official leagues which are a bit crowded; let's say you'll want to join us first so we can have some fun together [smile]). Our league has been running for a few season (9), and the game proved to be fun and addictive - even if, like me, you don't really like soccer [smile]. What happended during last season? Well, the most important point (at least for me) is that my team - the Black Socks) finished in the 3rd place. The Middletown Knights, an old team with washed players, finished first - but their record is not that impressive (20 wins and 2 draws out of 22 matches, they scored 60 goals and managed to got 8 goals; loosers... [grin]). The Lamington Lemmings finished 2nd - a good performance too. If you come and join (league id 47992) - and beleive me, this is something you must do, as I have the power to ban you if you don't - you'll have probably a harsh first season. It doesn't matter. It takes some time to get your team stronger, and strong teams are not aging very well - their experienced players quit the game, leaving some place for the younger, less experienced players. By the time you'll play your 2nd season, your team will be stronger and you'll be able to compete with the other teams. And when your 3rd season will start, you'll compete on the top of the league. But even during the first season, you'll get loads of fun - for a cheap investment - I mean, you'll only have to come 2 or 3 times a week and spend 3-4 minutes to devise your strategy. We want you to come in numbers. So here is an incentive: women will find you attractive, you'll get unexpected tax cuts, your boss will double your salary, your wife will agree to let you drink beer with your friends in a tap dancing bar and your children will get only A's. Your life will be more beautifuler than ever. So come and see us!

Nullable types : by ref

22 September 2007 - 12:11 AM

I was trying to do something weird: I have a nullable type which encapsulate a struct (MouseState), and a function that takes a MouseState by ref:
  class Stuff
    Nullable<MouseState> state = null;
    private void DoSomething(ref MouseState theState)
    { ... }
    public void Update()
      if (state.HasValue)
        DoSomething(ref state.Value);
Of course, this code doesn't compile (you can't pass a value type which is the return value of a property as a ref to a function). The goal is obviously to avoid yet another a copy of the struct whne it's not null. Do I have any other way to do the same thing? Thanks for your help :)

News: IBM Adds (parts of) Lotus Notes Code To OpenOffice Project

11 September 2007 - 05:24 AM

I had may daily OMG moment a few minutes ago: from Business Week:
In the latest challenge to Microsoft's stranglehold on the productivity software market, IBM said Monday that it will donate part of the code behind its Lotus Notes package to OpenOffice.org, a Sun Microsystems-backed group that offers open source office software as a free download. IBM officials said the move is part of a broader effort that IBM is undertaking to support OpenOffice.org, which produces free word processing, spreadsheet, and presentation software that competes with Microsoft's pricey Office 2007 suite.
Now, this is going to please a few zealots, and will amuse tons of people out there, so feel free to read the complete news and to discuss about what may change, why it is good, why it is bad, how it could help the OO project and so on (and I'm sure you'll be civile, polite and well, mature [smile]).