Recent Posts

Archives

Topics

Meta

Integer to int null pointer exception?

By Jeremy | March 20, 2009

As I was coding up some stuff for class today I was using your friendly HashMap in Java.  I created the hash map so it would use an Object and an Integer. I would have rather done an int but you can’t template ints.  Anyway, at one point I was pulling the Integer out of the map with something like this:

int parent = map.get(parentObj);

There happened to be a case where the parent object wasn’t in the map and that line kept throwing a null pointer exception. After a few minutes, I realized that is because the conversion from Integer to int implies an implicit method call. And when the value returned from .get was null, there was a null pointer exception on the Integer.toInt() method. So beware of implicit calls.

Topics: bugs, school | No Comments »

Steve Williams from Digg pays a visit…

By Jeremy | February 25, 2009

Steve Williams, the second employee hired on at digg, came by our class today and gave a lecture.  I really enjoyed the lecture.  There were tons of new problems and thoughts that he introduced about running a big distributed system like digg.  One thing I was really surprised about is that when your systems are as large as digg’s you run into Brewer’s Conjecture (PODC 2000).

What Brewer conjectured was that when you have a distributed system you want three main things from it: consistency, availability and partition-tolerance.  The problem is that Brewer showed that it is impossible to achieve all three of these goals.  Well, now what do you do?  Basically, you throw consistency out the window…but not very far.

Gilbert and Lynch went on to show in their paper that if you didn’t mind waiting a little bit for consistency, you could achieve all three.  That is what most high traffic websites are doing nowadays.  They have to replicate their data from their main database so what choice do they have?  Make the user wait?  I don’t think so.  You give them the best results you have knowing that eventually everything will become consistent.

One other lesson I learned that I felt was especially important was that we live in the real world.  What I mean by this is that our applications don’t have to be exact unless it is specifically required.  Does it really matter if we get an email 1 minute later than when it was sent or if we can’t see exactly how many pages of results a website has?  No.  Life isn’t perfect and we as people don’t really expect it to be.  Why should we hold our computer programs to an unreachable standard?  Mistakes need to be fixed when they are made but some things just don’t matter.

Topics: school | No Comments »

JRS AWS

By Jeremy | February 2, 2009

For one of my classes this semester we are using AWS to create a distributed web application for pictures.  I started a blog about so that I can fulfill the class requirement for a blog about it plus it really helps to remember the problems that I have had to fight through.  Anyway, if you are interested take a look at it.

Topics: school | No Comments »

Accelerated GWT – a review

By Jeremy | January 25, 2009

Accelerated GWT from Apress by Vipul Gupta has shown me that you can’t judge a book by its cover but you can judge a book by its title.  As clearly indicated by the title, this book isn’t professional GWT or advanced, it is accelerated, which when you really stop to think about it means ” to cause faster or greater activity, development, progress, advancement.” (Dictionary.com)  Acceleration is exactly what this book is about: it covers pretty much every topic that is basic to GWT and it covers them very well.

That being said, the back cover caused me to judge this book incorrectly.  The “Apress Roadmap” on the back indicates that Accelerated GWT should come after Beginning Google Web Toolkit and I disagree.  I think Accelerating GWT should be on par with a beginning book.  While the topics it covers are very diverse and dispersed it is only 300 pages long and thus doesn’t cover any of the chosen topics in depth.

Overall I really enjoyed the book’s content even if it was sparse at times.  I think this book is a great tool to get up and running using GWT in no time but if you are looking for advanced information on any topics then consider purchasing another book.

Topics: Reviews | 2 Comments »

Current Projects

By Jeremy | November 15, 2008

Over the past few months I have been working hard in another semester of school.  I have been implementing projects like a madman.  I just wanted to highlight a few of the more interesting ones I have been working on this semester.

Well, those are three of the really cool things I have been doing in my homework time this year.  They have been really enjoyable and really fun.  Not to mention the fact that I have learned loads of new stuff through doing them.  Next semester is going to be really enjoyable as well!

Topics: school | No Comments »

YouTube the plain-text password fairy

By Jeremy | July 30, 2008

So the other day I was doing some work and trying to explore different mainstream sites’ security models.  I was using fiddler and firebug and just some simple tools.  I tried Facebook and MySpace, Gmail and Yahoo and then I tried YouTube.  I almost didn’t try because I figured, They are part of Google; I assume they just use https like Gmail. Well, folks, I was very wrong.  I want to take you on a little journey with YouTube, the plain-text password fairy:

First, me, I created a nice fake profile: newuser258:

Next I started up fiddler and then I logged in with my new account:

Then I checked fiddler to see what exactly YouTube had sent through my browser and lo and behold, the plain-text password fairy was found out!

Well, I think the bottom line of all this is that the subsidiaries of the company that is not evil apparently don’t abide by the same non-evil rules.

Topics: Uncategorized | 1 Comment »

Calendar v0.1 – A Dynamic Javascript Date Picker…Tutorial

By Jeremy | June 7, 2008

This is the first of a few installments of how to create your own dynamic JavaScript calendar/date picker. First of all, I want to define what I mean be dynamic: simply put, the calendar creates itself from scratch so that it doesn’t matter what date the user wants to pick; they can find it.

The first thing that I always do when creating a JavaScript application is to mock up the html. I find it much easier to debug if I can actually see what is coming out of the JavaScript. This is exactly what I will show you now.

My main concern at this point is that my JavaScript calendar will be robust enough to handle any user’s need. This means considering how many weeks I needed to display to show all of the days. At first thought, 5 seems like a good idea, and why not? Most months consist of four weeks with a few days on either end. But, alas, there are many cases where five weeks would just not do. This means that my design includes six weeks with the first day of the month you are looking at, starting at the top week and the other days following.

The next thing I considered was how to display and manipulate this data. My first idea, and I think best idea, is to just use a simple table. I know, I know, I made reference to the dreaded html tag and even said that I used it, but the plain and simple task is that I do use it and so should you…when it makes sense.

With those two things in mind, I set off to compose some really ugly looking html. Let’s begin by creating a table that has a border so we can see exactly where our columns and rows are divided. That will look something like this:

<table border="1">

Pretty simple! The first thing I want the user to see is the name of the month with an arrow on either side so they can move from month to month. That would look something like this:

<tr>
<td><<</td>
<td colspan="5">May</td>
<td>>></td>
</tr>

The colspan=”5″ is included because we know that there are 7 days in a week and the arrows only need to be one column wide. This means that we want the name of the month to take up the rest of the columns which would be 5 columns. The next row will show each day of the week in the corresponding column assigned to it:

<tr>
<td>S</td>
<td>M</td>
<td>T</td>
<td>W</td>
<td>T</td>
<td>F</td>
<td>S</td>
</tr>

The final thing to do is simply list the days the correspond to the month. The first few will of course be for the month before and the last few days for the month after.

<tr>
<td>27</td>
<td>28</td>
<td>29</td>
<td>30</td>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
<td>10</td>
</tr>
<tr>
<td>11</td>
<td>12</td>
<td>13</td>
<td>14</td>
<td>15</td>
<td>16</td>
<td>17</td>
</tr>
<tr>
<td>18</td>
<td>19</td>
<td>20</td>
<td>21</td>
<td>22</td>
<td>23</td>
<td>24</td>
</tr>
<tr>
<td>25</td>
<td>26</td>
<td>27</td>
<td>28</td>
<td>29</td>
<td>30</td>
<td>31</td>
</tr>
<tr>
<td>1</td>
<td></td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
</tr>

And after all of that nice html code just finish it off with </table> and the mock of up our date picker/calendar is complete. Here is what the finished product should look like:

<< May >>
S M T W T F S
27 28 29 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

Not very pretty yet? Doesn’t actually accomplish anything yet? Um, yeah, that is correct. This is only so that we have a base off of which we can go. Now we easily know how we want to generate our html inside out javascript object. Figuring out the basic html before hand is the best way I have found to build web applications.

In the next installment of this tutorial I will show how to create a JavaScript object, public and private methods and variables in that object as well as one way to generate html on the fly with JavaScript. Thanks for joining me for this tutorial and I encourage you to check out the rest of the tutorials as they come.

Topics: tutorials, WebDev | No Comments »

JavaScript Foo or Flop?

By Jeremy | May 13, 2008

I know many people who downplay JavaScript and how cool it is. I personally love JavaScript and really enjoy writing web applications with it. These people contend that, while it is possible to write cool programs with JavaScript, it takes too much time to accomplish any really novel and useful items. The first thought that came to mind for me was, “Um, Google?” Since then I have just continued my nerdly adventures in the land of programming and have come across some pretty amazing projects written in JavaScript:

These are just three of hundreds, if not thousands, of amazing things people are able to do with JavaScript. I love JavaScript and while other technologies have their places, I intend to continue to develop in JavaScript for many days to come.

Topics: WebDev | No Comments »

gDo – my current baby

By Jeremy | April 8, 2008

I am currently working on a project I like to call gDo. I stole the first letter from Google and the second part of the name tries to describe what I am trying to create: a To-Do list. At the current moment it is really simple, but I plan on adding functionality until it becomes a pretty useful app.

I am developing this app for two reasons. One is so that I can learn AJAX better. The second is because I really need a to-do list that I don’t have to carry around with me everywhere. If I put this one up on the cloud then wherever I find the internet I will also find my to-do list.

So far there haven’t been any major problems as I have been fleshing out basic functionality. Currently gDo is just some iframes with a content div to hold the list of items in the to-do list. Figuring out how to interact between the windows and having different windows update at the correct times has been interesting. I would go into a long tutorial on how to do all of it except that I found all my solutions online. I will post on how I make the main window refresh and the complexities of knowing when windows are loaded so that they can be used.

Security has been my next project. I don’t want to implement full bore https but I don’t want people’s passwords to just be plain text available upon packet/request/response inspection. My solution has not been very original or novel (oh too bad, no patents that I can troll about with) but it is going to work great. I am just going to put the password through a little hash, which one of course will remain nameless, and add a little salt in for taste and bam. No little hackers reading my passwords without at least some effort.

The best part about all of this, though, is the experience I am gaining. I really enjoy learning new things and trying them out. It seems that many of my fellow nerds swear by this technology or that technology. They will argue until they are blue in the face about how Linux is better than Windows or Flex is better than AJAX or Java is better than any scripting language. The way I look at things is more of a buffet (and I do love buffets): I take a little AJAX when it seems to work well and then I take a little Flex when it works well. Bottom of the line, no technology is inherently bad. As long as you keep your eyes and mind open there will be places for every technology.

Topics: gDo, Security, WebDev | No Comments »

Hello world!

By Jeremy | April 2, 2008

Sheesh, this has taken me long enough! After at least a year of waiting, finally I am using my domain. I intend to use this blog to keep a record of my nerdly activities. I will talk about problems I have solved in the applications I have developed. I will muse about anything I want really. (That is the great and horrible part of the internet.) Hopefully anyone who reads this will enjoy themselves, learn a few things and become a little bit better of a person.

Topics: Uncategorized | No Comments »


Next Entries »