Tuesday, December 13, 2011

Apps. Confusion as much as with the pc

Scripting News: Why apps are not the future

There's an article raging over the internet, written by Dave Winer where he makes the argument that apps are not the future. His reasoning being that linking is something that is lacking from apps making them silos or buildings rather than an something as open as the web.

Firstly I have a bit of an issue with the definition of linking. But in the case of traversing and sharing information from silo to silo thus bridging the gap between them, I think we are getting there. Android in particular has done this excellently. A good example would be how I bogged this article. I simply long pressed the url on my browser (also an app mind you) and pressed share on the menu and shared it to Blogger. As far as linking goes where linking is passing information from one app to another I really do think we are getting there. But maybe Dave's argument goes deeper. And maybe only a medium which is controlled by open standards will win against individual mobile OS's. But I have a problem with this idea as well.

Mobile OS's need to open up their APIs first

How do you access the rich features of the smartphone if the operating system doesn't provide a unified open way of accessing them? Take a look at android and iOS and try and find out how you would take a photo through a web interface on the phone. You'd be better off encapsulating the mobile website within an app and then accessing the camera from there.

Offline persistence is a big win for apps

The beauty of mobile apps is that I can switch my 3g on for a few seconds, let my apps run an update course and then switch the 3g off leaving me with a new set of rich data to browse offline. This is not really possible with a website since on a mobile device, memory is limited and cached pages need to be refreshed when you make the tab it's encapsulated in visible again. Your best solution would be always on 3g.

But always on 3g is battery intense

Terribly so. Which leads to a far more complex issue than just apps vs the open web. To have websites work on mobile devices over apps you are going to be cranking out the 3g juice and frankly speaking, battery life isn't that good yet. While I hope that gets sorted soon I wouldn't hold my breath if I was you.

The work around to this would be to do what apps do. Offline data storage. Write directly to the phone memory and have your own pockets of data ready. So when I open Facebook.com it's not going to the internet to load those resources like the header bar and icons etc. Those will be ready along with my last update of the news feed which I can browse. But if the website can do all of that,

What is an app really?

Here comes the biggest issue. Linking is basically a functionality. It's not a property that can belong only to the web. It's something that's been implemented only by the web though. Similarly all those other things such as offline persistence of data also come under functionality. So assuming a website implements all of that, isn't the website then an app too?

This is the same problem I have with people using the buzz phrase, 'post pc era'. What utter rubbish. There is no post pc era. The form factor has changed but the personal computer remains. The day our body becomes the machine where data is stored and can be deleted simply within our brains and our eyes become the camera and electro magnetic implants become our gps, that'll be the post pc era. As long as there's a device we use external from our physical selves to do our everyday work stuff, the pc will remain. Just not in the same form factor as 10 years ago. 

And just like that, apps will evolve conceptually before being implemented. Battery life will increase, 4g coverage will become more comprehensive so my battery isn't drained. Javascript execution via the mobile device will become faster making use of the inevitable graphic cores for smoother rendering thus removing the concept of installing an app. But the app, will remain. Changing and evolving in terms of form factor but never dying. I'm sorry Dave. But apps are, the future.

Friday, December 9, 2011

Changing a Primary key value via SQL

I had to run into a rather annoying problem today where due to an error somewhere else in the database I was faced with two tables containing the same Primary Key (AL/1112/0001) which was causing a conflict in my data insertion. The only way to solve it business logic wise was to ensure that one table would programmatically receive the AX prefix and the other AL. While these values are stored in a separate table and changing them was a simple UPDATE statement, changing all the records in a similar way within the tables that would receive the AX prefix in the future was an issue. Changing a primary key value in the following manner:

happens to yield this abominable error due to the constraints and checks enforced

Bah! This may have been just a test DB but reinserting all those values whether through an INSERT/DELETE statement or through the program was going to take time. A quick bit of searching on the MSDN site to see what could be done to alter a table and I got this out.

The first thing you want to do is make all those ‘CHECK’ CONSTRAINTS be switched off. Here’s the code to do that.

I know that the standard code would be ALTER TABLE fcadadet WITH NOCHECK CONSTRAINT ALL but this gives an error with MSSQL. The MSDN documentation specifies it to be put in this way. (Is this wrong?) 

Run your update statement. This time it should work fine.

Once done, don’t forget to put your constraints back on using the code below.

Feel free to try another UPDATE. This time you’ll be met with the error from above again confirming that your constraints are all back in place.

Do note however that this is quite likely a very very bad practice and I used it only because it was a test database and the situation was one of those ‘it doesn’t matter who does what’ things. Using this statement on live data while a system is running is probably a bad idea. Those constraints are there for a reason.

Thursday, December 8, 2011

Hacking, Defined

There’s sadly a lot of confusion amongst a lot of people as to what a hackathon and hacktivist community is. It’s not so much about the definition of what should someone be doing to call it a hackathon but more about the fact that the media’s sensationalization has simply degraded this term to create a mental picture of some greasy hair kid seated in the darkness banging out commands into a shell command prompt in an attempt to gain access to the NSA’s database. Nothing could be further from the truth. Nothing.

I finally stumbled upon something that could put a definition to the word ‘Hacking’ and here it is. Short, and sweet.


Hacking is the process of writing code for, or contributing code to, a piece of software.

There is some controversy surrounding the meaning of this term. It began as a benign term meaning "to exercise proficiency" or "to alter or improve," but the popular media have since construed it to mean "to break into a computer system, usually with malicious intent."”

- From the WordPress Glossary page

The piece goes on to direct one’s attention towards Wikipedia for further disambiguation but honestly, for a term this misconstrued I really wouldn’t recommend that. Just take this definition above and keep it at that.

At hackathons we gather to hack upon a common purpose. And that purpose in our SL Hackathon is to hack on our ideas over a short period of time, usually a weekend. Be it individual or group.

What’s the point?



Hack = "to exercise proficiency" or "to alter or improve,"

Hackathon = to hack with a common goal in mind

SL Hackathon = The common goal to hack on is an idea where at the end of a weekend/Hackathon’s duration you have a tangible product.

Edits – Some awesome links (content is verbose) provided by @nazly and @laktek in response to this post.

http://catb.org/~esr/faqs/ – This is like the mother of all guides to becoming a hacker

http://www.paulgraham.com/gba.html – Paul Graham’s essay. “The Word “Hacker”

http://www.paulgraham.com/wealth.html – Another one of Paul’s essays. Related and very much worth a read.

Visual C++ 2010: Scope Of License

Early in the morning today while installing the MySQL client components I had to install Visual C++ 2010 runtime as a prerequisite to continue. No problem, set it to download via the installer itself (very convenient that) and once the install screen showed up I thought I’d give the EULA a bit of a go. Just for the heck of it. The scope of license section was actually quite interesting simply because of what I found to be one oddity.

2. Scope of License. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not

· disclose the results of any benchmark tests of the software to any third party without Microsoft’s prior written approval;”

Eh? I may not disclose the results of any benchmark tests without Microsoft’s approval? But why not??? I understand that Microsoft reserves all rights except my right to use the software but why can’t I perform a benchmark test without Big Brother’s approval?

Anyone know the answer to this one?

Edit – Some interesting posts related to this topic

Benchmarking is illegal says Microsoft

Microsoft Restricting Free Speech

Dangerous Terms: A Guide To EULAs

Discoveries on a day of programming from home

Thanks to me being sick due to food poisoning I had to stay home today instead of going for work. Feeling irritated since I had such a little left to complete I thought I would complete the code at home and then take it back to the office and integrate it with the rest of the code base, test, correct and make a final commit before going home. During one of the longer builds I was toying with the idea of how nice it would be if we had a remote SVN to which I could commit from work. Sadly such a feature does not exist. But how would you go about such a thing? VPN was the first thing that came to my mind. Ba! Too complex. Wouldn’t it be nice to set up the thing as a remotely accessible server by opening up a port, say:

"Company IP address:14035”

with some username and password and let us access it. I really don’t know if that can be done but it was still an idea worth toying with.

Out of curiosity however I just typed in our company IP address into the web browser bar and was greeted with the standard Router username and password dialog box. Feeling lucky I typed in admin, admin. No result. admin, admin123; nothing. admin, pass; still nothing. admin,password; welcome to the… “WHAT???????”

Turned out that not only was our router accepting external connections but the router’s username and password were still at default level. Note. I decided to wait a day to publish this since I gave a call to the office and asked the person in charge to fix it. Turns out that when the connection was being redone by SLT they had to do a hard reset on the router and hadn’t configured this bit again. Negligent but not as severe.

Strangely enough “Jerry” over on the IRC SLHacktivists had mentioned this before stating that it was unbelievable just how many routers one could find by typing in random IP addresses and even more unbelievable how many of those routers had been left on with the default username and password. Please don’t use this information for malicious purposes. If you do find someone’s router open and if it is an SLT ADSL configured one, you should be able to get the person’s phone number straight out from the username. Give that person a call and tell them to call SLT to reconfigure the router to prevent this kind of activity. I find it to be irresponsible on SLT’s part that they configure routers for clients and then leave it with these default settings on like this. Most people don’t know any better and therefore the onus of customer security falls upon SLT and any other company that installs these connections.

Wake up the community and spread some awareness people. Oh and check your own routers too.

N.B – Doing this at your own workplace could lead you to being thrown out and/or bringing up bad will between you and the server dude should the router have been left open. My suggestion is to do something in which you have definite evidence to say that nothing has been tampered with and that you did this only in the interest of investigating corporate security.

Technorati Tags: ,

Monday, December 5, 2011

Musings of a Weekend Hacker

Each of my blogs have been going through a serious repurposing over the last month and a half as I’ve tried to up my game somewhat in the blogging department. By upping the game I don’t mean to be some pro blogger who the world reads and then talks about but instead someone who is fairly consistent. By consistent I don’t mean how often I post. I’ve decided to put that aside since trying to do that unnaturally means it doesn’t get done. But by consistent I mean what I talk about. One thing I’ve always wanted to do is share whatever knowledge I gain with the rest of the world. Even if the rest of the world doesn’t read this blog it’s still a medium with which I can share everything right?

If you’ve read the last two or three posts of this blog you would notice that I’ve been trying to spur myself into becoming a weekend hacker. And it’s working. Along with dubstep and the pomodoro technique I am going through an unprecedented productivity burst. Over the last two weekends I have been able to release my first Open Source application, begin learning HTML and have given up my addiction to Twitter and RSS feeds. When you are programming those things matter less and less. I had to give up podcasts too up to a certain extent, something I’m a little sore about since the information I get from those is fairly valuable but some sacrifices have to be made I guess.

Digress digress digress.

Long story short, since I’m not reading tech news anymore I don’t really have anymore stories to write about all that often. But since I’m learning new programming stuff everyday I figured that whoever is trying to learn a new technology probably has to go through the same steps I do. So welcome to the journal of my tech life. Will it be daily? I don’t know. Will it be worth reading? For some yes. For others no. I don’t see the Hitler’s ghost taking much of an interest in this. What will it be?

Tech journal. Itsy bits of tech news. My open source projects. My ideas on building Sri Lanka’s Silicon Valley. Code snippets. Gotchas that screwed me over at work. And plain stupid things like how I managed to miss an assignment to a BigDecimal variable while using the add method on that variable itself. Why? Because it’ll keep me sane. :)