Pulkit Gaur

dream - do - deserve

Flash Skinnable Window

Filed under: Flash/Actionscript at 11:07:52 On 2006-05-31

Well ,

I started Flash/Flex a few dayz back.Got allured with its stronger "RAD" capabilities where you need not dwelve much into CSS and Javascript to make some web based application work for basic functionality and portability across browsers is a bless.

Some projects which i did are already online which includes Flash/Flex based web operating system( Web OS).It can be found @ www.ostype.com.

Other is Web Meet - which is an online meeting and collaborative tool.

Though, not getting much time to complete them ,but they will be fully functional soon ,this i hope cool

Ankur ,Chintan and Pratik have been helping me throughout these projects ,whereever i got stuck these guys have been more than helping to me and sometimes even gave their code.

One here comes from Chintan which is very basic thingy but shows how easy is it to inherit the skinnability to you components.

red window blue window

You can download the source from here.

 

Worst 25 technical gadgets

Filed under: General at 02:15:35 On 2006-05-27

And ......here are the winners ....... 

1. America Online (1989-2006)
2. RealNetworks RealPlayer (1999)
3. Syncronys SoftRAM (1995)
4.Microsoft Windows Millennium (2000)
5. Sony BMG Music CDs (2005)
6. Disney The Lion King CD-ROM (1994)
7. Microsoft Bob (1995)
8. Microsoft Internet Explorer 6 (2001)
9. Pressplay and MusicNet 2002
10. Ashton-Tate dBASE IV (1988)
11. Priceline Groceries and Gas (2000)
12. PointCast Network (1996)
13. IBM PCjr. (1984)
14. Gateway 2000 10th Anniversary PC (1995)
15. Iomega Zip Drive (1998)
16. Comet Systems Comet Cursor (1997)
17. Apple Macintosh Portable (1989)
18. IBM Deskstar 75GXP (2000)
19. OQO Model 1 (2004)
20. DigitalConvergence CueCat (2000)
21. Eyetop Wearable DVD Player (2004)
22. Apple Pippin @World (1996)
23. Free PCs (1999)
24. DigiScents iSmell (2001)
25. Sharp RD3D Notebook (2004)

Build Your own Laser

Filed under: General at 02:48:15 On 2006-05-22

Ever wanted to make own ruby laser device ?

Well ,now you can .. cool .

Find it here

Now ... this is cool

Filed under: General at 06:55:32 On 2006-05-21

Check this out


Why my Win32:Timer code sucks !

Filed under: Visual C++ at 13:05:24 On 2006-05-17

Now i came to know why my precise loops alwayz showed a random behaviour.

Actually i used to call timeGetTime() to do timing control.

But it seems because of the granularity of the system timer can be as high as 10-15
milliseconds, meaning that timeGetTime() is only accurate to 10-15 milliseconds.

There are multiple approaches which we can use for time control, some of them are :

"RDTSC":

It stands for "Read Time Stamp Counter." This assembly instruction returns
an unsigned 64-bit integer reading on the processor's internal high-precision
timer.

In order to get the frequency of the timer (how much the timer return
value will increment in 1 second), you can read the registry for the machine's
speed.

bool GetPentiumClockEstimateFromRegistry(unsigned __int64 *frequency)
{
HKEY hKey;
DWORD cbBuffer;
LONG rc;

*frequency = 0;

rc = RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
"Hardware\\Description\\System\\CentralProcessor\\0",
0,
KEY_READ,
&hKey
);

if (rc == ERROR_SUCCESS)
{
cbBuffer = sizeof (DWORD);
DWORD freq_mhz;
rc = RegQueryValueEx
(
hKey,
"~MHz",
NULL,
NULL,
(LPBYTE)(&freq_mhz),
&cbBuffer
);
if (rc == ERROR_SUCCESS)
*frequency = freq_mhz*1024*1024;
RegCloseKey (hKey);
}

return (*frequency > 0);
}

GetPentiumTimeRaw():

double GetPentiumTimeAsDouble(unsigned __int64 frequency)
{
// returns < 0 on failure; otherwise, returns current cpu time, in seconds.
// warning: watch out for wraparound!

if (frequency==0)
return -1.0;

// get high-precision time:
__try
{
unsigned __int64 high_perf_time;
unsigned __int64 *dest = &high_perf_time;
__asm
{
_emit 0xf // these two bytes form the 'rdtsc' asm instruction,
_emit 0x31 // available on Pentium I and later.
mov esi, dest
mov [esi ], eax // lower 32 bits of tsc
mov [esi+4], edx // upper 32 bits of tsc
}
__int64 time_s = (__int64)(high_perf_time / frequency);
__int64 time_fract = (__int64)(high_perf_time % frequency);
double ret = (time_s % (60*60*24*7)) + (double)time_fract/(double)((__int64)frequency);
return ret;
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
return -1.0;
}

return -1.0;
}

QueryPerformanceFrequency & QueryPerformanceCounter:

QueryPerformanceFrequency returns the amount that the counter will increment over 1 second; QueryPerformanceCounter

 

returns a LARGE_INTEGER (a 64-bit *signed* integer) that is the current value of the counter.

This approach is accurate upto 10 micro seconds.tongue-out



Conclusion

If we call timeBeginPeriod(1) at the beginning of our program (and timeEndPeriod(1) at the end), timeGetTime() will usually become

accurate to 1-2 milliseconds.

Sleep() sleeps for goes hand-in-hand with the granularity of timeGetTime(), so after calling timeBeginPeriod(1) once, Sleep(1)

will actually sleep for 1-2 milliseconds, Sleep(2) for 2-3, and so on (instead of sleeping in increments as high as 10-15 ms).

For simple timing, both timeGetTime and QueryPerformanceCounter work well, and QueryPerformanceCounter is obviously more accurate.


Part of this post is coming Ryan M. Geiss's post.

Firefox Blogging

Filed under: General at 10:52:12 On 2006-05-16

Deepest Sender is a blogging client for Firefox.

So, instead of having to go to the update page on LiveJournal/WordPress/Blogger/whatever, or loading up a separate client program, all you have to do is hit Ctrl+\, or click the button in your toolbar, and you can start posting your blogs from anywhere

Find it here 

Here are some of the features:

1.Multiple accounts

2.WYSIWYG

3.Sidebars.

4.Drag and drop

5.Music detection

6.Spellchecking

7.Crash recovery

8.Load and save drafts

9.Easily edit posts

10.Offline mode
 

Hacking Apache to its limit

Filed under: General at 11:56:03 On 2006-05-11

Well ,need we consider nay other example than this case study

Yahoo - One of the busiest site runs on Apache ,see how to make ur apache pump this much blood.

A very nice Power Point presentation about Yapache :

http://public.yahoo.com/%7Eradwin/talks/yapache-apachecon2005.htm

Google Suggest - Hack

Filed under: PHP at 04:00:00 On 2006-05-09

You may like to visit this old project of mine.

This tool does not use Google API.

We have gone beyond one step here from Google by recursively calling the function and appending alphabets from A to Z to the query string to get the complete resultset about that keyword.

For example if you put "paper" as a query the result set will be like :

paper 175,000,000 results
paper airplanes 1,830,000 results
paper mache 403,000 results
paper doll heaven 245,000 results
paper dolls 3,120,000 results
paperdoll heaven 19,100 results
paperport 353,000 results
paperdollheaven 1,780 results
paperchase 72,100 results
paper source 21,700,000 results

I used CURL for this project ,but regex can be used more efectively.

Actually i found this script on net a way back and then heavilly modified it as my webHost was not supporting many functions

putting a snippet here for you to think ahead. P.M. me if you need the complete source.

function buildSuggestUrl($keyword)
{
return "http://www.google.com/complete/search?hl=en&js=true&qu=" . urlencode($keyword);
}

PHP Eval

Filed under: PHP at 05:36:19 On 2006-05-07

Well ,this is a slower method (100 times slower sometimes) than direct page rendering.

But ,u get total control over the pagecontent dynamically.

Many a times its safe also to secure your PHP code.The immediate application which i could think of after looking at this function is my own template engine.


function eval_new_helper($arr){
return ("echo stripslashes(\"".addslashes($arr[1])."\");");
}

function eval_new($string){
$string = "".$string."";
$string = preg_replace("/<\?=\s+(.*?)\s+\?>/", "", $string);
$string = str_replace('?>', '', str_replace( array('((.|\n)*?)<\?/","eval_new_helper",$string) ) );
return eval($string);
}

// call it from here
eval_new($string);

?>

ALIAS Buzz

Filed under: Robotics at 06:40:49 On 2006-05-05

 Found some referrences to ALIAS over the net.

 

http://robots.net/robomenu/1112901712.html
http://mind.sourceforge.net/visrecog.html

 

Faster Web page rendering

Filed under: PHP at 07:32:35 On 2006-05-04

HTML files for larger sites can become pretty large themselves.

Gzipping or compressing these files has shown to provide a reduction in the neighboorhood of 70-80% of the original file size, a fairly significant 'weight loss'. I did the same thing for my site's index.php and to my surprise the page size came down to 11 KB flat from a huge 90 KB generated HTML.

The Trick

What you need to do is put is ob_start ("ob_gzhandler"); on the top of each page !

 

 How

We use PHP's ob_gzhandler to send compressed data. This function will first check to see if the browser requesting the file will accept 'gzip,deflate' encoding; if not it sends the file uncompressed. Almost all the browsers support GZip compression. One thing to keep in mind is that , Images are not compressed with this method as only HTML code is rendered via server.

Top 100 hollywood movies

Filed under: General at 11:18:54 On 2006-05-01

Found this list floating on the net.
1. The Avaitor 2. Million Dollar Baby 3. Mr. and Mrs. Smith 4. Crash 5. Mystic River 6. Hotel Rwanda 7. The Notebook 8. Ray 9. Sideways 10. Collateral 11. Finding Neverland (J.M. Barrie's Neverland) 12. Hitch 13. The Terminal 14. National Treasure 15. Man on Fire 16. Spanglish 17. Ocean's Twelve Ocean's 12 18. The Bourne Supremacy 19. The Day After Tomorrow 20. The Manchurian Candidate 21. "I, Robot" 22. Troy 23. The Last Samurai 24. Cold Mountain 25. Napoleon Dynamite 26. Batman Begins 27. Meet the Fockers 28. The Italian Job 29. The Longest Yard 30. Dodgeball: A True Underdog Story 31. Big Fish 32. Sahara 33. Lost in Translation 34. 50 First Dates 35. Closer 36. Kill Bill: Vol. 1 37. Mean Girls 38. Ladder 49 39. The Stepford Wives 40. War of the Worlds 41. Pirates of the Caribbean: The Curse of the Black Pearl 42. Eternal Sunshine of the Spotless Mind 43. Something's Gotta Give 44. 13 Going on 30 45. Monster-in-Law 46. Super Size Me 47. Garden State 48. Love Actually 49. Anchorman: The Legend of Ron Burgundy 50. Spider-Man 2 51. The Bourne Identity 52. Lemony Snicket's A Series of Unfortunate Events 53. Coach Carter 54. House of Sand and Fog 55. The Butterfly Effect: Director's Cut 56. Wedding Crashers 57. Secondhand Lions 58. Under the Tuscan Sun 59. Monster 60. The Incredibles 61. Kill Bill: Vol. 2 62. Matchstick Men 63. Master and Commander: The Far Side of the World 64. The School of Rock 65. Constantine 66. Miss Congeniality 2: Armed and Fabulous 67. Shrek 2 68. Mona Lisa Smile 69. Sin City 70. Two Weeks Notice 71. Hidalgo 72. Taking Lives 73. Catch Me If You Can 74. Raising Helen 75. Charlie and the Chocolate Factory 76. Fahrenheit 9/11 77. Hostage 78. Runaway Jury 79. The Forgotten 80. Road to Perdition 81. Shark Tale 82. Starsky & Hutch 83. Chicago 84. The Village 85. Cellular 86. Along Came Polly 87. How to Lose a Guy in 10 Days 88. Radio 89. Bewitched 90. Guess Who 91. Fantastic Four 92. Must Love Dogs 93. Gangs of New York 94. Be Cool 95. Bend It Like Beckham 96. Memento 97. In Good Company 98. The Passion of the Christ 99. Sky Captain and the World of Tomorrow 100. Anger Management
Next Page