tag:blogger.com,1999:blog-61833192024-03-08T05:13:49.465-05:00Terminally IncoherentUtterly random, incoherent and disjointed rants and ramblings...Unknownnoreply@blogger.comBlogger510125tag:blogger.com,1999:blog-6183319.post-1146581823909271242006-05-02T10:42:00.000-04:002006-05-02T10:57:07.560-04:00Moving on UpI decided that I need to move out of blogger. I like this place, but its a little bit to amateurish for me... I am a proffesional IT person, I have a degree in Computer Science and I'm writing my Masters Thesis. What the hell am I doing here? I need a more proffesionaly looking website, and a more presentable blog if I want to be treated seriously.<br /><br />I spend allot of time maintaining this blog, and it is a big part of my life. It is only logical to invest a little bit into this part of my life, and get some decent hosting. And this is not just for my blog. I want a place where I could publish my code, creative work and etc... I want to be able to have some online presence I could actually show to people when they are asking me about my web design skills. Blogger cannot give that to me.<br /><br />Thus, I decided to move to my own place: <a href="http://terminally-incoherent.com">terminally-incoherent.com</a>. There's not much there yet - just a wordpress installation which I used to import all my posts from this message board. An actual webpage will follow. I might still post here for the next few days as I do housekeeping, and settle in. But at some point you should probably update your RSS feeds and etc.<br /><br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/blogging" rel="tag">blogging</a>, <a href="http://technorati.com/tag/web+pages" rel="tag">web pages</a>, <a href="http://technorati.com/tag/leaving+blogger" rel="tag">leaving blogger</a>, <a href="http://technorati.com/tag/moving" rel="tag">moving</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1146375703629991152006-04-30T01:29:00.000-04:002006-04-30T01:41:43.663-04:00Twin SistersIs it just me or is Haley Berry stealing Gigi Edgley's Chiana look in X3? I swear, X3 storm and Chiana look like they were separated at birth:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/1990/301/1600/storm-chiana.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/1990/301/320/storm-chiana.jpg" border="0" alt="" /></a><br /><br /><div style="clear:both;">If they painted Haley the same grayish paint, she could play Chiana's sister :P</div><br /><br />Can't wait for X3. So far the X-men movies have been getting better. X1 was ok, X2 was better, so if that trend continues X3 should be actually a good movie. But then again, who knows.<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/x3" rel="tag">x3</a>, <a href="http://technorati.com/tag/xmen" rel="tag">xmen</a>, <a href="http://technorati.com/tag/x-men" rel="tag">x-men</a>, <a href="http://technorati.com/tag/storm" rel="tag">storm</a>, <a href="http://technorati.com/tag/chiana" rel="tag">chiana</a>, <a href="http://technorati.com/tag/halley+berry" rel="tag">halley berry</a>, <a href="http://technorati.com/tag/gigi+edgley" rel="tag">gigi edgley</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1146339661908735392006-04-29T15:41:00.000-04:002006-04-29T22:49:45.216-04:00Monster Mega Breackfast<style type="text/css">.flickr-photo { border: solid 1px #000000; }.flickr-frame { float: left; text-align: center; margin-right: 15px; margin-bottom: 15px; }.flickr-caption { font-size: 0.8em; margin-top: 0px; }</style><div class="flickr-frame"> <a href="http://www.flickr.com/photos/maciak/137002358/" title="photo sharing"><img src="http://static.flickr.com/49/137002358_e05df9bea1_t.jpg" class="flickr-photo" alt="Monster Mega Breackfast" /></a><br /> <span class="flickr-caption"> <a href="http://www.flickr.com/photos/maciak/137002358/">Monster Mega Breackfast</a>,<br />originally uploaded by <a href="http://www.flickr.com/people/maciak/">maciakl</a>. </span></div>Ark and me went to the Red Hawk Diner today. We made the mistake of ordering their <span style="font-style: italic;">Mega Meals</span>. He ordered the <span style="font-style: italic;">Gut Buster</span> and I got the <span style="font-style: italic;">12" Pankakes</span>.<br /><br />To my dismay, these pankakes were called 12" because they have a 12" diameter. Duh! I did not expect them to be that big. I don't know what the hell was I thinking. They are fucking huge ass, mastodonic, garganduan pankakes!<br /><br />The manager told me that if I eat them both, my meal is free :P I tried, but couldn't do it. I didn't even finish one of them. I think I need to bring Nick, our local eathing champion, with me next time :)<br /><br />Needless to say, I think I'm done with pankakes for a while :P<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/pancakes" rel="tag">pancakes</a>, <a href="http://technorati.com/tag/breackfast" rel="tag">breackfast</a>, <a href="http://technorati.com/tag/montclair+state+university" rel="tag">montclair state university</a>, <a href="http://technorati.com/tag/montclair" rel="tag">montclair</a>, <a href="http://technorati.com/tag/food" rel="tag">food</a>, <a href="http://technorati.com/tag/msu" rel="tag">msu</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1146270459618331022006-04-28T20:24:00.000-04:002006-04-28T20:27:39.640-04:00Best Fan Film Ever!Rayan vs Dorkman must be one of the most awesome Star Wars fan films I have ever seen. Check it out!<br /><br /><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/8NE5elL30w4"></param><embed src="http://www.youtube.com/v/8NE5elL30w4" type="application/x-shockwave-flash" width="425" height="350"></embed></object><br /><br />For more info go to <a href="http://rayanvsdorkman.com" title="Official Page">rayanvsdorkman.com</a><br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/star+wars" rel="tag">star wars</a>, <a href="http://technorati.com/tag/starwars" rel="tag">starwars</a>, <a href="http://technorati.com/tag/fan+film" rel="tag">fan film</a>, <a href="http://technorati.com/tag/video" rel="tag">video</a>, <a href="http://technorati.com/tag/cool" rel="tag">cool</a>, <a href="http://technorati.com/tag/lightsaber" rel="tag">lightsaber</a></div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-6183319.post-1146257432968853262006-04-28T16:39:00.000-04:002006-04-28T16:50:32.996-04:00LaTex AnnoyancesI really like LaTex. I much prefer to typset my papers, rather than manufacture them in word. But every once in a while, I find little things that make using LaTex a PITA.<br /><br />For example, in my document, I have text that often needs to be repeated. For example, I need the title on the titlepage (duh), the copyright page, the signature page and etc... Same goes for actor. I spent countless hours searching how to extract data from the built in variables initialized via the standard \author and \title calls. I even emailed my old mentor in all things LaTex and he also had no clue.<br /><br />So I decided to fake it:<br /><br /><code>\newcommand{\printtitle}{Title of My Paper}</code><br /><br />Now wherever I need to put title, I just use \printtitle and I'm done. This is not a perfect solution, but it works. At least as long as you don't start nesting functions. For example if you do:<br /><br /><code>\uppercase{\printtitle}</code><br /><br />You get lowercase letters. Why? Latex does not have a proper stack, and so nesting functions may or may not work depending on circumstances. At least that's what I have been told.<br /><br />This is annoying as shit. Anyone knows the proper way to do this? I know that the answer must be locked up somewhere deap within <span style="font-style:italic;">article.cls</span> which includes the implementation of the \maketitle call. But for the life of me, I can't decipher how to extract title and author from there.<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/latex" rel="tag">latex</a>, <a href="http://technorati.com/tag/programming" rel="tag">programming</a>, <a href="http://technorati.com/tag/typesetting" rel="tag">typesetting</a>, <a href="http://technorati.com/tag/school" rel="tag">school</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1146246611072063322006-04-28T13:40:00.000-04:002006-04-28T13:57:15.386-04:00What is a pirate?Abso-fucking-lutely priceless!<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.eff.org/IP/DRM/piratead/CEA_ad.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px;" src="http://www.eff.org/IP/DRM/piratead/CEA_ad.png" border="0" alt="" /></a><br /><br /><div style="clear:both;">Every time you say "piracy" when reffering to copyright infringement, you are helping to spread the RIAA's and MPAA's evil propaganda. Think about this.</div><br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/copyright" rel="tag">copyright</a>, <a href="http://technorati.com/tag/copyfight" rel="tag">copyfight</a>, <a href="http://technorati.com/tag/drm" rel="tag">drm</a>, <a href="http://technorati.com/tag/piracy" rel="tag">piracy</a>, <a href="http://technorati.com/tag/eff" rel="tag">eff</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1146200704768860322006-04-27T23:53:00.000-04:002006-04-29T22:16:27.033-04:00Makes you think...Note, this video is over an hour long, but it is worth it:<br /><br /><embed style="width:400px; height:326px;" id="VideoPlayback" align="middle" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?videoUrl=http%3A%2F%2Fvp.video.google.com%2Fvideodownload%3Fversion%3D0%26secureurl%3DwgAAAG7ggqAHSiJjpW0D3w4aYTXT7ZPLSU8BT8G_OITNI1bxhcjluWHrSexxQmr9HU7gvtDOq3fQEEMAWaDtYDV22qq03ZR_-a-jXwEKXbIYYx3JMxanPhjgQLAQYQ7CIeh0ONxbrLy1TjYnlBBtWe3GnMd2kAHfR9oLFNkxTftFOmwa3Xw23ic0ANqVRb4aRm_fxf92Dfa4mwmPkWu3n8b8kfUQye84kdut2pAkapBj504tqsUrFbgl429jtfpWsaptvwZUYjx5pUV7hkHXQneI7LY%26sigh%3DpVaKYDcXQAOW0DvkPMhVLLXmuhc%26begin%3D0%26len%3D4910709%26docid%3D-5137581991288263801&thumbnailUrl=http%3A%2F%2Fvideo.google.com%2FThumbnailServer%3Fapp%3Dvss%26contentid%3Dc52ac27bae689796%26second%3D5%26itag%3Dw320%26urlcreated%3D1146195456%26sigh%3D0s8v2AsMU4qNOrrAsh1oWLZH0Rw&playerId=-5137581991288263801" allowScriptAccess="sameDomain" quality="best" bgcolor="#ffffff" scale="noScale" wmode="window" salign="TL" FlashVars="playerMode=embedded"> </embed><br /><br />Think about this stuff when you watch <a href="http://www.united93movie.com/index.php" title="Official Movie Website">United 93</a>. Is United 93 an inspirational story, or a governmental propaganda?<br /><br />Everything you know about 9/11 might be a lie. Including the story of United 93. Watch the clip I posted. It really asks allot of good questions.<br /> <br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/conspiracy" rel="tag">conspiracy</a>, <a href="http://technorati.com/tag/9/11" rel="tag">9/11</a>, <a href="http://technorati.com/tag/politics" rel="tag">politics</a>, <a href="http://technorati.com/tag/activism" rel="tag">activism</a>, <a href="http://technorati.com/tag/trust+no+one" rel="tag">trust no one</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1146062559661746012006-04-26T10:24:00.000-04:002006-04-26T10:42:39.693-04:00Tape Drives for $2k?My hardware people recomend switching to a HP LTO2 tape drive for backups. I looked at their qoute, and I nearly fell off my chair. They were asking almost $2,000 just for the drive! Holy poop on a stick!<br /><br />I was so shocked I actually went to HP website to verify the pricing. And yeah, it is within the ballpark. This is crazy! Absolutely in-fucking-sane. I can get a semi-decent, brand new desktop for that price! WTF! I can't understand why would these things be so damn expensive!<br /><br />Why don't I just buy 5 <a href="http://www.nextag.com/Iomega-250-GB-7200--zz83663038zB2z2--COMPARE-PRICES-html" title="Some random Iomega drive I found online">250GB firewire drives</a> for half the price of that drive, and use them to image my disk every day of the week?<br /><br />I just don't see my boss signing off on a $2k tape drive order...<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/wtf+moment" rel="tag">wtf moment</a>, <a href="http://technorati.com/tag/tape+drive" rel="tag">tape drive</a>, <a href="http://technorati.com/tag/hp" rel="tag">hp</a>, <a href="http://technorati.com/tag/lto2" rel="tag">lto2</a>, <a href="http://technorati.com/tag/work" rel="tag">work</a>, <a href="http://technorati.com/tag/it" rel="tag">it</a>, <a href="http://technorati.com/tag/hardware" rel="tag">hardware</a>, <a href="http://technorati.com/tag/backups" rel="tag">backups</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1145988498081044312006-04-25T14:04:00.000-04:002006-04-27T22:03:20.513-04:00Latex ConditionalsIf you are a graduate student, and have some sort of assistantship position I have one advice for you. Do not tell your professors that you know/enjoy/use latex. Do not talk to them about latex. If they figure out that you do use it from the superb visual quality of your written assignments they may corner you and ask you about it directly. In that case shrug, make a dumb expression and quickly change the subject/run away.<br /><br />The truth is that today, most graduate students are brain-dead MS word zombies. In fact most faculty members hate non-wysiwyg stuff with a passion. So once the they spot a latex user they are going to pounce upon him, and ride him till he drops dead, or graduates (whichever comes first).<br /><br />This is, ladies and gentlemen, how I got stuck making thesis templates for Dr. Antoniou who is about ready to strange me these days. I'm officially working on the templates since... Er... Sometime last semester :P<br /><br />Yes, I am the undisputed king of procrastination. I could teach you all a thing or two about procrastinating to the fullest. But not today. Come back tomorrow... Or next week maybe.<br /><br />What I really wanted to talk about today are the conditional statements in Latex. I just typed all this back-story to give you some background on the problem I was facing. You see, at MSU it is only possible to submit a Masters Thesis in May, August or January. Thus, I wanted to make my template automatically select the correct month.<br /><br />I decided to use <span style="font-style:italic;">ifthen</span> package to do the conditionals. The ifthenelse statement seemed to be perfect here:<br /><br /><code>\newcommand{\shorttoday}{<br /> \ifthenelse{\number\month<5}<br /> {May, }<br /> {<br /> \ifthenelse{\number\month <8}<br /> {August, }<br /> {January, }<br /> }<br />\number\year}</code><br /><br />Now, whenever you do \shorttoday you should get an appropriate month. For example, right now it displays May. But if I change month to say December using \month 12 I will get January :)<br /><br />Now my only issue is that for January I should increment the year somehow. Any tips on how to do that? So far I haven't figured out how that could be done.<br /><br /><span style="font-weight:bold;">Update Thu, April 27 2006, 09:57 PM</span><br /><br />I finally figured it out:<br /><br /><code>\newcounter{theyear}<br />\setcounter{theyear}{\number\year}<br /><br />\newcommand{\shorttoday}{<br /> \ifthenelse{\number\month<5}<br /> {May, }<br /> {<br /> \ifthenelse{\number\month <8}<br /> {August, }<br /> {\addtocounter{theyear}{1} January, }<br /> }<br />\value{theyear}}</code><br /><br />It works :)<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/latex" rel="tag">latex</a>, <a href="http://technorati.com/tag/programming" rel="tag">programming</a>, <a href="http://technorati.com/tag/typesetting" rel="tag">typesetting</a>, <a href="http://technorati.com/tag/school" rel="tag">school</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1145749785196046842006-04-22T19:32:00.000-04:002006-04-22T19:49:45.240-04:00Text Dumping PDF filesThe other day I got a request to convert a PDF file into a text file or something that could be imported to Excel. The was essentially some big accounting mumbo-jumbo full of numbers arranged in columns with fancy headings. There were over 200 pages of it.<br /><br />Now the easiest thing to do was to use the Windows version of Adobe Acrobat and simply save the file as .txt. But of course, that knocked out all the white space. All the colums run into eachother and the file looked like crap. There is no way you could do anything useful with it.<br /><br />Of course my linux PDF reader (acroread) did not have the "Save as Text" option, so the first place I turned to was the nifty linux app <span style="font-style:italic;">pdftotext</span>.<br /><br /><code>pdftotext bigstupidfile.pdf</code><br /><br />This gives you a quick text dump which is roughly equivalent to the buit in Acrobat save behavior. But fortunately pdftotext has all kindso of nifty features. If you want to preserve the whitespace and layout details you should do:<br /><br /><code>pdftotext -layout -eol dos bigstupidfile.pdf</code><br /><br />The <span style="font-style:italic;">-eol dos</span> bit is there to specify the end of line style. Remember, I'm on a unix box converting this file for a windows dude who will want to import this stuff to excel.<br /><br />Needles to say, the trick worked perfectly. The columns were preserved and the file looked great. So whenever you need to convert some pdf data into text I highly recommend using -layout option.<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/pdf" rel="tag">pdf</a>, <a href="http://technorati.com/tag/pdftotext" rel="tag">pdftotext</a>, <a href="http://technorati.com/tag/convert+pdf+to+text" rel="tag">convert pdf to text</a>, <a href="http://technorati.com/tag/linux" rel="tag">linux</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1145747058894002242006-04-22T18:46:00.000-04:002006-04-22T19:06:11.126-04:00Save the InternetCome on people, this is serious!<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://savetheinternet.com/"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px;" src="http://savetheinternet.com/images/savetheinternet_header.jpg" border="0" alt="" /></a><br /><br /><div style="clear:both;">Let me show you how the internet works. Right now it is set up like this:</div><ul><li>You pay for your own bandwidth (up and down) to an ISP</li><li>Google pays for it's own bandwidth</li><li>NSP's like AT&T and Verizon route the traffic regardless of where it is coming from</li></ul><br />This setup works. But if AT&T, Verizon and palls have their way it will be set up this way:<ul><li>You pay for your bandwidth</li><li>Google pays for its' bandwidth</li><li>Google pays AT&T for it's traffic to have higher priority than yours </li><li>Google pays Verizon for it's traffic to have higher priority than yours</li><li>Google pays [insert NSP name here] for it's traffic to have higher priority than yours</li><li>Google pays etc..</li><li>If google does not pay the required price, it page will transferred so slowly most surfers will think the site is down</li></ul>We need network neutrality. Tiered internet is bullshit!<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/network+neutrality" rel="tag">network neutrality</a>, <a href="http://technorati.com/tag/save+the+internet" rel="tag">save the internet</a>, <a href="http://technorati.com/tag/internet" rel="tag">internet</a>, <a href="http://technorati.com/tag/tiered+internet" rel="tag">tiered internet</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1145647738401625332006-04-21T15:28:00.000-04:002006-04-21T22:32:40.633-04:00Arcane Java OperatorsI previously posted about the nifty ?: Java operator that I personally love, but that I never see in the code. And then I realized that there are quite a few instances of Java specific stuff that no one really knows or cares about. It seems that most Java instructors these days are C++ people who read a Java book - and thus they rely heavily on their C++ experience.<br /><br />And that's fine, you can really survive in Java world with a C++ like mindset (as long as you don't try to pass integers by reference). But you miss out on all nifty little language nuggets and syntactic sugar that Java has to offer.<br /><br />For example, Let's say you have an ArrayList, a Vector or another Collection class. At some point you want to extract something out of it. Since you populate your collection class you know what should be in it. But what happens if someone sticks in an Integer into a Vector that should contain only Strings?<br /><br />You can always do this:<br /><br /><code>try<br />{<br /> Sting foo = (String) vector.get(i);<br />}<br />catch(ClassCastException e)<br />{<br /> // error handling<br />}</code><br /><br />This is <acronym title="in my honest opinion">IMHO</acronym> a <acronym title="pain in the ass">PITA</acronym>. Of course Java has a much more elegant solution to a problem like that. It is the <span style="font-style:italic;">instanceof</span> operator:<br /><br /><code>if(vector.get(i) instanceof String)<br /> // do something<br />else<br /> // error handling</code><br /><br />Java will gladly let you know, what type of object you are dealing with, as long as you ask it the right way. Granted that this example is trivial, but in the long run, <span style="font-style:italic;">instanceof</span> can save you allot of catching and handling runtime exceptions.<br /><br />Operators such as instanceof or ?: do not exist in C like languages. So most C oriented Java instructors ignore them completely.<br /><br />Allot of programmers do not understand the <span style="font-style:italic;">this</span> keyword. For example most people do this:<br /><br /><code>public class Foobar<br />{<br /> private int foo, bar;<br /><br /> public Foobar(int a, int b) { foo = a; bar = b; }<br /> public Foobar(int a) { foo = a; bar = 0; }<br /> public Foobar() { foo = 0; bar = 0; }<br />}</code><br /><br />This is an ok code, but imagine having 5 or 8 fields to handle. It becomes real messy, really quick. What if you have 12 constructors need to change the name of bar to something else? What if you decide to initialize values to 1 instead of 0?<br /><br />What you shour really do is this:<br /><br /><code>public class Foobar<br />{<br /> private final DEFAULT =0;<br /> private int foo, bar;<br /><br /> public Foobar(int a, int b) { foo = a; bar = b; }<br /> public Foobar(int a) { this(a, DEFAULT); }<br /> public Foobar() { this(DEFAULT); }<br />}</code><br /><br />This is a good coding practice from the get-go. If you ever rename your fields, or change the default initialization value, all you need to do is to edit the top constructor. If your code is written well, you rarely need ractoring tools for minor stuff like this.<br /><br />I think there is simply a fundamental issue with teaching the students to use the correct tools for the right job.<br /><br />I cannot tell you how many times I have seen people implementing <acronym title="exclusive or">XOR</acronym> like so:<br /><br /><code>if(foo)<br /> foobar();<br />else if(bar)<br /> foobar();<br />else<br /> barfoo();</code><br /><br />But Java has a perfectly good boolean exclusive or operator:<br /><br /><code>if(foo ^ bar)<br /> foobar();<br />else<br /> barfoo();</code><br /><br />There is a xor operator in C, so I just see no reason why most college level programmers only use && and ||.<br /><br />This is kinda like using the break on the default case of the switch statement. Code that is not wrong, but obviously redundant, or unnecessarily convoluted annoys me.<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/java" rel="tag">java</a>, <a href="http://technorati.com/tag/programming" rel="tag">programming</a>, <a href="http://technorati.com/tag/java+operators" rel="tag">java operators</a>, <a href="http://technorati.com/tag/teaching+java" rel="tag">teaching java</a></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-6183319.post-1145646908047303822006-04-21T13:32:00.000-04:002006-04-21T15:26:33.363-04:00Java ?: operatorOne of the least understood, and most underestimated Java language constructs is the ?: operator. Most people never even seen it in action. And those who did, never actually used it to do anything meaningful. Imagine something like this:<br /><br /><code>public generateFoo(int threshold)<br />{<br /> if(threshold > MIN_THRESHOLD)<br /> return new Foo();<br /> else<br /> return null;<br />}</code><br /><br />In this snippet of code we have a function which generates a new Foo object if the passed argument is greater than some minimal threshold. If it is below threshold we return null. This is not an uncommon scenario... But with the ?: operator we could accomplish all of this on a single line.<br /><br /><code>public generateFoo(in threshold)<br />{<br /> return (threshold > MIN_THRESHOLD) ? new Foo() : null;<br />}</code><br /><br />If you didn't catch that let me show you something simpler:<br /><br /><code>int foo = bar ? a : b;</code><br /><br />Java expects to a boolean or an expression evaluating to a boolean before the question mark. If that expression is true, then the whole statement evaluates to a. Else it evaluates to b.<br /><br />It is elegant, produces a lean code and saves you one return statement. It is a good coding practice to have one return statement per method when possible. I think more Java programmers should embrace this little syntactic sugar. It saves you allot of typing when used appropriately.<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/java" rel="tag">java</a>, <a href="http://technorati.com/tag/programming" rel="tag">programming</a>, <a href="http://technorati.com/tag/java+operators" rel="tag">java operators</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1145503783230730222006-04-19T23:07:00.000-04:002006-04-19T23:29:43.396-04:00Barefoot ShoemakerThe keyboard on my laptop is fucked. Up and Left arrow keys simply do not work. I figured it might have been a software glitch, but they do not work at the bootloader either. It is annoying as hell, but if I hit down at the GRUB screen, I cannot go back up at all...<br /><br />My solution? I figured I xmodmap some other, rarely used keys to up and left. I use an external kyboard and monitor most of the time anyway. This is my problem - they pay me for fixing other people's computers, but my own laptop is a pile of junk.<br /><br />I have a broken pointer knob that sometimes short-circuits and sends signals without being touched (causing wandering mouse movements on the screen). I have a bad display that sometimes cuts off, or blooms out into multi colored jumble. And now two dead keys... But this does not bother me that much, because I know how to route around these problems. An average technophobe on the other hand, has a shit-fit every time their screen as much as blinks the wrong way :P<br /><br />I should get this fixed though. It's really annoying. I just don't have fucking time to sit on the phone with Dell for 3 hours explaining to them that I just need a new keyboard. I can't figure out why don't they sell laptop keyboards on their website. The only way you can get a new keyboard is to call their parts department. And you better have a valid part number, or an open service call...<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/hardware" rel="tag">hardware</a>, <a href="http://technorati.com/tag/computers" rel="tag">computers</a>, <a href="http://technorati.com/tag/technology" rel="tag">technology</a>, <a href="http://technorati.com/tag/laptop" rel="tag">laptop</a>, <a href="http://technorati.com/tag/dell" rel="tag">dell</a>, <a href="http://technorati.com/tag/keyboard" rel="tag">keyboard</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1145464030361040012006-04-19T11:50:00.000-04:002006-04-19T12:27:10.546-04:00The case of the switchPlease look at the following code snippet and tell me what is wrong with it. No it contains no errors, just something really dumb that shows that the programmer does not understand the switch construct:<br /><br /><code>switch(foo)<br />{<br /> case 1:<br /> // do something<br /> break;<br /><br /> case 2:<br /> // do something<br /> break;<br /><br /> default:<br /> // do something<br /> break;<br />}</code><br /><br />Do you see what I'm talking about? Come on, look at it!<br /><br />If you couldn't spot it, shame on you. Look at the default block. Why do we have a break there? The break statement is only there to prevent rolling down the the next case. If you are in the default case, which also happens to be the last case of the switch you are done. There is nothing below default it that can be executed. There is no need to put that break there!<br /><br />And yet every book, online tutorial, and example I see put it there. Who the hell stated it? Why is everyone blindly copying this pattern? Is it for consistency?<br /><br />Putting a break on a default statement is not wrong. It is syntactically correct. But that does not mean it does not look dumb as hell when you do it :P<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/programming" rel="tag">programming</a>, <a href="http://technorati.com/tag/java" rel="tag">java</a>, <a href="http://technorati.com/tag/annoyances" rel="tag">annoyances</a>, <a href="http://technorati.com/tag/switch+statement" rel="tag">switch statement</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1145457649952685012006-04-19T10:19:00.000-04:002006-04-19T10:40:53.606-04:00No chanel switching during commercials.Holy Jesus Jumping Christ! WTF is this world comming to?<br /><br /><blockquote cite="http://www.newscientisttech.com/article.ns?id=dn9011&feedId=online-news_rss20">Philips suggests adding flags to commercial breaks to stop a viewer from changing channels until the adverts are over. The flags could also be recognised by digital video recorders, which would then disable the fast forward control while the ads are playing. via <a href="http://www.newscientisttech.com/article.ns?id=dn9011&feedId=online-news_rss20" title="New Scientist">New Scientist Tech</a></blockquote><br /><br />The day they start doing this, is the day I stop paying for cable. This is the stupidest fucking thing I have seen since the unskipable DVD previews bullshit, and the broadcast flag. WTF! What if I accidentally switch to an infomercial channel? You just going to keep me there forever?<br /><br />This is not going to fly with the consumers dude. You may be able to sell the broadcast flag to retarded idiots using that "pirates steal our content" joke. And hey, average Joe will not know about the broadcast flag until he tries to tape a show, or points a camcorder at the screen. But this? Hell, you don't mess with people's TV. That's just plain stupid! If a Philips device would do that to me one day, I would fucking take a hammer to it in 5 seconds flat and then I would cancel my cable subscription.<br /><br />Hell, they will have to modify the Nielsen rating system stuff to accommodate this. Cause, you know - you may really want to watch Lost or 24 but you are stuck on a channel running a 20 minute infomercial that can't be skipped. To bad...<br /><br />Implementation of this would be the beginning of the end of American TV industry. People would watch less TV, and download more TV shows with commercials edited out. Less and less people would get cable legally, because the a hacked illegal cable box would probably strip the "no-commercial-skip" flags off the signal.<br /><br />The only winers would probably be the paid subscription channels like HBO - because this bullshit would make them even more appealing than before. They don't have commercials AND you can flip to a different channel whenever you want :P<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/tv" rel="tag">tv</a>, <a href="http://technorati.com/tag/commercials" rel="tag">commercials</a>, <a href="http://technorati.com/tag/philips" rel="tag">philips</a>, <a href="http://technorati.com/tag/advert+enforcement" rel="tag">advert enforcement</a>, <a href="http://technorati.com/tag/entertainment" rel="tag">entertainment</a>, <a href="http://technorati.com/tag/copyright" rel="tag">copyright</a>, <a href="http://technorati.com/tag/copyfight" rel="tag">copyfight</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1145419599246830862006-04-18T23:30:00.000-04:002006-04-19T11:38:17.226-04:00Dirty MindsToday after Programming Languages class we established that we (tech geeks) are really a bunch of horny perverts :P Only in our field, phrases like these below are considered normal and appropriate:<br /><br />A <span style="font-weight:bold;">floppy</span> is good but a <span style="font-weight:bold;">hard drive</span> is better. You may also sometimes need a USB <span style="font-weight:bold;">dongle.</span><br /><br />Your web-app should have a nice <span style="font-weight:bold;">front end</span> and a solid<span style="font-weight:bold;"> back end</span>. You should also avoid being <span style="font-weight:bold;">rooted</span>.<br /><br />When you log into a unix machine you can <span style="font-weight:bold;">finger</span> your friends. You can also get <span style="font-weight:bold;">head</span>, and get <span style="font-weight:bold;">tail</span> (of a file), take a <span style="font-weight:bold;">dump</span>, or <span style="font-weight:bold;">mount</span> something (a drive). You may also <span style="font-weight:bold;">fsck</span> your drive :P<br /><br />And apparently on a vax machine you sometimes need to <span style="font-weight:bold;">anal</span> (analyze) the drive (thanks Brian).<br /><br />:P<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/funny" rel="tag">funny</a>, <a href="http://technorati.com/tag/humor" rel="tag">humor</a>, <a href="http://technorati.com/tag/geeky" rel="tag">geeky</a>, <a href="http://technorati.com/tag/geeky+innuendos" rel="tag">geeky innuendos</a>, <a href="http://technorati.com/tag/sexual+innuendos" rel="tag">sexual innuendos</a>, <a href="http://technorati.com/tag/jargon" rel="tag">jargon</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1145417392230461862006-04-18T23:16:00.000-04:002006-04-18T23:29:52.303-04:00Bush is a thief by RIAA standardsApparently, president Bush has <a href="http://www.boingboing.net/2006/04/16/gw_bushs_ipod_contai.html" title="Boingboing">illegally ripped mp3's</a> on his ipod.<br /><br /><blockquote cite="http://www.boingboing.net/2006/04/16/gw_bushs_ipod_contai.html">President Bush's iPod contains songs by the Beatles; since no Beatles songs have been licensed for the iTunes Music Store yet, these must have come from ripped CDs. Remember last February, when the RIAA told a federal agency that ripping CDs is illegal?</blockquote><br /><br />Now, if you recall your lessons of RIAA doublespeak "copyright infringement" == theft. So in other words, Bush is a no good, stinking thief. No better than all the other nasty "pirates" that were sued for file sharing.<br /><br />Sigh... How can our government enforce the copyright law, if even the president can't figure it out and commits blatant infringement on a daily basis?<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/bush" rel="tag">bush</a>, <a href="http://technorati.com/tag/bush+is+a+thief" rel="tag">bush is a thief</a>, <a href="http://technorati.com/tag/bush+ipod" rel="tag">bush ipod</a>, <a href="http://technorati.com/tag/copyright" rel="tag">copyright</a>, <a href="http://technorati.com/tag/copyfight" rel="tag">copyfight</a>, <a href="http://technorati.com/tag/riaa+sux" rel="tag">riaa sux</a></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-6183319.post-1145342611534276762006-04-18T02:27:00.000-04:002006-04-18T02:43:31.616-04:00Google Calendar > 30boxesGoogle Calendar is possible the best calendaring app online at the moment. I have been playing with 30boxes lately, but the big G is much more polished and feature-full. Hell, for what I use it for it is better than Outlook, Sunbird and KCalendar combined :P<br /><br />To bad for 30boxes crew - they had a solid design, and really good app. 30boxes is like the Sega Dreamcast of online calendaring apps. When it came out first, there was allot of hype around it - but then we got PS2 and Xbox and Dreamcast died. I suspect that soon Microsoft will start providing a free Outlook whatever bullshit thing to counter Gmail+Google Calendar. And then 30boxes will be marginalized completely.<br /><br />Of course, the old issue still stands - every new Google app you use, gives Google more information on you. And since Google does not seem to grasp a concept of "delete", their database is a great resource for our beloved <strike>thought police</strike> government. But then again, Google already reads my emails, and catalogs my web searches (cause I'm usually logged into gmail, and hence google as I browse). Do I really care if Google knows that I have an OWL presentation next Tuesday, or that I have finals in two weeks?<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/google" rel="tag">google</a>, <a href="http://technorati.com/tag/google+calendar" rel="tag">google calendar</a>, <a href="http://technorati.com/tag/30boxes" rel="tag">30boxes</a>, <a href="http://technorati.com/tag/calendars" rel="tag">calendars</a>, <a href="http://technorati.com/tag/calendaring" rel="tag">calendaring</a></div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-6183319.post-1145247397074491512006-04-16T23:58:00.000-04:002006-04-19T12:38:59.980-04:00WTF Code moments...One of my Graduate Assistant responsibilities this semester is grading homeworks for an introductory Java class. As you can imagine, I see alot of bad code. But every once in a while, I run into something really "special".<br /><br />The assignment was to write a payroll class, and one of the methods should calculate employees sick days. Every employee gets 1 sick day per 75 hours worked. This is how one of the students tackled the problem:<br /><br /><code>int totalHoursWorkedTemp = totalHoursWorked;<br />while(totalHoursWorkedTemp > 75)<br />{<br /> totalHoursWorkedTemp = totalHoursWorkedTemp - 75;<br /> sickDays++;<br />}<br /> <br />return sickDays;</code><br />I was about to mark it wrong, but then I realized that this will actually do the job. Ackward, but valid solution.<br /><br />I don't know... What's wrong with sickDays = totalHoursWorked/75 (integer division)? But then again, maybe I'm being a minimalist here. I should be glad that they figured out how a loop works, eh?<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/wtf" rel="tag">wtf</a>, <a href="http://technorati.com/tag/code" rel="tag">code</a>, <a href="http://technorati.com/tag/programming" rel="tag">programming</a>, <a href="http://technorati.com/tag/school" rel="tag">school</a>, <a href="http://technorati.com/tag/schoolwork" rel="tag">schoolwork</a>, <a href="http://technorati.com/tag/java" rel="tag">java</a>, <a href="http://technorati.com/tag/funny" rel="tag">funny</a>, <a href="http://technorati.com/tag/humor" rel="tag">humor</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1145157494482318292006-04-15T23:06:00.000-04:002006-04-15T23:25:59.796-04:00The Shell is DoneI finished the <a href="http://terminally.blogspot.com/2006/04/writing-shell.html" title="This Blog">Shell assignment</a> for my OS class. All the basic requirements are met. I'm planning to play around with it some more, to add pipes, redirection, and allow user to run native apps from within. But that's just extra stuff. The assignment is technically done.<br /><br />Now I can concentrate on the OWL-Lite project (10 bonus points if you know what OWL is, and 50 bonus points if you can tell me what is it good for), and grading CMPT-183 homeworks (bleh).<br /><br />Happy Easter everyone!<br /><br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/programming" rel="tag">programming</a>, <a href="http://technorati.com/tag/schoolwork" rel="tag">schoolwork</a>, <a href="http://technorati.com/tag/school" rel="tag">school</a>, <a href="http://technorati.com/tag/msu" rel="tag">msu</a>, <a href="http://technorati.com/tag/montclair" rel="tag">montclair</a>, <a href="http://technorati.com/tag/easter" rel="tag">easter</a></div>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-6183319.post-1145079476409182662006-04-15T01:31:00.000-04:002006-04-15T01:38:58.366-04:00Achtung!Here is a random warning message which could be found on many BBS'es back in the day:<br /><br /><pre> ACHTUNG!<br /> --------<br />Das machine is nicht fur gerfingerpoken und mittengrabben.<br /> Ist easy schnappen der Sprinngwerk, blowenfusen und<br /> poppencorken mit spitzensparken.<br />Ist nicht fur gewerken by das Dummkopfen. Das rubbernecken<br /> sightseeren keepen hands in das Pockets.<br /> Relaxen und watch das blinkenlights...</pre><br /><br />Taken from <a href="http://textfiles.com" title="T E X T F I L E S">textfiles.com</a>.<br /><br />8D<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/fun" rel="tag">fun</a>, <a href="http://technorati.com/tag/humor" rel="tag">humor</a>, <a href="http://technorati.com/tag/bbs" rel="tag">bbs</a>, <a href="http://technorati.com/tag/silly" rel="tag">silly</a>, <a href="http://technorati.com/tag/achtung" rel="tag">achtung</a></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-6183319.post-1144986541696464032006-04-13T23:36:00.000-04:002006-04-14T01:43:46.860-04:00Writing a ShellThe new project in the OS class is to write a java based shell emulation. I'm excited - this sounds like a really fun assignment. In fact, it just seems a wee bit easy. All you really need to do is to parse user input and traverse the file system.<br /><br />Requirements are really easy - do include equivalents of ls, mkdir, cd and date, keep history of n most recently used commands, and m most recently visited directories. Not much else. Sounds like cake...<br /><br />What I really want to explore is to mimic pipes and input/output redicection, and letting the user to execute native programs by using Javas Runtime exec method. It also doesn't seem that difficult if you think about it.<br /><br />Dr. Robila reccomended that those who can't figure this assignment out can allways attempt to buy code from <a href="http://www.livejournal.com/users/zewrestler/" rel="friend met">zewrestler</a> who was the only person in class who managed to implement this last semester. Hehe...<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/programming" rel="tag">programming</a>, <a href="http://technorati.com/tag/school" rel="tag">school</a>, <a href="http://technorati.com/tag/schoolwork" rel="tag">schoolwork</a>, <a href="http://technorati.com/tag/os" rel="tag">os</a>, <a href="http://technorati.com/tag/shell" rel="tag">shell</a>, <a href="http://technorati.com/tag/java" rel="tag">java</a></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-6183319.post-1144982768473512422006-04-13T22:44:00.000-04:002006-04-13T22:51:42.306-04:00Wheeeee!Best add evar:<br /><br /><object codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="400" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" height="306"><param name="src" value="http://media.revver.com/broadcast/19542/video.mov" /><param name="controller" value="True" /><param name="cache" value="False" /><param name="autoplay" value="False" /><param name="kioskmode" value="False" /><param name="scale" value="tofit" /><embed src="http://media.revver.com/broadcast/19542/video.mov" pluginspage="http://www.apple.com/quicktime/download/" scale="tofit" kioskmode="False" qtsrc="http://media.revver.com/broadcast/19542/video.mov" cache="False" height="306" width="400" controller="True" type="video/quicktime" autoplay="False"></embed></object><br /><br />LOL!<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/firefox" rel="tag">firefox</a>, <a href="http://technorati.com/tag/ie" rel="tag">ie</a>, <a href="http://technorati.com/tag/netscape" rel="tag">netscape</a>, <a href="http://technorati.com/tag/safari" rel="tag">safari</a>, <a href="http://technorati.com/tag/browser" rel="tag">browser</a>, <a href="http://technorati.com/tag/add" rel="tag">add</a>, <a href="http://technorati.com/tag/advertisement" rel="tag">advertisement</a>, <a href="http://technorati.com/tag/video" rel="tag">video</a>, <a href="http://technorati.com/tag/funny" rel="tag">funny</a>, <a href="http://technorati.com/tag/humor" rel="tag">humor</a></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6183319.post-1144819228345272842006-04-12T00:13:00.000-04:002006-04-12T01:20:28.526-04:00Sociology of PornographyI read an interesting <a href="http://newyorkmetro.com/nymetro/news/trends/n_9437/" title="New York Magazine">article on pornography</a> earlier today. In it Naomi Wolf claims that the wide availability of pornography in fact contributed to lowering of male libido in recent years.<br /><br />Sigh... We should really require all these Sociology and Anthropology specialists to take a Statistics class or two at some point during their college career. If I had a penny for every time someone scores an article after making huge generalizations, based on logical fallacy I would be so rich, that I would hire Bill Gates to clean my toilet :P<br /><br />You see, the name of the game here is Correlation vs Causality. Everyone who majored in science knows that Correlation ≠ Causality. To prove anything in science, you need to show the causality relationship. Correlation is absolutely meaningless.<br /><br />But people in Humanities, and Business related fields usually have a shaky grasp of science. Thus if you are doing anthropology or sociology research, all you need to do is to identify a correlation. The more obvious is the correlation, the better. Once you have one, you can start making big generalizations and draw baseless conclusions.<br /><br />This is also the case with this article. Did Ms. Wolf do a controlled long term study of effects of porn on relationships? Hell no, she simply assumed that since we have better access to porn these days, it must be affecting people's relationships. She based this conclusion based on conversations with college students and different couples.<br /><br />There was no scientific approach, no rigorous data collection, no control group. Naomi Wolf simply talked to few people, and decided that porn makes people unhappy. She doesn't even try to hide the bias. She asked people loaded questions, which were constructed to support her conclusion irregardless of the response. Most of their conclusions are derived from her personal experiences as a middle-aged woman. Abso-fucking-lutely brilliant.<br /><br />I believe that the lowering of male libido that she talks about is an illusion created by changing of sexual norms in todays society. Yes, we are much more open about sexuality now. But at the same time, we developed the notion of political correctness, tolerance and professionalism.<br /><br />It is a huge oversimplification to say that pornography has any effect on relationships, male libido, or anything at all. This is the same as saying that video games cause violence. Or that alcohol causes violence and inflates that crime rate. Prohibition proved that we were wrong about that one. Why do people think that this is different in case of video games and porn???<br /><br />Again, we need hard evidence supported by controlled tests, and clinical studies. We need reliable results that are possible to verify. Otherwise we are just playing the "what if" game. What if porn is bad for relationships? What if video games cause violence? And what if they do not?<br /><br />I call bullshit on this article. "Men are less able to connect erotically to women" my ass lady! Show me some hard evidence for this? Selectively interviewing repressed girls who are disappointed with their sex lives, or undereducated, stoners who have no clue about life does not count as evidence. It is coincidental correlation.<br /><br />Naomi Wolf likes romantic tension and mystery. An undergrad guy from Northwestern on the other hand seems to prefer close intimacy without the awkward tension, and second guessing your partner. Personal preference? Generation gap? Both? No, of course not. The fact that some random guy does not share Naomi Wolf's sexual preferences must be a proof that evil porn corrupted his mind.<br /><br />Give me a fucking break!<br /><br /><div class="tag_list">Tags: <a href="http://technorati.com/tag/porn" rel="tag">porn</a>, <a href="http://technorati.com/tag/pr0n" rel="tag">pr0n</a>, <a href="http://technorati.com/tag/pornography" rel="tag">pornography</a>, <a href="http://technorati.com/tag/sociology" rel="tag">sociology</a>, <a href="http://technorati.com/tag/sociology+of+pornography" rel="tag">sociology of pornography</a>, <a href="http://technorati.com/tag/the+porn+myth" rel="tag">the porn myth</a>, <a href="http://technorati.com/tag/science" rel="tag">science</a></div>Unknownnoreply@blogger.com0