I know some design patters, and I have used some, but I haven't studied them properly, so now I am thinking I will pick up all the books I have and study 1 pattern per week. Lets see how it goes.
Saturday, December 29, 2007
Wednesday, December 05, 2007
Shuffle a deck of cards
hmm I never thought of this before, if I had to write a program to shuffle a deck of cards, how would I do that?
PDF Is Now ISO 32000
Check out : iso_ballot_for_pdf_17_passed
So what does that mean? what is this ISO 32000 standard?
Anyway, here's how you can create your own PDF
- PDFCreator This software installs a printer which can print any document as a PDF.
- 2007 Microsoft Office Add-in After installing this, you will be able to save all Office 2007 documents as PDF.
Tuesday, November 27, 2007
Monday, November 26, 2007
Time difference logger
Did you ever have to log time taken by some chunk of code? I hate writing log statements every where to get time difference - so I came up with this :
1: using System;
2: using System.Collections.Generic;
3: using System.Linq;
4: using System.Text;
5: using System.Threading;
6:
7: namespace TimeLogger
8: {
9: class Program
10: {
11: static void Main(string[] args)
12: {
13: using (TimeLogger tl = new TimeLogger("sleeper"))
14: {
15: Thread.Sleep(3000);
16: }
17: }
18: }
19: }
1: using System;
2: using System.Collections.Generic;
3: using System.Linq;
4: using System.Text;
5: using System.Diagnostics;
6:
7: namespace TimeLogger
8: {
9: public sealed class TimeLogger:IDisposable
10: {
11: private Stopwatch sw;
12: private string codeDescription = string.Empty;
13: public TimeLogger()
14: {
15: this.sw = Stopwatch.StartNew();
16: }
17: public TimeLogger(string codeDescription)
18: {
19: this.codeDescription = codeDescription;
20: this.sw = Stopwatch.StartNew();
21: }
22:
23: void IDisposable.Dispose()
24: {
25: sw.Stop();
26: if(string.IsNullOrEmpty(codeDescription))
27: Console.WriteLine("Time taken by = {0} ms", sw.ElapsedMilliseconds);
28: Console.WriteLine("Time taken by {0} = {1} ms",codeDescription, sw.ElapsedMilliseconds);
29: }
30: }
31: }
What do you think?
Friday, November 23, 2007
Multithreading is a pain
synchronizing pieces of code is a lot lot harder than i thought... basically this is the first time i am working on multithreading stuff. I added a lot of variables just to keep track of the state... then my manager gave me a solution to have a seperate entity which will co-ordinate and supervise all the threads... hmmm lets see how that one goes.
Thursday, November 15, 2007
Make Vista go ....zzzZZZ
Looks like you cannot make Vista machine go to sleep using the shutdown command, but there is this pill available :
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
Subscribe to:
Posts (Atom)