Wednesday, September 25, 2013
Styling Apps In Android - Not for the Faint of Heart
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: http://stackoverflow.com/questions/16208365/create-circular-image-view-in-android). It's especially hurtful when doing the same in iOS is so headslappingly simple http://stackoverflow.com/questions/7705879/ios-create-a-uiimage-or-uiimageview-with-rounded-corners I just wish making my apps look cool was a much easier process.
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.
Sunday, August 25, 2013
Play Framework 2.x - Taking the Plunge
So after many months of kicking and screaming against being forced into the new 2.x.x branch of the Play! Framework I finally decided to take a weekend and learn the damn thing and get it over with.
Pros
Much more powerful and feature packed than the 1.x branchIn 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.
The Scala templating language is not as scary as it sounds
...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?
The new ebean ORM
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 @ManyToOne 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.
Cons
Not as friendly, free form an "playful" as the 1.x branch.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:
public static void updateUser(User user) {
user.save();
render();
}
Now I have to do:
public static void updateUser() {
Form
User u = userForm.get();
u.save();
ok(views.html.users.updateUser.html);
}
This approach provides certain advantages, but it really takes away from the appeal and fun I had with the 1.x approach.
Documentation is a bit lacking
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.
Searching for help turns into a hunt
Searching for help online usually returns 1.x or 2.x Scala results. This is not helpful to a 2.x Java developer.
Other Thoughts
I've been a big fan of the +Play Framework 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!
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 (shudder), 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.
Conclusion
Sunday, May 26, 2013
Why I Am Choosing the Playstation 4
Now before I begin, I must declare that this post is not titled why you should choose the Playstation 4, but why I am making it my companion for my next romp in the Elysian fields of console gaming.
Why the Playstation 4?
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.When that next MGS/Uncharted/The Last of Us drops, I want it IMMEDIATELY.
What's Wrong with the Xbox?
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.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.
You Fool! PC is Where It's At!
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.
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.
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.
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.
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.
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.
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.
In conclusion/TLDR:
- I'm choosing the PS4 because I like the exclusives.
- I'm not choosing the Xbox One because I don't really care for that platform's exclusives.
- I'm not choosing PC (from the get-go) because of the terrible console ports of last generation.
- You are free to decide which one you want to go with.
Thursday, January 17, 2013
Today I Fed A Man
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.
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.
By the time I came to this conclusion I was already out the store, groceries in hand.
I saw him looking at me expectantly, all the while counting up some singles and fives; his day's take I guess.
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.
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.
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!"
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.
Friday, December 07, 2012
It's About Doing Something Good
I was saved from this torment twice and now I think it's time I return the favour to my countrymen.
Friday, November 30, 2012
Fixing a Problem
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.
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?
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.
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.
Thursday, August 23, 2012
jQuery QR Code Generator
It's called jQuery QR Code and it's written by Jerome Etienne. Take a look at his GitHub project and tell me what you think. This will definitely come in handy on my current project!
Saturday, March 03, 2012
Fixing Ubuntu Issues: No Wireless on Reboot
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.
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.
So on my Windows machine i ran ipconfig and found out those addresses:
192.168.1.1 - My modem's address
192.168.2.1 - My wireless router's address (Default gateway)
192.168.2.5 - Address of PC
255.255.255.0 - Subnet mask
I took those settings over to Ubuntu, opened the network manager by clicking the Wireless icon in the top task bar, selecting Edit connections... > Wireless > FBI_VAN_467 (My SSID) > Edit... > IPv4 Settings and entering the information as follows:
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.
After that it worked like a charm. I hope this helps!
Thursday, March 01, 2012
New Search Engine - DuckDuckGo
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.
Truthfully I was never 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.
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 DuckDuckGo.
![]() |
| Google Search Results |
![]() |
| Results from the Duck |
Friday, February 24, 2012
Validating Virtual Attributes in Rails 3.1
Class User
attr_accessor :password
validates :password,
:presence => true,
:on => create
validates :password,
:length => { :minimum => 6 :maximum => 8 },
:if => :password?
.
.
.
end
When calling valid? on the User object I got a method undefined error for password?. 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:
. . . def password? self.password.present? end . . .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.
I hope this helps save someone else the frustration I endured.
Thursday, February 23, 2012
Fixing Ubuntu Issues: Ugly Font Rendering in NetBeans
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:
- sun-java6-bin
- sun-java6-jdk
- sun-java6-jre
Mark all installed instances of Open JDk for uninstallation if you have to, then click Apply.
Confirm your Java version by going to the console and entering
java -versionYou should see
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)
ttf-mscorefonts
![]() |
| Before |
References:
http://ubuntuforums.org/showthread.php?t=1930034
http://www.howtogeek.com/howto/15495/add-microsoft-core-fonts-to-ubuntu/
Wednesday, February 22, 2012
Fixing Ubuntu Issues: Restart Wireless Without Reboot
sudo ifconfig eth1 down sudo ifconfig eth1 upWhere 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.
Fixing Ubuntu Issues: Flickering Pointer
Note: xorg.conf is depreciated in Ubuntu 11+
Type the following in a new console window:
cd /usr/share/X11/xorg.conf.d sudo touch 10-monitor.conf sudo gedit 10-monitor.conf
Paste the following into the file, changing variables where indicated by the comments
Section "Monitor"
Identifier "Monitor0"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia" #Choose the driver used for this monitor
EndSection
Section "Screen"
Identifier "Screen0" #Collapse Monitor and Device section to Screen section
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24 #Choose the depth (16||24)
SubSection "Display"
Depth 24
Modes "1680x1050" #Choose the resolution
EndSubSection
EndSection
Save the file.
Press CTRL + ALT + FI to enter terminal mode and type the following:
sudo stop lightdm sudo start lightdm
Log in and notice that the cursor does not flicker any more. You may have to unplug your mouse and plug in back in to get the cursor to work. If you do not get back to the graphical mode after starting the display manager, press CTRL + ALT + F7
Reference: http://ubuntuforums.org/showthread.php?t=1730188
Friday, July 29, 2011
Venturing Into Vim
As an aspiring Ruby on Rails developer, I looked around to see what was the best code editor I can/should use for handling the development of a RoR web application. The vote went almost unanimously to Vim - a minimalist as (according to its veterans) extremely powerful code editor.
So this week I took a journey into Vim land to see what all the buzz was about and boy was it a rough one. Vim is not Notepad++, Komodo Edit or any other code editor that you've used before, and that's a key concept to remember when learning to use Vim, because operating as you did in your previous editors will send you into a mad swirling fit of rage and confusion.
Vim is it's own beast. The fact that you have to press a key before entering text and press another key when you've finished entering text should tell you a lot.
After a week of use, though, I must say that I chose wisely in the investment of my time and I would like to encourage my fellow coders to do the same. Get in the know with this great (yet sometimes frustrating) piece of software; it's powerful, simple and fast.
There isn't an opinion of Vim that wasn't stated by Jeffrey Way over at his blog, so I'll leave it up to you do some further reading.
Happy Vimming!
Monday, March 14, 2011
Regular Expressions
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false
}
return true
}
function ValidateForm(){
var emailID=document.frmSample.txtEmail
if ((emailID.value==null)||(emailID.value=="")){
alert("Please Enter your Email ID")
emailID.focus()
return false
}
if (echeck(emailID.value)==false){
emailID.value=""
emailID.focus()
return false
}
return true
}
To this :
function validateEmail(str) {
var RE_EMAIL = /^[a-z]+[\w-_]+@[a-z]+\.[^@]*\w\w$/
if(RE_EMAIL.test(str)) {
return true;
}
else {
return false;
}
}
If you are like me and you never understood regular expressions, I would advise you give them a try. If you're a web developer, one of these days you are going to have to develop a form component that needs validation. Learning regular expressions is a definite time saver and I would suggest you invest the necessary time into learning them.
Saturday, February 26, 2011
Friday, February 25, 2011
Clients from Hell
Me: “Ok, we’ve pushed the site live.”
Client: “Why isn’t the site #1 on Google yet?”
Me: “We just pushed it live five minutes ago.”
Client: “Optimize the fireball.”
Me: “I’m sorry? Do you mean the firewall?”
Client: “I need more hits NOW, so I need you to optimize the fireball. I know what I’m talking about!”
Me: “We’ll get right on it.”
Tuesday, February 22, 2011
Productive Unproductivity
Unfortunately this confidence is the source of your frustrations as you will find that the deadline for that multi-faceted, highly featured business web application is closing in and you realize that you've spent an entire day trying to find out why the jQuery.post() function isn't receiving JSON information from your PHP script on the login page.
With just a few days left to finish this app, and a myriad of other documents, reports and meetings to tackle, this is going to be one interesting week.
Monday, February 21, 2011
Left FB For Good
The internet is really a lonely place when you're doing everything your friends aren't. In this case, i'm glad to be alone though - FB was a giant waste of time and a huge distraction from more important things.
Oh well, on to the next thing I suppose.
Tuesday, October 27, 2009
Lovely Titan Robot on Gitex Exhibition 2009 - Dubai
As a (soon to be certified) Computer/Software Engineer, it really would amaze me if I even glimpsed the components and programming that went into creating this machine.
As a primitive citizen, seeing a walking singing robot of this size is just plain scary!











