<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3715569787779993102</id><updated>2011-07-28T20:29:37.529-07:00</updated><category term='Project Week'/><category term='flash'/><category term='biomodd'/><category term='ai'/><category term='java'/><category term='ajax'/><category term='fonts'/><category term='maven'/><category term='actionscript 3'/><category term='game'/><category term='flex'/><category term='null'/><category term='c'/><category term='string'/><category term='game development'/><category term='game programming'/><category term='Corporate Slave'/><category term='cms'/><category term='jcreator'/><category term='html'/><category term='darkstar'/><category term='code snips'/><category term='eclipse'/><category term='post mortem'/><category term='Mask Man Project'/><title type='text'>Code Ang Ina Mo</title><subtitle type='html'>Look Ma, I'm coding</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-8959006852779797469</id><published>2009-12-17T01:52:00.000-08:00</published><updated>2009-12-17T01:53:39.882-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cms'/><category scheme='http://www.blogger.com/atom/ns#' term='code snips'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript 3'/><title type='text'>How to use dynamic fonts on html using AS3</title><content type='html'>Challenge:&lt;br /&gt;Most designers find themselves worrying about cross-browser compatibility. Most of the time, they have to work with a limited choice of fonts.&lt;br /&gt;&lt;br /&gt;What if you want to do something flashy, like this:&amp;nbsp;&lt;a href="http://us.blizzard.com/en-us/company/"&gt;http://us.blizzard.com/en-us/company/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_XCqW9huzq_Y/Syn_O0TPlhI/AAAAAAAAAGU/gK_yT5J-VQ4/s1600-h/Blizzard+Entertainment-+Company_1261043389739.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_XCqW9huzq_Y/Syn_O0TPlhI/AAAAAAAAAGU/gK_yT5J-VQ4/s320/Blizzard+Entertainment-+Company_1261043389739.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Notice the g&lt;span style="font-family: inherit;"&gt;radient and the drop shadow in the "Company" header. It's done in flash. And since it's Blizzard, I assume it runs under a CMS so it's dynamic. You can change "Company" to "Kompanya" just as easily.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;Solution:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;b&gt;1. Design whatever wonderful &lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;&lt;b&gt;&lt;i&gt;dynamic&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;&lt;b&gt;&lt;i&gt; &lt;/i&gt;text you want in flash.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;b&gt;2. Make sure you embed the characters you want included in the font.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;b&gt;3. Assuming your instance name is "textMC". Put this in the main timeline:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var params:Object = LoaderInfo(this.root.loaderInfo).parameters;&lt;br /&gt;var _text:String = String(params["content"]);&lt;br /&gt;var _orientation:String = String(params["align"]);&lt;br /&gt;&lt;br /&gt;var myTextFormat:TextFormat = new TextFormat();&lt;br /&gt;if(_orientation == "center"){&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;myTextFormat.align = TextFormatAlign.CENTER; //align center&lt;br /&gt;}else if(_orientation == "right"){&lt;br /&gt;&lt;span style="white-space: pre;"&gt; &lt;/span&gt;myTextFormat.align = TextFormatAlign.RIGHT; //align right&lt;span style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;}else{&lt;br /&gt;&lt;span style="white-space: pre;"&gt; &lt;/span&gt;myTextFormat.align = TextFormatAlign.LEFT; //default alignment is left&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;textMC.text = _text;&lt;br /&gt;textMC.setTextFormat(myTextFormat);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;span style="font-family: monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Arial; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;b&gt;4. In your embed code, specify "content" and "align" in the params. "content" contains your content. If you want to set the alignment set "align" to "center" or "right". The text aligns to the left by default.&lt;/b&gt;&amp;nbsp;&lt;i&gt;Ex:&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Arial; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;i&gt;&amp;nbsp;content="This is the content"&amp;amp;align="center"&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Arial; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Arial; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;i&gt;Note:&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Arial; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;i&gt;Call setTextFormat() only after you set the text. Flash needs to know the content first, before it can properly format the textfield.&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-8959006852779797469?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/8959006852779797469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=8959006852779797469' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/8959006852779797469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/8959006852779797469'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2009/12/how-to-use-dynamic-fonts-on-html-using.html' title='How to use dynamic fonts on html using AS3'/><author><name>Zero</name><uri>http://www.blogger.com/profile/13633975230889735611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_XCqW9huzq_Y/Syn_O0TPlhI/AAAAAAAAAGU/gK_yT5J-VQ4/s72-c/Blizzard+Entertainment-+Company_1261043389739.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-3006453570190782007</id><published>2009-10-07T10:07:00.000-07:00</published><updated>2009-10-07T10:19:45.319-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='game programming'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='biomodd'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Biomodd Game Post Mortem</title><content type='html'>&lt;table style="width: auto;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://picasaweb.google.com/lh/photo/a1VlEi_46UEYu2GNHtxicw?feat=embedwebsite"&gt;&lt;img src="http://lh6.ggpht.com/_XCqW9huzq_Y/SszASSw0QxI/AAAAAAAAAB4/SMl_ytuvjHE/s400/Image132.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;"&gt;Original design sketch.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;I was trying to stay away from writing a post mortem for this game because I don't want to accept that it's over. Multiplatform support, multiplayer networking, a 3 (occasionally 2, but usually 1) man development team and a very short project deadline; this was clearly one of the most challenging projects I ever did. It was also the most fun. From the all nighter brain storming session with Jeryll, &lt;a href="http://www.angelovermeulen.net/"&gt;Angelo&lt;/a&gt;'s wonderful design inputs, game design arguments with &lt;a href="http://mind-grape.blogspot.com/"&gt;Lomel&lt;/a&gt; (ex. Should Maria Makiling have a "Wrath" meter that allows her to nuke the whole place?); the whole creative process justified the reason why I chose to make games: it's way more fun than just playing them.&lt;br /&gt;&lt;br /&gt;However, coming from a software engineer's perspective the project piled up with mistake after mistake that the game would have come out mediocre at best. And it did, actually. The game wasn't there during the first opening night and it was barely enjoyable when it came out in the second. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 14pt;"&gt;&lt;strong&gt;What Went Wrong?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Choosing the wrong guns&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;During the initial planning, I was the only game programmer present, and a very inexperienced one at that. Multiplatform? That leaves GameMaker out. Multiplayer? Hmm, Java has nice networking features. Graphics requirements.. ok there's no way we can render something that intensive in Flash. I chose Flash and Java anyway for the main reason that Flash is actually more multiplatform than Java, and Java will handle Flash's networking. I was in the middle of creating my game engine in Flash when I posted this..&lt;br /&gt;&lt;br /&gt;&lt;table style="width: auto;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://picasaweb.google.com/lh/photo/rPQPwYjExqrMbSmhkDrMXg?feat=embedwebsite"&gt;&lt;img src="http://lh5.ggpht.com/_XCqW9huzq_Y/SszE5_-59EI/AAAAAAAAACA/tvIpqgr4OPU/s400/facebook-status.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;That's right, I can't make the animations smooth enough for an enjoyable game experience. So I went back to Java. I chose an old Java game framework  called JGame and Sun's Project Darkstar Server. Both frameworks looked easy enough. I put aside JGame since it was the least challenging and began working on the Server Side. &lt;br /&gt;&lt;br /&gt;Bad choice number 1. It was too late when I realize that JGame wasn't a good choice programming wise because it hardly implements any OOP, and there were already two programmers sharing and modifying the same java code file. Plus it became a headache just trying to locate java functions inside a 1000 plus line single file source code. &lt;br /&gt;&lt;br /&gt;Bad choice number 2. Choosing to work on the network servers before even creating a working game. I thought that if I finish the hardest part, then everything would be smooth sailing from there. What I didn't saw, was the possibility that I just might not pull off that hardest part. Blinded by my inexperience and my pride to do something only few developers even attempt to do, I marched on; with the rest of the Biomodd guys not seeing the semblance of a game coming out from my computer screen.&lt;br /&gt;&lt;br /&gt;This was a case when a rapid prototype would have benefited the project greatly. More people could have played the game even if it was still on beta. Playtesting and balancing would have been done based on their inputs. And more buzz would have been generated about the game.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Lacking the right tools&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Remember Java's "write once, run anywhere" credo, well, I never realized how much of a fantasy that was until I tried running the server and the client on Ubuntu. I never anticipated the screensize not automatically adjusting plus the sound not working on Linux. Add the extra work of uploading the necessary .jars and you have yourself a big problem that would've been easily solved if I used multiple Virtual Machines on my laptop.&lt;br /&gt;&lt;br /&gt;I was also using Vista x64 which much to my disappointment, being the fanboy that I am, crashed every time my development processes took 100% of the memory. &lt;br /&gt;&lt;br /&gt;&lt;table style="width: auto;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://picasaweb.google.com/lh/photo/pQMRpCqPaPZD_wv1G6TIJg?feat=embedwebsite"&gt;&lt;img src="http://lh6.ggpht.com/_XCqW9huzq_Y/SszMlW5IQfI/AAAAAAAAACI/YZIqasMLHQQ/s400/P6210051.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;"&gt;Jeryl in the lab&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;span style="font-size: 14pt;"&gt;&lt;strong&gt;What Went Right?&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Changing Horses in Midstream&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;And having the courage to do so. I have been ignoring &lt;a href="http://slick.cokeandcode.com/"&gt;Slick2D &lt;/a&gt;up until 3 weeks before the Manila exhibit. I realized I can't go on with JGame and if I continue trying to make it work the code is going to be worse and worse. Slick was actually pretty easy to jump into and I recoded the whole game in just 2 days. The transition was painless I even added some extra holes in it for the networking layer.&lt;br /&gt;&lt;br /&gt;The code base itself became more stable and extensible that it just took me a little more than an hour to add the 2-player and Twitter features.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Compromise&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;A lot of the features originally stated in the game design didn't make it to the final game (or at least the game that was played in the exhibit). My inadequacies in programming skills prevented me from creating a stable networking layer. Hardware issues made receiving data streams from environment sensors a difficult task. The way we intended to represent Maria Makiling seemed impractical considering our lack of artistic skills. We also have to let go of the much debated Wrath issue of Maria Makiling. It looked as if the features that made the game fun on paper weren't going to be part of the actual software. &lt;br /&gt;&lt;br /&gt;Then, 2 weeks before the end of the exhibit, I made some of the few good decisions I made in this project.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Put the game source on code sharing.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Dropped the networking layer altogether.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Made a single machine 2 player game.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Connected the game to twitter.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;First, I shared the game in Google Code. This way the game can finally declare itself open-source. (Well, not really that open, outsiders only have read privileges). It didn't actually contribute anything development-wise, but putting it up there made the project "immortal". The installation may be dismantled, its parts distributed or recycled, but the software and the source will always remain in the clouds free for anyone to check out – and/or laugh at. (Which reminds me, I might need to clean up the code a bit for those who are allergic to duct-tape coding).&lt;br /&gt;&lt;br /&gt;Second, I made the painful decision to let go of the highly unstable networking code. It was becoming a monster and working on it ate a lot of valuable dev time that should have been spent on improving the gameplay. Throughout the project, the multiplayer feature took the highest priority; the game cannot be the game if it wasn't multiplayer, the game design hinges on that. Also, call it programmer's ego, but the thought of giving up on the coolest thing you have ever coded simply didn't enter my thoughts during that time. &lt;br /&gt;&lt;br /&gt;It was after taking a few days off that it finally hit me. There simply isn't enough time to pull off what I've been trying to do. And it wasn't that I was giving up on my code, I simply saw a different way to write it. The networking layer needs to be taken down, but that doesn't mean the game had to change. In fact, releasing it on single player for the exhibit was already shameful in my part. &lt;br /&gt;&lt;br /&gt;The game should only be played with other people. So I settled with the easiest option: make it 2 player. With only a few days left on the exhibit, I thought it was too late. &lt;br /&gt;&lt;br /&gt;Lastly, there's "the game tweets" decision. Originally, Tina, the electronics ninja, setup some sensors to connect to the internet and visualize the state of the installation. The game was supposed to hook to that as well, creating a unique interaction that fuses everything in Biomodd together. Sadly, because I was too focused on unimportant stuff (curse you, networking and parallel programming!) I didn't give much attention on this until it was too late. I was trying my hardest to get pachube feeds to the game when I thought, "It's going to take a lot of time to set this up. And I still don't have any idea how to interpret the data into the game aside from changing the background. Maybe if the sensors just tweet me stuff they want to happen to the game…" &lt;br /&gt;&lt;br /&gt;So I connected the game to twitter and the possibilities of the tweeting interaction began pouring as I code it. The game tweets, players tweet the game. And since I know that the game was only going to be played within the PCs of Biomodd, I can get away with this easily. It won't flood Twitter's bandwidth, players feel Makiling in the context of the game and the installation and there's certainly the "Whoah, this has never been done before" factor.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Conclusion&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;The project is definitely my most challenging yet. I don't want to conclude.&lt;br /&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/7TtlKs4gq4Q&amp;hl=en&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/7TtlKs4gq4Q&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Links:&lt;br /&gt;&lt;br /&gt;Biomodd[LBA2] website:&amp;nbsp;&lt;a href="http://www.biomodd.net/"&gt;http://www.biomodd.net/&lt;/a&gt;&lt;br /&gt;Google Code Project Repository:&amp;nbsp;&lt;a href="http://code.google.com/p/biomoddgame/"&gt;http://code.google.com/p/biomoddgame/&lt;/a&gt;&lt;br /&gt;Maria Makiling's Twitter account:&amp;nbsp;&lt;a href="http://twitter.com/maria_makiling"&gt;http://twitter.com/maria_makiling&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It is what is. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-3006453570190782007?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/3006453570190782007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=3006453570190782007' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/3006453570190782007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/3006453570190782007'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2009/10/biomodd-game-post-mortem.html' title='Biomodd Game Post Mortem'/><author><name>Zero</name><uri>http://www.blogger.com/profile/13633975230889735611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_XCqW9huzq_Y/SszASSw0QxI/AAAAAAAAAB4/SMl_ytuvjHE/s72-c/Image132.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-5909334359622645423</id><published>2009-09-18T12:42:00.000-07:00</published><updated>2009-09-18T13:21:30.495-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>Specifying -vm option in Eclipse</title><content type='html'>I recently had the trouble of having multiple Eclipse installs in the system. And since I didn't have web connection then, the whole installation had to be done offline.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I was coding with Project Darkstar using the Darkstar Maven Plugin. I installed the M2Eclipse plugin for better mvn integration. When I restarted the ide, I got this wierd warning:&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="-webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 1px; font-weight: 600;"&gt;&lt;code&gt;&lt;span style="font-family: georgia;"&gt;&lt;i&gt;&lt;span style="font-size: small;"&gt;The Maven Integration requires that Eclipse be running in a JDK, because a number of Maven core plugins are using jars from the JDK.&lt;br /&gt;&lt;br /&gt;Please make sure the -vm options in eclipse.ini is pointing to a JDK and verify that Installed JREs are also using JDK installs.&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Wierd. I checked my Installed JREs (Windows&amp;gt;Preferences&amp;gt;Java&amp;gt;Installed JREs) and I was using a JDK. I checked my eclipse.ini and added on  the first line:&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;code&gt;&lt;i&gt;&lt;b&gt;-vm  "C:\Program Files (x86)\Java\jdk1.6.0_06\bin"&lt;/b&gt;&lt;/i&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Didn't work, and so lacking net access, I proceeded to ignore the warning. My only problem was that the javadoc for jdk classes where lacking. And when you autocomplete method calls, parameters were replaced with "arg0, arg1.. ". No big deal. I could just manually locate the javadocs and point my jdk to them.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A while ago, I decided I had enough of the startup warning and took matters to the java forums. Turns out my -vm command in eclipse.ini was being silently ignored because apparently it wasn't the right syntax. It should be:&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: -webkit-monospace; font-size: 13px; font-style: italic; font-weight: bold;"&gt;-vm &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: -webkit-monospace; font-size: 13px; font-style: italic; font-weight: bold;"&gt;C:\Program Files (x86)\Java\jdk1.6.0_06\bin&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: -webkit-monospace; font-size: 100%;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: -webkit-monospace; font-size: 100%;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-family: Georgia; font-size: 16px; font-style: normal; font-weight: normal;"&gt;With the newline and without the quotes. Yup, one of those quirks worth posting a blog for.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, I can start my Eclipse in peace.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-5909334359622645423?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/5909334359622645423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=5909334359622645423' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/5909334359622645423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/5909334359622645423'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2009/09/how-to-add-javadocs-to-your-java.html' title='Specifying -vm option in Eclipse'/><author><name>Zero</name><uri>http://www.blogger.com/profile/13633975230889735611</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-5792051943701457536</id><published>2009-08-01T09:51:00.000-07:00</published><updated>2009-08-10T07:40:24.965-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ai'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='game programming'/><category scheme='http://www.blogger.com/atom/ns#' term='jcreator'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><title type='text'>Remember that AI game you were working on?</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Back when I was still in school, a professor advised us to createa code repository. Sure you might find your old programs stupid and badly written but within those old crappy code you might find something of value. Come to think of it, this is one of the reasons why I made this blog.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;  &lt;img src="http://4.bp.blogspot.com/_6466SWUJEn8/SoAwqMiBPvI/AAAAAAAAAIs/Zw9ER-4v5ls/s400/robots-ai-old.jpg" style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5368344257302183666" /&gt;&lt;p class="MsoNormal"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;While working on the Biomodd game, I stumbled upon an old project of mine. It was a java based simulation platform for implementing bot behavior. I started coding it a few weeks after graduation fresh from my immune algorithms thesis. The algorithm bit of the thesis was interesting but I was more curious at how I can extend the system so that I can easily swap algorithms without changing much of the code. I didn’t know it then but I was actually trying to design a framework. Like most of my “ventures”, I eventually had to freeze the project after I dug into “flocking algorithms” and totally messed up the physics part. I was at my hometown with no internet and no physics or math book so I had to rely on stock knowledge for pretty much everything.&lt;/p&gt;  &lt;img src="http://4.bp.blogspot.com/_6466SWUJEn8/SnR0a8GuRSI/AAAAAAAAAIk/2U1_XMaIqdw/s400/robots-ai.jpg" style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5365041062264849698" /&gt;&lt;p class="MsoNormal"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;My OOP and design pattern skills were limited but the code came in handy when I was studying for an IT-certificate course (don’t ask &lt;span style="font-family:Wingdings;mso-ascii-font-family:Calibri;mso-ascii-theme-font: minor-latin;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin; mso-char-type:symbol;mso-symbol-font-family:Wingdings;"&gt;&lt;span style="mso-char-type: symbol;mso-symbol-font-family:Wingdings;"&gt;J&lt;/span&gt;&lt;/span&gt;). We were required to present a game that utilizes OOP concepts. I revived the project, added a few sprites, simplified the movement algorithms (to a simple linear Point A to Point B movement), added a few if-else conditions then presented the “game” to our class the next day. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;It was almost a year since I last touched the code and had to download JCreator in order to open the project file. Going back to JCreator after my experience with NetBeans and Eclipse made me wonder at how simple my programming needs were back in college. No code-complete, no SVNs, no build or debug tools, no refactoring. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Everything was so simple. I looked over my code and saw stupid OOP mistakes. Bad use of inheritance here, bloated classes there. I searched for the movement logic and, thanks to the code comments of my old self, easily found it and toyed with it once more.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;I guess maybe I need to create a google code account or something, just to have something to put all the past codes/garbage in. Ok I’ll do that, as soon as I have broadband access.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-5792051943701457536?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/5792051943701457536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=5792051943701457536' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/5792051943701457536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/5792051943701457536'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2009/08/remember-that-ai-game-you-were-working.html' title='Remember that AI game you were working on?'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_6466SWUJEn8/SoAwqMiBPvI/AAAAAAAAAIs/Zw9ER-4v5ls/s72-c/robots-ai-old.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-7133025982723299658</id><published>2009-07-29T15:57:00.001-07:00</published><updated>2009-07-30T00:46:51.662-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='darkstar'/><category scheme='http://www.blogger.com/atom/ns#' term='game programming'/><category scheme='http://www.blogger.com/atom/ns#' term='game development'/><category scheme='http://www.blogger.com/atom/ns#' term='biomodd'/><title type='text'>Designing the Biomodd Multiplayer</title><content type='html'>&lt;p class="MsoNormal"&gt;We are still currently at the development phase of the project. The team is made up of 3 volunteers: 2 programmers and 1 game artist. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;I am responsible for both the server side architecture and the client-server messaging protocols. Lemuel is in charge of the client side engine. And Jeryl is responsible for the art assets. It would be great if we have another programmer take care of the messaging protocols so I can focus on the server.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;As you can see from the &lt;a href="http://www.biomodd.net/game-development-subteam-wiki"&gt;game design&lt;/a&gt;, the uniqueness of the game calls for 3 technically challenging features. First, it has to be multiplayer, which means it has to be built on a server-client framework. Second, it has to simulate a growing organic being. Third, the game must have no “beginning” and “end”. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;Standalone games are usually executed on a game loop (movePlayer-&gt;moveEnemies-&gt;checkAgainstGameRules-&gt;renderGraphics-&gt; repeat until game ends). But in the case of a multiplayer game, the game loop is partly in the server and partly in the client. The server stores the game state and broadcasts it to the clients for rendering, while the clients get user inputs and sends it to the server to update the game state. In a turn based multiplayer game this change in structure wouldn’t really matter much, since the players are contained in a simple little queue and at any given time only one client is accessing the game state. This changes drastically on an arcade style multiplayer, since the game runs on real time and at one point multiple clients might be trying to access a single resource.&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;This would eventually lead to deadlocks, memory leaks, and all kinds of nasty behavior. To resolve this issue, we implemented Sun Microsystem’s Project Darkstar Server. (Though still on its beta phase, this framework worked like a charm).&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Traditional multiplayer game designs limit the amount of data transfers between client and server. Send packets too much too soon and you’ll clog the network. This leads the team to its current roadblock. The entire game state (plants, enemies, players and all) must be stored in the server. Everything, including the movement calculations, plant growth, collision detection, spell cool-downs, etc. must be calculated in the server. Why not put some of them in the client? Because the game has neither a definite beginning nor end. The game exists even without a client. Once a client enters the world the server has to send him the entire game state. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;Putting all the stress in the server would be impractical. We are currently trying to resolve this issue by using timestamps. By storing a timestamp value corresponding to the time a game object was last updated, hopefully, any fresh client can calculate the game state based on the time elapsed without having the need to physically store the game objects. That way we are transferring the computational burden to the clients.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;We are using Project Darkstar for server side and jGame for the client (the latter is actually pretty old/dead, but it’s easier for non-game programmers to understand than “real” java game frameworks like jMonkeyEngine). &lt;/p&gt;  &lt;p class="MsoNormal"&gt;With the deadline creeping in, the team would be more than happy if we can at least make the game playable. I for one, still think it’s the kewlest game ever.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-7133025982723299658?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/7133025982723299658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=7133025982723299658' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/7133025982723299658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/7133025982723299658'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2009/07/designing-biomodd-multiplayer_29.html' title='Designing the Biomodd Multiplayer'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-1670044613887592593</id><published>2009-07-02T23:52:00.000-07:00</published><updated>2009-07-03T00:35:31.256-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='fonts'/><category scheme='http://www.blogger.com/atom/ns#' term='code snips'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript 3'/><title type='text'>How to embed fonts properly in AS3</title><content type='html'>Best practice for embedding fonts in AS3.&lt;br /&gt;&lt;br /&gt;Fonts can be embedded using the Flex metadata "Embed".&lt;br /&gt;&lt;br /&gt;For example, if you want to embed the font named Arial (this should be the system font located in FontBook or the Fonts folder)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;[Embed(systemFont="Arial", fontName="Arial", mimeType="application/x-font", unicodeRange="U+0041-U+0054")]&lt;br /&gt;var arial:Class;&lt;br /&gt;&lt;br /&gt;Font.registerFont(arial);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;systemFont: looks for the current system font with the name "Arial"&lt;br /&gt;&lt;br /&gt;fontName: the name used to reference this font inside the code&lt;br /&gt;&lt;br /&gt;mimeType: the type of file that i'm embedding, in this case an x-font&lt;br /&gt;&lt;br /&gt;unicodeRange: the sample unicode range represents uppercase characters from A-Z (convert unicode easily &lt;a href="http://rishida.net/scripts/uniview/conversion.php"&gt;here&lt;/a&gt;)&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For best practices, we can compile the file as a swf, and load them at runtime using the loader class. This way we only need to load the file when it's actually needed.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-1670044613887592593?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/1670044613887592593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=1670044613887592593' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/1670044613887592593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/1670044613887592593'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2009/07/how-to-embed-fonts-properly-in-as3.html' title='How to embed fonts properly in AS3'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-6874797399510336784</id><published>2009-06-23T04:34:00.000-07:00</published><updated>2009-06-23T04:47:05.331-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='post mortem'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><category scheme='http://www.blogger.com/atom/ns#' term='actionscript 3'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Quitz Quiz Post Mortem</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_6466SWUJEn8/SkDAms-q26I/AAAAAAAAAIc/3b1KaXJ8VXo/s1600-h/quits_screen2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_6466SWUJEn8/SkDAms-q26I/AAAAAAAAAIc/3b1KaXJ8VXo/s320/quits_screen2.jpg" alt="" id="BLOGGER_PHOTO_ID_5350488128457726882" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_6466SWUJEn8/SkDAfZ8PAsI/AAAAAAAAAIU/5dzNlal9jEs/s1600-h/quits_screen.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 253px;" src="http://3.bp.blogspot.com/_6466SWUJEn8/SkDAfZ8PAsI/AAAAAAAAAIU/5dzNlal9jEs/s320/quits_screen.jpg" alt="" id="BLOGGER_PHOTO_ID_5350488003088155330" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I was commissioned to create an interactive quiz game in flash. “Quitz Quiz” is a quiz game for an anti-smoking campaign. The project was supposed to last for 1 week, it was delayed to 2, and finally got the pay 3 weeks after that.&lt;p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style="font-size:130%;"&gt;What Went Wrong&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;Asking Price. &lt;/b&gt;Inexperienced at this kind of business, I offered a cheap price tag. $200 for “just” another quiz game is a sweet deal, I thought. Quizzes are the type of games they teach you when you were starting programming and $200 is already pretty big in the third world – my monthly salary is approximately $300. It was during the development phase itself that I realized my mistake. &lt;i style=""&gt;They are paying me for my expertise, &lt;/i&gt;besides the client wasn’t just some college friend who can’t make their homework, it was a company with a budget and my asking price wouldn’t have meant anything to them. Asking cheap made me think cheap, it was as if there was this very low ceiling that didn’t force me to expand the game or at least made the art a little better.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;Assets. &lt;/b&gt;Although I got the quiz list the night after I took the job, the rest of the game assets took a pretty long time considering the game is supposed to be finished in a week. My lack of a decent internet connection limited our exchange of communication to SMS. I was only able to check my email once per day (after work), so if ever there were questions that lack answers or a missing art asset, I would get the response the next day. This delayed the project and pushed it to a total of two weeks (including play testing and QA).&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;Being too greedy. &lt;/b&gt;After realizing how cheap my asking price was I decided to hard code the questions--instead of putting them on a separate editable XML file or something. I could have just embedded an XML file or something, but being the greedy programmer that I was, opted to create a separate Factory class containing all the questions in an array. My evil plan backfired, when during the play testing process, they discovered a lot of spelling errors and I had to go back to the code and examine each question one by one with my IDE- FlashDevelop- lacking a spell checker. If I wrote the questions on a text file, I could have just run it on WordPad or something&lt;span style=""&gt;  &lt;/span&gt;or better yet sent them that file so they can edit the questions themselves.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style="font-size:130%;"&gt;What Went Right&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;Modularity. &lt;/b&gt;This was my first completely AS3 flash game, and I have to say, I was very impressed at how my project structure turned out. The assets were completely separate from the code. I’d use Flash CS3, or Photoshop, or Painter, or Audacity for the assets and just use the embed tag to link them with the code. This way, if ever I had a separate artist working on the same project, we can go our own ways without relying on each other.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;Experience. &lt;/b&gt;The project forced me to treat the game I was developing as work. There was a deadline, a paycheck, and a real client (not the hey-I-need-help-here-I-give-you-money &lt;span style=""&gt; &lt;/span&gt;friend but a real business client) involved. It helped me evaluate my “business model” and also expose my weaknesses. From now on, I’ll specialize on game development as a freelancer (I’ll only consider web dev/design jobs when I’m really desperate). I also realized that I can only go so far as a visual artist (I need training or better yet, I need a partner artiste.)&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-6874797399510336784?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/6874797399510336784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=6874797399510336784' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/6874797399510336784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/6874797399510336784'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2009/06/quitz-quiz-post-mortem.html' title='Quitz Quiz Post Mortem'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_6466SWUJEn8/SkDAms-q26I/AAAAAAAAAIc/3b1KaXJ8VXo/s72-c/quits_screen2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-243300709381848448</id><published>2009-02-01T21:05:00.001-08:00</published><updated>2009-02-01T21:28:50.590-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='null'/><category scheme='http://www.blogger.com/atom/ns#' term='string'/><title type='text'>Null Ang Ina Mo</title><content type='html'>I recently had the misfortune of debugging someone else's code.  This is typical stuff for programmers working with a new team. One particular bug which comes out rather often, and really gets irritating after a few dozen of times, is when programmers don't understand the difference between a null and an empty string, and how a language evaluates conditions.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Not understanding this concept can lead to logical conditions slightly higher than:&lt;/div&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;if(isRunning == true)&lt;br /&gt;&lt;/code&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Codes such as:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;if(name != null || name != "")&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;The programmer wants to see if &lt;span class="Apple-style-span" style="font-style: italic;"&gt;name &lt;/span&gt;isn't null or isn't empty. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But for the second expression to be evaluated, &lt;span class="Apple-style-span" style="font-style: italic;"&gt;name&lt;/span&gt; should be null in the first!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-243300709381848448?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/243300709381848448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=243300709381848448' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/243300709381848448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/243300709381848448'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2009/02/null-ang-ina-mo.html' title='Null Ang Ina Mo'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-744948210424360901</id><published>2008-10-09T06:29:00.000-07:00</published><updated>2008-10-09T09:30:38.751-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Corporate Slave'/><title type='text'>My Corporate Slave Self</title><content type='html'>I'm currently under a 2-year bond to work for a Filipino software company. While this may be my first real job, I have a feeling I'm working for a company that could really do better. In less than a week of working there I have broken so many coding rules just to finish a project on time. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let this post be my post mortem...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I was asked if I knew HTML. Of course I do, every computer science student knows how to use that primitive markup language. I asked if it was XHTML he was asking since HTML is basically extinct. He said just simple HTML for a static web app. Ok, simple HTML. Just basic stuff. So I said yes, I'll do that.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I was assigned to a team of three. The specs where given to us and WTF!... it asked for functionalities that require Javascript, CSS and at times even AJAX or Actionscript to work. I guess their definition of static is "anything not connected to a server". What kind of software company who specializes in web and enterprise apps doesn't know what a static website is?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;My teammates (a fresh grad and a career shifter) don't know anything about Javascript! And 4 demos in 9 days? Complete with verifications, menu bars, image viewing, input processing. How the hell are we going to do that?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Not to mention we are serving 2 masters at the same time. We report to the QA and our PM. They have different ideas about the project. One wants to focus on the layout since it's a demo after all. The other wants to focus on the functions since it's a demo after all. I know, I'm supposed to follow the PM but what happens when they also have a different understanding of the specs. One interprets a "search" as a "search" the other interprets it as a search of local data on the local computer because not all data is sent to the server. WTF!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And what happens when the PM, who wants to focus on the layout, wants to stick to her "layout" which, to put it bluntly, is an insult to interface design and all the things I like doing. Large confusing icons. Bad color combinations. Cluttered web pages. Redundant forms. Non-cross browser compatibility. Any true web designer would have resigned right there and then when he was told that that thing they call a "layout" is better because it is what the client wants. Look, I'm no expert in banking, but I know design. And if this company wants to sell their product it should never be demoed on a very very amateur interface that looks like a highschool girl's friendster layout. I've seen softwares sell because of interface alone (ex. Windows), I've seen companies thrive by making useless, though cute and pretty, programs (ex Atlassian), and I've heard of Microsoft Bob.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Anyway, to cope with my teammate's lack of scripting experience I didn't enforce standards. So now we he have a bunch of spaghetti codes, redundant functions, brute-force algorithms, and the uber-low-level "i just created pages with the values predefined and make it look like it's javascript when actually we just made separate pages of every possible value".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now I wonder if I made the right decision to work on a non multinational company. How many coding standards do I have to break before I realize that my work is actually making me more stupid. I chose to work here because I want to take side with the underdog. I always think that small companies are purer.. people who code because they want to make the world a better place. They remain small because they are not doing it for the profit. I hope I'm not mistaken.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-744948210424360901?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/744948210424360901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=744948210424360901' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/744948210424360901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/744948210424360901'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2008/10/my-corporate-slave-self.html' title='My Corporate Slave Self'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-3891565008685875718</id><published>2008-09-19T22:08:00.000-07:00</published><updated>2008-09-19T22:22:51.542-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='code snips'/><title type='text'>How to add a favicon</title><content type='html'>1. Create an icon file. 16x16 is the normal size although 36x36 icons will be resized by the browser. A .gif can also be used.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2. Add this code inside the "head" : &lt;span class="Apple-style-span" style="font-family: arial; font-size: 13px; "&gt;&amp;lt;link rel="icon" href="image/favicon.ico" type="image/ico"/&amp;gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3. The href should specify which directory the icon is located&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-3891565008685875718?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/3891565008685875718/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=3891565008685875718' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/3891565008685875718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/3891565008685875718'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2008/09/how-to-add-favicon.html' title='How to add a favicon'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-4834799557556507659</id><published>2008-09-19T06:21:00.001-07:00</published><updated>2008-09-19T06:21:45.352-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='code snips'/><title type='text'>Get an XML in jquery</title><content type='html'>&lt;div&gt;$.ajax({&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;type:"GET",&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;url:"story.xml",&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;dataType: "xml",&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;success:function(xml){&lt;span class="Apple-tab-span" style="white-space:pre"&gt;            &lt;/span&gt;&lt;/div&gt;&lt;div&gt;                     $(xml).find('line').each(function(){&lt;/div&gt;&lt;div&gt;                         var id_text = $(this).attr('id')&lt;/div&gt;&lt;div&gt;                         var name_text = $(this).find('name').text()&lt;span class="Apple-tab-span" style="white-space:pre"&gt;      &lt;/span&gt;   &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;      &lt;/span&gt; storyArray[$(this).attr('id')] = $(this).text();                 &lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt; &lt;/div&gt;&lt;div&gt;                     });               &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;});&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-4834799557556507659?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/4834799557556507659/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=4834799557556507659' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/4834799557556507659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/4834799557556507659'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2008/09/get-xml-in-jquery.html' title='Get an XML in jquery'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-822138257219832272</id><published>2008-09-18T05:42:00.000-07:00</published><updated>2008-09-18T05:43:33.478-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c'/><category scheme='http://www.blogger.com/atom/ns#' term='code snips'/><title type='text'>Open a file and output numbers</title><content type='html'>&lt;div&gt;#include &lt;stdio.h&gt;&lt;/div&gt;&lt;div&gt;#include &lt;stdlib.h&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void accessFile();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int main()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    accessFile();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    return 0;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void accessFile()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    FILE *fp;&lt;/div&gt;&lt;div&gt;    int n = 0;&lt;/div&gt;&lt;div&gt;    int z = 0;&lt;/div&gt;&lt;div&gt;    fp = fopen("count.txt","a+");&lt;/div&gt;&lt;div&gt;    if(fp == NULL)&lt;/div&gt;&lt;div&gt;        printf("Error opening file");&lt;/div&gt;&lt;div&gt;    else&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            while(!feof(fp))&lt;/div&gt;&lt;div&gt;            {&lt;/div&gt;&lt;div&gt;                fscanf(fp, "%d", &amp;amp;z);&lt;/div&gt;&lt;div&gt;                n++;&lt;/div&gt;&lt;div&gt;            }&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;    fprintf(fp,"%d\n",n-1);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-822138257219832272?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/822138257219832272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=822138257219832272' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/822138257219832272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/822138257219832272'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2008/09/open-file-and-output-numbers.html' title='Open a file and output numbers'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-7645071619631747052</id><published>2008-08-29T10:28:00.000-07:00</published><updated>2008-08-29T10:32:37.434-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Week'/><title type='text'>Update on Project Week</title><content type='html'>I am extending the deadline to Sunday. By Sunday I'd have finished something worth uploading to a webhost. Anyway, my first purpose in making the site was already achieved. I now have a relatively better understanding of how XML and Flash interact.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-7645071619631747052?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/7645071619631747052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=7645071619631747052' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/7645071619631747052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/7645071619631747052'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2008/08/update-on-project-week.html' title='Update on Project Week'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-2135834252936886113</id><published>2008-08-16T23:50:00.000-07:00</published><updated>2008-08-16T23:57:18.313-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='code snips'/><title type='text'>A More Complicated Preloader</title><content type='html'>Steps for complicated pre-loading:&lt;br /&gt;&lt;br /&gt;1. The actual movie starts on the 3rd frame. The 1st frame is for the preloader. The 2nd frame is for loading the codes and stuff&lt;br /&gt;&lt;br /&gt;2. To set the 2nd frame as the part to load the bulks, set Publish Settings&gt;Flash&gt;Settings&gt;Export Frame for Classes, set it to 2.&lt;br /&gt;&lt;br /&gt;3. Set the linkage of library symbols to not load on first frame.&lt;br /&gt;&lt;br /&gt;4. Create a preloader graphics and put it into the first frame.&lt;br /&gt;&lt;br /&gt;5. Add actionscript in to the main timeline.&lt;br /&gt;&lt;blockquote style="font-style: italic;"&gt;this.onEnterFrame = function()&lt;br /&gt;{&lt;br /&gt;    var amount:Number = this.getBytesLoaded()/this.getBytesTotal() * 100;&lt;br /&gt;    preloader._xscale = amount;&lt;br /&gt;   &lt;br /&gt;    if(amount == 100)&lt;br /&gt;    {&lt;br /&gt;        preloader._alpha-=5;&lt;br /&gt;        if(preloader._alpha &lt; 0)&lt;br /&gt;        {&lt;br /&gt;            this.gotoAndPlay(3);&lt;br /&gt;            delete this.onEnterFrame;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-2135834252936886113?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/2135834252936886113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=2135834252936886113' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/2135834252936886113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/2135834252936886113'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2008/08/more-complicated-preloader.html' title='A More Complicated Preloader'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-3841357472498426713</id><published>2008-08-16T23:33:00.000-07:00</published><updated>2008-08-16T23:50:18.310-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='code snips'/><title type='text'>How to disable people from forward-ing in flash movies</title><content type='html'>&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;blockquote&gt;var myMenu:ContextMenu = new ContextMenu();&lt;br /&gt;myMenu.hideBuiltInItems();&lt;/blockquote&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;br /&gt;&lt;br /&gt;Turns out that thing that pops up when you right click a movie is called a ContextMenu. So an easy way to disable it is to hide them by using &lt;b&gt;&lt;i&gt;hideBuiltInItems();&lt;/i&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;An item in the ContextMenu is called a ContextMenuItem. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;blockquote&gt;var useless:ContextMenuItem = new ContextMenuItem("Useless Me", deadClick);&lt;/blockquote&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;The 1&lt;sup&gt;st&lt;/sup&gt; parameter is the label of that item. The 2&lt;sup&gt;nd&lt;/sup&gt; is what function it calls if the item was clicked.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;function deadClick () {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;}&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;We just create an empty function for it. If we want to make the menu item more useful make it call a function that does something cool.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;function gotoMySite () {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;getURL("http://codeanginamo.blogspot.com/", "_top");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;}&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;You can add items into a menu by pushing it into the customItems stack of the ContextMenu.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style=""&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;span style="font-style: italic;"&gt;&lt;blockquote&gt;myMenu.customItems.push(mySiteLink, copyrightNotice);&lt;/blockquote&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;Then we attach it into the main timeline:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;b style=""&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;blockquote&gt;&lt;b style=""&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Cambria&amp;quot;,&amp;quot;serif&amp;quot;;"&gt;_root.menu = myMenu;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;  &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-3841357472498426713?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/3841357472498426713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=3841357472498426713' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/3841357472498426713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/3841357472498426713'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2008/08/how-to-disable-people-from-forward-ing.html' title='How to disable people from forward-ing in flash movies'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-5152998759666955602</id><published>2008-08-16T23:28:00.000-07:00</published><updated>2008-08-16T23:33:21.701-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Week'/><title type='text'>Project Week (Start)</title><content type='html'>I won't have any school this week. That means I have a lot of free time.&lt;br /&gt;&lt;br /&gt;And how else am I going to spend it than geek-out and do a small 1-week project. I started reading about AS2 yesterday. And hopefully learn something useful enough to create a whole mini project.&lt;br /&gt;&lt;br /&gt;What kind of project?&lt;br /&gt;&lt;br /&gt;Well I was thinking about it last night and just this morning I finally decided to create a flash based website. Nothing fancy, just something to help me grasp AS and a little XML. Once I'm done with it, maybe I'll move on to making a fancy flash game and upload it to portals and maybe earn some money.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-5152998759666955602?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/5152998759666955602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=5152998759666955602' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/5152998759666955602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/5152998759666955602'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2008/08/project-week-start.html' title='Project Week (Start)'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-8614755693852048992</id><published>2008-08-10T11:35:00.001-07:00</published><updated>2008-08-10T11:35:57.872-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mask Man Project'/><title type='text'>Mask Man Conception</title><content type='html'>Today, 1:47 AM, I concieve my brainchild. He is a man of the mask. Not a superhero, just someone who doesn't like to be seen. But wants to be felt.&lt;br /&gt;&lt;br /&gt;BACKGROUND:&lt;br /&gt;&lt;br /&gt;He has a shady past. Some say he is merely a group of different men wearing the same mask. Some say he saw his parent's get murdered in front of him (like batman). Some say he is emo. But one thing is for certain, he is but a man. And his life just like any man is normal, ordinary, and dull... all that and maybe except for a few darn awesome cutscenes.&lt;br /&gt;&lt;br /&gt;It is safe to assume that he might have MPD. Given that he gets confused when switching masks. The more frequent he does that, the more uncontrollable he becomes.&lt;br /&gt;&lt;br /&gt;ABILITIES:&lt;br /&gt;&lt;br /&gt;He draws all his abilities from his masks. That's right, masks. Darn too many of them. Masks he crafted out of his experiences. Stealth, strength, flight, fight, speech. His mask is his weapon. Take away his mask, and he becomes ordinary.&lt;br /&gt;&lt;br /&gt;Can his masks be destroyed?&lt;br /&gt;&lt;br /&gt;Yes. By taking it away from his face, then breaking it into a million pieces. So basically most people just beat him to death. Or force him to go crazy, then beat him to death.&lt;br /&gt;&lt;br /&gt;Can his masks improve?&lt;br /&gt;&lt;br /&gt;Yes. If the mask is frequently used, his abilities become better. But use it too often and the mask's innate personality takes over.&lt;br /&gt;&lt;br /&gt;Is he unique?&lt;br /&gt;&lt;br /&gt;Yup, no other person in the world has his abilities. That is what makes him a target of all sorts of crazy people. That's why people mustn't see his real face.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;*UPDATE:&lt;br /&gt;Just thought of it, right after I posted. He takes drugs. This adds more depth to the character.&lt;br /&gt;He's no junkie. But he's highly mentally unstable. Which can be seen on some scenes where he just fail to respond coherently. Eventually this will take over him.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-8614755693852048992?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/8614755693852048992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=8614755693852048992' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/8614755693852048992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/8614755693852048992'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2008/08/mask-man-conception.html' title='Mask Man Conception'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3715569787779993102.post-4276612299264490343</id><published>2008-08-01T12:18:00.000-07:00</published><updated>2008-08-01T12:48:24.227-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='code snips'/><title type='text'>A linked list</title><content type='html'>&lt;span style="font-family:courier new;"&gt;/*#include headers here */&lt;stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-weight: bold;"&gt;struct list_el &lt;/span&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   int val;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   struct list_el * next;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-weight: bold;"&gt;typedef struct&lt;/span&gt; list_el Item;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Item *list, *tail; &lt;span style="font-style: italic; color: rgb(102, 204, 204);"&gt;//references to the linked list&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;int main() {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   int i;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   Item *curr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   int array[] = {1, 24,3,412,125,6,74,228,9, 10};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(51, 255, 255);font-family:courier new;" &gt;    /*initialize the list*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    list = (struct Item*)malloc(sizeof(Item));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    list-&gt;next=NULL;   &lt;span style="color: rgb(51, 255, 255); font-style: italic;"&gt;// this is important to &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    list-&gt;val = 0;           &lt;span style="font-style: italic; color: rgb(51, 255, 255);"&gt;// avoid wierd looking variables occupying our list&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    tail = list;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(51, 255, 255);font-family:courier new;" &gt;    /*populate the list*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   for(i = 0; i &lt;&gt;&lt;br /&gt;&lt;span&gt;   {&lt;/span&gt;&lt;br /&gt;&lt;span&gt;       addToList(array[i]);&lt;/span&gt;&lt;br /&gt;&lt;span&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;    curr = list;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;   while(curr-&gt;next != NULL)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;   {&lt;/span&gt;&lt;br /&gt;&lt;span&gt;       printf("%d -&gt; ", curr-&gt;val);&lt;/span&gt;&lt;br /&gt;&lt;span&gt;       curr = curr-&gt;next;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span&gt;   printf("%d\n", tail-&gt;val); &lt;span style="font-style: italic; color: rgb(51, 255, 255);"&gt;//the tail isn't really printed coz a tail triggers the loop to end&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;addToList(int value)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    Item *curr;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;    if(tail == list &amp;amp;&amp;amp; tail-&gt;val == NULL) &lt;span style="color: rgb(51, 255, 255); font-style: italic;"&gt;//if the list is empty&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        tail-&gt;val = value; &lt;span style="color: rgb(51, 255, 255); font-style: italic;"&gt;//create the head, since it's the only element&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        tail-&gt;next = NULL;&lt;span style="color: rgb(51, 255, 255); font-style: italic;"&gt; //it is also the tail&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    else&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        if(curr = (struct Item*)malloc(sizeof(Item)))&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            curr-&gt;val = value; &lt;span style="color: rgb(51, 255, 255); font-style: italic;"&gt;//create a new node&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            curr-&gt;next = NULL; &lt;span style="color: rgb(51, 255, 255); font-style: italic;"&gt;//new node becomes the tail -- essentially, coz it doesn't have anything after it&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            tail-&gt;next = curr;&lt;span style="font-style: italic; color: rgb(51, 255, 255);"&gt; //the old tail links with the new node, so essentially it's no longer a tail&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            tail = curr;       &lt;span style="color: rgb(51, 255, 255); font-style: italic;"&gt;//the new node is now formally a tail&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        else&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            printf("\nOut of memory error\n");&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            system('pause');&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3715569787779993102-4276612299264490343?l=codeanginamo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeanginamo.blogspot.com/feeds/4276612299264490343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3715569787779993102&amp;postID=4276612299264490343' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/4276612299264490343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3715569787779993102/posts/default/4276612299264490343'/><link rel='alternate' type='text/html' href='http://codeanginamo.blogspot.com/2008/08/linked-list.html' title='A linked list'/><author><name>Zeroin</name><uri>http://www.blogger.com/profile/10463770352750295184</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://bp2.blogger.com/_6466SWUJEn8/R7b3aCmaA0I/AAAAAAAAAAM/VDN5MolWZaA/S220/fly.jpg'/></author><thr:total>0</thr:total></entry></feed>
