Main Contents

The Prototype life, Ajax universe and JavaScript everything

April 25, 2009

I was from the very beginning of the ajax days a anti-framework guy. The XMLHttpRequest object has a pretty straightforward API, easy enough not to need any abstraction layer on top of it. I also took the X on Ajax for real, and used Ajax async calls to call RESTful services on the server side (I didn’t know they were called RESTful services back then)  and process the XML returned from them in javascript, in order to update elements of the page using the DOM.

As I was exposed to more fellow Ajax developers, and also some server-side frameworks such as Rails and CakePHP, I realized everyone was using it in order to pull partial page renders from the server itself, instead of handling XML in the client side. Although it all started with that Apple Developer Connection article for me, and that already pointed me to the “right way”, I must admit that I fell in love instantly on all of a sudden being able to treat my server as a “business service server” and have the user interface on the client side.

I started looking for a way around the browser quirks and repeated JS code, and by then the most used framework was Prototype. But Prototype was all too simple and didn’t have any UI components, so it made things only a bit easier. I looked into dojo, and found something new to love.

So I grew older, and as I got older I also got lazier, and I ended up finally allowing myself to get interested in Rails and CakePHP and other agile frameworks, all of which used Prototype as their underlying JS library of choice. I started using the built-in Ajax capabilities of those frameworks, and tried my best not to cringe at the idea of pulling partial HTML from the server-side. Turns out it makes things quite simple for people used to server-side development, but still I wouldn’t use that if it wasn’t a part of the frameworks.

The Prototype experience came in to me a little late, since seemingly everybody was using it while i was still hacking dojo to get my share of client-side code up and running, and now the hype has been growing constatly over jQuery. I recall looking at it once and thinking “yeah nice, CSS selectors on JavaScript, but where are the widgets?”. Well seems I found another JS-head – Simon Willison- that thought about the same thing at first look, but decided to dive deeper than I ever did, and seems to have made the case for one to use it.

His blog article got me interested again on jQuery and I will definetly look into it for the next rich interface webapp I build. Great work there Simon,  I’m just sorry to only have found it only a couple years later than when you posted it.

Filed under: ria | Comments (0)

Windows and open source

April 23, 2009

I’ve been known among my friends for pushing people to use quality open source software instead of illegal copies or copyrighted software, or unregistered versions of shareware programs. I’ve also been pushing the day to blog about this for a while, for some reason.

After using a Mac if only for a few hours – I bought my wife a MacBook that i tend to use the “Look don’t touch” approach with in order to let her feel as its true owner  and customize it her way – I clearly understood why Apple becomes a religion to most people. There’s so much aggregated value to the Mac OS itself and iLife that now ships with all new Apple computers since 2008 at least, that you might as well do without installing a single piece of software in it.

Now if you look at Windows, there may be some of that too: where Apple has iTunes, they have Windows Media Player. Where the Mac has Mail, windows has Microsoft Exchange…. So why is the Mac OS more pleasant to people?  Simple answer: Apple’s products don’t feel half-assed. Why does Windows Media Player be such a resource hog and take me anywhere but my own music when I open it? I could brag about this all day, but my point is, Windows is NOT pleasant to use out of the box.

Does it make it a bad OS? Well, if you compare it to, say, Kubuntu, it’s definetly far superior in the usability aspect. Sure, amarok beats WMP’s sorry behind, and Konqueror is sexier than IE, but it’s still broken. I tried using Kubuntu with KDE4 almost exclusively for the last year, but felt relieved when I finally took the decision to ditch it and go with windows instead.

What makes windows usable is the endless number of add-ons, packages and applications you can use to make it better. It’s more of a platform for creating your own OS in a way. I chose to create mine using lightweight and quality open source software.

So without further due, here’s a list of the open source software I use, endorse, and can’t live without on windows:

  • Browser – Mozilla Firefox – If you’re reading this blog you know all I can tell you about it. I’ve been using Google Chrome more than it, I have to admit, but Firefox still has the best add-on support and I find myself resorting to it for the great Firebug, FireFTP, DownThemAll and ChatZilla add-ons.
  • Music Player – Songbird - Songbird is the closest thing you’ll get to Open Source iTunes. I love iTunes’ interface, but I hate being locked in to a store I can’t shop in (Apple Store won’t sell anything but iPhone apps to Brazil), so Songbird unlocks the potential of the iTunes library to a broader set of – you guessed it – add-ons.
  • CD Recorder – InfraRecorder - Now here’s something that I’m proud I’ve found. I was sick of having to install the monolithic Nero everytime I wanted to record a CD on windows. The built-in CD recording capabilites are seriously lacking, and InfraRecorder handles anything from MP3 CDs to Audio, to DVD Video and DVD Data discs. It also burns images both on the bin/cue and ISO format. All that on a 5mb install footprint, all open source.
  • Code Editor - Notepad++ – I must admit I was a die-hard vi fan. I used gvim on windows for quite a while, and it served me well, but I grew tired of the whole <esc>:something thing. I was looking into TextPad which is what most of the people in the coding business use for quick file opens with syntax highlight, and as usual looked for a open source alternative. I stumbled into Notepad++ which is godsent. The syntax highlight works awesomely, it has an explorer plugin that allows me to open files as I go while developing with Rails or CakePHP,  and also has some nice plugins for syncing with remote FTPs and for pretty printing HTML and XML. 
  • Archiver – 7-zip – Can’t say enough about this open source archive handler. It handles all format, and does so with style. The VB interface (as much as I hate VB) is flawless, and it also integrates nicely into the shell right-click menus. Their own .7z format allows for better compression than any other algorythm I’ve seen as well, and I’ve been converting people using WinRAR and WinZip to use 7zip with 100% of success so far. Get rid of those silly “UNREGISTERED” messages and go with the best, open source solution
  • Launcher – Launchy - If you ever heard of QuickSilver for the mac, Launchy would be the closest thing in windows. Basically you press alt-space and it brings up a “command line” where you can type in anything from a Putty session name to a command prompt command or a bookmark title, and it fires the right program for you, already positioned where you want to be. Anything in your computer is just an alt-space away.

As a side note, I’ve been doing some rails development, and this blog post has some nice highlight and shortcuts Notepad++ setup for .erb files.

Wish it had a command prompt window integrated like Kate does in Linux/KDE4

Filed under: software engineering | Comments (0)

The rotten and broken music industry and the press

April 20, 2009

The music industry is a declining business as we all know by now. The internet has shifted the control from record labels and publishers to the artists, breaking their monopoly on the most valuable thing in the business: the listeners.

Alongside that, we’re also seeing the printed press die. Newspapers were one the first ones to take the hit, both by a generation uniterested and unwilling to go to a news stand and buy a paper, and by the lack of advertising caused by shifting of classified business to the internet, through eBay and craigslist, and the targeted ads offered by new technologies such as Google AdWords and even ad networks such as Double Click.

Despite the really  bad scenario for both medias, boy was I surprised to read this announcement by my former Guitar Teacher and good friend Breno Teixeira, stating that a new music magazine in Brazil asked him R$ 1k to publish an interview alongside a track in the CD that comes bundled with it.

How stupid is that? I mean, artists are the ones who generate content for those magazines.  Content is what draws what’s left of their audience to them.  It seems that the magazine thinks it is the middle man, the record label, the only means to reach the audience, and wants to charge artists for access to their precious audience.

I call you all to join this cause and link to Breno’s post to spread the word on the internet and hopefully hit the said magazine with a major punch in the stomach, because that’s what they deserve. Am I trying to start a mob? Hell yeah, I am.

Breno’s Original Post

Filed under: music | Comments (0)

Interface Mockups

April 19, 2009

 

 
During agile project planning meetings, we usually find ourselves having to skecth a mockup of the user interface in order to make sure that both us and the client understood what will be done, and to improve that discussion as well.

If you’re on-site with your client, it’s a no brainer, just pick up a piece of paper, a pencil, and draw it up. But what if you’re on opposite corners of the world? One way would be to use a video camera to capture it, but usually live video over the web is low resolution, which would make it impossible to fully see what you’re trying to picture. You would have to take pictures, and pictures are not that easy to modify anyway.

I find myself to be in that very position, having been doing projects for people around the globe through GetAFreelancer.com and other freelance websites. One of the guys I worked with, Ken Naza, pointed me to a great software he uses for creating interface mockups. Balsamiq is a simple flash tool that you draw in using pre-built components, pretty much like crafting a mockup in Visio, and then export to XML. You and your client can send that XML back and forth and refine the mockup till you’re both happy with it.

Here are some sample J2ME and web mockups I’ve crafted with it, for your viewing pleasure. I’m totally pleased by them, and they look remarkably similar to the ones in “Agile Web Development with Rails

 

Website

Website

 

J2ME app

J2ME app

Filed under: software engineering | Comments (0)

MD5 and SHA1 hashes on PHP and JBoss AS

April 15, 2009

So, a hash is a hash, and all you need to do to compare them is comparing strings right?

Well, while that might be true for PHP version of the hashes, the MessageDigest class in the java security package hashes bytes into other bytes, not strings into other strings or bytes into strings. In order to obtain a string representation of the hash, you need to convert it to a string, be it representing bytes as hex strings (i.e. ff for 255), or converting it through other algorythms such as Base64, which generate a smaller string.

PHP functions sha1() and md5() both convert strings into other strings, and nothing else. They also use hex (base16) conversion to create them.

I had a problem trying to get both PHP and Java to use the same hashes using the DatabaseServerLoginModule in JBoss AS, because by default it encodes hashes with base64 when comparing them to strings in the database, while PHP was doing it base16 (hex). In order to fix that, I had to add this:


	
		
			
                ...
				HEX
			
		
	
        ...
    

Thought I’d share that.

Filed under: software engineering | Comments (0)

Database backed declarative security in JBoss

April 15, 2009

This had me looking through the docs for a while to find, so I thought I would share.

If you need to secure a Java EE app, be it a web or EJB module, and want to use container-based security instead of coding it yourself, JBoss provides a nice convenience model for pulling out Principals (users)  and Roles (permissions)  from a table in your database.

What you have to do is edit the file <jboss_home>/server/login-config.xml and add an entry using the org.jboss.security.auth.spi.DatabaseServerLoginModule. Here’s the one I’m using:


    
        
            
            java:/AdminPanelDS
            
                 select password from entry_user where username=?
            
                select role, 'Roles' from entry_user_roles where username=?
            SHA-1
            
        
    

After that, add to your applications WEB-INF/jboss-web.xml if it’s a webapp or META-INF/jboss.xml if it’s an EJB jar the name of your policy:

jboss-web.xml:


    java:/jaas/CaptchaUserDB

jboss.xml


    java:/jaas/CaptchaUserDB

After that, obviously configure security using the @RolesAllowed annotation on the methods or class of your EJBs or the security elements in web.xml of your webapp

 

Further detail can be found at the JBoss Documentation.

Filed under: software engineering, thoughts | Comments (0)

SOA Security

April 1, 2009

For all those that ignored security as a major concern of SOA (me included), here’s an excerpt from the soapUI welcome screen today:

Important Notice

Warning! Do not use soapUI to withdraw money! 

Eviware software has been alerted to users using soapUI to withdraw large sums of money from the European National Bank.  

So far millions of Euro has left the European National Bank further enhancing the credit crisis in Europe.  The Perpetrators has been downloading a WSDL from the European National Banks Web Service using a security flaw to retrieve large sums of money from the European National Bank, “The Fort Knox of Europe”.  

“At eviware we take this issue seriously and are working with the people at the ENB to solve the problem” says Dain Nilsson, Security Expert from eviware Switzerland, “The solution is not many days away, but due to the complexity of the Web Services and the powerful features of soapUI, the WSDL allows for untraceable withdrawals from the ENB.”  At eviware we urge all users not to download the WSDL found here and take advantage of a critical situation. Europe has a tough time as it is.

 

Scary isn’t it? Might happen to YOUR SOA if you don’t do your security homework.

Filed under: soa, software engineering | Comments (0)

The time for enterpreneurs and startups

March 5, 2009

Yes we all do know by now that the world is undergoing one of the worst financial crisis in capitalism history.  Jobs are being cut, work hours and salaries have been reduced, and most importantly, companies are being pushed into making cost cuts and seeking new business partners in order to become more efficient and agile while spending less money.

I could write about how SOA would make your enterprise more agile, and how you could leverage Open Source SOA tools in order to make it happen even on tight budgets, but SOA has been getting a lot of badmouthing these days since so many projects have failed to meet the expectations set to pie-in-the-sky standards by all the vendor babble.

Today’s post is about the opportunity that rises from rough financial times: starting your own company. In the brazilian IT industry most of us have done it already. 90% of the IT workforce are contractors, and 70% of those have their own one-man companies in order to avoid the legal issues of being hired, and to pay lower taxes on our incomes. So what does it take in order to push your one-man company into a full-fledged profitable business?

Well first of all, you obviously need customers. Since you’re probably a contractor like me, you have worked for at least a couple companies, and probably have a good contact with a project manager or CIO on at least one of them. If you can manage to get them to lend their name as one of your customers, you already have a customer portfolio before you know it.

Since companies are looking for new partners, it is your chance to present to both your previous employers, and potential clients how can you do what they need cheaper, which leads us to one of the big questions in this subject: Why would I be cheaper?

Well, some could defend not charging less than your current employer charges their customers in order to keep everyone’s gains high, but it’s exactly those companies such as the one you probably work for right now that customers are trying to get rid of.   

If you can manage to be more agile, and charge less, the odds are you’re probably gonna catch the attention and praise of your customers, and before you know it, you’ll have more work demand than everyone else is getting right now. Also, the companies already stabilished are probably undergoing the same financial issues as everyone else, so if you have less mass, you’ll be less affected by the crisis.

It is a unique time for everyone with the enterpreneur spirit ready for action, it’s up to us if we’re ready to get some real money, or to be yet another guy looking for a new, lower pay job after you get a cut from your current one.

Filed under: soa, software engineering, thoughts | Comments (0)

Generations

October 30, 2008

I have never felt the need to hide my feelings regarding people of generations different than mine. For instance, my parent’s generation seems to think that getting a job in a large company and spending the rest of my life building  a carreer inside it is THE BIG THING for me to do. They’re so obviously wrong, people with jobs in large companies NEVER get promoted these days, as new leadership talents are usually recruited from the market, not inside the company.

I didn’t have a lot of contact with what I believe to be the following generation to mine: the people born in the 90s that are just turning 15-20 and beginning their careers. Recently I was given the task to hire an intern, and finally made contact. Out of all sorts of people that showed up for the job, most of them fit into the 90s generation age-range, and also,  most of them didn’t really seem motivated for anything. They just wanted a job to fill in their college resume, or to earn some cash and fund their movie tickets / trips / whatevers.

I always felt there was a huge gap between generations, but never thought there was a formal study of the subject. Yesterday the oddest thing happened, I was sitting at a bakery eating, and was invited into some “event” that was happening upstairs by an elderly man. We had a short talk about cellphones before that happened, but before I knew I was abducted into a Herbalife event. No, I’m not selling you Herbalife (thank god), but it was one of the first times in my life that I ever heard the term “Baby Boomers”. After googling it today I found out that it’s the term used to describe my parent’s generation, and there I had it in Wikipedia, the whole categorization thing unfolded before my eyes.

I was discussing something(portuguese) about the younger generations with Serj before I knew this, and all of a sudden it got a lot clearer to me. I’m definetly picking up a copy of a couple books from these guys to learn more.

Also during my research I found out that the Boomers are having a hard time dealing with us, the Millenians, and our demands for better workplaces, less dressing rules, more influence, and working from wherever we feel like, as can be seen in this article, clearly written by someone who despises our generation. For the Baby Boomers who are afraid of the Millenians I have only one thing to say: PWNED. We will pwn your jobs, our carreer growth totally pwns yours, and our ideas WILL change the world instead of being afraid to change the Status-quo. We are the crazy ones.

Filed under: thoughts | Comments (2)

The new MacBook

October 30, 2008

I got SO excited when I saw the new MacBook specs. The same LCD screen as the Air, a GeForce 9400M that runs WoW way better than the previous Intel X3100, etc. What more could anyone ask from a notebook computer?

How wrong was I though, to think they had kept all ports in the MacBook intact. They couldn’t, as they had to save the STUPID amount of $0.25 per unit not adding a Firewire port to it.

Why would someone use firewire you may ask. Well, if you ever looked at pro audio interfaces, you would’ve noticed that all the GOOD external ones are Firewire not USB, for a reason. It’s a latency critical situation, and USB is heavily CPU-dependant, while Firewire is a lot more discrete. Also a ton of digital video cameras out there used by pros and semi-pros have a firewire interface for fast video transfers from the camera to a computer. Because of $0.25 on a $1200 product apple has just gotten rid of both consumer bases.

Some people seem to believe that $0.25 savings on a million units sold would become some really big savings in the end, but to me, those are short-sighted people that can’t measure real profit. If you get, say, $400 profit for each unit sold, what the heck of a difference would it make if you got $400.25? You might end up saving up to a million in an year, but it’s not even 1% of your total profit, so WHY CARE to do it?

I owned a car made by General Motors only in Brazil named Celta. It was created from the ground up to be a very low cost car to compete with Fiat’s cheapest offering here, the Uno. Instead of improving their manufacturing processes or optimizing their supply chain, the car has seen SEVERAL stupid cost-cuts:

  • Only 1 light to indicate the Reverse Gear, every car has 2 of them and it costs a stupid $2 to add one
  • No sensor for door opening on the passenger’s door, meaning the internal light won’t light up when the door is open – Stupid $5 savings
  • No mirror on the passenger’s sunshield – Another stupid $5 savings
  • No lights on the luggage compartiment – At most $10 savings

It all ends up for less than $25 woth of savings on a product that costs $15.000. WHY BOTHER to take such stupid cost cutting measures when it impacts under 1% of your profits? WHY, OH WHY can’t anyone at GM, Apple or whatever other company doing that see the STUPID move they’re making in order to save an insignificant amount of money?

It might make sense at the company level at first when you think of large scale production – at least on the instant yearly savings figure – but NO sense at all on the customer level. It also doesn’t make ANY sense when you compare the increase in profit percentage caused by the cost cutting.

I was motivated to write this post after reading this one.

Filed under: thoughts | Comments (0)