tag:blogger.com,1999:blog-153153142024-03-18T22:48:33.494-04:00BrainstepA blog with no missionVinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.comBlogger139125tag:blogger.com,1999:blog-15315314.post-19165982938227932162015-03-26T00:06:00.000-04:002015-03-26T00:06:22.505-04:00More Frustrating than the Chicken and Egg Problem....<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://jasonlbaptiste.com/wp-content/uploads/2015/01/ibeacon-chicken-egg-problem.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://jasonlbaptiste.com/wp-content/uploads/2015/01/ibeacon-chicken-egg-problem.jpg" height="320" width="320" /></a></div>
<br />
<br />
So you've been brainstorming for the past five hours and you've finally come up with the next billion dollar idea. It's a platform that lets buyers and sellers talk to each other and transact business while you take a cut of every penny that passes. You're going to make billions, right? Of course!<br />
<br />
You start canvasing your area talking to buyers, introducing them to this revolutionary idea of yours, but one question keeps popping up: How many sellers are there on your platform? You pause. You realize that a change of strategy is in order - get sellers then come back and get the interested buyers.<br />
<br />
You head out the next day, this time hunting for sellers. You get some meetings and each time at the end of your fancy presentation you get the question: How many <i>buyers</i> are there on your platform?<br />
<br />
You, my friend, have a classic case of common "chicken and egg" syndrome.<br />
<br />
This, no doubt, is frustrating and you are, in fact, tasked with finding very creative ways to overcome this problem. However, what if I told you that there's something worse than this? What if I told you that there's something more frustrating than spending months setting up meetings, tweaking the product, getting the word out and polishing pitches only to end up sitting late at night propping your jaw trying to figure out how to get sellers and buyers to drink from your milk saucer?<br />
<br />
What if I told you that there is a situation in which you create the "perfect product" that escapes the clutches of ye old chicken and egg and is aimed squarely at a unidirectional audience that loves it but simply won't try it because it's a new product that nobody's tried before?<br />
<br />
There is a name for this type of situation. I call it the "You Go First" situation - that's where several potential clients are standing in a circle around your product; all of them waiting for the other to try it first meanwhile you just sit there cueing them on to "step right up" while they all stand there stroking their chins; it's like you're the only guy at a kissing party and the girls all want to kiss you but they're each waiting for someone else to make the first move because nobody want to appear to be the thirstiest of thirsties. You know what happens in that scenario? The parents come home and break up the party before any lip locking gratification can be had - everybody misses out because nobody wanted to be the one to make that bold move. Who knows where the evening cold have gone? I digress...<br />
<br />
It's amazing - you come to a client that loves you and your product. They believe that the idea is novel, and it's the shot in the arm that the industry needs. It will cost them $0 to try and involve <i>very </i> minute changes (if any) to their business process while maximizing profits and saving them tens or hundreds of thousands of dollars in the process... but they're skeptical to try it because nobody else has tried it yet.<br />
<br />
That, my friends, is the state of the soil that we entrepreneurs are attempting to till to plant the seeds of innovation here in T&T. That's one of the reasons why great products (especially technology products) aimed at a T&T audience seldom succeed.<br />
<br />
You think it's because most ideas are crap? No! Well, some of them are, but the point is that some of the great ideas, the really good ones are left out in freezing limbo until the money in their veins dries up and the entrepreneur has no choice but to move on and either a.) get a job and become another working stiff or b.) hunker down and set up camp somewhere else.<br />
<br />
Is the situation unique to T&T? Of course not. I'm pretty sure this exists in other places as well, but does that mean it's acceptable?<br />
<br />
As for what can be done about the situation, I'm fresh out of ideas. All I can suggest is prayer and patience. Every business owner has the right to accept or not accept any business proposition no matter how good it may appear to be. Here's hoping that this generation will see the last of this type of thinking.<br />
<br />
<br />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-52025646037923019012015-03-17T10:24:00.001-04:002015-03-17T10:24:39.216-04:00Teaser-ception<div class="separator" style="clear: both; text-align: center;">
<a href="https://cdn3.vox-cdn.com/thumbor/if6NzWfYmF61vLgE6k37Tg_dckI=/176x0:842x444/800x536/cdn0.vox-cdn.com/uploads/chorus_image/image/45910576/CAP1e1kWsAA9iv_.0.0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="267" src="https://cdn3.vox-cdn.com/thumbor/if6NzWfYmF61vLgE6k37Tg_dckI=/176x0:842x444/800x536/cdn0.vox-cdn.com/uploads/chorus_image/image/45910576/CAP1e1kWsAA9iv_.0.0.jpg" width="400" /></a></div>
<br />
<br />
So this is where we've gotten to, huh? A teaser, for a teaser for a poster that will probably tease a teaser for the first official trailer.<br />
<br />
Back in my day the official trailer served as the teaser for the movie. I wonder what happened?<br />
<br />
<a href="http://www.theverge.com/tldr/2015/3/16/8227475/spectre-007-james-bond-teaser-poster" target="_blank">http://www.theverge.com/tldr/2015/3/16/8227475/spectre-007-james-bond-teaser-poster</a>Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-27667414865837091092015-02-20T23:21:00.002-04:002015-02-20T23:21:26.486-04:00Yes It's Still Coming...<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<span style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: left;">Those of you in my other social circles would have seen me tease a bit of big news a couple weeks back and promised to reveal the big surprise shortly after.</span></div>
<div class="" style="clear: both; text-align: left;">
Admittedly it's taking just a <i>tiny</i> bit longer than expected, but I want to make sure all the nails are flush, screws are tight, I's are dotted and T's crossed before I yank the veil off. Trust me, it's that big a deal, both for me and for the latest iteration of my pet project - Linq.</div>
<div>
<br /></div>
<div>
Stay tuned to the blog this coming week to see what's happening.</div>
Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-52241861478380844872015-01-16T16:52:00.001-04:002015-01-16T16:52:06.714-04:00Only Fools Rush In<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://missstep.org/wp-content/uploads/2012/07/old-faithful-1.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://missstep.org/wp-content/uploads/2012/07/old-faithful-1.jpg" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Image of Java, er, Old Faithful</td></tr>
</tbody></table>
I fear I may be getting old. There was once a time when I rushed for the latest technology stack being touted as the "hip new way of doing x, y and z" and scoffed at the older "dinosaur" programmers who were reluctant to try out this new hotness that's being lauded by Reddit users and is steadily gaining traction on Github.<br />
<br />
Four years have passed, and upon reflecting on my habits for selecting technologies for projects as of late, it would seem that I, too, have joined the dinosaur herd... but is that necessarily a bad thing?<br />
<br />
I mean, sure, this new framework or tool has a flashy new website with parallel scrolling and SVG animation out the wazoo, but does it mean that it's time to flee from my resting place on the rock of surety and hop and skip on the ever changing, ever shifting (and ever deprecating) sands of "the new hotness?"<br />
<br />
The obvious answer would be yes and no - yes, because in this line of work you need to keep that skill base very up to date, and no because nothing is worse than setting your heart on a way forward with a framework only for it to get uppity and start meandering down a winding road of deprecations, refactorings and (sometimes) outright revamps and you find yourself pushing back deadlines as you scramble to re-learn the damn thing because v2.0 took v1.9's APIs out into the back yard and put two to the back of its head.<br />
<br />
My point is don't rush for the new technology/framework/stack as soon as you hear about it. If it's still in version 0.x.x it's probably best to keep away from it until it matures a little bit more. Basing any of your production applications on a technology this early in development is making ample room for headaches later down when updates are due. No one is saying to avoid new tech completely though - download it to your sandbox and build a few small apps; it won't hurt. You might even be able to contribute code to the project in the process.<br />
<br />
At the time of writing NodeJS is currently at version 0.10.35. Will I select it as the foundation for my next official project? No. I will, however use it and the (very awesome) Gulp plugin to compile my Less CSS files, minify my Javascript and other small things. And yes, I've only just started using build tools over the last week or so. For my next major project I would much rather rely on the stability and "boringness" of Java. I can bet my bottom dollar that there's a library to perform almost any task and a documented solution to any problem I might encounter during development. The framework launched about a year ago is not as likely to afford me this comfort. Sure Java might not be a sexy as [insert new-fangled language here] but it sure is faithful and, most importantly, predictable - attributes that make it my primary choice for major application development.<br />
<br />
<b>TL;DR;</b><br />
It might seem obvious, but don't use early stage technologies heavily in production. Stick to something that's a lot more mature and stable to avoid surprises and headaches come update time.<br />
<br />
<br />
<br />
<br />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-25018740631791786212014-11-20T16:33:00.000-04:002014-12-01T16:28:47.953-04:00About that Customer Service...<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://m.c.lnkd.licdn.com/mpr/mpr/p/3/005/07b/0ad/2cb4626.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://m.c.lnkd.licdn.com/mpr/mpr/p/3/005/07b/0ad/2cb4626.jpg" height="200" width="184" /></a></div>
Yesterday I wrote a review on Amazon about some screen protectors I had bought and was very dissatisfied with. About two hours later I received an email from the vendor telling me that they were sorry to hear about my bad experience and as such were willing to send me another pack of screen protectors to try again or issue me a no-questions-asked a full refund.<br />
<br />
A couple months ago I ordered a fried beef pie from a bakery around the block from where I work. Upon reaching back to the office I realized that they erroneously gave me the wrong type of pie, so I returned to the bakery and asked for an exchange. The cashier, with whom I had interacted with almost every day for the past 18 months proceeded to tell me that even though it was the wrong product I've received, they don't do exchanges on purchased items.<br />
<br />
What's the difference between these two businesses? The bakery will NEVER receive another cent from me, while the screen protector vendor will actually receive high commendations and wide recommendations from me (provided the replacement batch is good).<br />
<br />
That, my fellow business folk, is the difference in customer reaction when your customer service is top notch.<br />
<br />
It's about going to great lengths, and sometimes beyond the call, to show your customers how much you care and how much you value their business. Falling short in this area can actually cost you more money not only in the long run, but in the immediate term. Remember, you're not just disrespecting one customer with your bad service, you're disrespecting all 50 of the people that that one customer would have recommended your business to. The inverse remains true.<br />
<br />
So remember, no matter what line of business you get in to - fast food, retail, online services, etc. - the customer is king (or queen). Give them your utmost respect and make them feel like their money was well invested and not simply spent.<br />
<br />
I got the exchange on my pie though. I wasn't about to allow my $5 to go down the drain.<br />
<br />
Update: I got the new batch of screen protectors, and they were awesome! Here's the product in question: <a href="http://www.amazon.com/Definition-Protector-Defender-High-Response-Lifetime/dp/B00GHD28BS/ref=cm_cr-mr-title" target="_blank">http://www.amazon.com/Definition-Protector</a><br />
<br />
<br />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-15120394259562882022014-11-14T16:35:00.001-04:002014-11-14T16:35:03.863-04:00You Can't Run a Company When You're Dead<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvZ-dolJfxGCvMj7sfGQ02Ep3xyj027kbsLDe1O11LbCaL6Yh_3nIVe_jM2urs9mSOQwRQILmO2D4V8cnEv48ST6JSJmmjNhCtSmiI4atKuTFlmIIAff54r39LOrzKu3zI86PG2A/s1600/IMG-20141107-WA0009.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvZ-dolJfxGCvMj7sfGQ02Ep3xyj027kbsLDe1O11LbCaL6Yh_3nIVe_jM2urs9mSOQwRQILmO2D4V8cnEv48ST6JSJmmjNhCtSmiI4atKuTFlmIIAff54r39LOrzKu3zI86PG2A/s1600/IMG-20141107-WA0009.jpg" height="320" width="240" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">5lb ain't nothin' to mess with!</td></tr>
</tbody></table>
As the founder of the next billion dollar startup, it can get tempting at times to just hunker down, dig in and pull out all the stops for the sake of a 4 month coding stretch. As the founder of a new company, myself, the temptation to just let everything hang out and grow out while I go for that 1.0 release is strong and sometimes overpowering.<br />
<br />
Unfortunately this kind of activity does more harm than good. That diet of potato sticks, juice, water and fried chicken isn't doing ANYBODY any favours. Sure your code is lean, optimized and DRY but the body being used to create such a beautiful code base is slowly, but surely withering away.<br />
<br />
As the title says, you can't run your billion dollar company when you're dead. Try as much as possible to keep a reasonably healthy diet. Nobody is saying to break out the dehydrated meat loaf and the soy milk, but keep things civilized. Also, make some time for exercise. I do a 30 minute jog then about an hour of some gym work at most 3 times a week. 90 mins out of your day every other day or so can do wonders for your health.<br />
<br />
As a programmer, I'm all to familiar with the importance of that mental momentum. However, I've found that that a brisk jog and some gym time allows me to take a step back and clear my head for a bit. I may even use this time to think about the solution to a nagging bug that's been tormenting me all day. I've found that this works out better for me as opposed to sitting there and staring at code and hitting F5.<br />
<br />
So take a break for the sake of your health. Lift your head up and see the beautiful sunshine, hear the birds and get that blood pumping. Your mind and body will thank you for it in the end, and the journey to 1.0 will be so much sweeter.Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-2042522403282629382014-10-24T14:49:00.000-04:002014-10-24T14:49:22.207-04:00Keep On Keeping On<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-fFwytS9-PyQ/VEqd8BOk21I/AAAAAAAAQ-Q/KR2B02D6CXE/s1600/IMG_20141024_144040~2.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-fFwytS9-PyQ/VEqd8BOk21I/AAAAAAAAQ-Q/KR2B02D6CXE/s1600/IMG_20141024_144040%7E2.jpg" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Becoming one with the code</td></tr>
</tbody></table>
As some of you may know I've started a small company about 2 years ago in my spare time and I've since created 2 products/services. One of which has just seen its second iteration and is currently in that ticklish and oh-so-stressful stage of customer acquisition.<br />
<br />
Now, even with a free 60 day no-risk trial, no additional hardware or software to buy/install and no drastic changes to current workflows, getting members of the target market to use the service (or even give it a try) is like pulling teeth from a very timid, very untrusting bullshark.<br />
<br />
Thank God that thus far I haven't received an outright "no" from any of the folks I approached, but boy it sure does get annoying constantly being thrown into that big grey abyss of "let me talk to my boss/let me think it over".<br />
<br />
Honestly, sometimes I feel like giving up and resigning myself to being a permanent member of the working class. Paying $X a month to my VPS provider for a service that brings in $0 (as at writing time) isn't exactly one of the things I look forward to every pay day.<br />
<br />
So what keeps me going strong? What keeps me dialing back the phone numbers of potential clients even when my emails go unanswered and their personal assistants sigh at the sound of my name? Aside from heavy reassurance from God and my nightmare of my wife having to quit her job to sell shoes door to door, I found inspiration in the most unlikely of places - a group of people I ignore every day on my way to work - roadside vendors!<br />
<br />
You see, every day on my way to work a vendor would ask me if I'm interested in buying watch bands, cell phone cases or the one ring to rule them all and their offers to me would usually be met with an unapologetically blank stare and a strong breeze, void of acknowledgement, as I swoosh by on my way to get a taxi. Now that's just me, on person, turning down their offers on my way to work every day, 5 times a week for 18 months. Multiply that by about 10 thousand other no's they get daily and you see some interesting things starting to form in the mathematical soup.<br />
<br />
One of those things is that they have a high tolerance for disappointment. They're resilient and persistent enough to boldly approach the same person over and over no matter how many times that person passes by ignoring them. After (literally) more than a million no's they still come out, set up shop and ply their trade <b>daily</b>;<b> </b>they keep banging on the market's door until the market responds with a yes, and it's that yes that keeps their fire burning until another yes comes along to stoke the flames again.<br />
<br />
Compared to the 20 or so "I'll have to think some more about it" responses that I've gotten, things really aren't that bad in my court, and it probably isn't that bad in your court either, my fellow entrepreneur.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-F7mYCXNROuk/VEqaovn5R4I/AAAAAAAAQ9M/tKqol8_xDAk/s1600/IMG_20141024_142325~2.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-F7mYCXNROuk/VEqaovn5R4I/AAAAAAAAQ9M/tKqol8_xDAk/s1600/IMG_20141024_142325%7E2.jpg" height="200" width="150" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Sims on the grind</td></tr>
</tbody></table>
Being a young tech company in T&T is tough, and especially so when you don't have an illustrious family name that makes potential clients quiver and have to sell your product "door to door" because that $500 000 marketing budget is just slightly out of your reach at the moment. However, as someone who is currently in your shoes, I just want to encourage you to press on. I assure you that it's not a solid stone wall; there are soft spots, and with the right hammer, attitude and persistence you can make a breakthrough. <br />
<br />
Just hang in there.<br />
<br />
<br />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-63330404951003871742014-06-15T18:37:00.003-04:002014-06-15T18:39:54.684-04:00Module Naming Conventions for Play 2.2 and IntelliJ 13.1So today I noticed something strange with <a class="g-profile" href="https://plus.google.com/104653401767241115426" target="_blank">+IntelliJ IDEA</a> and the <a class="g-profile" href="https://plus.google.com/106233335814246022600" target="_blank">+Play Framework</a> 's build.sbt file.<br />
<br />
Say you create a project using the following method:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg74vki1d9DyTFRjkoxUvX8ho5dzqXnHG2urhRpZQlnSNNqvHPbr85nmxDO15Y3bMiipmJS67o6YmI9pJe7xQcWn_IlK1SSSVTZbYG7kHm09uCZwEuYK-h-av6-Dpk7XSF6g7EtWQ/s1600/create_app.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg74vki1d9DyTFRjkoxUvX8ho5dzqXnHG2urhRpZQlnSNNqvHPbr85nmxDO15Y3bMiipmJS67o6YmI9pJe7xQcWn_IlK1SSSVTZbYG7kHm09uCZwEuYK-h-av6-Dpk7XSF6g7EtWQ/s1600/create_app.PNG" height="320" width="314" /></a></div>
<br />
1. Create a new app using the play new command (testapp)<br />
2. Naming the application (Test_Application)<br />
3. Selecting the Simple Java application template<br />
<br />
When you open the project with IntelliJ and look at the build.sbt file, this is what you see:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCOajq2xA_srvbZFkwP2Ukyz6VuJXX6Oik7UMFhVeC2zGBIzYdk4Is89D7z1J332_qAVr1wlNHvOWB06uQlqirW3vgYUhsZy8LqAViojqxegnsi5WPA9MxMdgCMgWgcKm6nbRk4g/s1600/intellij_error.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCOajq2xA_srvbZFkwP2Ukyz6VuJXX6Oik7UMFhVeC2zGBIzYdk4Is89D7z1J332_qAVr1wlNHvOWB06uQlqirW3vgYUhsZy8LqAViojqxegnsi5WPA9MxMdgCMgWgcKm6nbRk4g/s1600/intellij_error.PNG" height="194" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
This means that the project ins't properly resolving within IntelliJ. This can lead to false error flags and almost zero code assist support when building your controllers and whatnot. Now your Play application will still run as normal, but at this point you might as well use Notepad to do your code editing - IntelliJ will be almost useless to you.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The fix, however is simple. Simply rename the project's build module to the same name as the main project module and attach "-build" to the end of it. This can be achieved by going to File > Project structure... > Modules. Mine show up like this;</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqNQEDYaXo6UyorsHvuC6B8nxThfp3D4rGxDFKZfx8vK-C9Eu2aANg4S4DL11dG-MxA0PWfRPBJlDs2sVyZf5xsDfUoNNVQcu9ShB6vodLSRV7c_2zDipraSO5tygOP2CW8riLpw/s1600/intellij_modules_wrong.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqNQEDYaXo6UyorsHvuC6B8nxThfp3D4rGxDFKZfx8vK-C9Eu2aANg4S4DL11dG-MxA0PWfRPBJlDs2sVyZf5xsDfUoNNVQcu9ShB6vodLSRV7c_2zDipraSO5tygOP2CW8riLpw/s1600/intellij_modules_wrong.PNG" height="258" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
From here what I will do is change the build module's name to "testapp-build", </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1sEidKNGhX6fldqNcO4Hx4H64xEgVFt88dbnKYluB2XyMvU1TLLuYIIa9h9cxcXbpPaaYRYrVOwoKtpvRkD5oyK4sN7KtE4vOfwkwF8ZJ5DSgI0l3nMqaD0UtsgCRV7OiPL3URA/s1600/intellij_modules_right.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1sEidKNGhX6fldqNcO4Hx4H64xEgVFt88dbnKYluB2XyMvU1TLLuYIIa9h9cxcXbpPaaYRYrVOwoKtpvRkD5oyK4sN7KtE4vOfwkwF8ZJ5DSgI0l3nMqaD0UtsgCRV7OiPL3URA/s1600/intellij_modules_right.PNG" height="258" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
click OK and when I look at my build.sbt file again, everything should resolve properly and my code assist should work splendidly:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQFW_am8UGFTkbsqadjQVhW2keh-FHVae32dBhUdtidQyIJQ0sgJfuFGhABBqs7K6x0PgM8x5Hula188N-Gy97b2IfkUUIvYfuZwVzzkPNc_TiKMJzfkysILk03shd37YFzP2pHA/s1600/intellij_error_fixed.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQFW_am8UGFTkbsqadjQVhW2keh-FHVae32dBhUdtidQyIJQ0sgJfuFGhABBqs7K6x0PgM8x5Hula188N-Gy97b2IfkUUIvYfuZwVzzkPNc_TiKMJzfkysILk03shd37YFzP2pHA/s1600/intellij_error_fixed.PNG" height="194" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Well, it's almost fixed. Restructure the file as follows to make sure the library dependencies resolve properly as well:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi74_D-jogtU4X2VbfdHiKobSGqx3RykjTnDsqEx999YVpCSeM6Q6bCCyPykYtCLutY16MnDlCc3fY7qIo_BxoLbj_T1EBjOuwPNLXEd7y9zkDulZViw11mAf141UBo2Nug4nQGBg/s1600/intellij_error_fixed_final.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi74_D-jogtU4X2VbfdHiKobSGqx3RykjTnDsqEx999YVpCSeM6Q6bCCyPykYtCLutY16MnDlCc3fY7qIo_BxoLbj_T1EBjOuwPNLXEd7y9zkDulZViw11mAf141UBo2Nug4nQGBg/s1600/intellij_error_fixed_final.PNG" height="194" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
To avoid all this tra-la-la, I would advise skipping the step to name your application when creating the application from the command line. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Happy coding!</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Bug affects:</b></div>
<div class="separator" style="clear: both; text-align: left;">
Play 2.2.3</div>
<div class="separator" style="clear: both; text-align: left;">
IntelliJ 13.1.3 Build IU-135.909</div>
<div class="separator" style="clear: both; text-align: left;">
Play plugin 0.38.437</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-17244982294576790032014-06-03T21:32:00.000-04:002014-07-28T17:37:44.782-04:00Proper build.sbt Settings for Play 2.2 and IntelliJ<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.clker.com/cliparts/c/3/b/d/1194985428453820625bug_nicu_buculei_01.svg.med.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://www.clker.com/cliparts/c/3/b/d/1194985428453820625bug_nicu_buculei_01.svg.med.png" height="190" width="200" /></a></div>
<span style="font-family: Arial, Helvetica, sans-serif;">I came across a bug today that cause IntelliJ 13.1 to act strangely when passing Java objects to Scala templates.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">For example the snippet:</span><br />
<pre class="prettyprint">public static Result login() {
ok(login.render(Form.form(Login.class)));
}
</pre>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">will compile and run, but IntelliJ will flag it as an error because it says that it found a <i>play.data.Form</i> object when the Scala template was expecting a<i> play.api.data.Form</i> object. Now that's just the tip of the iceberg, I even found that in some cases my routes (for redirects within the controller) were flagged as unresolvable objects.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Fear not, for the solution is simple. Your <i>build.sbt</i> file will look like this when Play generates the project:</span><br />
<pre class="prettyprint">name := "testapp"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache
)
play.Project.playJavaSettings
Simply change it as follows:
import play.Project._
name := "testapp2"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache
)
playJavaSettings
</pre>
<br />
Run the following commands:<br />
<pre class="prettyprint">play clean
play compile
</pre>
<br />
And voila! Those nasty red squiggly lines are gone.<br />
<br />
<h4>
Bug notes</h4>
<br />
This bug was present in the following software and their versions:<br />
<br />
IntelliJ IDEA version: 13.1 IU-135.475<br />
Play Framework version: 2.2.1 - 2.2.3<br />
Play 2.0 plugin version: 0.33.404<br />
Scala plugin version: 0.33.403Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-69251070618594634682013-11-03T11:23:00.000-04:002013-11-03T11:23:47.668-04:00GTA; The Lost and the Damned Final Thoughts<div class="separator" style="clear: both; text-align: center;">
<a href="http://media.rockstargames.com/flies/TLAD/images/phase/black/logo_agegate.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="296" src="http://media.rockstargames.com/flies/TLAD/images/phase/black/logo_agegate.gif" width="320" /></a></div>
Even though it was a product of <a class="g-profile" href="http://plus.google.com/115451798537673468313" target="_blank">+Rockstar Games</a> I thought I would never play and never like GTA: The Lost and Damned because I found the characters repulsive, depraved, degenerate and unlikable, and the protagonist - Johnny Klebitz - was voiced by an overcompensating wannabe tough guy with a very forced "gravel voice".<br />
<br />
After playing and completing it though, I have to say I really like it. My initial critiques still stand, but the overall story, pacing and gameplay is perfect for busy people who enjoy the engaging narrative of a full Grand Theft Auto game without the investment of time needed to unlock all the cool toys and see the entire city.<br />
<br />
Now I was never a fan of the whole death metal, leather jacket, biker scene so it was a bit difficult for me to get into the story and start caring about the characters even with such an exciting and edgy trailer...<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/ZrsFIPrM5Bg?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />
But once I did my regrets were zero.<br />
<br />
I'd describe this as a perfect day-off experience. Long and involved enough to keep you occupied all day but short enough to allow you to get to the conclusion of the story before the sun sets.<br />
<br />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-76783204608855239342013-10-30T21:37:00.002-04:002014-07-28T17:50:09.527-04:00Running Play 2.1.x App as Windows Service (Fat Free Version)<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhydF2f944_qML1EaU9ymCA1ELf7WpvHLR22I-B3cYCaJTRiY6tQoL5F3Z772P94NF_0dsyEc3sToouW7IcULNzgN1S3x7TFVgv6h3DaJ8bQuyRipkUQXJFdGLKMG23pCcp2uZNUg/s1600/zentasks-3.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhydF2f944_qML1EaU9ymCA1ELf7WpvHLR22I-B3cYCaJTRiY6tQoL5F3Z772P94NF_0dsyEc3sToouW7IcULNzgN1S3x7TFVgv6h3DaJ8bQuyRipkUQXJFdGLKMG23pCcp2uZNUg/s320/zentasks-3.PNG" height="244" width="320" /></a></div>
In this post, I'll show you how to run your Play 2.1.x app silently as a background service and give you a couple tools you can use to ease the administration process for your app. All of this without the use of third party tools.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
For this tutorial we will use the Zentasks sample application that came bundled with the framework. This tutorial assumes that:<br />
<br />
<ul>
<li>The zentasks project folder is located in C:\apps\zentasks</li>
<li>The Java executable is located at C:\Program Files\Java\jdk1.7.0_25\bin\</li>
</ul>
<br />
Adjust these directories to suit your needs. Let's get started.<br />
<br />
<h3>
The Problem</h3>
<br />
You have several apps that you need to deploy in a production Windows environment, but you hate having the pesky command prompt window visible in the background when you run <b><i>play start</i></b> for each application. You want your apps to run silently as Windows services on startup.<br />
<br />
<h3>
The Solution</h3>
<br />
Create a standalone distribution of your app by opening a command window and running<br />
<b><i><br /></i></b>
<b><i>cd c:\apps\zentasks</i></b><br />
<b><i>play clean dist</i></b><br />
<br />
In the <b><i>dist</i></b> folder of the application directory, you should see an archive named <b><i>zentasks-1.0-SNAPSHOT.zip</i></b> Extract the contents of that archive to the current folder.<br />
<br />
In my case the location of my app is <b><i>C:\apps\zentasks</i></b> and the location of the folder I just extracted from the archive is <b><i>C:\apps\zentasks\dis\zentasks-1.0-SNAPSHOT.</i></b><br />
<br />
To run my app invisibly, I take advantage of the <i>javaw.exe</i> application bundled with my Java installation. This file does exactly what <i>java.exe</i> does but it does it in the background without showing a console window.<br />
<br />
<b>Note before continuing:</b> Either turn off evolutions or set them to automatic in the <i>application.conf </i>file. You can do that by following the example <a href="http://www.playframework.com/documentation/2.2.x/Evolutions" target="_blank">here</a>. Once that's done, run <b><i>play dist</i></b> again.<br />
<br />
In a command prompt window I then run the following commands:<br />
<pre class="prettyprint">cd c:\apps\zentasks\dist\zentasks-1.0-SNAPSHOT
javaw -cp lib\* play.core.server.NettyServer
</pre>
<b><i><br /></i></b>
You'll notice that the command runs and returns you to the command prompt. Give it a couple seconds and go to <b><i>http://locahost:9000</i></b> (or whatever port you set the app to run on) and see if your app is running. It should be.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZy0Ie7_kBQSmFJifF0tUS4diFFLPInxoG-v_eA1ZjE9T1Ik4-C66oitO3wNdiyQvT0b_hFqIxr6T1h3cJmwZxHdYKOj_76bEV3NtDFNoMOu89Z7gQTh76utxFeB4KnKCh-uwypQ/s1600/zentasks-1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZy0Ie7_kBQSmFJifF0tUS4diFFLPInxoG-v_eA1ZjE9T1Ik4-C66oitO3wNdiyQvT0b_hFqIxr6T1h3cJmwZxHdYKOj_76bEV3NtDFNoMOu89Z7gQTh76utxFeB4KnKCh-uwypQ/s320/zentasks-1.PNG" height="160" width="320" /></a></div>
<br />
<br />
Once you have that sorted out, let's move on. We're going to create two batch files for starting and stopping the application. Once these files are created we can also place them in the Startup folder on our Start menu to have them execute when Windows starts up.<br />
<br />
<h3>
Batch File #1: Start.bat</h3>
<br />
Open a Notepad document and paste in the following:<br />
<pre class="prettyprint">cd .
start "" "C:\Program Files\Java\jdk1.7.0_25\bin\javaw.exe" -cp lib\* play.core.server.NettyServer
</pre>
<br />
Substitute the correct paths where necessary and save the file as <b><i>start.bat</i></b> in your application's <b><i>dist<span style="font-family: inherit;">\</span></i></b><span style="font-family: inherit;"><i><b>zentasks-1.0</b></i><b><i>-SNAPSHOT</i></b></span> directory.<br />
<br />
To test the file, open task manager and kill the <b><i>javaw.exe</i></b> process,<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbrxC-So174eKeUg3QQNA9FQfMJ8A6cu3yR0SKteWymUVOXCEOwq1RElKfJsNqNs2y0_jup04GV1ZUn-aiXwOe_iDOYCm2KBIfHbH571NPbNRelKtJJ2YGOTm12z4YhFlzfrWLQw/s1600/zentasks-2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbrxC-So174eKeUg3QQNA9FQfMJ8A6cu3yR0SKteWymUVOXCEOwq1RElKfJsNqNs2y0_jup04GV1ZUn-aiXwOe_iDOYCm2KBIfHbH571NPbNRelKtJJ2YGOTm12z4YhFlzfrWLQw/s320/zentasks-2.PNG" height="276" width="320" /></a></div>
<br />
<br />
then go to your application's <b><i>dist<span style="font-family: inherit;">\</span></i></b><i><b>zentasks-1.0</b></i><b><i>-SNAPSHOT</i></b> directory and delete the <b><i>RUNNING_PID</i></b> file. Now double-click <b><i>start.bat</i></b>, wait a couple seconds then go to <b><i>http://localhost:9000</i></b> to check if your app is up. It should be.<br />
<br />
<h3>
Batch File #2: Stop.bat</h3>
If starting your app in production mode is now that easy, then stopping it should be too.<br />
<br />
Again, open a new Notepad document and paste in the following:<br />
<pre class="prettyprint">set /p pid=<RUNNING_PID
taskkill /PID %pid% /F
DEL RUNNING_PID
</pre>
<br />
That information goes on three separate lines.
Save the file as <b style="font-style: italic;">stop.bat, </b>place it in your app's<b style="font-style: italic;"> </b><b><i>dist<span style="font-family: inherit;">\</span></i><i>zentasks-1.0</i><i>-SNAPSHOT</i></b> directory and when you run it, it should kill the <i>javaw</i> process that your app is running on and delete the <i><b>RUNNING_PID</b></i> file as well. To ensure that your app has been shut down, go to <b><i>http://localhost:9000</i></b> and observe that your app is down.
At the end of it all your directory structure is supposed to look as follows:<br />
<br />
<pre>* zentasks
*-- dist
*-- zentasks-1.0-SNAPSHOT
*-- lib
*-- RUNNING_PID
*-- start.bat
*-- stop.bat
</pre>
<br />
You can now take this folder and plop it down on your production server worry-free. Yay!
<br />
<h3>
Q&A </h3>
<b>But what about my configuration options? What if I want to change the port that the application is running on?</b><br />
Simple. In start.bat include<span style="font-family: inherit;"> <b><i>-Dhttp.port=xxxx</i></b> </span>or any other configuration options before the -cp argument. E.g:
<br />
<br />
<pre>start "" "C:\Program Files\Java\jdk1.7.0_25\bin\javaw.exe" <b>-Dhttp.port=9001 -Dconfig.resource=prod.conf -cp ...
</b></pre>
<b><br /></b>
<b>Is starting the application this way safe?</b><br />
As far as I can tell, yes. The long and short of the story is that the command you place in the <i>start.bat</i> file is what is essentially run when you execute <span style="font-style: italic;">play start</span><b style="font-style: italic;"> </b>plus or minus a few directory and Java option changes. <a class="g-profile" href="http://plus.google.com/101156657838073927919" target="_blank">+James Ward</a> and the <a class="g-profile" href="http://plus.google.com/112934241782504236037" target="_blank">+Play Framework</a> team are free to correct me on this if I'm wrong.<br />
<br />
<b>Where will the logs and other necessary files be created?</b>
A directory for logs will be created in the <i>dist<span style="font-family: inherit;">\</span></i><i>zentasks-1.0</i><i>-SNAPSHOT</i><i style="font-weight: bold;"> </i>folder and an <i>application.log</i> file will be placed there. File system h2 databases will be placed in the <i>dist<span style="font-family: inherit;">\</span></i><i>zentasks-1.0</i><i>-SNAPSHOT </i>folder.<br />
<br />
<b>Where does the application read configuration items from in this mode?</b><br />
In the lib directory of <b><i>dist<span style="font-family: inherit;">\</span></i></b><i><b>zentasks-1.0</b></i><b><i>-SNAPSHOT </i></b> there is a file named <i>zentasks_2.10-1.0-SNAPSHOT.jar </i>If you were to extract the contents of this file, you'd see all the <i>evolutions</i> and <i>*.conf</i> files your created up to the point in time you ran the play dist command.<br />
<br />
I hope this was helpful to you.
Thanks to <a class="g-profile" href="http://plus.google.com/101156657838073927919" target="_blank">+James Ward</a> and the amazing <a class="g-profile" href="http://plus.google.com/106233335814246022600" target="_blank">+Play Framework</a> team for all their hard work, and as always thank you for reading.
Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-91833896283441851902013-10-16T17:48:00.000-04:002014-07-28T18:00:08.027-04:00Scheduling Jobs In Play 2<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.clker.com/cliparts/c/b/1/a/12982680871015273270stop%20watch%20icon.svg.med.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://www.clker.com/cliparts/c/b/1/a/12982680871015273270stop%20watch%20icon.svg.med.png" height="200" width="200" /></a></div>
In this tutorial, I'll show you how to schedule asynchronous jobs in the Play! Framework version 2.1.3.<br />
<br />
The Play! Framework has moved away from using Job classes with Crontab-like annotations for application level task scheduling. In place of the old model we find heavy use of the <a href="http://akka.io/" target="_blank">Akka </a>system, which operates a bit differently and can take some getting used to if you're accustomed to the CRON/<a href="http://quartz-scheduler.org/" target="_blank">Quartz</a> way of doing things.<br />
<br />
Let's get started!<br />
<br />
After creating our application, we need to create a <span style="font-family: inherit;"><b>Global.java</b></span> file in the <span style="font-family: inherit;"><b>app/</b></span> directory. Place the following in the file:<br />
<br />
<pre class="prettyprint">import play.Application;
import play.GlobalSettings;
import play.libs.Akka;
import scala.concurrent.duration.FiniteDuration;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class Global extends GlobalSettings {
@Override
public void onStart(Application app) {
//Magic goes here
}
}
</pre>
<div>
<br /></div>
The above is nothing too complex. It's a file that contains code that will be executed upon starting the application. The important piece is the <b>onStart</b> method that has the <b>@Override</b> annotation. That's where we're going to place our scheduling code.<br />
<br />
Before continuing, you should probably take a look at what the Play devs have to say about the use of their <a href="http://www.playframework.com/documentation/2.1.x/JavaAkka" target="_blank">Akka scheduler</a> before I give my personal explanation.<br />
<br />
Place the following in the onStart method of the Global.java file we just created.<br />
<br />
<pre class="prettyprint">FiniteDuration delay = FiniteDuration.create(0, TimeUnit.SECONDS);
FiniteDuration frequency = FiniteDuration.create(5, TimeUnit.SECONDS);
Runnable showTime = new Runnable() {
@Override
public void run() {
System.out.println("Time is now: " + new Date());
}
};
Akka.system().scheduler().schedule(delay, frequency, showTime, Akka.system().dispatcher());
</pre>
<br />
The above simply allows us to log the current time to the console ever 5 seconds. Not very useful, but it's a start. Run the application and see for yourself.<br />
<br />
<b>schedule() Arguments Explained</b><br />
<br />
Before we continue we should probably get a firm grip of the schedule(...) method signature.<br />
<br />
<i><b>delay</b></i> - How long after the application starts should I wait before running my code?<br />
<i><b>frequency</b></i> - After I've run my code the first time, how often should I repeat it?<br />
<i><b>showTime</b></i> - A runnable containing the code that is to be run after the delay and at the defined frequency.<br />
<b><i>Akka.system.dispatcher()</i> </b>- Not entirely sure what this is, but it's needed as the last argument.<br />
<br />
Neither of the first two arguments can be changed from within the <i>Runnable</i> body. The <i>delay</i> (and <i>frequency</i>) must be calculated on application start correctly and in such a way that the timing of the job is not affected by application restarts.<br />
<br />
<b>Defining a Proper Schedule</b><br />
<br />
Now that we've covered the basics, let's move on to creating a useful schedule. The schedule that we'll create will run a task at 4PM every day.<br />
<br />
The first step is to determine the delay i.e. how long the scheduler should wait to execute our task once the application has started. The challenge here is that the calculation of the delay must accommodate random application restarts. Say, for example, we start our application at 8AM, the job should wait roughly 6 hours before it starts, but if at 3PM the need arises for us to restart the application, the delay should be recalculated to 1 hour. We will calculate this delay in seconds for better precision.<br />
<br />
I'll be using the Calendar class, but feel free to use <a href="http://www.joda.org/joda-time/" target="_blank">JodaTime</a> if you're more comfortable. So let's augment our previous code snippet to calculate this delay:<br />
<pre class="prettyprint">Long delayInSeconds;
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 16);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
Date plannedStart = c.getTime();
Date now = new Date();
Date nextRun;
if(now.after(plannedStart)) {
c.add(Calendar.DAY_OF_WEEK, 1);
nextRun = c.getTime();
} else {
nextRun = c.getTime();
}
delayinSeconds = (nextRun.getTime() - now.getTime()) / 1000; //To convert milliseconds to seconds.
</pre>
<br />
<b>Code explanation:</b><br />
<pre class="prettyprint">Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 16);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
Date plannedStart = c.getTime();
</pre>
<br />
Use a <b>Calendar</b> object and set it's time to 4PM of the current day, then create a date object to store the current date and the intended start time based on the modified <b>Calendar</b> object.<br />
<pre class="prettyprint">Date now = new Date();
Date nextRun;
if(now.after(plannedStart)) {
c.add(Calendar.DAY_OF_WEEK, 1);
nextRun = c.getTime();
} else {
nextRun = c.getTime();
}
</pre>
<br />
Find out the current date and time (<b>now</b>) and create a new Date object (<b>nextRun</b>) that will store the date and time of the next code execute.If the time now is after the time we planned to start the job, then we'll set the time that the job should execute to be tomorrow at 4PM. If not then we're on schedule and the <i>nextRun</i> will be today at 4PM.<br />
<pre class="prettyprint">delayInSeconds = (nextRun.getTime() - now.getTime()) / 1000; //To convert milliseconds to seconds.
</pre>
<br />
<i style="font-family: 'Trebuchet MS', sans-serif;"><br /></i>
<span style="font-family: inherit;">Next we do some simple subtraction to find out how many seconds between now and the next time the code should run. This is our delay... In seconds, of course.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">From here on it's gravy. Simply </span>substitute<span style="font-family: inherit;"> the <b>delayInSeconds</b> value for the integer value in the <b>FiniteDuration delay</b> variable and change the frequency to 1 day as follows:</span><br />
<span style="font-family: inherit;"><br />
</span><br />
<pre class="prettyptrint"><span style="font-family: inherit;">FiniteDuration delay = FiniteDuration.create(delayInSeconds, TimeUnit.SECONDS);
FiniteDuration frequency = FiniteDuration.create(1, TimeUnit.DAYS);
Runnable showTime ...
</span></pre>
<span style="font-family: inherit;">
<b>Altogether Now!</b><br />
<br />
<pre class="prettyprint">Long delayInSeconds;
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 16);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
Date plannedStart = c.getTime();
Date now = new Date();
Date nextRun;
if(now.after(plannedStart)) {
c.add(Calendar.DAY_OF_WEEK, 1);
nextRun = c.getTime();
} else {
nextRun = c.getTime();
}
delayInSeconds = (nextRun.getTime() - now.getTime()) / 1000; //To convert milliseconds to seconds.
FiniteDuration delay = FiniteDuration.create(delayInSeconds, TimeUnit.SECONDS);
FiniteDuration frequency = FiniteDuration.create(1, TimeUnit.DAYS);
Runnable showTime = new Runnable() {
@Override
public void run() {
System.out.println("Time is now: " + new Date());
}
};
Akka.system().scheduler().schedule(delay, frequency, showTime, Akka.system().dispatcher());
</pre>
<br />
Now every day at 4PM your application will remind you of the time. Awesome.<br />
<br />
Thanks very much to <a class="g-profile" href="http://plus.google.com/101156657838073927919" target="_blank">+James Ward</a> and <a href="https://groups.google.com/forum/#!searchin/play-framework/Schedule/play-framework/82qXuFvPTfE/CiWdkWL3ZbMJ" target="_blank">this magnificent post</a> for helping me wrap my head around this tricky concept. Thanks to the <a class="g-profile" href="http://plus.google.com/108281124915010080743" target="_blank">+Typesafe</a> folks for all their hard work with the <a class="g-profile" href="http://plus.google.com/112934241782504236037" target="_blank">+Play Framework</a> , and as always thank you for reading.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</span>Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-47387134876863796062013-10-02T15:37:00.000-04:002013-10-02T22:45:12.246-04:00How to Install Play 2 War: The Bare Minimum<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: start;">In this post, I'll show you how to install the </span><a href="https://github.com/dlecan/play2-war-plugin" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: start;" target="_blank">Play 2 War</a><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: start;"> extension. This article describes the installation and configuration procedure for </span><b style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: start;">Play 2.1.x </b><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: start;">applications.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; text-align: start;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Tomcat-logo.svg/300px-Tomcat-logo.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Tomcat-logo.svg/300px-Tomcat-logo.svg.png" /></a></div>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">From the author: </span><br />
<blockquote class="tr_bq">
<span style="background-color: #cfe2f3; font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><span style="color: #333333; font-size: 15px; line-height: 25px;">This project is a module for Play framework 2 to package your apps into standard WAR packages. It can be used with </span><strong style="color: #333333; font-size: 15px; line-height: 25px;">Servlet 3.0 and 2.5 containers</strong><span style="color: #333333; font-size: 15px; line-height: 25px;"> (Tomcat 6/7, Jetty 7/8/9, JBoss 5/6/7, ...)</span></span></blockquote>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Step 1:</b> Add the Plugin to plugins.sbt</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Navigate to </span><span style="font-family: Courier New, Courier, monospace;"><project_path>\project </project_path></span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">and open the </span><span style="font-family: Courier New, Courier, monospace;">plugins.sbt </span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">file. Add the following line to the end of the file:</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">addSbtPlugin("com.github.play2war" % "play2-war-plugin" % "1.0")</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="background-color: #d9ead3;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Note:</b> Be sure to include an empty line between this line and the previous </span><span style="font-family: Courier New, Courier, monospace;">addSbtPlugin</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> statement.</span></span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Step 2:</b> Add Play2War keys to Build.scala</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">In the same folder as </span><span style="font-family: Courier New, Courier, monospace;">plugins.sbt</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">, you'll find the file </span><span style="font-family: Courier New, Courier, monospace;">Build.scala</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">. Open this file and follow the template below for modifying it. Items in <b>bold</b> are the new lines that were added. Items in <i>italics</i> are items that can be modified to suit your application's needs.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">import sbt._</span><br />
<span style="font-family: Courier New, Courier, monospace;">import Keys._</span><br />
<span style="font-family: Courier New, Courier, monospace;">import play.Project._</span><br />
<span style="font-family: Courier New, Courier, monospace;"><b>import com.github.play2war.plugin._</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">object ApplicationBuild extends Build {</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> val appName = "<i>your_app_name<your_app_name></your_app_name></i>"</span><br />
<span style="font-family: Courier New, Courier, monospace;"> val appVersion = "1.0-SNAPSHOT"</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> val appDependencies = Seq(</span><br />
<span style="font-family: Courier New, Courier, monospace;"> // Add your project dependencies here,</span><br />
<span style="font-family: Courier New, Courier, monospace;"> javaCore,</span><br />
<span style="font-family: Courier New, Courier, monospace;"> javaJdbc,</span><br />
<span style="font-family: Courier New, Courier, monospace;"> javaEbean</span><br />
<span style="font-family: Courier New, Courier, monospace;"> )</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> val main = play.Project(appName, appVersion, appDependencies)</span><br />
<span style="font-family: Courier New, Courier, monospace;"> <b>.settings(Play2WarPlugin.play2WarSettings: _*)</b>.settings(</span><br />
<span style="font-family: Courier New, Courier, monospace;"> // Add your own project settings here </span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>Play2WarKeys.servletVersion := "3.0"</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"> )<b>.settings(</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>Play2WarKeys.targetName := Some("<i>war_file_name<war_file_name><war_file_name></war_file_name></war_file_name></i>")</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> )</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
<span style="background-color: #d9ead3; font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Tip:</b> The full list of Play2WarKeys and their expected data types can be found <a href="https://github.com/dlecan/play2-war-plugin/wiki/Play2War-configuration#build-configuration" target="_blank">here</a>.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Step 3:</b> Resolve Dependencies and Build the WAR</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Open a command terminal and cd into your project's directory. Once there, run the following commands:</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">play</span><br />
<span style="font-family: Courier New, Courier, monospace;">clean</span><br />
<span style="font-family: Courier New, Courier, monospace;">dependencies</span><br />
<span style="font-family: Courier New, Courier, monospace;">war</span><br />
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Once the </span><span style="font-family: Courier New, Courier, monospace;">war</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> command has completed you can look in </span><span style="font-family: Courier New, Courier, monospace;"><project_path>\target</project_path></span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> to see the generated WAR file. You can then take this file and deploy it to your servlet container of choice.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Why Would I Want to Use This Plugin?</b></span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">That's a great question especially seeing that Play comes with its own high performance web server built in. My answer to that question is if you work in a Windows-centric environment like mine, you become acquainted with the "shortcomings" of the Play framework when it comes to production deployment in a Windows environment. Unlike Linux where you can easily set your application to run as a service in the background on startup, Windows forces you to resort to all sorts of .bat magic that leaves you with a bunch of command line windows popping up and having to stay open for the duration of the application's life.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So for a cleaner, less cluttered production server that other members of your team can appreciate, I recommend using a Servlet container </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">like Tomcat that </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">can be installed as Windows service and set to run on startup. No more .bat magic and no more freaking out when the server admin says he restarted the server a couple hours ago and now the folks in HR can't access the employee registration application.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Closing Remarks</b></span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">In all, the installation of this extension was easy once you figured out how to switch mental context to deal with the different syntaxes for each file that has to be manipulated. I find that in some cases the author of the documentation could have gone into a little more detail in addressing the little gotchas with each file type. For example the need for an empty space between lines in the <i>plugins.sbt</i> file. Thankfully the Play command was smart enough to point this out to me when I tried to start the application and it was an easy fix.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">That being said, though the installation of this particular plugin was not all that difficult, I would still like to see some more abstraction in the plugin installation process. I think the guys over at <a class="g-profile" href="http://plus.google.com/108281124915010080743" target="_blank">+Typesafe</a> could take a very interesting page out of the Rails book in this regard.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">That's it for now. I hope this article was useful.</span><br />
<br />
<br />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-90146184563166342902013-09-25T09:44:00.001-04:002013-09-25T09:46:03.888-04:00Styling Apps In Android - Not for the Faint of Heart<div class="separator" style="clear: both; text-align: center;">
<a href="http://futurecom.com.br/blog/wp-content/uploads/2013/01/evolution-android.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" src="http://futurecom.com.br/blog/wp-content/uploads/2013/01/evolution-android.jpg" width="320" /></a></div>
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; color: #404040; font-size: 12.727272033691406px; line-height: 16.363636016845703px;">If it's one thing I would like to see in future Android </span><span style="background-color: white; color: #404040; font-size: 12.727272033691406px; line-height: 16.363636016845703px;">APIs is more support for the artistic side of app creation.</span><br style="background-color: white; color: #404040; font-size: 12.727272033691406px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #404040; font-size: 12.727272033691406px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #404040; font-size: 12.727272033691406px; line-height: 16.363636016845703px;">Coming from a Web/CSS background, I was expecting things like drop shadows, gradients, rounded corners, selective border colours etc. to be relatively easy to implement. As it turns out, it's not. For example, getting rounded corners on an ImageView involves a fair amount of coding (as illustrated here: <a href="http://stackoverflow.com/questions/16208365/create-circular-image-view-in-android">http://stackoverflow.com/questions/16208365/create-circular-image-view-in-android</a>). It's especially hurtful when doing the same in iOS is so headslappingly simple</span><span style="background-color: white; color: #404040; font-size: 12.727272033691406px; line-height: 16.363636016845703px;"> </span><a href="http://stackoverflow.com/questions/7705879/ios-create-a-uiimage-or-uiimageview-with-rounded-corners"><span style="font-size: x-small;">http://stackoverflow.com/questions/7705879/ios-create-a-uiimage-or-uiimageview-with-rounded-corners</span></a><span style="background-color: white; color: #404040; font-size: 12.727272033691406px; line-height: 16.363636016845703px;"> I just wish making my apps look cool was a much easier process.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br style="background-color: white; color: #404040; font-size: 12.727272033691406px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #404040; font-size: 12.727272033691406px; line-height: 16.363636016845703px;">Anyway, if anybody feels the same way, knows of easier ways to achieve aesthetic gold or if the styling and graphics APIs are supposed to get a reboot anytime soon, sound off in the comments below. </span></span>Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-50837565054158144192013-08-25T23:49:00.000-04:002013-08-25T23:50:43.069-04:00Play Framework 2.x - Taking the Plunge<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.playframework.com/assets/images/logos/normal.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="109" src="http://www.playframework.com/assets/images/logos/normal.png" width="320" /></a></div>
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;">So after many months of kicking and screaming against being forced into the new 2.x.x branch of the <a href="http://www.playframework.org/" target="_blank">Play! Framework</a></span><span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;"> I finally decided to take a weekend and learn the damn thing and get it over with.</span><br />
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;"><br /></span><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<h3>
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">Pros</span></h3>
<b><span style="background-color: white; color: #404040; line-height: 18px;"><span style="font-family: Arial, Helvetica, sans-serif;">Much m</span></span><span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;">ore powerful and feature packed than the 1.x branch</span></b><br />
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;">In addition to some serious code optimizations and refactorings, things like an interactive console, built in H2 in-memory database browser and a built-in LESS and CoffeeScript compiler are just a few of the bells and whistles added on that really add to the development experience.</span><br />
<span style="background-color: white;"><span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"><br /></span></span></span>
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;"><b>The Scala templating language is not as scary as it sounds</b></span><br />
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;">...And that's coming from a Java developer. Yes, I really enjoyed using this templating system even though some things took a couple minutes to really sink in. Parameter groups? What's that?</span><br />
<span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"><br /></span></span><span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;"><b>The new ebean ORM </b></span><br />
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;">Though I've only used it to complete the Zen Tasks tutorial, i'm seeing that it requires a lot less hand-holding in the JPA annotation department. Give it a <i>@ManyToOne</i> annotation in one class and you don't need to go to the related class and set up the mappings. It's something I haven't seen done anywhere else (except Rails, I think) and it's nice to see it available here in sweet ol' Java. </span><br />
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; font-size: 13px; line-height: 18px;"><br /></span>
<br />
<h3>
<span style="color: #404040; font-family: Roboto, arial, sans-serif; font-size: large;"><span style="line-height: 18px;">Cons</span></span></h3>
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;"><b>Not as friendly, free form an "playful" as the 1.x branch. </b></span><br />
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;">Doing the simplest of things requires a lot more typing, planning and thought now. Gone are the days when I could have just done this:</span><br />
<span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"><br /></span></span>
<span style="color: #404040; font-family: Courier New, Courier, monospace;"><span style="line-height: 18px;">public static void updateUser(User user) {</span></span><br />
<span style="color: #404040; font-family: Courier New, Courier, monospace;"><span style="line-height: 18px;"> user.save();</span></span><br />
<span style="color: #404040; font-family: Courier New, Courier, monospace;"><span style="line-height: 18px;"> render();</span></span><br />
<span style="color: #404040; font-family: Courier New, Courier, monospace;"><span style="line-height: 18px;">}</span></span><br />
<span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"><br /></span></span>
<span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;">Now I have to do:</span></span><br />
<span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"><br /></span></span>
<span style="color: #404040; font-family: Courier New, Courier, monospace;"><span style="line-height: 18px;">public static void updateUser() {</span></span><br />
<span style="color: #404040; font-family: Courier New, Courier, monospace;"><span style="line-height: 18px;"> Form<user> userForm = form(User.class).bindFromRequest();</user></span></span><br />
<span style="color: #404040; font-family: Courier New, Courier, monospace;"><span style="line-height: 18px;"> User u = userForm.get();</span></span><br />
<span style="color: #404040; font-family: Courier New, Courier, monospace;"><span style="line-height: 18px;"> u.save();</span></span><br />
<span style="color: #404040; font-family: Courier New, Courier, monospace;"><span style="line-height: 18px;"> ok(views.html.users.updateUser.html);</span></span><br />
<span style="color: #404040;"><span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;">}</span></span></span><br />
<span style="color: #404040; font-size: x-small;"><span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><br /></span></span></span>
<span style="color: #404040;"><span style="line-height: 18px;"><span style="font-family: Arial, Helvetica, sans-serif;">This approach provides certain advantages, but it really takes away from the appeal and fun I had with the 1.x approach.</span></span></span><br />
<span style="color: #404040; font-size: x-small;"><span style="line-height: 18px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span></span>
<span style="color: #404040;"><span style="line-height: 18px;"><span style="font-family: Arial, Helvetica, sans-serif;"><b>Documentation is a bit lacking</b></span></span></span><br />
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;">I wish the documentation could have been organized better and be more detailed a la 1.x. Certain sections like Forms and Action Composition could use a little attention.</span><br />
<span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"><br /></span></span>
<span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"><b>Searching for help turns into a hunt</b></span></span><br />
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;">Searching for help online usually returns 1.x or 2.x Scala results. This is not helpful to a 2.x Java developer.</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><b>Other Thoughts</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><b><br style="background-color: white;" /></b></span><span style="background-color: white;"><span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;">I've been a big fan of the </span></span><a class="g-profile" href="http://plus.google.com/106233335814246022600" style="color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;" target="_blank">+Play Framework</a><span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"> since I walked away from Rails over a year ago. I haven't looked back since. Part of what made me fall so madly in love with it was it's power without being verbose; elegant simplicity without the need for me to get embroiled in XML files and the like. I could have hardly believed it was Java I was using!</span></span></span><br />
<span style="background-color: white;"><span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"><br /></span></span></span>
<span style="background-color: white;"><span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;">As of late though, it's become a bit heavier and less of a tool that I could use to knock out a prototype in no time flat. Don't get me wrong, it's still miles better than Spring or Struts (</span><i style="line-height: 18px;">shudder</i><span style="line-height: 18px;">), but it's just not as free form and delightful as it was when it was younger. I do understand, though, that some of its "agility" was sacrificed to introduce better optimized code and more powerful technologies, so I guess I'll just file this under the price of progress.</span></span></span><br />
<span style="background-color: white;"><span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"><br /></span></span></span>
<br />
<div style="text-align: left;">
<span style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;">For those of you wondering why I took a weekend, this included getting comfortable with <a class="g-profile" href="http://plus.google.com/104653401767241115426" target="_blank">+IntelliJ IDEA</a> </span><span style="background-color: white;"><span style="color: #404040;"><span style="line-height: 18px;"><span style="font-family: Roboto, arial, sans-serif;">and wrangling with the many technical issues that came up with the Scala and Play2 plugins. IntelliJ is a marvelous IDE and has proved me wrong in believing that Eclipse was the be all and end all of Java IDEs, but I think the Play 2 plugin could use some work. It won't, for example, let me reference a template via </span><span style="font-family: Courier New, Courier, monospace;">index.render(...)</span><span style="font-family: Roboto, arial, sans-serif;">, so I have to do </span><span style="font-family: Courier New, Courier, monospace;">views.html.index.render(...)</span><span style="font-family: Roboto, arial, sans-serif;"> or </span><span style="font-family: Courier New, Courier, monospace;">import views.html.index</span><span style="font-family: Roboto, arial, sans-serif;"> before I can call the render method. It's a minor issue, but majorly annoying when I'm trying to dance my way across the keyboard to project completion.</span></span></span></span></div>
<div style="text-align: left;">
<br /></div>
<h3>
<span style="color: #404040; font-family: Roboto, arial, sans-serif; font-size: large;"><span style="line-height: 18px;">Conclusion</span></span></h3>
<div style="text-align: left;">
<span style="color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;">In closing I'd like to say that Play 2 is not the horrid, complex mess I thought it was. Sure it's a bit different and sure i'll have to wave goodbye to some of my old habits, but the framework has been made better and future proofed for tomorrows web application developers. I really appreciate all the hard work that </span><a class="g-profile" href="http://plus.google.com/101156657838073927919" style="font-family: Roboto, arial, sans-serif; line-height: 18px;" target="_blank">+James Ward</a><span style="color: #404040; font-family: Roboto, arial, sans-serif; line-height: 18px;"> and the team at Typesafe have been doing. </span></div>
<div style="text-align: left;">
<span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;"><br /></span></span></div>
<div style="text-align: left;">
<span style="color: #404040; font-family: Roboto, arial, sans-serif;"><span style="line-height: 18px;">Here's hoping that Play 3.0 will be backwards compatible!</span></span></div>
<br />
<br />
<br />
<br style="background-color: white; color: #404040; font-family: Roboto, arial, sans-serif; font-size: 13px; line-height: 18px;" />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-33578108297087678732013-05-26T22:05:00.001-04:002013-05-26T22:07:47.798-04:00Why I Am Choosing the Playstation 4It's almost that time again, folks - the time where we choose our allegiances for the next generation of the console wars, while berating and ridiculing anyone else who chooses a system different to the one we chose.<br />
<br />
Now before I begin, I must declare that this post is not titled why <b><i>you</i></b> should choose the Playstation 4, but why <b><i>I</i></b> am making it my companion for my next romp in the Elysian fields of console gaming.<br />
<br />
<b>Why the Playstation 4?</b><br />
<br />
<a href="http://images.vg247.com/current//2013/03/Metal-gear-solid-5-21.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="225" src="http://images.vg247.com/current//2013/03/Metal-gear-solid-5-21.jpg" width="400" /></a>One word: Exclusives. I am most interested in the properties that are tied to the Sony brand than any other platform. Why buy an Xbox or an absurdly powerful PC when I will only end up quaking nervously to find out if Hideo Kojima will ever release his next game for anything other than Sony Playstation. It simply doesn't make sense.<br />
<br />
<br />
<br />
When that next MGS/Uncharted/The Last of Us drops, I want it IMMEDIATELY.<br />
<br />
<b>What's Wrong with the Xbox?</b><br />
<br />
<a href="http://static.guim.co.uk/sys-images/Guardian/Pix/audio/video/2013/5/22/1369213310669/New-XBOX-ONE--016.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="180" src="http://static.guim.co.uk/sys-images/Guardian/Pix/audio/video/2013/5/22/1369213310669/New-XBOX-ONE--016.jpg" width="320" /></a>Nothing at all. As a matter of fact, I have never owned an Xbox to find out what are some things I may not like about it. As for whether or not I will even consider picking up an Xbox later down the line, it's a possibility should there be a piece of IP that is just that good that I absolutely have to have it.<br />
<br />
Currently though, Halo just isn't my thing and the new Xbox One's slew of living room features just don't make a compelling enough case for me to pick this thing up on day one.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www1.pcmag.com/media/images/80272-gaming-pc.jpg?thumb=y" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="239" src="http://www1.pcmag.com/media/images/80272-gaming-pc.jpg?thumb=y" width="320" /></a></div>
<b>You Fool! PC is Where It's At!</b><br />
<br />
And you maybe right, more so in this console generation than ever. For those of you who aren't acquainted with each system's technical specifications, these new systems are basically just PCs with a smaller form factor and features that make them more suitable for your living room than for editing PowerPoint presentations.<br />
<br />
Be that as it may, I have a very awful taste in my mouth regarding PC ports of last generation's games. I found that far too often I had to become this great PC hackboy to get some of my favourite games to work well. When it wasn't replacing particle files to fix visual glitches, it was simply a case of poor PC optimization on behalf of the developers. I'm looking at you GTA 4.<br />
<br />
Worse yet, all of my PS2 faves like Vice City and San Andreas just didn't carry over well once I started getting more modern hardware for my PC. I actually had to install a video card "hack tool" to get them to play properly on my Radon 6670. Not to mention the laughable support for more recent joypads.<br />
<br />
These are issues that console gamers simply don't have to worry about, but were my nightmare almost every time I installed a game that was ported from the consoles to PC.<br />
<br />
Sure you can throw the argument about better graphics and modding ability at me, but the truth is I never really cared for mods and I remember enjoying Vice City immensely on the PS2 in all it's buggy and glitchy glory. I'm prepared to sacrifice a bit of visual fidelity for the sake of a hassle-free gaming experience.<br />
<br />
Now it may be safe to conclude that the source of all of the last generation's PC ports were so terrible due to the Playstation 3's Cell processor and that this generation's ports may be much better due to the fact that both consoles are using more standardized PC-like hardware, but that remains to be seen.<br />
<br />
I may still end up build a gaming PC to catch the odd game or two that are "tremendously better on PC" but i'll be taking my time with that project.<br />
<br />
<b>In conclusion/TLDR:</b><br />
<ul>
<li>I'm choosing the PS4 because I like the exclusives.</li>
<li>I'm not choosing the Xbox One because I don't really care for that platform's exclusives.</li>
<li>I'm not choosing PC (from the get-go) because of the terrible console ports of last generation.</li>
<li>You are free to decide which one you want to go with.</li>
</ul>
<br />
<br />
<br />
<br />
Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-23550673939768872082013-01-17T11:15:00.001-04:002013-01-17T11:15:54.257-04:00Today I Fed A Man<p>Walking in to my new neighbourhood convenience store, I caught a whisper of a beggar asking me for some change. I mostly ignored him and continued on. </p>
<p>While inside the store his voice ricocheted around the inside of my head like a vindictive stray bullet. I wrestled with logic and my humanity as I weighed the pros and cons of giving this beggar some money - if I give him cash he'll probably spend it on drugs, so maybe I should default and give him some food instead. </p>
<p>By the time I came to this conclusion I was already out the store, groceries in hand. </p>
<p>I saw him looking at me expectantly, all the while counting up some singles and fives; his day's take I guess. </p>
<p>To put an end to this absurdly long thought process I just reached into my pocket and handed him two of the singles that happened to be in there. He accepted it graciously. </p>
<p>A few minutes later, my short term memory kicked back in and reminded me that I needed some matches. There was a small parlour across the street,so there I headed to make my last purchase. </p>
<p>As I'm standing by the counter counting my pennies, up comes the beggar behind me and with the fives and singles he was counting, purchased a small loaf of bread, a snack and a drink. He then looked at me, the delight in his eyes shining through his bushy eyebrows, and said "thank you brother!" </p>
<p>At that point I swore I could feel the Holy Spirit smiling at me and nodding in approval. Best feeling I had all day knowing that I fed my saviour. </p>
Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0Downtown, Downtown10.659714 -61.512142tag:blogger.com,1999:blog-15315314.post-22126768351351975382012-12-07T00:13:00.001-04:002012-12-07T00:13:15.368-04:00It's About Doing Something GoodIt's not always about the fame and the fortune. Sometimes it's as simple as saving someone the headache of having to get a new ID card, passport or driver's permit.<br />
<br />
I was saved from this torment twice and now I think it's time I return the favour to my countrymen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<object width="320" height="266" class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://2.gvt0.com/vi/Qh2X-yb_tRY/0.jpg"><param name="movie" value="http://www.youtube.com/v/Qh2X-yb_tRY&fs=1&source=uds" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="http://www.youtube.com/v/Qh2X-yb_tRY&fs=1&source=uds" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<br />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-5731870892497691392012-11-30T14:59:00.001-04:002012-11-30T15:01:13.914-04:00Fixing a Problem<div class="separator" style="clear: both; text-align: center;">
<a href="http://images.wikia.com/theregularshow/images/8/80/Troll-face-problem.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="200" src="http://images.wikia.com/theregularshow/images/8/80/Troll-face-problem.jpg" width="200" /></a></div>
Problems. They're everywhere, especially in my country. They range from simple annoyances to huge socio-economic issues that will take a large amount of effort, money and divine intervention to cure.<br />
<br />
As humongous or diminutive as problems might be I believe that the solutions to them come about by chipping away at the issue in a very incremental manner. It just takes time and a fair amount of consistency, but eventually the problem will dissolve.<br />
<br />
But what about this case - what do you do in a case where the solution to the problem is so simple, yet the people for whom you are solving the problem are too paranoid and distrusting for them to even dip their toe in the solution unless they see someone else drinking the proverbial Kool-Aid first? What do you do then? What becomes of the problem? Can it still be classified as a problem since nobody seems to want it solved or everybody balks at the presented solution?<br />
<br />
There is a culture in my country that says no solution (or product in a general sense of the word) is any good unless millions have been spent in creating it is presented with lavish press conferences and promotional campaigns. I honestly find this highly annoying and it shows where we are as a people in terms of our mental development.<br />
<br />
I'm daring to change that culture and see if I can bring my country even one step closer to the 21st century. That's why I'm challenging myself to fix a problem that plagues everyone in my country, and i'm going to fix it with a budget of $20USD and I want to see how my countrymen react to it. It's going to be practical, free and simple to use. Let's see how it goes.<br />
<br />
<br />
<br />
<br />
<br />
<br />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-21943419053784877782012-08-23T00:46:00.000-04:002012-08-23T00:47:18.372-04:00jQuery QR Code Generator<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://qrcode.kaywa.com/img.php?s=5&d=http://brainstep.blogspot.com" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://qrcode.kaywa.com/img.php?s=5&d=http://brainstep.blogspot.com" /></a></div>
So I came across a QR Code (2D Barcode) generator tonight that is written in pure JavaScript, relies on jQuery and makes 0 calls to any external API.<br />
<br />
It's called jQuery QR Code and it's written by Jerome Etienne. Take a look at his <a href="https://github.com/jeromeetienne/jquery-qrcode">GitHub project</a> and tell me what you think. This will definitely come in handy on my current project!Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-56289970895527261942012-03-03T22:57:00.000-04:002012-03-03T22:57:09.096-04:00Fixing Ubuntu Issues: No Wireless on RebootContinuing on with my series on solving problems I've encountered while using Ubuntu 11.10, I've found yet another solution to a problem that I heard a lot of people talking about. It's also a hot topic on the Ubuntu forums. I',m speaking, of course, about Ubuntu and wireless internet access.<br />
<br />
In recent times it has not been uncommon for Ubuntu to not be able to connect to my wireless network on boot up, so I did some digging and found out that the problem was that the Automatic DHCP IPv4 settings were to blame. My solution: use manual IPv4 configuration. Here's how.<br />
<br />
My internet set up is as follows :- My modem is connected to my wireless router which propagates the signal that my PC's USB wireless adapter receives. There's plenty of networking going on there, (something I am not the best at) but I do know that finding out the IP addresses of my various pieces of network hardware will be the key.<br />
<br />
So on my Windows machine i ran <i>ipconfig </i>and found out those addresses:<br />
<br />
192.168.1.1 - My modem's address<br />
192.168.2.1 - My wireless router's address (Default gateway)<br />
192.168.2.5 - Address of PC<br />
255.255.255.0 - Subnet mask<br />
<br />
I took those settings over to Ubuntu, opened the network manager by clicking the Wireless icon in the top task bar, selecting <i>Edit connections... > Wireless > FBI_VAN_467 (My SSID) > Edit... > IPv4 Settings </i>and entering the information as follows:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_ZfNGrSgFHlyVDgUKbW2Yczp2jEXDpvzdcv5cKkLEZ7HZ0LCO89Y2VHcREoPZkLuRLzagDog8ZbFG5wlJpCaBtal1rgfTsj0lLN8DO81kxCuOLTkXsKPcVAV1W_0qZKH7WhuSxw/s1600/Screenshot+at+2012-03-03+22:53:32.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_ZfNGrSgFHlyVDgUKbW2Yczp2jEXDpvzdcv5cKkLEZ7HZ0LCO89Y2VHcREoPZkLuRLzagDog8ZbFG5wlJpCaBtal1rgfTsj0lLN8DO81kxCuOLTkXsKPcVAV1W_0qZKH7WhuSxw/s320/Screenshot+at+2012-03-03+22:53:32.png" width="297" /></a></div>
<br />
I chose a random non-conflicting IP address for my Ubuntu PC's address, used my wireless router's IP address for my default gateway and set my DNS server address to my modem's address.<br />
<br />
After that it worked like a charm. I hope this helps!<br />
<br />
<br />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-83115663625594390962012-03-01T12:34:00.000-04:002012-03-01T12:34:53.821-04:00New Search Engine - DuckDuckGoAfter reading this very interesting and informative article (<a href="http://dontbubble.us/">http://dontbubble.us</a>/) and hearing mentions of it in the tech-o-sphere, I was intrigued to look into this DuckDuckGo search engine to see what it was about.<br />
<br />
Now, anybody who knows me knows that I'm a G-Man (Google Man) through and through, but honestly i've not been to happy about their recent skirmishes with the law when it comes to people's privacy and the extent to which they will go to get your personal information so that they can target ads to better suit you.<br />
<br />
Truthfully I was <b>never </b>a fan of the idea that I was being herded and processed by a big company that was going to use my personal information, my likes, dislikes, hobbies - my personality - to make money, but I had to tolerate it because it was the companies behind some of the best internet services that I use were doing this.<br />
<br />
Now there's a new duck in the search engine pond and this one is more morally secure and less thirsty for money and is doing... just fine! I'm talking of course, about <a href="http://duckduckgo.com/" target="_blank">DuckDuckGo</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://i.imgur.com/JpECU.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="187" src="http://i.imgur.com/JpECU.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
Granted i've only been using it for a grand total of 6 hours, I was very impressed with the speed, the relevance of the search and the cleanliness of the design... I'm just not too fond of the name. It doesn't quite adhere to the web 2.0 naming convention of 2 syllables, real/unreal word but I guess it sort of works for them. DuckDuckGo doesn't really roll off the tongue like Google or Yahoo or Bing but the name contributes to the overall playful charm of the site and to be honest, I would be reluctant to use another Web 2.0 named search engine like <i>Searchly</i> or <i>Fynd</i> or something like that.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">A Sample Search</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
I did a Google search for Railscasts and compared the results to those I found on DuckDuckGo. I preferred Duck's search results. They pointed to some more relevant resources.</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://i.imgur.com/eKUAj.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://i.imgur.com/eKUAj.png" width="316" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Google Search Results</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://i.imgur.com/Dx6Ja.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="265" src="http://i.imgur.com/Dx6Ja.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Results from the Duck</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
I personally prefer Duck's results. As you can see I snatched up the Railscasts them for Vim :) What do you think?</div>
<br />Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-51584432953331606282012-02-24T11:18:00.000-04:002012-02-24T11:18:25.086-04:00Validating Virtual Attributes in Rails 3.1When validating virtual attributes in Rails it's important to remember that they are just that - <i>virtual </i>attributes.
I spent almost an hour last night trying to figure out why my validations were throwing an error when I called <i>Object.valid? </i>
My class was structured similar to the following (forgive me, I am a Rails n00b):<br />
<pre>
Class User
attr_accessor :password
validates :password,
:presence => true,
:on => create
validates :password,
:length => { :minimum => 6 :maximum => 8 },
:if => :password?
.
.
.
end
</pre>
When calling <i>valid?</i> on the User object I got a method undefined error for <i>password?</i>. I could't quite figure it out and I was wondering
what I was doing wrong until eventually I tried appending the following to the bottom of the class definition:
<pre>
.
.
.
def password?
self.password.present?
end
.
.
.
</pre>
An seemingly simple and obvious solution, I know, but this took me about an hour to figure out after Stack Overflow failed me for the first time.
<p>
I hope this helps save someone else the frustration I endured.
</p>Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0tag:blogger.com,1999:blog-15315314.post-62765733652011812022012-02-23T11:51:00.002-04:002012-02-23T11:51:54.721-04:00Fixing Ubuntu Issues: Ugly Font Rendering in NetBeansRecently i've had the displeasure of working in NetBeans on Ubuntu. The IDE is great but the font rendering is <b>terrible</b>. Here's my solution to this problem.<br />
<br />
The first step is to uninstall Open JDK (if it is installed) and install Sun's JRE. Do that by selecting the following packages in the synaptic package manager:<br />
<br />
<ul>
<li>sun-java6-bin</li>
<li>sun-java6-jdk</li>
<li>sun-java6-jre</li>
</ul>
<br />
Mark all installed instances of Open JDk for uninstallation if you have to, then click Apply.<br />
<br />
Confirm your Java version by going to the console and entering<br />
<br />
<pre>java -version</pre>
You should see<br />
<pre>java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)</pre>
<div>
Now that that's done, install Microsoft's Core Fonts. Do this by going to the Ubuntu Software Center and searching for </div>
<div>
<pre>ttf-mscorefonts</pre>
</div>
<div>
Install them, then open NetBeans, go to <i>Tools > Options > Fonts and Colours </i>and choose the Courier New font. I set mine to size 18 bold. Here is my result:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu4sm0HaljPItcPu2yCOB_0XEWA8ins1AbNqpvYddrqQIsx4eUPQeScnckWuOeQookv9Pi2BzA3UiztLV54YuAwWjhf8jrc1dGFPNz26M_XnwxGEEshJraxuC3AXS4TNdiAK0Tow/s1600/Screenshot+at+2012-02-23+11:41:14.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-c3IKAjqOMYH3kwxNkk5pU_-EFYcxgcAm9kna8bH-Lqog8EwpFyDri5wjcCdqOE9T1AZ47Gukx9i69FJP7icaK97xKgC_bjVpzJ7c-i81H-ZLkZY-3QR_iOGkdxv8NiGhoA5iXA/s1600/Screenshot+at+2012-02-23+00:53:19.png" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: left;"><img border="0" height="88" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-c3IKAjqOMYH3kwxNkk5pU_-EFYcxgcAm9kna8bH-Lqog8EwpFyDri5wjcCdqOE9T1AZ47Gukx9i69FJP7icaK97xKgC_bjVpzJ7c-i81H-ZLkZY-3QR_iOGkdxv8NiGhoA5iXA/s320/Screenshot+at+2012-02-23+00:53:19.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Before</td></tr>
</tbody></table>
<br />
<br />
<div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu4sm0HaljPItcPu2yCOB_0XEWA8ins1AbNqpvYddrqQIsx4eUPQeScnckWuOeQookv9Pi2BzA3UiztLV54YuAwWjhf8jrc1dGFPNz26M_XnwxGEEshJraxuC3AXS4TNdiAK0Tow/s1600/Screenshot+at+2012-02-23+11:41:14.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto; text-align: left;"><img border="0" height="131" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu4sm0HaljPItcPu2yCOB_0XEWA8ins1AbNqpvYddrqQIsx4eUPQeScnckWuOeQookv9Pi2BzA3UiztLV54YuAwWjhf8jrc1dGFPNz26M_XnwxGEEshJraxuC3AXS4TNdiAK0Tow/s320/Screenshot+at+2012-02-23+11:41:14.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">After</td></tr>
</tbody></table>
</div>
<div>
Many thanks to <a href="http://ubuntuforums.org/member.php?u=1120551" target="_blank">aura7</a> of Ubuntu forums for this tip.<br />
<br />
References:<br />
<a href="http://ubuntuforums.org/showthread.php?t=1930034">http://ubuntuforums.org/showthread.php?t=1930034</a><br />
<a href="http://www.howtogeek.com/howto/15495/add-microsoft-core-fonts-to-ubuntu/">http://www.howtogeek.com/howto/15495/add-microsoft-core-fonts-to-ubuntu/</a></div>Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com1tag:blogger.com,1999:blog-15315314.post-77116728134913851212012-02-22T19:05:00.003-04:002012-02-22T19:10:33.010-04:00Fixing Ubuntu Issues: Restart Wireless Without RebootSometimes after resuming from sleep, you would find that your wireless connection no longer works. Up until now, my only solution to this was to reboot. I've found an alternative solution from user mariosx on <a href="http://ubuntuforums.org/archive/index.php/t-913407.html">http://ubuntuforums.org/archive/index.php/t-913407.html</a> that involves simply restarting the wireless interface. To do so, enter the following in a terminal window<br />
<br />
<br />
<pre>sudo ifconfig eth1 down
sudo ifconfig eth1 up
</pre>
Where eth1 = your network interface. Could be wlan0 or something like that.
I have not yet tried this out, but it's one of the more sane solutions i've come accross for this problem during my searches.Vinmasterhttp://www.blogger.com/profile/05358428940552643109noreply@blogger.com0