<CharlieDigital/> Programming, Politics, and uhh…pineapples



Posted by Charles Chen

Finally figured out how to fix some of the bugs and problems I
had with jsTetris last night as I was laying down to sleep (I hate

Each list element needs to have a property, State, which takes one of two values:

  • 0 when the list element is empty (no pieces in it) or the list element is holding an active block (a block that can still move).
  • 1 when the list element is holding a fixed block (a block that can no longer move).

One of the big problems I had previously was that it was difficult to
calculate when a piece could still move.  The method I was using
was too inefficient and took too many lines of code.  It tried to
examine each of the target blocks to see if it contained an inactive
block.  This should make it easier by performing some simple math

Each block of each piece must be examined in the direction of the move
and simply do a sum between each block and the list element in the
target block.  If the sum of the State is 0, then we can move the block.  If the sum is anything other than 0, then the block cannot be moved anymore.

Once a block stops moving, before the next buffered piece is moved (may
have to cancel timer), we sum across the bottom most row up 4 rows and
see if the sum in that row divided by the number of columns is exactly
1.  If so, this means that every list element in that row is
holding a fixed block and we can move get rid of that row.  Once
we've checked 4 rows, we can then move all of the remaining straggling
pieces down before reactivating the timer on the buffered piece.

Seems like a plan.

I was also thinking about doing two other games last night. 

One of them would be based off of pipe dreams.  Remember that game
where you have to move around blocks which contained pipes as this
green ooze started flowing?  I think it can be done with .gif
animations if each of the animations takes precisely the same amount of
time.  There are a total of 7 different pieces.  6 of those
pieces would need two sets of animations and one of them, a cross
shaped piece, would need 4 animations.  This brings the total
number of pieces up to 16.  The idea would be to cache each of
these images and swap them out as the flow of the ooze moves through
the pipes.  This one should be interesting.

The other game would be based off of a game that I had on my TI-83 back
in my highschool days which is kind of along the lines of Dr. Mario or
Tetris Attack, except without falling pieces.  Basically, you get
a random m*n board, which is completely filled with
pieces (maybe 5-6 different types).  When you have three or more
adjacent pieces, those pieces disappear.  And "loose" pieces fall
into the space left by those pieces and can cause "combos".  The
objective is to clear the entire board with as high a score as possible
(factoring in time and combos).  Like Tetris Attack (I don't
completely remember the mechanics of Dr. Mario), you can manipulate two
adjacent blocks in the grid at a time.

Neither of these seem too difficult and sound like fun.

Oh yeah, I'm also working on a ASP.Net Beta 2 based version of Chinese chess or Xiangqi
The idea is to use Atlas to allow two players to play in real time,
with the moves and chat being relayed using calls to web services from
the client.  So far, I have the board and objects laid out. 
I still have to figure out how I want to implement the game rules and
how complex to make it in terms of supporting multiple games at
once.  I'm also waiting for my Beta 2 hosting account from ServerIntellect, my webhost.

That's it for now.

Filed under: Self Note No Comments

Awesome Photoshop Tutorials

Posted by Charles Chen

I (pretty randomly) came across an awesome series of Photoshop tutorials on deviantart.com (good place to wander around if you're in a creative funk).

I haven't done any heavy Photoshop artwork in quite a while now,
regardless, my technique never turned out results as good as
hers.  Very nice work and nicely put together tutorials.

Makes me want to plug in my (severely) underused Wacom and work on
some backlogged sketches.  Gah!  Can't make up my mind. 
Am I a software developer, or an artist?


I’m Not Alone!

Posted by Charles Chen

This pretty much sums up how I've been feeling every-freaking-day for the last few weeks/months:

I've never been more unsure about everything in the entire universe. I
no longer comprehend what is important in the essence of everything.
All knowledge and understanding I have aquired now all just seems
meaningless and empty. I feel I am completely hopeless. My mind
revolves so much around school and stale concrete fact. I don't really
have a life. Right now I am just existing, going day to day with what
seems like essentially no purpose or direction. I can't find my
foundation for thought or reason or action. This is the worst feeling I
have ever had in my entire life. Nothing is important, which in itself
is sigificant for some reason. I think. I don't know. I feel so
overwhelmed. I feel like I'm trying to wrap my head around life. Do you
know what all is in life? A whole fucking lot. And my mind feels
obligated to figure out every fucking bit of it at the same time. I
feel like I'm trying to wrap a rubber band around a dumptruck. I'll
either stay frustrated like this, or I'll somehow keep trying to
stretch until it snaps.

In my case, I don't think I can even recall a particular point in time when this happened. It feels
like I've been in this kind of funk forever.  I envy people, like
my wife, who (at least on the surface) seem to have figured out exactly
what life is about, what is important to them, what their goals are,
and what they have to do to get there.  I think it's healthy to
have goals; it gives you purpose and meaning in every action that you
do.  Problem is, I just can't seem to solidify mine.

:Sigh: :-S

Filed under: Life, Rants 2 Comments

Office Space

Posted by Charles Chen

For those of you who are curious, this is what my (tiny) "office" space looks like.


The funky looking thing on the right is actually a vertical, blower style, fan made by Holmes.  Yes, that is indeed a 19" Samsung LCD.  Very sweet.  Since I have very little desk space, I've started to invade the neighboring desks and even the divider (which doubles as a bookshelf!).  I swear, we were told that this was temporary, like 3 months ago.  Oh well.  Note the extra fanny cushion...these are the worst desk chairs.  EVAR.

On a side note, I finally figured out how to upload images from my cell phone 😀

I snapped a pic of a truck this morning that had quite a funny line scrawled on the back of it: "REAL MEN LOVE BUSH 04" (wink, wink, nudge, nudge).  Something very humorous about that :-), especially first thing in the morning.  Unfortunately, it came out all blurry :-S

Actually, I'm somewhat disappointed in the quality of my cameraphone.  Whodathunk that the camera sucked so much given the hefty price of the Razr?

Filed under: Miscellany No Comments

Workshop : Configurable DTS Packages

Posted by Charles Chen

I finished my first "workshop" article!

Had a bit of free time and decided to finish it as it's something that I've been meaning to do for quite a while now.

As an aside, the "workshop" series of articles are meant to be my
gesture of giving back to the community from which I've taken so
much.  I know I've found tons of useful blog posts and articles
online that have helped me greatly in the past, so I feel that it's
only fair that I give back a bit.   I don't claim to be some guru
or know all of the answers,
but my hope is that the information that I provide in these articles
can help someone out there get their job done more easily.  I'm
also aware that someone out there may have already done something like
this, but my own experience tells me that it's always helpful to work
with various sources to gain different insights.

Now onto the article!

In March, I worked on creating a SQL Server DTS package to import data
from various data files.  One aspect that grew tiring really fast
was having to manually change the paths of the source data files each
time I moved the package from one environment to another (or even from
my machine to Kent's).  We had 6 datafiles at the time (early
testing/development phase) in addition to various other settings that
were environment dependent like mail server addresses and database
logins.  I was simply too lazy to keep fiddling
with the settings in DTS every time I had to send the package to the
client or to Kent.

The solution I came up with makes use of DTS global variables, the
powerful "Dynamic Properties Task" task, and some simple VBScript.

Still interested?  Then read the full article.

Feel free to leave comments, questions, and criticisms 🙂 in this thread


OMG Live Giant Squid Photographed!

Posted by Charles Chen

Came across this article via Ars.

If you didn't know, I'm a huge fan of the cepholopod
class of animals.  The giant squid is one of those rare beasts
that we know exists via dead specimens that we've found, but have yet
to observe, live, in the wild.

So this is a very cool discovery!

Filed under: Miscellany 2 Comments

What’s Wrong with Insourcing?

Posted by Charles Chen

As I was browsing through the forums at Arstechnica, I came across a post titled "Alternatives to outsourcing?".

Being an IT consultant, this immediately caught my attention.

I read in Time, a while back, that a few companies were experimenting with insourcing, or the idea of setting up shop in areas of the US where the cost of living is low.

As the Net has spread and the amount of bandwidth has increased, to me,
physical location is becoming less and less important as communication
via the Net has become more accessible.  From video chat to VoIP,
the reality of a truly distributed team unit is getting ever closer to
reality.  Hopefully, WiMax will get us over that next hurdle of "the last mile" and truly network the entire nation.

What kind of strikes me as odd is that, even though most (probably
every) software developer or IT consultant has a broadband connection,
why I still have to show up at the office every day.  To be
honest, for the 9 months that I've worked here, a total of 4 of those
months were spent on "The Bench" (some refer to it as "The
Beach").  I know some people that can't work at home due to the
inability to focus or other distractions like spouses or children, but
that's not the case with me and I'd happily and productively (somehow
this doesn't seem like proper grammar) work from home.  It
wouldn't be so bad if I could show up in jeans and a dress shirt, which
I did for the first few months, but now we have this silly business
casual dress code (yes, I'm being picky), and I have to wear
khakis.  Tucked.  Blah!

Okay, back on topic :-).  To be honest, I could do my job just as
well from my fictional house in rural Georgia or South Dakota, provided
I have a broadband connection.  And I'd rather be doing
that than living in Jersey.  Traffic congestion is horrible and I
think it lessens my lifespan by 20 minutes each day (the amount of
extra time it takes me to get to work due to traffic).  For the
price of a small townhouse in Jersey, I could build a huge, 4 bedroom castle in Kansas.  In fact, Kansas offers free residential land
to encourage people to move out there.  Not only that, they offer
free commercial land and lots of monetary incentives to set up shop out

So the question stands, what's wrong with insourcing and why don't we
see more of it?  Certainly, while it's not as cheap as
outsourcing/offshoring, I think it's a better investment in the long
run considering the state of our economy and the good press it can
bring a company willing to invest in the American people.


The Perfectionist Plague

Posted by Charles Chen

There has to be other people out there like me.

I have issues.  Many issues.  We all do.  Perhaps the
one that gets to me the most is that I'm a perfectionist when it comes
to certain things, like designing software.  It's a curse, because
I try to be perfect from the beginning and it adds to the inertia of
getting the project started in the first place; getting that first,
crucial prototype out the door is the key first step to any project.

This is an issue that I've had for a quite a while now and I know that
software is supposed to be imperfect.  Particularly when you
undertake to create something new, no one knows what it's supposed to
look like; no one knows, 100%, what it's supposed to do. 
Certainly, there is an idea of what problem a particular piece of
software should solve with version 1, but I'm always trying to figure
out what it's supposed to do in version 2, before version 0.1 is even
complete.  Therein lies the problem.  My psyche forces me to
understand the
problem and solution completely before I can really start to make it a

I have a pile of papers scattered around my desk at home and my desk at
work with various projects that I've doodled or half started, but couldn't think
through completely either due to waning interest or lack of time. 
In all cases, I get stuck trying to see the whole picture before I've
arrived at the destination.

As a developer, I know the importance of prototyping and building
simple proof-of-concepts.  If fact, I do this often in my
professional life.  But as soon as I start working on any type of
personal project, this perfectionist drive just kicks in and
immobilizes me from the get-go 🙁

I can't be the only one that suffers from this afflictive emotion.  How do other developers deal with it?

One way is to work with others.  A couple of months back, I worked on a project with a friend I met while working at ITT,
Blake Dubin.  It was great working with him as he had a vision of
exactly what this tool needed to do, which relieved me from
over-analyzing the requirements of the tool.  In addition, it
helps that he prodded me to get the work done 😀 Yeah, the code was a
bit sloppy, but it was done in under 15-18 hours and it's really pretty
cool to boot.

The problem is that in my day-to-day life, I rarely deal with other
developers/managers that I feel are as interested in building these
things as I am.  One of the big problems is that I'm surrounded by
slightly older developers.  That in itself is not so bad, as there is
always something to be learned from experience in the industry, but the
problem is, they're not old enough that they can kinda shake off the
responsibilities of family life yet.  These guys are in their late
20's and 30's, so they have to, rightfully, place family ahead of self,
especially since they have very young kids, which leaves them with little free time to work on anything else.

I have a few friends who are developers as well.  My college
roommate, Joe, lives right around the corner from me.  But he's absorbed
by World of Warcraft.  The man is practically glued to his
computer desk.  In addition, he doesn't have the same passion for
creating random pieces of software (I think he'll end up in management
in a few years).

I'm sure this problem is not restricted to just software
development.  So how do you guys deal with this?  It's even
more annoying that I realize that this is a problem that I have, and
yet I'm unwilling or unable to resolve it by myself.


Saw the Dalai Lama!

Posted by Charles Chen

Quite a long weekend.

It culminated on Sunday with the lecture given by the Dalai Lama at my alma mater, Rutgers.

I also attended a wedding the same night; quite a spectrum of events to absorb in one day.

I would like to preface by stating that I am an atheist.  I am attracted to Buddhism not for the
spiritual/religious aspect of it, but rather the philosophical/moral
aspect and the message of the Dalai Lama, one of peace, compassion,
acceptance, and altruism without exception.

To be honest, I didn't know what to expect from this lecture; I wasn't sure why
I plopped down $30 for the tickets.  I was first formally
introduced to Buddhism in my Chinese Civ. class by a Dr. Peter Li (who,
in retrospect, reminds me a lot of the Dalai Lama in mannerisms,
speech, and approach).  As I mentioned, I'm an atheist and thus,
Buddhism, to me, is not so much a religion as it is a philosophy of

Having been removed from that academic environment, I've been
slacking in terms of my continued studies of Buddhism.  To that
effect, I wasn't sure that there would be any purpose or value
in going to this event.  Was it just to satisfy my ego? 
Bragging rights?  I don't know, but I felt that I had to go, being
that this might be a <cliché>once in a lifetime chance</cliché>.

The day began early for us as we took the scenic route to Rutgers (really scenic).  As we waited in the stadium, I found that I was quite surprised at the number of people that showed up
(I'm not quite sure why, as I knew that the lecture was sold
out).  It's an awesome sight to see so many people congregate in
one place for a non-sporting event.  What struck Sandy and I the
most was the incredible diversity of the group that was
present.  In our day to day lives, I think that most people rarely
deal with such a diverse population (be it your classroom or you

Aside: The population of Rutgers, and New Jersey in general, is
incredibly diverse.  I recall sitting outside, waiting for my
classes to start and watching as people of all races, cultural
backgrounds, and religious beliefs passed by.  What's amazing is
the level of acceptance demonstrated by everyone.  I mean, yeah,
we had our share of bad apples (I recall some anti-semetic graffiti),
but for the most part, the Rutgers student body is bountiful in its
cultural and racial differences.

It was simply amazing to witness the event; as 10:40 arrived,
the entire crowd of thousands of people sat in silence, focused
completely on the presence of a single man.  The Dalai Lama
himself is a simple man of simple words and simple ways.  He began
by addressing the crowd in Tiebetan and had a translator translate his

For the remainder of the lecture, the Dalai Lama addressed us in
English, only turning to his translator for a few terms here and
there.  The lecture had a very informal feel to it.  In
speech and mannerisms, we, his audience, were just as "old
acquaintances".  I half expected a much more formal, more serious
tone to his lecture.  Okay, actually, I fully expected it
to be a very stale lecture.  To my surprise, the entire stadium
would occasionally erupt with warm laughter as the Dalai Lama made
small jokes throughout his speech.

The subject of the lecture itself contained nothing earth
shattering (I won't bore you with a transcript of what was said, you
can catch that from the videos); nothing that you or I haven't thought
of before.  In fact, when Igor asked me what I had learned from
the lecture, I struggled to figure out what exactly moved me so much? Why
should it matter that these views were being conveyed to us by this
man?  I thought deeply about this after the lecture and today as well and I think
the reason it was such a moving speech (yes, I teared up at one point)
was the absolute conviction with which he delivered his message; one
full of compassion, understanding, acceptance, and altruism.  The
very embodiment of the Buddhist philosophy.  Yes, I found myself moved to tears as I sat there listening to his views, in complete silence, along with 40,000 of my brothers and sisters.

What made the entire experience even more enriching is that you can
only truly realize how down-to-earth and "everyman" the Dalai Lama is
if you see him, observe his mannerisms, and listen to his speech. 
He made it plain and clear that he is just like everyone of us and no
different.  He has his moments when he suffers from afflictive
emotions such as anger and jealousy.  He doesn't claim to know all
of the answers; in fact, he states the opposite quite frankly. 
When asked about this thoughts about the conflict between the Israelis
and the Palestinians, he offered his views, but added a footnote that
since his history of the region and the background of the two groups
was insufficient, he was incapable of providing us with The

The appeal of his message, and of Buddhism as a whole, I think, is
the idea that there is hope for humanity.  No, there is hope for all
sentient beings to live in peace and contentment.  And the
solution lies not in some mystical god who works in mysterious ways,
not in some relic, not in some religion, but in each of us
The fate of this Earth lies in our own hands and we can only truly
achieve peace through education, self cultivation (be it spiritual or
otherwise),  compassion, and shedding our ignorance inherent in
perception (as opposed to reality).

Igor asked whether I felt that this was a religious experience or an
intellectual experience.  In reality, it was neither.  It was
a humanistic experience that occurs but rarely in our lifetimes.

I highly recommend watching the video recap of the lecture (linked
off of the Rutgers site above).  And if you should ever get the
chance to see him in person, even if you are Christian, Jewish, Muslim,
Black, Caucasian, Americn Indian, or Martian ;-), I can only advise
that you do not miss the chance as he is truly an extraordinary human
being, whether he thinks so or not.


ASP.Net Cost of Entry

Posted by Charles Chen

Over the weekend, I was looking for some nice .Net based, open source web based photo gallery applications.

There are only a small handful of such products, including nGallery and Community Server (which uses nGallery).

On the other hand, one of the slickest and most feature rich web based photo management apps, Alex King's Photos 4.1, is built on PHP and MySQL.  While Alex mentions that it's not a gallery app, it's simple to imagine that it could be with only a few small modifications.

In general, the entire .Net culture of create-and-profit is
disheartening, considering the wide open community built around
alternative technologies like PHP, MySQL, Perl, and so on.  Part
of this is Microsoft's fault for not releasing free, full featured
tools necessary to build the applications.  Yes, you could build
ASP.Net web apps using only the SDK and command line tools, but then
you increase the barrier of entry by relegating the technology to only
the diehard nerds.

My hope is that, with the release of the Express line of tools and new development frameworks (like Atlas), we will see more open source tools that don't suck in the next .Net generation.

I'm currently debating on whether it's worth my time creating a web
based photo management/gallery application (that doesn't suck) using
.Net 2.0 and Atlas or WPF/E, which would limit the availability. 
Any votes?

On a related note, this month's Wired mag contains an interview with
Tim O'Reilly (of O'Reilly publishing fame).  As summarized by
Stephen Levy, the "new Net" is built upon "a philosophy of
participation and sharing and a sense that collective action will
inevitabley accrue to the greater good." 

When asked to identify his passion with only three words, O'Reilly
responded: "Harnessing collective intelligence."  I like to think
that Microsoft is catching on and will truly lead us into the pack
rather than away from the pack like the lone wolf that is sure to
struggle without the support of his pack.  The vision that I see coming out of Redmond with this
new generation of technologies is very promising in that respect. 
And for that, we should be greatful and excited.  I hope that many
of the incredibly talented developers out there who've traditionally
shunned Microsoft technologies will give them a shot this time
around.  There's just some really incredible free tools on the horizon that will enable developers to create the next generation of web based tools.