computers

JAVA QUESTION MARK ? ? ? Posted on 03/31/08 at 7:54PM
[ mandlar ]

Again, to prove that I learn something new everyday:

You can use a ? in a return statement (or whenever assigning a value to a data member) as follows in Java:

return (boolean condition) ? (if boolean is true) : (if boolean is false);

For example:

int x = 5;
int y = 10;
return (x > y) ? x : y;

Which would return the greater value: x or y (in this case, y).

Posted in computers | No Comments »
THIS WILL BLOW YOUR MIND Posted on 03/28/08 at 10:37AM
[ mandlar ]

Dear FireFox and Internet Explorer tab browsing users,

I would like to direct you to the middle button on your mouse a.k.a. the scroll wheel.

Hover thy mouse on top of a click and press the middle button, and thy browser wilt open thy page in a new tab! Amazing!

Hover thy mouse on top of a tab and press the middle button, and thy browser wilt close thy tab! Amazing!

Seriously, someone should have told me these things a year ago.

Posted in computers | 2 Comments »
JAVA CONTINUE LABELS Posted on 02/27/08 at 9:21PM
[ mandlar ]

I just learned something new in Java today. I’m finishing up my SMTP (e-mail) client/server program for my networking class and came across the follow peculiar situation:

When the server is listening for the next input from the client, it may receive the command to QUIT, which will essentially cause the server to disconnect from the client and go back to its original state. No biggie, but I thought to myself, how am I suppose to stop the current loop and go back TWO loops? I know that continue will stop where I am in a loop and re-start that loop, but what if it is a loop nestled in a loop and I want to go back to the outer loop? Well, my friend, this is where continue labels come in handy!

I will illustrate what I mean with the follow snippet of “code” (more like logic):

(Read on!)

Read the rest of this entry »

Posted in computers | 2 Comments »
RESILIENCE AND RENDERING BUG IN SAFARI Posted on 02/25/08 at 12:09PM
[ mandlar ]

When it comes to programming and grades, I usually do really good at both. But when I got my latest WWW programming grade back, I wasn’t happy, with neither the grade nor the reason why. I was given a 7/10 because “search appears to be broken”. But it wasn’t, I thought to myself. I had tested the program on all three of my machines on both IE and FireFox and hadn’t encountered any problems what so ever.

After shooting the TA an e-mail about the grade and asking for a more specific reason why it was broken, he pointed out that it was because of the following line for each text field:

<input name=’first’ type=’text’ id=’first’ size=’40′ value=’
Hello
‘>

The value of the field was written on separate lines. The way I learned about HTML is that it shouldn’t matter how many or few lines HTML is written on, it should still display the same. So if you want to write an entire page on a single line, then that is okay (although it would be a pain to read), or if you wanted to write one letter a line, then that should also technically work. The TA noticed this and gave me a point back (now 8/10) for it as he noticed that it wasn’t really broken, just not displaying. He also recommended that it should have read as:

<input name=”first” type=”text” id=”first” size=”40″ value=”Hello”/>

Which is great and all, but there should be no reason that my previous code didn’t work. This is when I found out that he was using Safari on his Mac, which was a browser I did not test against (because I didn’t think about it). I was therefore recommend to check my HTML at w3’s validator next time.

Being persistent in not giving up, I decided to see if I could find a test case to prove that it is Safari, and not my code, that is wrong. And here is when I came up with this simple test case that passed w3’s validator on XHTML Strict:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-strict.dtd“>
<html xmlns=’http://www.w3.org/1999/xhtml‘ xml:lang=’en’ lang=’en’>
<head><title>test</title></head>
<body>
<table width=’500′ border=’0′ cellpadding=’0′ cellspacing=’0′>
<tr>
<td>First Name </td>
<td><label>
<input name=’first’ type=’text’ id=’first’ size=’40′ value=’
hello
‘/>
</label></td>
</tr>
</table>
</body>
</html>

Even with the value on separate lines, this HTML passes the validator. I then copied this into a text file, saved it as HTML and opened it in Safari. Guess what? It still rendered a text field that was blank. I then opened it in FireFox and IE6 (the same HTML file) and it rendered a text field that had “hello” in it. So the major problem was, after all, a rendering bug in Safari. I e-mailed the TA my findings and as a result he bumped my grade up to 9/10, but highly insisted next time that I do try and write the HTML not only valid but with good practice, which I highly agree with and led me to quickly fix/update my JSPs for the next assignment (that is due on Wednesday).

So the moral of the story is to not forget about Mac users and their browser when doing web development. It is rather difficult to test against all browsers, but I guess one could consider IE, FireFox and Safari to be the three major browsers of today and should therefore at least test against those three. Another point of the story is to never accept a grade just “as-is” if you feel that you have some argument for a better grade, even if you do feel like a dick for telling your TA s/he is “wrong”.

Posted in computers | 3 Comments »
ONE DAY, I DREAM… Posted on 02/22/08 at 5:02PM
[ mandlar ]


Wow this was taken a long time ago (2 years ago!).

I hope that one day I can have an awesome (permanent) computer room/desk setup like one of these people.  It is hard to do now because I’m at school 9 months of the year and I don’t have a lot of space to work with (I’m just glad that what little space I do have works).  And when I’m at home I’m not there long enough to try and set up something awesome.  I’ve always wanted to completely re-do our basement computer room (my former dungeon), but I’ve never had the time and there is too much “other” stuff in there to sort out.  I guess I’ll have to wait until I have a little place of my own to officially call home (in what, 5 years?  hah).

Plus I’d have to think how I would want to organize and use things.  For example: right now I currently use my desktop and my Averatec laptop whenever I’m in my room.  I hardly ever use my IBM laptop unless I’m in class, studying, out of the room, or programming (in the room).  Not to say it doesn’t have it uses, I just find it hard to use three separate computers at once, efficiently

Now I also have the consideration of my new TV as another monitor.  Currently it is only used as a TV (and sometimes I’ll show something on my desktop computer to the TV monitor), but in a better setup it could actually be a second monitor to my desktop.  But since it is a lot larger than my current monitor, it would be hard to have it position next to it to “expand” the desktop space.  Would it be better to simply have another similar Samsung (17″? I think?) monitor to put beside of my current one?  And if that was a possibility, then would my Averatec laptop serve its same purpose as a pseudo-second monitor controlled mainly via Synergy?  Of course you’d have to remember that its two physical different machines since the laptop has its own processor, hdd, etc. and is not just simply another monitor per-say.

And of course (as I’ve mentioned this before), this would a totally awesome setup, but who in the world could actually use all of those screens at once in an efficient and optimized way?  But one that looks even more appealing to me is this multi-OS setup.  It makes more sense.  Sure you won’t be using all 4 at once, but you also have the power of 3 different OSes at your hands with more focus on your primary OS (in his case, Ubuntu).  I’ve always wanted to have at least a second OS to fiddle around with, but I’ve neither had the time nor energy to do it.  Sure, I could wipe one of my laptops and load Linux on it, but I’m already accustom to their current setups.  Of course I could get something like a fitPC or a Mac Mini but then I’d have to have a real physical KVM setup or would really need to get a second monitor for the dual OS setup (and still possibly a KVM switch such that one OS or the other could have control of both monitors).

I know, I know, I’m just rambling away here, but let me dream for a bit.  I can already Jenn butting in and telling me “but what in the world do you need all of that for?” like when I hooked up my TV to my desktop.  I guess you’d have to be a techie like myself to understand how much we love to have unique, interesting, and efficient ways to use our many, many, many gadgets.

Posted in computers | No Comments »
QUICK NOTE ON ADV WWW PROGRAMS Posted on 02/22/08 at 2:49PM
[ mandlar ]

Just a quick note, but you can find my most recently updated Advance WWW programming assignments here.  Nothing too interesting, but they work 100%.  If you want to mess around with it then either go to Homework 1c or to Homework 2.  They are the exact same thing except the Views (the web pages that you are seeing) are implemented differently.  Homework 1c is done via a lot of html wrapped around out.println(“Html code“) lines in Java (with out being a PrintWriter for HTML).  Homework 2 does away with that horrible method and instead uses JSPs (Java Server Pages).  Basically they are HTML files that can have Java code executed in them (sort of like how PHP works).

Anywho, sorry to bore, but just sharing my current class work with you all.

Posted in computers | No Comments »
SPEEDYDOMAINREGISTRATION / DEPENDABLEWEBHOST AND WHY YOU SHOULD JUMP SHIP (BEFORE IT SINKS) Posted on 02/17/08 at 12:12AM
[ mandlar ]

As I’ve mentioned before, I’ve had many issues with my (former) web host and (now former) domain registrar.  The first problem I had was that the web host completely dropped bottom: the website was down, couldn’t be pinged, and I couldn’t even FTP to their website.  Everything was gone, poof!  It had happened before, but after a quick e-mail (and reply back) things were back to normal.  However this time around, they never e-mailed me back.  And that was okay, because I just moved everything to the CS department servers that are free (for now, until I graduate).  And I canceled my subscription to their web hosting service.

Yet the part I was really worried about was getting control over my domain name back.  I can’t transfer my domain name to any other registrar without getting the transfer codes to it.  And if I don’t get e-mail replies, then I can’t get the transfer codes and therefore I’m stuck in a rut.

Well I decided earlier today to see if it was possible to e-mail them again.  Instead of getting no reply, I got a bounced reply.  Essentially, their e-mail no longer worked so I couldn’t even try to talk to them if I wanted to do such a thing.

A few google searches later I found myself at dotregistrar.com (now mydomain.com), which is the domain registrar that speedy domain registration worked through.  After a couple of e-mails to their tech support and proof of ID (scanned drivers license), I now have my domain successfully under control via their services.  In less than 24 hours.  Lets just say I’m very happy.  (And their domains are only $9/year).  I’m very happy.  I just need to find a cheap actually dependable web host and all will be well.  But I can worry about that another time.

A couple of other important notes:  If you have a bookmark to my website, please make sure that it is www.mandaria.net.  You can, yes, continue to use wwwx.cs.unc.edu/~denny/, but just remember that it’ll only last until 1) I get a new web host or 2) I graduate.  Additionally, now that I’m at mydomain.com, the forwarding my domain to the CS web server should keep mandaria.net in your address bar and not switch completely to wwwx.cs.unc.edu/~denny/.  It may take a couple of days for this change to come into effect (the technical term for this is called stealth URL forwarding).

But please, if you are using Speedy Domain Registration, then jump ship before it hits rock bottom.  In less than 24 hours and a couple of e-mails you’ll be sailing the high seas again!

Posted in computers | No Comments »
BANNER ROTATION CHANGE UP Posted on 01/27/08 at 8:24PM
[ mandlar ]

I spent some time today going through some of my more recent pictures and added 16 more photos to the banner rotation. It is something I’ve meant to do for quite some time because I only had pictures up from last year and very few of them at that. I kept those in the rotation and added pictures from Christmas, school, and other places!

If you have some suggestions of what to put into the rotation, then please drop me a line. I plan on (someday!) taking pictures of campus and putting them up.

If you want to see them all without madly refreshing your browser, then check them out after the cut.

Read the rest of this entry »

Posted in computers | No Comments »
JFLAP – MAKING AND TESTING FINITE STATE MACHINES Posted on 01/19/08 at 7:40PM
[ mandlar ]

So I found a really awesome program today to help me with my Comp 455 class.  The program is called JFLAP.  It lets you (very easily) make finite machines.  It supports DFA (Deterministic Finite Automaton), NFA (Nondeterministic Finite Automaton), regular grammar, regular expression, conversion between types, and many other things.  The best part?  You can test them.

For example: I made a NFA and then created a series of tests to make sure that it was correct (the problem was along the lines of “make a NFA for all binary strings starting with 1 that are multiples of 3″, i.e. 11, 110, 1001, etc. [3,6,9,etc. respectively]).  You can test just single queries against your machine or it’ll also let you do multiple queries.  It’ll even let you trace each query to see how the machine will read it and therefore allows you to easily “debug” it.  Super awesome!

Did I mention it was written in Java?

Posted in computers | No Comments »
SONGBEAT PLAYER Posted on 01/17/08 at 1:20PM
[ mandlar ]

Remember when I posted on how to use Google search for music?  Well I have one better now: Songbeat Player.

Basically it does the same as the Google search except it 1) puts it in a nice GUI such that you don’t have to remember the search string to find music 2) allows to stream the music before you even download it to make sure that you are getting what you want.  The only downside I have found so far (and it is minor) is that you can’t choose what directory it puts your music at.  There doesn’t seem to be an options or settings menu…

Still, it is pretty awesome.  Check it out!

Posted in computers | 1 Comment »