Mildly Hurtful Sarcasm

Meaningless ranting, just like everybody else.

Wednesday, January 30, 2008

Charisma means little, and I approve this message

Substance, people, substance. What you have done, and what you are capable of doing; insights, visions, implementations. Since when that takes a back seat to charisma. When the Kennedys throw their support to Barack Obama, it hits me, Obama draws his crowd of supporter with his charisma, cause gives his speech just like JFK. His gesture, the content, everything. He's slick, he knows how to work the crowd. The thing is, I've not heard anything special from him: "Washington is broken", "we need to fix health care", "we need to reduce our dependency on foreign oil". Duh?!?! Even grandpa Ron Paul manages to criticize US foreign policy, attributing part of the Arabic population's hatred towards the US to the military base in Saudi Arabia. So shut up with the "I went to Detroit to insist on higher fuel efficiency" already (and even if he did... what did his trip accomplish? And doesn't he realize alot of people drive Japanese and German??)

It's fine if you support Obama, but do it for the deeds, not the charm please. Like the Kennedys, if Teddy can't say his name, I wonder how well he actually knows him.



And yeah, I am really sick of the "... and I approve this mesage" shit. Those commercial directors got to make that less annoying.

Labels: ,

Monday, January 28, 2008

TK Scrollable Frame

From my experience of developing graphical user interface, the two most tedious tasks are making your windows/widgets resizable and scrollable. TK, the de facto GUI extension of of TCL (and many other scriptings such as Python), has great window managers such as pack, grid and place that make creating resizable windows/widgets really easy.

That leaves scrolling.

So I created scrollableframe some years ago to ease the tasks. The idea is it being a regular frame that responds to scollbar commands. For example, I first create a scrollable frame .sf that talk to scrollbars .hs and .vs

scrollableframe .sf -xscrollcommand {.hs set} -yscrollcommand {.vs set}

Then I create the corresponding scrollbars

scrollbar .hs -command {.sf xview} -orient horizontal
scrollbar .vs -command {.sf yview} -orient vertical


Pack (grid) them together

grid .sf -column 0 -row 0 -sticky news
grid .vs -column 1 -row 0 -sticky news

grid .hs -column 0 -row 1 -sticky news

grid columnconfigure . 0 -weight 1

grid columnconfigure . 1 -weight 0

grid rowconfigure . 0 -weight 1

grid rowconfigure . 1 -weight 0


And BAM! you have a scrollable frame. Now if I have a label with some gigantic text

label .sf.l -text "I Tried To Create Some Very Very Big Text\n\nSome Ridiculously LARGE Text\n\nTo Demonstrate Scrolling" -font [font create -family times -size 100]

All I have to do is let the scrollable frame .sf swallow it, and it will work.

.sf swallow .sf.l



scrollableframe is written in pure TCL so it is highly portable and easy to use. Full source and description is downloadable from here. Man page is available here. Feedback welcomed.

Labels:

Tuesday, January 22, 2008

The MacBook Air makes me a better person

I think the MacBook Air is brilliant. With built in 802.11n wireless, you can install software or watch a movie using a CD drive that is on a different computer at a whopping over 100mbps speed. That means your software will install really fast. This represents a major technological break through made by a company that is at the forefront of innovation.

I predict the next generation of Mac notebook will allow you to connect to another computer using something called a ethernet cable to achieve a stunning 1000mbps, that's up to 10 times the speed of 802.11n. And the next next generation may even allow you to dock your notebook to a docking station that has an optical drive so you don't even need a cable or a seperate computer, as a result your software or media files will show up even faster. Who knows, at Apple's rate, we may even see a built in CD drive in our life time.

Labels:

Thursday, January 17, 2008

The iPhone makes me a better person

Whenever the guy in the commercial points to his iPhone and says "this phone makes me a better...", I just can't help but talk back to the TV "it makes you a bigger idiot than you already are". Cause he could have done that with any phone that has a web browser, and there are lots of them, some support both GRPS and 802.11. Get over it already.

Labels:

Sunday, January 13, 2008

Ron Paul in debate

Not that I'd be casting any ballot, but as much a leftist liberal as I am, none of the democatic candidate this year appeals to me. Edwards - too clueless, Obama - too slick, Clinton - too bitchy. On the other hand, the Republicans seem plenty electable this year. John McCain the war hero who dares break ranks and be unpopular just to speak his mind against toture and for the troop surge, etc. Huckabee who's sharp enough, not afraid to throw in a joke or two and seems honest enough. And then I saw Ron Paul the supposedly unelectable on TV the other night. This meek and seemingly senile Texas representative surprsingly had gotten everything right. He was fiercely against the war before it was started and is for government spending control. This grandpa got a good track record.

Labels:

Sunday, January 06, 2008

Obama in debate

Nothing good was on tonight so I watched the presidential debate. It was surprising how ugly it went.

I think John Edwards was the winner. He was strong and responsive (unlike last time when he looked like an idiot debating Dick Cheney). Bill Richardson wasn't aggressive enough, he came off clueless. Hillary was decimated by the Edwards-Obama alliance.

Obama came out the most shocking. He sounded more intelligent and stronger than I imagined. But he certainly slipped. When talked about the accountability of federal budget, he wanted a system to reveal where every dime goes, and said (to the effect of) "hopefully embarrass them [the Republicans]". What is that supposed to mean?? Would he rather see embarrassment at the cost of tax payers? For that, I question his honesty. And if he thinks inspiring words is enough he got something else going.


On the topic, what the eff is with Change?? Everybody tried so hard. Were they all doing that because Obama won in Iowa?

Labels:

Wednesday, January 02, 2008

Windows Mobile Today item font size and color

The newer versions of Windows Mobile allow users to change the default font size, including fonts displayed on Today items. The color of text can (and should) also change according to themes. I've looked up the internet/news groups but couldn't find any documentation or discussion about how to get the right font size and color, so I thought I lay it out here.

Font size can be changed from Start -> Settings -> System -> Screen -> Text Size. However, most of the discussion on the web mistaken the following as the way to get font size:

lf.lfWeight = FW_NORMAL;
lf.lfHeight = -((8.0 * (double)GetDeviceCaps(hDC, LOGPIXELSY) / 72.0) + 0.5);

This is no good, this will only get you font size based on device capability. It doesn't take into account user preferences. The proper way is to retrieve font size using SHGetUIMetrics defined in Aygshell.dll. Since I am using PocketPC 2000 SDK, I will dynamically load the library and find the function manually.

typedef HRESULT (WINAPI* TSHGetUIMetrics)(SHUIMETRICP shuim, PVOID pvBuffer, DWORD cbBufferSize, DWORD* pcbRequired);

DWORD dwFontSize;
TSHGetUIMetrics pSHGetUIMetrics;
HINSTANCE hAyg = GetModuleHandle(_T("Aygshell"));
pSHGetUIMetrics = GetProcAddress(hAyg, _T("SHGetUIMetrics")));
(*pSHGetUIMetrics)(SHUIM_FONTSIZE_PIXEL, &dwFontSize, sizeof(dwFontSize), 0);

Having the font size, creating the font is just a matter of getting the LOGFONT template from the device context, and then change its height.

LOGFONT lfTemplate;
hOldFont = (HFONT)GetCurrentObject(hDC, OBJ_FONT);
GetObject(hOldFont, sizeof(lfTemplate), &lfTemplate);
lfTemplate.lfHeight = GetFontHeight();
lfTemplate.lfWeight = FW_NORMAL;
HFONT hFont = CreateFontIndirect(&lfTemplate);

Voi la. You have now the correct font size. As for font color, it is just a matter of sending a message to the parent (Today) window to retrieve the color itself. Again, using PocketPC 2000 SDK, I need to define the message myself.

#define TODAYM_GETCOLOR (WM_USER + 100)
#define TODAYCOLOR_TEXT 0x10000004
COLORREF clrFont = (COLORREF)SendMessage(hwndParent, TODAYM_GETCOLOR, (WPARAM)TODAYCOLOR_TEXT, 0);
SetTextColor(hDC, clrFont);

There. It's that easy. I wonder why so many people have asked the question but no answers were found using search engines. Let me know if it works for you.

Labels: