typedef struct
{
RectangleType bounds;
WinHandle savedbits;
} ProgBar;
void OpenProgressBar (ProgBar *progbar)
{
UInt16 savebitserror;
progbar->savedbits = WinSaveBits (& progbar->bounds, & savebitserror);
WinEraseRectangle (& progbar->bounds, 0);
}
void CloseProgressBar (ProgBar *progbar)
{
if (progbar->savedbits)
{
WinRestoreBits (progbar->savedbits,
progbar->bounds.topLeft.x, progbar->bounds.topLeft.y);
}
else
{
/* maybe should enqueue a frmUpdateEvent instead, maybe not */
WinEraseRectangle (& progbar->bounds, 0);
}
}
void UpdateProgressBar (ProgBar *progbar, Int32 numerator, Int32 denominator)
{
RectangleType fillrect;
RctCopyRectangle (& progbar->bounds, & fillrect);
fillrect.extent.x = progbar->bounds.extent.x * numerator / denominator;
WinDrawRectangle (& fillrect, 0);
}
void TestProgressBar ()
{
Int32 i;
const Int32 max = 25;
ProgBar progbar;
progbar.bounds.topLeft.x = 20;
progbar.bounds.topLeft.y = 70;
progbar.bounds.extent.x = 120;
progbar.bounds.extent.y = 20;
OpenProgressBar (& progbar);
for (i = 0; i <= max; i++)
{
UpdateProgressBar (& progbar, i, max);
SysTaskDelay (SysTicksPerSecond() / 5);
}
CloseProgressBar (& progbar);
}
Friday, January 18, 2008
Progress bar programming
Thursday, January 17, 2008
Top Ten Languages
10. French -- Number of speakers: 129 million
Often called the most romantic language in the world, French is spoken in
tons of countries, including Belgium, Canada, Rwanda, Cameroon, and Haiti.
Oh, and France too.. We're actually very lucky that French is so popular,
because without it, we might have been stuck with Dutch Toast, Dutch
Fries, and Dutch kissing (ew!).
To say "hello" in French, say "Bonjour" (bone-JOOR).
9. Malay—Indonesian Number of speakers: 159 million
Malay-Indonesian is spoken - surprise - in Malaysia and Indonesia.
Actually, we kinda fudged the numbers on this one because there are many
dialects of Malay, the most popular of which is Indonesian. But they're
all pretty much based on the same root language, which makes it the ninth
most-spoken in the world.Indonesia is a fascinating place; a nation made
up of over 13,000 islands it is the sixth most populated country in the
world. Malaysia borders on two of the larger parts of Indonesia (including
the island of Borneo), and is mostly known for its capital city of Kuala
Lumpur.
To say "hello" in Indonesian, say "Selamat pagi" (se-LA-maht PA-gee).
8. Portuguese -- Number of speakers: 191 million
Think of Portuguese as the little language that could. In the 12th
Century, Portugal won its independence from Spain and expanded all over
the world with the help of its famous explorers like Vasco da Gama and
Prince Henry the Navigator. (Good thing Henry became a navigator . . .
could you imagine if a guy named "Prince Henry the Navigator" became a
florist?) Because Portugal got in so early on the exploring game, the
language established itself all over the world, especially in Brazil
(where it's the national language), Macau, Angola, Venezuela, and
Mozambique.
To say "hello" in Portuguese, say "Bom dia" (bohn DEE-ah).
7. Bengali -- Number of speakers: 211 million
In Bangladesh, a country of 120+ million people, just about everybody
speaks Bengali. And because Bangladesh is virtually surrounded by India
(where the population is growing so fast, just breathing the air can get
you pregnant), the number of Bengali speakers in the world is much higher
than most people would expect.
To say "hello" in Bengali, say "Ei Je" (EYE-jay).
6. Arabic -- Number of speakers: 246 million
Arabic, one of the world's oldest languages, is spoken in the Middle East,
with speakers found in countries such as Saudi Arabia, Kuwait, Iraq,
Syria, Jordan, Lebanon, and Egypt. Furthermore, because Arabic is the
language of the Koran, millions of Moslems in other countries speak Arabic
as well. So many people have a working knowledge of Arabic, in fact, that
in 1974 it was made the sixth official language of the United Nations.
To say "hello" in Arabic, say "Al salaam a'alaykum" (Ahl sah-LAHM ah
ah-LAY-koom) .
5. Russian -- Number of speakers: 277 million
Mikhail Gorbachev, Boris Yeltsin, and Yakov Smirnoff are among the
millions of Russian speakers out there. Sure, we used to think of them as
our Commie enemies. Now we think of them as our Commie friends. One of the
six languages in the UN, Russian is spoken not only in the Mother Country,
but also in Belarus, Kazakhstan, and the U.S. (to name just a few places).
To say "hello" in Russian, say "Zdravstvuite" (ZDRAST-vet- yah).
4. Spanish -- Number of speakers: 392 million
Aside from all of those kids who take it in high school, Spanish is spoken
in just about every South American and Central American country, not to
mention Spain, Cuba, and the U.S. There is a particular interest in
Spanish in the U.S., as many English words are borrowed from the language,
including: tornado, bonanza, patio, quesadilla, enchilada, and taco grande
supreme.
To say "hello" in Spanish, say "Hola" (OH-la).
3. Hindustani -- Number of speakers: 497 million
Hindustani is the primary language of India's crowded population, and it
encompasses a huge number of dialects (of which the most commonly spoken
is Hindi). While many predict that the population of India will soon
surpass that of China, the prominence of English in India prevents
Hindustani from surpassing the most popular language in the world. If
you're interested in learning a little Hindi, there's a very easy way:
rent an Indian movie. The film industry in India is the most prolific in
the world, making thousands of action/romance/ musicals every year.
To say "hello" in Hindustani, say "Namaste" (Nah-MAH-stay) .
2. English -- Number of speakers: 508 million
While English doesn't have the most speakers, it is the official language
of more countries than any other language. Its speakers hail from all
around the world, including the U.S., Australia, England, Zimbabwe, the
Caribbean, Hong Kong, South Africa, and Canada. We'd tell you more about
English, but you probably feel pretty comfortable with the language
already. Let's just move on to the most popular language in the world.
To say "hello" in English, say "What's up, freak?" (watz-UP-freek) .
1. Mandarin -- Number of speakers: 1 billion+
Surprise, surprise, the most widely spoken language on the planet is based
in the most populated country on the planet, China. Beating second-place
English by a 2 to 1 ratio, but don't let that lull you into thinking that
Mandarin is easy to learn. Speaking Mandarin can be really tough, because
each word can be pronounced in four ways (or "tones"), and a beginner will
invariably have trouble distinguishing one tone from another. But if over
a billion people could do it, so could you. Try saying hello!
To say "hello" in Mandarin, say "Ni hao" (Nee HaOW). ("Hao" is pronounced
as one syllable, but the tone requires that you let your voice drop
midway, and then raise it again at the end.)
Posted by
sumesh
at
4:19 PM
|
Wednesday, January 9, 2008
Run Palm OS® Applications on Windows Mobile®
StyleTap® Platform allows you to run applications (and games) originally written for Palm OS handhelds on devices running
- Windows Mobile Pocket PC
- Windows Mobile 5.0 for Smartphone
- Windows Mobile 6.0
With more than 20,000 applications for the Palm OS platform available – many of them free – you will be able to do so much more with your Windows Mobile device.
StyleTap Platform is fast, compact and comes with everything you need. Just add your favorite third-party applications for Palm OS platform and you're ready to go!
Download a free 14-day trial of StyleTap Platform now, or
purchase a copy of StyleTap Platform for $49.95 (US).
Thursday, January 3, 2008
ASCII Generator
In the first in a series of tutorials on how to use the ASCGEN dotNET, I show you how to convert an image to a high quality fixed width text image with just a few simple steps and very little effort.
We will be going from this
First, a quick lesson about fonts or just skip ahead to the tutorial.
There are two main types of font: Fixed Width, which has one specific size for every character, and Variable Width, which has a fixed height but the width can vary between different characters.
Fixed width fonts such as Courier New, Lucida Console, Fixedsys are traditionally used for ASCII art, however most word processors use a variable width font like Times New Roman, or Arial.
When you have selected a fixed width font, at the top of the program you will see the “Ramp” toolbar used for setting the current ASCII ramp. When you use a variable width font, you will instead see the “Characters” toolbar, which is used for setting the conversion characters.

The ASCGEN dotNET is the first and only program able to convert images into ASCII art made for variable width fonts. We will cover variable width font conversions in a future tutorial, but for now let’s start with the default fixed width font.
Tutorial One: Creating your first image
Get a suitable image into the program
For this tutorial I will be using the following image, which was taken from a royalty free stock photo archive.
Go to “File/Load” or double-click the image area and select the image, or you can drag and drop the image onto the image tab or just copy it and paste it with “File/Import from Clipboard”.
Select an area of the image
When we convert the image, its resolution is reduced to the output size in memory, which means that small details will be lost or difficult to see. To produce the best output, we need to zoom in and concentrate on the main subject of the image.
So, imagine a box around the person or thing you want to see, then click on a corner and drag to create the selection area.
Click and drag the box to move it around, and use the white boxes to adjust the size. Make the input image bigger by dragging the separator between the text and image if needed.
Select the output font
For this tutorial, we will leave it at the default font settings which are Lucida Console, 9pt. The “Auto” button on the toolbar should be pushed down by default, which has the program create an accurate ASCII ramp for the font, and the ramp box will be grayed out.
Switch to full screen mode
To get a better view of the output, switch to full screen by clicking the button, or pressing F11. You could also hide the input image by clicking the
or pressing F12.
Adjust the brightness/contrast and levels for the output
To get the best results, the ASCGEN dotNET allows you to adjust the output image in real time.
It does this in two ways. The first is a Brightness/Contrast control which does exactly what you expect. However, a much more recommended method is through the levels control.

This control shows you a histogram of the current image, and allows you to adjust the minimum, median and maximum values in exactly the same way as you would in photoshop and other photo applications. It will make the image use the whole range of the output ramp, and can drastically improve the results. Google photoshop levels for some proper explanations and tutorials.
First, click and drag the black slider to adjust the minimum level. Try and put it near the first peak. Then, click and drag the white slider to adjust the maximum level. Try and put it around the last peak. If necessary, adjust the grey slider a little to set the middle point of the range.
Because of the way these images work, there isn’t a smooth incremental range of characters for the output and it’s easier to work with the output then the graph. Just adjust the settings until you’re happy with the results.
Save the text image
Now the image is finished, we just need to save it.
Go to “File/Save…” and the save dialog will appear. Set the “Save as type” drop down box for how you want to output the text image:
- Plain Text - Save the text without any font information (remember to set the correct font when you display it)
- Plain Text (Unicode) - Same as above, but will save as a unicode text file that can store ANSI and other non standard characters
- Rich Text - Saves the text and font settings as a rtf file that can be opened by wordprocessors
- XHTML 1.1 - Saves the image and font settings to a valid html file that can be opened by web browsers.
An alternative way to save the image is by clicking on “File/Save as an Image…”, which will output the text into an image format.
This is useful if you want to make sure the image will be displayed looking exactly as it should look without having to worry about the font.
By default the image is resized to 75% of its original size, but you can adjust up to 100% (the actual text size) with the slider or down to 25%. Use the arrow keys to adjust the size in smaller increments to the exact dimensions you want. Click “Ok”, then set the output filename and type (.gif usually produces the smallest output sizes), and we’re done.
Send Yourself an Email in the Future Using Google Calendar
Ever wanted to send yourself emails that are scheduled for delivery sometime in the future - say ten years from now ?
Now there are some services that allow you to send email messages with a future send date but there aren’t any guarantees that the email will get delivered to your Inbox on the scheduled date as that service itself may not stick around for that long a period.
Therefore a more reliable solution for sending future emails to yourself is to create an event reminder in any web based calendar from Google, Yahoo!, Microsoft or AOL - some of these companies may merge in the future but they’ll definitely be around in some form in the coming decades.
To compose an email with a future date, just create a new event in any of the web calendars and set the event date same as the email delivery date. Then set an email reminder 5 minutes from the start of the event.
You can use the same trick to schedule SMS messages in the future as all web calendars can send event alerts to your mobile phone.
Edit Clip Art Images inside PowerPoint Presentations
Microsoft PowerPoint is like Photoshop for clip art images. In just a few clicks, you can modify existing clip art graphics in PowerPoint so that the image appear more relevant to the theme of your Presentation.
For instance, you can easily remove complex backgrounds from clipart, merge two or more clip art images into one, change colors schemes, add perspective, image effects and so much more.
How to modify clip art in PowerPoint
Since clip arts are nothing but a group of lines and colored fills, the key to editing a clip art is to separate everything. Once you have inserted a clip art in your PowerPoint presentation slide, right click the graphic and select Group -> Ungroup. Repeat.
Now the clip art is like any other vector shape. If you want to remove a background (as in the case of tiger above), select the different objects that form the background and press delete.
Alternatively, you can change the color of the background by selecting a different color from the Format menu.
You can also create very interesting clip art by combining multiple images. In the example below, we placed the rabbit clip art onto the study table. In the process, we removed that golden egg, scaled the size and also flipped the rabbit direction.
In the next example, we imported an Excel chart inside PowerPoint, then picked only the standing lady from the “meeting” clipart and placed her behind the chart to add a slight 3D look.
The possibilities are endless. You can just change the color of the shirt while keeping everything else same or rotate the graphics or even place multiple copies of the same clip art image on one slide but with a different scale.
And once you are done editing the clip art, select all parts of the split image (just drag the mouse around the image) and press Ctrl+G to group everything again.