|
|
|
|
|
|
Good News, Bad News
Friday, May 27, 2005 5:16 PM
OK, good news, I'm planning to revive the blog. The bad news, I'm moving this blog over to Blogger.
I had my reasons doing so, but mostly because they have a more attrative page layout that I would feel like
actually posting stuff. Well, guess I'm just as normal as everyone
else, I guess, since Black and Green (or White) doesn't really appeal
to me, if that's any sort of a lame excuse :p.
Anyway, the link is http://thedigitalbluewave.blogspot.com/. Will be
posting stuff up soon, and do expect more frequent updates from me :).
Data Binding Vows
Saturday, December 18, 2004 7:54 AM
More itsy bitsy frustrations! This time round it's about Visual C# 2005 Express Edition.
Here's the scenario, I would like to bind my data to a DataGridView. So basically what I did is:
- Add the SqlClient stuff (SqlConnection, SqlDataAdapter, SqlCommand and other what nots) into my toolbox
- Drag the SqlDataAdapter into my Win Forms application
- Go through a cool data adapter wizard which deals with all those nitty gritty things (setting up connections, set up SIUDC [Select, Insert, Update, Delete Commands] etc.)
Everything is fine and dandy, and it should work straight... at least that's what I thought it should be. But no, my datagrid still doesn't display any data, even after I set my data source and display members correctly.
OK~ No big deal, let's make a simple Form_Load event with SqlDataAdapter.Fill(DataSet). Should work? Yes it should, but NO~ I get an exception instead. After quite some time figuring out what happened. The exception message caught my eye and I only noticed that the wizard generated EVERYTHING except for the Connection property for the SqlCommands it generated!
Hmm... I wonder whether this is a bug or not? Let me just check carefully before I send a bug report.
Event Handling Vows
Wednesday, December 15, 2004 7:34 AM
"It's always all the small things that causes the frustration.", guess that's pretty true to any sort of software development.
I have been pulling my hair out when I'm getting an "Object reference to an instance of an object." error everytime I'm raising an event to the parent window. It's like "WTF! My code is perfectly OK and yet why this stupid error keep on coming out when I tried to raise just one event?! (OK OK, I KNOW this doesn't sound anywhere from being professional ;p)
However, under close inspection, I found my answers from C# Programmer's Reference: Events Tutorial, which did made me kinda silly: Invoking an event Once a class has declared an event, it can treat that event just like a field of the indicated delegate type. The field will either be null, if no client has hooked up a delegate to the event, or else it refers to a delegate that should be called when the event is invoked. Thus, invoking an event is generally done by first checking for null and then calling the event. if (Changed != null)
Changed(this, e);
Invoking an event can only be done from within the class that declared the event.
So there, yet lesson learnt :)
Journey Into The Abyss
Tuesday, December 07, 2004 11:23 AM
Oh man! I can't believe I'm threading into the realms of System.Reflection, which is WAAAAY beyond what we would usually learn in school.
Anyway, I'm using it to load user controls dynamically. Will post up some views and stuff once I got the hang of it ;).
When You Wish Windows Forms Are Much Less Complicated Than Web Forms
Friday, December 03, 2004 8:55 AM
For those who have done quite a lot of WebForms datagrid
programming, it wouldn't be too long for you to start pulling your hair
out when you found out that customizing your datagrid was not as simple
as in webforms... Well, sort of, if you decided to use the rules that
works for webforms. (Every single customization is just one tag away!)
Dealing with Winform datagrids are a totally different story, and
you pretty much have to do most of the work programmatically,
especially when it comes to adding custom, non-databound columns (like
one of those "Remove" buttons that you can easily code in ASP.NET).
After quite some time of research, luckily I bumped into SyncFusion's Windows Forms FAQ, which up until now, have save me a lot of times from digging through the gigabytes of information over MSDN.
So yeah! It's really neat :). For those who would be curious how to
put that remove button on a Winforms datagrid, here's the closest fit I
can find:
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp?print=904
Something Minor, But...
Wednesday, November 24, 2004 7:01 AM
After about an hour of searching, I just found out that you can't bind a data reader to a Windows forms datagrid (or any other WinForms controls for that matter). But it's perfectly OK with WebForms though.
(I lost the MSDN link already, but doing a quick search I'm sure you'll able to find that article)
For those who are wondering where is part II of the previous post, theSpoke has ate it >.>. Too lasy to retype it, so maybe I'll do it later.
But in short, plan your exception handling codes, because handling errors gracefully without you being aware of it means an extremely hard time to find the problem in your program.
Debuggin' Experience: Things To Take Note When Doing Security (Part 1)
Wednesday, November 17, 2004 8:18 AM
OK, after almost a week of extremely hair pulling debugging experience, I finally got my web service to work. I'm still working on the major parts which will provide some funcitonality of the web service, but here's some insights when you are dealing with cryptography stuff:
Lesson #1: Clear Your Garbage Early... But Not Too Early For those who have been programming for quite some time (especially those from the C++ background), it is extremely important to make sure that you're quite diligent in cleaning up your own mess once you have done with your work.
C# is extremely useful when it comes to this, with the "using" keyword, you can be sure that it'll junk off any the specified object reference that you know that you won't be using anymore.
Now... the problem arises when you depend on the "using" keyword too much. Because there's some possibility that the garbage collector would junk away that object reference earlier than you expected. This is what I learnt the hard way.
So, my extremely clean yet extremely problematic code looks like this: using( MemoryStream memStream = new MemoryStream() ) { using( CryptoStream cypStream = new CryptoStream( memStream, tdes.CreateDecryptor(), cryptoStreamMode.Write ) { cypStream.Write(inputBArr, 0, inputBArr.Length); } }
Now this code is perfectly correct, just that the problem now is that... my decrypted stream has been truncated by 4~10 characters! And no, the .Flush() doesn't work as it should like in C/C++ (Ah~ Those were the days).
The reason behind this problem? The CryptoStream object has been killed off prematurely! Reading it up on MSDN, basically in order to make sure that everything has been written in the Cryptostream, we would need to .Close() it. (Does that reminds you of more C/C++? :p) So actually doing a "using" without a close is pretty much a bad idea here, since you would have killed it before you can close it. And so, the code goes like:
using( MemoryStream memStream = new MemoryStream() ) { CryptoStream cypStream = new CryptoStream( memStream, tdes.CreateDecryptor(), CryptoStreamMode.Write ); cypStream.Write(inputBArr, 0, inputBArr.Length); cypStream.Close(); // Get your decrypted data from the memStream, process it... }
So there you have it. Guess the old advice from programming gurus are right after all.
[to be continued next time]
We Had The Freedom, Yet We Shy Away from It
Friday, November 12, 2004 2:24 AM
Coming back to my techie life, I have been pretty much slowly crawling
back to the things that I used to do: exploring new technological
advances, doing more programming, keeping focus on what I want to
achieve, mastering some skills, and so on. And of course, what's a
techie life all about if we didn't get into the community :)? So yeah,
so I made my silent return to a few tech forums that I used to join in
the past.
There's one particular forum that I kind of find it funny. It's not
because it has some new wacky changes that made it humorous, but
instead it's because it seems that the community haven't changed a bit.
So the story goes when one of the topic asking for (extremely vague)
help on ASP.NET, and due to interesting circumstances the topic derails
and went off-tangent into a hot debate on the ethical issues of being
academically honest (i.e. Ahem... The ethical discussion on... hiring
someone to do one's final year project). And a hot yet interesting
debate ensues, and just when it comes to its climax, suddenly some cold
water has been pour on it and people suddenly pull themselves out from
the discussion.
And the reason? They don't want to spoil the festive mood of Deepavali and Hari Raya! What?!
OK, I DO have to admit that there are slight mudslinging happening over
there, but I don't see the reason why people trying to shy away from
intellectual debate and conflicts. As much as I would say that there
are some participants really need to pull themselves away and keep
their mind cool (and don't take things too personally), that doesn't
warrant having somebody else to tell everybody to stop this interesting debate!
Hello, if you don't want a heated discussion to spoil your festive mood, don't read it in the first place!
Don't be a spoil sport and kill a good discussion. (as much as I knew
that a person's (except from a mod or the admin) voice don't carry much
actual impact to actually stop the discussion, and yet I still find
that insulting.
... Maybe it's just typically... Malaysian? More often than not we seem
to be the gentle type who would want to avoid any sort of conflict as
much as possible. And yet is this false sense of harmony is going to do
any good for us? No wonder we always see a lot of whiners when it comes
to everything: especially politics. So what's the point of freedom of speech in our country's constitution if we don't use it?
Coming back, kudos for Amy Tang for stating her strong stance against this corrupted behaviour! (Refer to her Nov 10 entry, and do comment her on that one ^^)
[link] Cryptographic Tasks
Thursday, November 11, 2004 8:42 AM
MSDN: Cryptographic Tasks
This should provide a good introduction to those who wants to put in
some encryption technology into their applications. Currently I'm
thinking of using a two layered encryption architecture: Having Triple
DES as my data encryption algorithm, while RSA used as my key exchange
algorithm.
One problem though: Should I let my web service as the main data access
layer for both my ASP.Net and Windows forms application? How much
overhead it'll incur to the server hosting the WS? Should I make it two
servers: one for data store and another for the web service (judging
with the company I'm working with... maybe not). If one server can be
used, is encryption feasable? (assuming that the web service server
must handle about 20~50 concurrent users [should be a good estimate for
a normal SMI environment])
And... most importantly, how much data actually warrant for a secure
transportation? (well, for one thing, I'm sure usernames and passwords
are an obvious definite candidate. But how much business data that
actually needs encryption?)
Currently I'm developing a few toy projects before I'm able to actually
stress test that thing. But till then, I really need to look into a lot
of design factors.
Journey with ASP.NET 2.0
Friday, November 05, 2004 3:03 AM
Currently looking at ASP.NET 2.0 membership and personalization provider models and controls. Looked kind of nifty, however, since my work is much more on writing the underlying web service and the corresponding WinForms, I can't seem to benefit from the controls done for ASP.NET 2.0. However, that doesn't mean that WinForms and web service can't benefit from these functionality that .NET framework 2.0 have to offer. Basically according to MSDN VS2005 Documentation, basically we can look into several classes in the framework regarding the provider model (as in System.Web.Security, you can check the Membership, MembershipUser and the related classes), and we can basically write our own controls, business logic and other programming logic. I'm still looking into it, will post up some sample codes and stuff when I discovered something :).
Techno Rave! (As Much As I Hate The Genre :p)
Wednesday, November 03, 2004 1:43 AM
After a really exciting roller coaster ride in my own life (refer to my LiveJournal at http://www.livejournal.com/users/FelixLeong), I pretty much have no time (or concentration, to be exact) to touch on cool technological/programming stuff. The waves in my own life isn't stopping just yet (in fact I'm still hitting and surfing on them :p), but at least now I had more energy go back and focus more on my interest in programming and technology. And currently I'm having a paying part time job to touch on .NET stuff, so why not? Anyway, looking forward to see some updates on various experiences on several programming stuff and methodologies, among them are:
- .NET Application Blocks
- C# and Windows Forms
- AI in .NET (which will be my presentation in MIND in Dec. Hopefully I'm able to get it prepared)
So, hopefully this digital blue wave is going to rise again ;).
Good Online Shopping Sites
Thursday, July 29, 2004 8:50 AM
Just got my CD from CDJapan, and it's so sweet that they packaged it
nicely in a tough cardboard box with bubble wraps and stuff :).
Anyway, here's some online shopping sites which I deal with and extremely recommended:
- Acmabooks (http://www.acmabooks.com/)
An online bookstore which have branches in Malaysia, Singapore and Hong
Kong, the booklist might not beat Amazon, but having it local means
that the shipping might not cost you a bomb. :) Not to mention that
they provide free courrier shipping when you spend RM150 and above.
Just sweet.
The customer service is extremely friendly and custom ordering books is a breeze.
- YesAsia (http://www.yesasia.com/)
Can't find your favourite Asian CD, videos or books? Here's one spot to
source them out! OK, the CDs are slightly on the expensive side
compared to what we get from Malaysia (consider yourself lucky, man!),
but for hard-to-get CDs, it's really worth the extra 20 ringgit :).
Not to mention that they offer free regular air-mail shipping when you spend US$47 there. Good deal.
- CDJapan.co.jp (http://www.cdjapan.co.jp)
For JPop junkies, here's the place to get Japanese import CDs! OK, the
price is a tad high due to the fixed CD price in Japan and the strong
exchange rate of the Japanese Yen... well... ._."
But the price is slightly lower compared to HMV
(http://www.hmv.co.jp/), and the site and customer support is really
user-friendly :). And their packaging is unbeatable (Hey! They DO
charge like 700 yen for shipping and service charge, right? :p)
Guess that's the list which came up to my head now. Now I might be
considering to deal with big sites like eBay and Amazon.com. But the
customer service in eBay is kinda... well, nevermind.
I'm Just A Kid With Toys :3
Wednesday, July 28, 2004 1:59 PM
Hah! It's been a while I ever posted anything here. But well... since it's my tech blog, sorry about that :p.
Anyway, I'm feeling like a kid right now, having a 3rd generation iPod
to play with (yeah! Now I got bragging rights :LOL:). Been dealing with
eBay and PayPal for the first time, currently having some bids for
certain items which I can only drool in the past. Haven't got any
successful bids yet, but I have a nasty feeling that I'll get addicted
to it.
Anyway, got some really great programming experience with my AAI
assignments, and C++ does make my head spinning like a top. Yeah...
it's hectic but fun nonetheless.
Anyway, signing off here. Oh BTW, just wondering, what is the coolest gadget that you own/plan to own? :)
|
|
|
|
|
|
| | Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|
| 30 | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 10 | 11 | 12 | 13 | | 14 | 15 | 16 | 17 | 18 | 19 | 20 | | 21 | 22 | 23 | 24 | 25 | 26 | 27 | | 28 | 29 | 30 | 31 | 1 | 2 | 3 | | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|
|
|
|
|
|
|
|
|