Monday, October 18, 2010

Flash, Web Services and Cross-domain restrictions

I am working on a game community portal called Jippii. This is the link to the Spanish version http://www.jippii.es/. There you can play flash skill games and earn actual prizes, like phones or movie tickets. Although, I haven't finished the development yet.  Just a  few more weeks  and you will be able to give it a try.

Today I wasted several hours in forum pages looking for the answer to a problem I had. Every day I am getting more and more used to immediately google my programming problems. On this occasion, I was having troubles with the communication of the flash game with the web services that handles the trials and the score records.
In a nutshell, the flash game is hosted on a different server than the web services, so of course, I needed a crossdomain file.  The problem was to make a correct one.  Let's back to the wasting hours part, I started to google and found many people having the same problem. This made me think that I would find the solution to mine soon enough by just reading the forums. I was wrong. None of the entries I found solved my problem. And then, suddenly I remembered RTFM (thanks to my friends JG and DO for teaching me that) and the enlightenment came to me.

In the Cross-domain policy file specification page 15, example 1.9:

<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="SOAPAction"/>
</cross-domain-policy>

Problem solved.  From now on, I will try googling a little bit less and RTFM instead.

Wednesday, September 1, 2010

EMT Madrid on my Blackberry Bold

My friend Pablo and I we both live in Madrid, we are both computer science engineers, which implies that neither of us earns enough money to buy a car and pay for gas, which is actually pretty expensive around here. Luckily for us, Madrid has an excellent transport system, in my opinion the best i know of from the cities i have visited. Barcelona,Berlin,London,Milan to name a few. I think this is due to the fact that Madrid has it all. There are excellent  train, subway (the Madrid Metro is the densest metro network in the world) and bus systems, they all so perfectly integrated. Even the Barajas Airport is not far away from the city center.

 All metro and train stations have signs indicating how much time is left till the next wagon arrives. But almost none of the bus stops has this kind of signs. If you think this is unnecessary, think again. Imagine that the next bus isn't coming for the next twenty minutes, you will probably then would like to consider taking the metro or simply walking home.

  If you google a bit you will easily find mobile applications for IPhone and Android which given a bus line and a bus stop number will tell you the corresponding waiting time. For blackberry you will find none. My friend Pablo who apparently has more free time than he is willing to accept decided several months ago he would build his own blackberry application for that purpose. Of course, he forgot that famous phrase about not reinventing the wheel. You will see why.

  Pablo's  initial approach, was to use this public service Waiting Times Bus Madrid , emulate a standard browser request, parse the response ( a whole html page with a lot of useless information) and extract the one line that he needed for his blackberry app. This worked well for a time, until the EMT redesigned its website and changed the http form params.

  Pablo asked for my help knowing i would be interested in getting the application working again. After taking a glance at the web page's source code,  i knew immediately it was going to be very tedious job in case of continuing with Pablo's initial approach. What i did was to download one of the free available Android applications and analyze how it was getting the bus waiting time information.

Step by Step:
  1.  Android apps are  distributed as  .apk files. An .apk file can be opened and inspected using common archive tools such as unzip or unrar.
  2. I found a classes.dex archive which as far as i know contains all the .class files.
  3. I used a dedexer tool.  Dedexer is able to read the DEX format and turn into an "assembly-like format".
  4. In one of the resulting files i found the following
    >> new-instance v4,org/apache/http/client/methods/HttpPost

    >> const-string    v10,"http://195.76.144.242/services/tespera2.asp"

    >>...
  5. >>new-instance v10,org/apache/http/message/BasicNameValuePair const-string >>v11,"linea" >>....
  6. As you can see I could get a "private" url, the method of the request and the params.

I said "private" url because it is a public service after all and I suppose that if I get in touch with the IT department of the EMT I could possibly get to talk to someone who would give me the url and the necessary info.  Or maybe I'll just get lost in bureaucracy or "i have no idea" people.

After getting the URL and the params, the update to Pablo's blackberry app was pretty straightforward. He made it himself. He did not have to parse the response anymore because the new service we are using is designed specially for mobile applications. For that same reason I suppose it wont be changing anytime soon.

If you are interested in building your own blackberry app this is a good start BlackBerry Developer Zone. I already read the guide and found it simple and easy to follow.






    Tuesday, August 17, 2010

    My Five-Year Plan

    Recently, I just can't stop thinking: Am I doing things right?
    I have always had the idea of having my own company. Honestly, who doesn't? What I really meant to say, is that I genuinely think  I have the necessary skills to accomplish this goal. Still, there is something missing.

    When I finished college, I do remember thinking, need to gain some real work experience first. Four years has passed now, and I wonder how much of this experience is really worthy? and even if it is 100%. How much of this experience is actually product of a "classic work environment" ?  Just in case, lets define "classic work environment" as the following set: me(employee),many colleagues, my boss, his boss and the Big Boss ( you can add as many bosses as you want, this doesn't affect the model), fixed salaries, generic career plans, company values not usually honored, money comes first,etc.

    Among the IT Consulting Industry companies there is one thing in common that stands above all others. The almost incredible lack of good leading technical professionals. In their defense I will say that this is not a one company problem. It is a business model problem. That said, the following quote really fall into place "It seems to me that many problems in software development stem from the desire to decouple software development from programmer".

    I keep finding project technical leaders who are obsessed with becoming managers(budgeting,planning,profitability). Apparently, it is not that important to be first a software building expert to become and IT manager.  What happens next is that most IT managers end up with the responsibility of making decisions for what they aren't prepared for or not making decisions at all.

    How is this related to My Five-Year plan? Let's see, my initial thinking of  "need to gain some real work experience first" has fallen into pieces. For two main reasons:
    • I have almost none valuable knowledge product of  that "classic work environment" I have been so deep into. Most of the skills I have are either product of my academic experience or self-learned while working. Just to clarify I consider valuable knowledge : design patterns,  requirement management, developing methodologies, problem-solving techniques,quality assurance,etc.  Learning JSF, Struts, or whatever are not examples of valuable knowledge to me.  I hope you get my point. When you start to work you expect to learn not only by mistake, but also by example. The last one hasn't happened a lot to me.
    • I have almost no interest in founding a traditional IT Consulting Company. So working in one probably is not what fits me the best. I like to do things the right way and I would like to work in my own products. From conceiving the idea throughout the whole development process. 
    My Five-Year Plan is an Inflexion-Point Strategy for rearranging my professional goals and how I plan to achieve them. I don't expect to see results in five years. No one can put accurate timelines in this kind of Utopian projects. "Five-Year Plan" is simply a commonly used term for any plan for national economic or industrial development specifying goals to be reached within a period of five year. It was made famous by the USSR. It seemed appropriate for the title of this post.

    In conclusion : I am going to stop waiting to feel ready and gonna put in motion one step-by-step process starting for trying to get myself that valuable knowledge I am not getting at work.


      Sunday, August 15, 2010

      Introducing the blog

      I finally have a blog. Now what? Where  do i start?

      I have never been much of a blogger, but suddenly, i thought of how writing a blog would help me with my English. Of course, you always need a subject to write about. At first, this was going to be a strict technology oriented blog. Algorithms, programming, web developing tools, etc. Not so fun right?  At least not for my girlfriend Andreyna who happens to be a journalist with absolutely no interest in computers. Therefore I'll be writing also about random subjects that catch my attention. It can be sports -- if you know me you'll know by now that i am a huge Inter Milan fan -- movies, life in Madrid, trips, pretty much about everything. But always trying to keep at least  50%  of the content Technology-Based.

      Every now and then i get to do some interesting stuff at work. Find a solution to a really weird bug, write a beautiful piece of code, trying a new tool or framework, etc. It would be satisfying if someone finds useful one of my upcoming posts. It would be even  more satisfying if a big company CTO reads my blog and i end up working at Silicon Valley.

      I think this is enough information regarding to "Introducing the blog". I hope to soon find the time to write the first real post which luckily will catch your attention, making of you an assiduous reader of this entry in the DNS database.

      For those of you who don't get the title of the blog it is a mix of Web 2.0 concepts, old-fashioned diary, and the following book that i had to read at college Artificial Intelligence: A Modern Approach.