Deprecated: Array and string offset access syntax with curly braces is deprecated in /homepages/18/d158249911/htdocs/blogs/inc/_core/_misc.funcs.php on line 5524

Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/18/d158249911/htdocs/blogs/inc/_core/_param.funcs.php on line 2220

Warning: Cannot modify header information - headers already sent by (output started at /homepages/18/d158249911/htdocs/blogs/inc/_core/_misc.funcs.php:5524) in /homepages/18/d158249911/htdocs/blogs/inc/_core/_template.funcs.php on line 398

Warning: Cannot modify header information - headers already sent by (output started at /homepages/18/d158249911/htdocs/blogs/inc/_core/_misc.funcs.php:5524) in /homepages/18/d158249911/htdocs/blogs/inc/_core/_template.funcs.php on line 40

Warning: Cannot modify header information - headers already sent by (output started at /homepages/18/d158249911/htdocs/blogs/inc/_core/_misc.funcs.php:5524) in /homepages/18/d158249911/htdocs/blogs/inc/_core/_template.funcs.php on line 336

Warning: Cannot modify header information - headers already sent by (output started at /homepages/18/d158249911/htdocs/blogs/inc/_core/_misc.funcs.php:5524) in /homepages/18/d158249911/htdocs/blogs/inc/_core/_template.funcs.php on line 337

Warning: Cannot modify header information - headers already sent by (output started at /homepages/18/d158249911/htdocs/blogs/inc/_core/_misc.funcs.php:5524) in /homepages/18/d158249911/htdocs/blogs/inc/_core/_template.funcs.php on line 338

Warning: Cannot modify header information - headers already sent by (output started at /homepages/18/d158249911/htdocs/blogs/inc/_core/_misc.funcs.php:5524) in /homepages/18/d158249911/htdocs/blogs/inc/_core/_template.funcs.php on line 339
Category: "Technology" - Charlie's Thoughts

Category: "Technology"

Scientific Mysteries - Why I Love to Fly

12/04/13 | by Comp615 [mail] | Categories: The Mind, Technology

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /homepages/18/d158249911/htdocs/blogs/plugins/_bbcode.plugin.php on line 234

Deprecated: Array and string offset access syntax with curly braces is deprecated in /homepages/18/d158249911/htdocs/blogs/plugins/_auto_p.plugin.php on line 502

Deprecated: Array and string offset access syntax with curly braces is deprecated in /homepages/18/d158249911/htdocs/blogs/plugins/_auto_p.plugin.php on line 500

Deprecated: Array and string offset access syntax with curly braces is deprecated in /homepages/18/d158249911/htdocs/blogs/plugins/_auto_p.plugin.php on line 500

Deprecated: Array and string offset access syntax with curly braces is deprecated in /homepages/18/d158249911/htdocs/blogs/plugins/_texturize.plugin.php on line 116

The idea of flying has always been one of those weird blendings of the real and unreal for me; as I write this, I sit comfortably in my chair on an A320, watching us seemingly levitate through the air, cutting through the clouds. The winglets appear to hold us fixed in a straight flight through some unseen current, almost like a car on a Hot Wheels track.

And yet I understand that the magical sensation we know as lift is caused by a pressure differential forming around the plane based on the carefully designed shape of the wing which allows the air passing over and under the wing to flow at different speeds.

A few weeks ago I passed a checkride and officially became a pilot. I've done the requisite number of hours in various flight conditions and understand most of the physical components of a plane and of the atmosphere which allow flight from the properties of a wing to the effects of humidity on aircraft performance. Even as I flew my first commercial flight since starting my training, I could see the perfectly executed entry into the pattern "on the 45."

Yet despite the addition of checklists, rules and all that practical knowledge, I realize that I've maintained that sense of wonder; maintained the passion for the mysterious experience that is flight. For me, being able to use physics, logic, and well-defined concepts to create something so totally inconceivable and magical is truly gratifying.

I realize, in hindsight, that this is the second such passion I've been able to explore. Photography bears a strange number of similarities to flight. As I explored photography, I was told to use the "Rule of Thirds" which says that if the subject is generally on the one-third portion of the frame, it's often more interesting. I even led workshops in college, teaching people how to use flash in their photographs to ensure that the subject is well lit and easily distinguished from the background. It's quite simple really, just a matter of tweaking settings and coloring the light to match the frequency of the surrounding light. Yet I looked back through some old pictures and I saw myself applying the simple lighting tricks, but somehow capturing the life's work of a retiring swim coach or a moment of warring ideologies and changing times in a street debate between protestors. Even things so banal as a ping pong ball falling in a cup of beer seem to somehow convey more than the splash that's depicted and frozen in time.

Many great photographers often tell stories with or speak about the inspiration for their photos, people often refer to them as artists. Yet no matter the subject matter, I'll always consider myself simply a photo journalist. I'm capturing a tangible, real moment with (hopefully) proper exposure, composition and light balance. When I see it on paper though, that photo is not a page from a history book, but rather seems to tell a story. What story I cannot begin to understand, but I know that there's something more there, even if only a memory in my own mind.

Even programming, one could say, exhibits these characteristics. I sit and type in a well-defined language that might as well be French to most people, yet is nevertheless very rigid. But when people open up a site I've made, or a well-coded game…the experience they have on there can be truly transformative in a way that can't possible adhere to the constraints of a strongly typed programming language.

Every time I snap a picture and see it presented back…the result seems so much different, so much more magical than what I was just seeing through the viewfinder. And every time I reach rotation speed and feel the wheels gently ease off the runway, I find myself confused for a moment. I understand why they are doing this, yet the fact that they are, that the plane is in flight, seems wonderfully impossible. The application of science, of the definite and tangible rules of physics, to create something wholly foreign is…well, indescribable. But needless to say, I'm pretty confident that I'll enjoy being a pilot, a programmer, and a photographer for years to come, even as I search for the next mystery of science to unravel.

Tags: flying

Numbered Markers in Leaflet

04/02/12 | by Comp615 [mail] | Categories: Web, Technology

UPDATE: A Gist with the code is available here. You will still need to download the image I mention below.

One of the projects I'm currently working on deals heavily with mapping locations. Although Google Maps is great, I decided to go with a newer and more flexible solution, Leaflet. This little utility allows you to hook into CloudMade's huge database of tilesets to completely change how the maps look, in addition, Leaflet is just generally a super solid and fast mapping library.

After playing around with Leaflet, I really needed a way to label markers 1,2,3,etc. and wasn't able to find any easy way of doing this. So here's a quick little trick that should get anyone else looking for this functionality started.

First, make sure you are using the 4.0+ version of Leaflet, that's what I modeled this after, although you could probably use a similar approach for 3.0 as well.

The default marker wasn't quite the right size for fitting text inside, so I took it and distorted it a bit in photoshop. It's by no means perfect, but should do in a pinch. Download my custom marker here.

Next, we need to create our own icon class. Add the following code to a javascript file in your project, editing the path to the image as appropriate (Mine is ERB js):

L.NumberedDivIcon = L.Icon.extend({
options: {
iconUrl: '<%= image_path("leaflet/marker_hole.png") %>',
number: '',
shadowUrl: null,
iconSize: new L.Point(25, 41),
iconAnchor: new L.Point(13, 41),
popupAnchor: new L.Point(0, -33),
iconAnchor: (Point)
popupAnchor: (Point)
className: 'leaflet-div-icon'

createIcon: function () {
var div = document.createElement('div');
var img = this._createImg(this.options['iconUrl']);
var numdiv = document.createElement('div');
numdiv.setAttribute ( "class", "number" );
numdiv.innerHTML = this.options['number'] || '';
div.appendChild ( img );
div.appendChild ( numdiv );
this._setIconStyles(div, 'icon');
return div;

//you could change this to add a shadow like in the normal marker if you really wanted
createShadow: function () {
return null;

Now we need to unstyle the disgusting default div, and a little bit of styling will line up our number nicely. This goes in your CSS somewhere:

.leaflet-div-icon {
background: transparent;
border: none;
.leaflet-marker-icon .number{
position: relative;
top: -37px;
font-size: 12px;
width: 25px;
text-align: center;

And that's it! Now we have a nice new class we can use to number things, for instance:

var marker = new L.Marker(new L.LatLng(0, 0), {
icon: new L.NumberedDivIcon({number: '1'})

Hopefully someone finds this useful! I'd love to see a better implementation of this make it into Leaflet master, but till then this should do nicely. Enjoy and happy mapping!

The Android Experience (Day 3)

09/05/11 | by Comp615 [mail] | Categories: Technology

Well I never thought the day would come, but I finally gave up my trusty old Blackberry for a shiny new Droid 3 from Verizon. When they finally came up with a decent android phone with a physical keyboard, I ran out of reasons not to upgrade. These are some of my initial impressions after using the phone for a couple days.

My entire family actually was due for phone upgrades, so most of us got the Droid 3 (my mom also enjoys the physical keyboards). My brother was actually the only one to choose an Iphone, which I'm almost certain is due to the overwhelming social pressures to fit-in he experiences as a freshmen in high school. Nevertheless, my experiences with the Droid have not been totally positive. Partially because of certain design choices, but also because I'm so used to a blackberry. This isn't a review of the specific phone so much as it is of the overall Android experience (Gingerbread for those interested).

It took me all of an hour to get all my applications setup how I wanted. I never needed to search the internet or read the manual to figure out what I was doing. Just like when I was 5, I simply pushed buttons until I figured out what they did. Once I got over the initial fun of a touch screen (just moving things back and forth for a couple minutes), I quickly went to the marketplace and loaded up some much needed apps.

Armed with my flashlight, Google maps, Facebook, and the angry birds series. I went to configure my home screens.

Here's the thing. IPhones have a great design and aesthetic. As long as you enjoy that aesthetic and are willing to conform the way you use your phone to fit it, that works. But I was immediately struck by this nifty thing on the android called widgets. I can search the web, YouTube or Facebook, quickly browse my email inbox, or view the weather all from my home screen. No I mean it's literally ON my homescreen, I don't have to push an icon to go to it.

While that's great, and the quick view of information is helpful, here's a super concrete example of why widgets are better than icons. When an Iphone user wants to use the "flashlight" feature of their phone, they click the icon to open the flashlight app, then push a button to turn the light on. Simple right?

When I want to use my flashlight, I click an icon on my homescreen and the flashlight turns on or off. Wow! Why add extra clicks when I don't need them? Since widgets/icons can execute arbitrary code within an app, I'm not really using the app...I'm extending the functionality of my phone through this app. Moreover on the search widgets. Since they aren't forced into a rigid icon structure, but rather a modular design, they can do a lot more from the home screen.

This isn't a concrete example, but is more of a philosophical point. Android is designed to be a framework. It doesn't tell me how I should use my phone, rather it provides a framework for me to setup my phone the way I want. After I installed the skype app, when I clicked on someone's phone number, I was presented with a modal box asking me which application I wanted to use to complete the action, "Phone or Skype". Being a normal user, I clicked the remember my decision box and chose phone. But for those who have limited minutes in a data heavy environment, skype could be the default dialer.

The framework is integration, I don't have to go into an options menu to change it (initially) nor do I have to open the skype app and dial a number. I can change nearly everything about how my phone functions easily.

This lies at the core of why I love Android. It doesn't presume to understand how I want to use my phone, nor do I ever feel like there's a task I want to accomplish that cannot be done because of operating system limitations.

For instance, I now have every facebook friend as a contact in my phone, it's a lot more than I had, and kind of overwhelming, but when someone asks me if I have someone's number...chances are I do. The total integration of app and phone is both scary to me, but also immensely useful. Google apps such as calendar and mail are obviously integrated flawlessly, but I haven't used them too much yet.

It's not perfect out of the box. One of the things that annoyed me most was that there is no way to select all email messages and then mark them as read. Sucks right. But I could download an app and alter the way it works!

Another really cool feature I just discovered today is call-back texts. Basically, if someone calls me and I ignore the call, I immediately get a selection of three text messages I can click on to send the caller. Naturally these are configurable, and the two I see myself using the most are: "Hey I'm in class, what's up?" and "Hold on. I'll call you back in a couple minutes." Looking back I can't help but wonder how many times I've typed out that first message after someone calls me during class. It's genius.

The modularity of the framework leads to some very nice features as well. For instance, I can task kill things eating up resources. Or even better, I can view my battery usage based on application. (Angry Birds is killing my battery life). Just nice touches.

Finally, from a development stand point. It's so easy to develop for Android. So easy. It took me around 2 hours to get my environment setup and start debugging live on my phone. In contrast: 1) Steve Jobs decided I will never be deserving enough to develop for Iphone because I am a PC user (or because he's a money hoarder), 2) It's been about 6 weeks and we still can't get the development app paperwork done with Apple.

It's certainly not perfect, but Android is something that makes with happy with the underlying values it seems to support. The flexibility is much appreciated and the niftiness is icing. I'm actually quite pleased with it initially (despite the fact that the keys are now too big for my fingers!) I'll try and scrounge up a few other tidbits to share as I have some more time using it.

The Changing Face of File-Sharing

05/15/11 | by Comp615 [mail] | Categories: Technology

As the technology and the internet (and the regulations governing it) continue to evolve, so too do the means by which people abuse it. Where there is an easy way to get something for free, people will do it. Such is the nature of file-sharing. I got on the internet relatively early (which is to say in the 90's), and in the past decade, there's have been hundreds of preferred or *best* ways to illegally access files. As some died, others arose, this is their tale.

The Golden Age
Right around the turn of the millennium was the high point in digital file-sharing. The technology was ripe: computers were just gaining the storage space necessary to accommodate large amounts of digital media, people were writing programs which showed the vast potential of the internet, and connection speeds were finally rising from 56k dialup modems.

For reference, I used to have dialup. When I tried to download a song, I basically just queued up a couple and left. Downloading a game was a multi-day endeavor. Based on the 3MB, low-quality song size that was typical back then, it took me about 12 minutes to download a single song over dial-up.

You downloaded songs!? Yeah, I did, but I was a clever little 10-year-old. I stayed away from the hard-drugs (Napster), cause my mom would have been mad. Instead, I simple used AltaVista Music Search. Yup, I literally used a search engine to download music.

At this point in time there were dozens of option for downloading files. As I mentioned, search engines were a great starting point. Of course, there were also the numerous file-sharing programs and networks which all popped up right around 1999. Napster, Kazaa, E-Mule, Gnutella, Morpheous, and Azureus were the mainstream programs. Now while those were the main programs, they operated on a smaller number of networks (which still exist) such as Ed2K, mp2p, and Gnutella. In addition, there were tons of off-brand programs which interacted with the others. It's fun to note that nearly every single program on that list has been sued and now tries to operate as a legitimate music program.

The Dark Ages
As more and more programs started coming under fire from the RIAA, however, it became more risky to use those programs, or at least it seemed that way. A relatively small number of people were actually sued of the millions of people who inhabited those networks.

In any case, simply making all your files available to peers (or the government) was no longer a good idea. Luckily, for the consumer level file-sharer, there was an alternative. Internet Relay Chat (IRC) has been around since the early 80's and is what most people are talking about when they mention a chat-room. When I played video games, my group of friends had a chat room we hung out in, when I worked on an open-source software project, we offered support through a chat room, and of course, people with common interests often found their way to a chat room.

But IRC wasn't just for talk. If you knew where to look, you could find a special search engine which monitored all these rooms and compiled a list of (ro)bots. These bots would sit in specific channels/rooms and broadcast a message every 5 minutes or so listing the files which they hosted. These were typically big-ticket files like albums, games and movies. You then had to open a personal chat to the bot, and type specific commands which informed it which file you wanted. The good ones only transmitted to a handful of people at a time (to increase speeds), so you'd have to wait for quite some time before you actually got the file.

Of course, with the rise of DSL and cable internet, these were an important stepping stone to modern file sharing. They provided relatively high transfer rates on a variety of files. This also provided a high amount of safety from detection. For instance, in Canada it's only illegal to upload illegal content, not to download it. The US law is different, but in any case, it's usually the uploading part that causes trouble.

The Renaissance
What's better than downloading from one server? Downloading from a million! Enter torrents. So far the transfers have all been peer-to-peer or server-to-peer, but now it's going to get a bit more complicated. Torrents are peers-to-peers. There's actually no server involved (other than a coordinating server).

It works like this. Someone creates a very small torrent file (which is a listing of files it contains and servers and some other special stuff). They then announce this torrent on a server. People search on that server, see the torrent file and load it.

Anyone who has a full copy of ALL the data is considered a seed, while anyone with a partial copy is a peer. Seeds will send peers a portion of the file, then peers can send each other parts of the files at the same time. So a seed could send 4 people a quarter of a file apiece, and at the same time, the peers can transfer their respective parts to each of the other 3. Thus in the amount of time the server would have transferred one file, four copies have been distributed.

That was a terrible explanation, so you should probably just go stare at the wikipedia page and animation for a bit.

In any case, it should be apparent that there is no true server in this model. At the same time, every downloader is also a server. This leads to potentially very fast transfer speeds with the caveat that if everyone with a full copy of the file logs off, the torrent could potentially die.

Torrents are actually an incredibly powerful tool for large, legal file transfers (although you internet service provider hates them). For instance when I downloaded Linux, I used a torrent. It saves the host servers bandwidth and provides high upload speeds to everyone else.

Unfortunately, this method also draws considerable scrutiny from your ISP. They actually inspect what you're transferring and sometimes can detect illegal files. See Net Neutrality on Wikipedia for more on that topic.

The Modern Age (and future!)
Today, people use a variety of the above methods. If you know what you're doing, you can even download from Google. With cloud-storage and file-transfer sites (think YouSendIt!) becoming more popular, those are the natural progression of file sharing. They provide the perfect cover of anonymity and distribution potential. There's literally hundreds of services like that. Simply upload your file and send random people the link.

Honestly, I have no idea where file-sharing will go in the future. If ISPs ever loosen their strangle-hold on upload bandwidths, I really do think BitTorrent is an ideal model. It embodies cloud-computing with its distributed-server model. I almost used it the other day for a project I'm working on this summer, BlueFusion (You'll get some blog posts about that later). We needed to download a huge amount of data (~15G&#66;&#41;, and it was available as a torrent.

You can always share files across local networks (college dorm rooms) or by sharing external hard drives. So no matter what, friendly file-swaps will always exist. The future of internet sharing depends a lot more on how the FCC Net Neutrality story unfolds. Lemmie know if you have any other methods I forgot to mention!

The Open-Source Experience (Pt. 4)

08/23/10 | by Comp615 [mail] | Categories: Web, Technology

My Involvement

Thus far I’ve only talked about my work with CKEditor, however back in high school I was involved with another project called ALP (Autonomous LAN Party). I found it when I was searching for LAN party software and became interested in it. When I discovered it, a first version had been developed but had since fallen into disrepair. I made a few modifications and found another guy who had made a few modifications and together we took over the project and developed it for awhile. To this day, it still (more or less) works, although the last version was released about 4 years ago.

We got to the point where we had outgrown the original slopped together version and needed to do a total rewrite. Unfortunately, the prospect of so much work and the lack of people to do it caused the project to fall apart in the planning phase. Nevertheless, all our work is publicly available and maybe someday I or someone else will pick it up and keep going.

CKEditor, just finished a rewrite and is much better off for it. Although this means it’s not totally mature yet and has a few bugs still lurking around. I encountered some of these and they were easy enough problems that I could hop right in and fix them. Thus it was quite easy for me to get involved in the project.

The hard part, however, was running the support forums (I just tried to answer a lot of posts). I ended up fielding about 7 posts a day. Some of the problems were legitimate or valid debugging things. I helped people work out their configurations and do things I had been through when I first setup the editor. On the other hand, some were face palmingly stupid questions which could have been solved by 2 minutes of effort or simply using google. I often had very little patience in these topics.

My feeling is that you should at least be able to understand the software you are using and how it works before asking questions. There were people who simply needed to find a configuration option (Which is all given on a single page on the site’s support area). They just hadn’t looked around before asking. While those cases are stressful, it’s also nice to see the people who say “oh thanks!” when they solve their problem. Those are the people who have actually worked through their problem before asking.

In any case, working on this project has given me a better understanding of the software, a better understanding of javascript, and made me feel like I’ve contributed to the project. Sure in a week I probably will never touch the project again, but that’s how it goes. Next month some new developer will have to use the software and will begin stomping bugs right where I left off.

The whole process is really an art though. There’s open-source software to manage open-source software, I.E. Trac. It’s the program almost everyone uses to “trac” bugs and manage source code. Most interestingly though is the fact that everything has to be so well thought out. Since none of the developers ever really see each other, there’s a remote code review process, standards have to be employed, and the whole project has to be well documented so that at a moments notice someone new can step in and start contributing.

It’s a fantastic process and one that I really support. If anything, it’s made me want to assemble a team to redevelop ALP. In summary I guess the open-source ideal, to me, seems to define a certain type of social norm. The tragedy of the commons doesn’t apply because even by being selfish, people will still help the project; It's impossible to use up all the open-source resources. Rather than not supporting the project, people will use the software for free and, when they themselves find bugs or make changes, will send their changes back into the commons helping future users.

Nevertheless, there are things that cost money in these projects. There is also the matter of incentive to develop. So next time you find one of these projects useful, consider sending $10 to help support it's development. After all isn't that better than having to pay hundreds of dollars for some commercial software? Support community development, choose open-source!

Pages: 1 3 4

A collection of musings from my time at Yale along with some thoughts about my "Freshman year of life" in San Francisco.


  XML Feeds

Build your own website!