Thursday 28 January 2016

How your Mobile Apps are made

Mobile applications (or "apps"), technically, come in three different forms - native, web and hybrid. To most people, they are "mobile apps", and that's all there is to it. Laypeople have that luxury. But the web developer needs to understand that there are differences - and not just in terms of Android, iOS or Windows Phone.

Native 

Native apps are created in a language native to their platform. Native apps for iOS are written in Objective-C or Swift, and native apps for Android are written in Java. So if your app needs to function on both platforms, you will need to write that same application twice - once for each platform. As you may conclude from this, development of a native app tends to take a bit of time.

Of course, since the app is created in a native language and can interface with the device's operating system and hardware directly, it has a distinct advantage in terms of speed and versatility. Anything that your device can do, your app can manipulate. Need to access the camera on your tablet? Maybe tune the brightness and sound? No problem. It's all there.

Here's an example of Facebook's Android app.

Accessing the
native app via
an icon.


Facebook for
Android.

Web 

Web apps, in the mobile context, are like your desktop/laptop browser-based websites. You type in a URL or access a bookmark, and with a working internet connection, you're able to access the functionality of those sites. These are written in HTML5, styled with CSS and coded with JavaScript. Again, like any other website. The only difference here is that these sites are designed to fit onto the screen of your mobile device. Functionality is limited to whatever traditional web applications can do - retrieval/updating/deletion of data, animations, playing of videos, and so on.

You don't need any special skills outside of the average web developer's repertoire (I'm making some huge assumptions here, but bear with me) to create a web application. But you're severely limited by the need for a browser.

Here's an example of accessing the Facebook and Quora's mobile web apps.

First, you access
the internet via a
web browser's icon,
like Chrome.

Next, you type in the
URL of Facebook...

... or Quora.

Note that we first start up Chrome (or any web browser), then type in the URL.

Hybrid 

Hybrid apps are, simplistically put, web apps that have been ported over to a mobile device in a native app-like wrapper (via platforms such as Cordova and Phonegap) and therefore simulate the behavior of native apps. How so? Well, for starters, you no longer need to start up your browser and access a URL. You merely need to click on your app's icon, just like a native app. Limited access to the native functions of your mobile device can be accomplished via plug-ins. As you may surmise, this slows things down somewhat on the hardware side of things.

Development of a hybrid app tends to be fast, though. You're basically taking the same web app and porting them to different platforms. Write once, run anywhere. Maintenance is also markedly easier. Excellent if you just want a quick-and-dirty prototype.

Here's an example of Quora's hybrid app.

Editor's Note: It's not confirmed that Quora is a hybrid app. But the interfaces of their web app and mobile app look suspiciously similar.

As in a native app,
you access the app
directly via an icon.

Quora

 

What to use for Mobile Development? What's better? 

This probably feels like a cop-out answer but, as with most things, it really depends on what you're going for. Is this a final product or a prototype? How crucial is speed or development time? Do you foresee a lot of maintenance? Your answer will determine the direction you eventually head towards.

Thanks for reading. Much app-reciated.
T___T

Monday 25 January 2016

The Jover Touch

A couple weeks ago, the battery of my LG smartphone began taking on a bloated appearance, like it had engaged in a torrid one-night stand with the charger and gotten itself knocked up. This meant it was time to get a new battery.

Naturally, I headed down to Sim Lim Square, one of Singapore's hotspots for IT merchandise. Horror of horrors - it was a ghost town. Granted, it was hardly gathering cobwebs and filled with shambling zombies. But it was definitely a far cry from the days you couldn't walk five steps without swerving to avoid some other visitor. The problem was particularly pronounced at the high levels. It was barely 7pm, and shops were closed. Closed! Around the second and third floor, more eateries had sprung up. I could have sworn I even saw a barber shop! Sim Lim Square's days as an exclusively IT stop looked to be over.

A chocolate shop? Wait, what?

A small cluster of eateries
among conspicuously inactive shops.

A western food section
where an IT parts store used to be.

The most striking change, of course, was the first floor. The row of dodgy-looking shops touting mobile phones and accessories had been replaced by spanking new, expensive-looking brand names showroms for laptops.

I call this The Jover Touch. You know the story about Midas, who turned everything to gold with his touch? Well, a certain Jover Chew seems to have done the exact opposite.

It was June last year when Jover Chew, boss of Mobile Air, and a few of his employees were arrested on charges of cheating and criminal intimidation, among others; and finally sentenced in November.

Mobile Air's shenanigans had been going on a while before this, with CASE receiving complaints from customers who had been burnt by their practices. One woman went through the trauma of having to count about 1000 SGD's worth of refunds in coins at Mobile Air while Chew taunted her.  And shortly after that, a video of a Vietnamese tourist crying and begging for his money back on his knees at Mobile Air, went viral.

At this point, Jover Chew had gone too far. He had made himself impossible to ignore.

Most people can accept a man trying to turn a profit - that's what retail is for, isn't it? So that rascal Jover Chew used a few sneaky tactics. No big deal, moving on.

The fact that he picked on low-wage earners and people who had little power to stand up for their consumer rights, was rather more disturbing. This makes him a little shit... but he's no more guilty than many employers in Singapore in that regard. (Fess up, how many of you like employing foreigners because they can't stand up for their rights?)

But all this is small potatoes compared to gangster-like behavior used to intimidate customers, and humiliating them. Laugh at a man as he begs you on his knees for money you cheated from him? That was totally unnecessary. What a bastard. Money can be earned back, but dignity is priceless.

Jover Chew has been sent to jail. And it is my opinion that he deserves every day spent behind bars, every cent fined. All of it.

One other thing concerns me about this entire affair. Perhaps I'm mistaken as to the legal process, but it is absurd that this was allowed to go on for so long despite numerous reports, before this bunch of miscreants was finally taken to Court. While it may not be the truth, perception is everything. And public perception seems to be that in order for the legal system to get off its arse and start working, the public has to first make enough noise about it.

I think it goes without saying that this should not be the way. And it is hardly reassuring to the man in the street, who has been brought up to have absolute faith in Singapore's brand of justice.

So - yes. I obtained my new battery. But it was a sad day. Hopefully Sim Lim Square recovers from this bout of consumer distrust.

Just something to Chew on,
T___T

Monday 18 January 2016

2011 - Three Jobs In a Year (Part 3/3)

So I got released from my second job in 2011. Don't be mistaken - I have no problem calling a spade a spade. If I was fired, I'd say so. But I can't honestly say I was "fired" or "retrenched" because there was no monetary compensation involved. I wasn't "asked to resign" either. So, for lack of a better term, "released" or "let go" seems more appropriate. Technically, I hadn't passed my probation.

But meh. Splitting hairs much?

Interviewing.

Getting that new job

So once again, it was time for an interview spree. This was becoming second nature by now. I'd become so familiar with the process I mostly breezed through it. Managed to land two interviews just before my final month in the company was up. And both gave me offers! 100% success rate! That gave me a world of confidence, and let me know that technically, I was solid. Like a rock. Either that, or I'd just become pretty damn good at selling myself. Especially when you consider that the first company was interviewing for an ASP.NET developer, a platform I wasn't at all well-versed in.

The first interviewer spent almost three hours with me. My inexperience with ASP.NET gave him pause, but I did have extensive HTML and CSS credentials now, along with back-end scripting and database knowledge. I was an experienced web developer - all I was missing was ASP.NET.

The second company's interviewer struck me as a nice easygoing guy. They were using PHP, but it was in the form of Drupal. And after my last experience, I'd had enough of CMSs for now, thanks very much.

Feeling the need to get out of that comfort zone, I opted for the ASP.NET job. The pay was slightly lower due to my inexperience with the platform, but what the hell, right? I asked for permission to visit the company and familiarize myself with my environment a few days in advance. The Technical Director was only too pleased to oblige. Which again confirms what I've always said - in the absence of skill, enthusiasm counts for something.

Climb harder, maggot.

Learning the ropes

I threw myself into the new job with gusto. My colleagues were a PRC team lead and a few other programmers from Myanmar. They were more than happy to share what they knew. And while I wasn't their match in C#, I soon found that my working experience gave me an edge. I was better at Photoshop due to the countless nights slaving over slicing up Photoshop files to turn into HTML and CSS. Needless to say, my CSS was several levels above theirs too. Where client communications were concerned, I was also ahead. I give my previous boss full credit - the hell he'd put me through really paid off.

Tempered by fire.

In the first three weeks, not only did I learn C#, I learned SQL Server and Coldfusion. So much free software and tools got uploaded onto my laptop. I actually felt that even if they eventually decided to let me go too, I'd definitely gotten a huge bargain. Not only did they not let me go, they even ended my probationary period early.

Epilogue

Enough blathering! Suffice to say, I eventually left this company too. But that's another year, another story. Just felt like recapping one of the toughest years of my professional career, ever. It was a roller-coaster ride all the way. The battle to stay afloat goes on.

Thanks for reading. What can I say? Good job... er, jobs.
T___T

Saturday 16 January 2016

2011 - Three Jobs In a Year (Part 2/3)


My work at this 4-man (me being the fourth man) operation began in earnest...

Working from home

Projects were in Joomla!, and I spent many nights tinkering till I made sense of them. It's caused me to hate Joomla! to this day.

Each new project would be passed to me in the form of a Photoshop file, which I would then convert to HTML and CSS, and then incorporate into Joomla!. In addition, I attended client meetings, sometimes with the boss, sometimes by myself.

Working from home, in theory, gives the web developer a great deal of freedom. In practice, it was exhausting. There was no firm line drawn between home and office. My home was my office. I let my enthusiasm get the better of me instead of exercising self-discipline. I worked late into the night, up to 4am, sometimes up till daylight. But since clients were operating from 9am to 5pm, I still had to be awake by 8am. This left me, over time, in a state of perpetual fatigue.

Tired. So tired.

A demanding boss

I soon found out that where client communications were concerned, I was a novice. I made elementary mistakes, talked too much, gave an overall poor impression. My new boss was very displeased, and reprimanded me on more than one occasion. It got so severe that at one point, I was fully expecting to be fired after screwing up a government project. Instead, he extended my probationary period by another three months.

Constant terror.

On one hand, I was grateful for the opportunity. On the other hand, I was starting to sense that nothing I did would ever make this dude happy. Screwing me for messing up client communications was one thing. Screwing me for negligence and sloppy work was all right, too. But it got to the point where he would pick on me for poorly-chosen words, the occasional missing email attachment, and so on. He would send me an SMS, and when I didn't reply within 30 seconds, send me another one pressuring me to answer. Seriously, what the fuck?

But I was determined to make it. This bullshit actually made me work even harder. He thought I wanted to pass my probationary period so as to get that promised substantial pay increment. But in truth, this had stopped being about money. I needed to prove I could do it. The more he piled the pressure on, the more I gritted my teeth and hung on. Yes, I got that he didn't think much of me and perhaps he had cause to think that way. Well, guess what? Challenge accepted, motherfucker.

I'd like to take this opportunity to clarify that I'm not attempting to paint this guy as the Boss From Hell. As bosses go, he was pretty decent about paying me on time. And he did make the attempt to engage in a little guy-talk, make things a bit friendlier. Points for effort, yo.

Getting increasingly tired

However, this couldn't last. My confidence was dwindling. Every time I got an email or SMS from my boss, I would agonize over how to properly answer. Add to the fact that I was pulling 18-hour days now, and something was bound to snap. Not getting out of the house other than for the occasional client meeting, didn't help. I was developing a serious case of cabin fever. My buddies, concerned for my mental health, made a point to get me out for movies and supper. I was so exhausted that I'd fall asleep within ten minutes of the movie starting, and wake up only when the credits were rolling.

I wasn't sure if I would make it another three months, but I sure as hell was determined to try.

Let go

The sixth month came and went. I waited for an indication from my boss as to whether or not I was confirmed, or if he was still not satisfied with my performance and wanted to re-extend my probationary period. None came. Finally, after a week or so, I sent him an SMS inquiring about my status. His reply was a request to meet me at a cafe near my place.

Sent packing.

There, he apologetically informed me that he had to let me go because the company was downsizing, and that I would leave at the end of the month. Apparently, he himself was unsure if he could continue to run the company. I asked him why he'd waited till now to tell me, and he said my probationary period had completely slipped his mind till now.

How coincidental. How convenient.

Maybe his company wasn't actually downsizing. It was already a 4-man operation - how much smaller was he going for? Maybe he simply decided that I wasn't worth keeping on after a substantial pay raise as promised. (And he couldn't just keep me on without the pay rise because my motivation would be gone. For the past 6 months, the sheer amount of effort I was putting in had been my only saving grace. Without even that, I would be useless to him.) Maybe the whole "downsizing" thing was just an excuse to spare my feelings, or just make it easier for me to land that next job. Nice of him, eh?

Aftermath

Whether he knew it or not, this fella did me a huge favor by letting me go. I no longer had anything to prove. I had never given up - it was he who was telling me to go, right? And since there was no longer anything in it for me, I stopped trying so hard and simply concentrated on going for job interviews, and informing all the clients that I would be leaving at the end of the month. Interestingly, many of the clients, upon hearing the news, asked if I was interested in maintaining those projects for them, but on a freelance basis. Which basically meant I would be taking jobs away from my soon-to-be ex-boss. It was tempting. Money and sweet revenge! (Hey, he's downsizing, right? What does he need so many jobs for?)

Anyway, where was I? Oh yes - the aftereffects. Since I wasn't trying so hard anymore, I was no longer running on adrenaline. It felt like I had finished a race. My body started to rebel after having been pushed to its limit for the past 6 months. By 11pm, no matter what I was doing, no matter how much caffeine I'd taken during the day, I would start nodding off and wake up only at 8am. It was like magic.

That was scary. It showed me just how far I had pushed myself. If the guy hadn't let me go, how long could I have kept this punishing pace up? It just doesn't bear thinking about.

Next

The third job in 2011.


Thursday 14 January 2016

2011 - Three Jobs In a Year (Part 1/3)

A new year has arrived, and this inevitably brings memories of the harrowing year that was 2011. This was one of the toughest years I've ever had to endure. This was the year I worked for three different companies in the space of one year. It was a time of great uncertainty, though no less than what I'd had to go through before. I've not encountered any situation quite as tough since.

At the beginning of the year, I was still happily working for the boss of a tiny web development company. The hours were long. The girlfriend had left, which gave me even greater freedom to pull 12-hour days, and even come in on weekends and public holidays. I was a man obsessed with my work. But strangely, I was happy.

Let me explain something about my boss. He and I had what I considered a good working relationship. Sometimes we would argue over the best way to accomplish certain tasks - but always with the understanding that after making my case, I would defer to his final decision. He would take the trouble to explain to me why he made certain decisions. He understood that I argued not out of any desire to challenge his authority, but because I cared. Through the process, I learned a lot.

My boss appreciated me as well. I wasn't the most skilled programmer in the world, or the most experienced. But my enthusiasm pleased him. I was committed. Sure, I didn't always arrive early in the office, but I'd be there long after everyone had gone. Whatever tasks he sent me out on - web projects, client meetings, door-to-door sales - I carried out with the same energy and initiative. I was also an employee who didn't ask for much; though after what happened at the last workplace, I was extremely particular about getting paid on time.

Mooooving on to greener pastures.

So yes - I was happy. But not complacent. It didn't stop me from looking around for greener pastures. I had given myself one year - maybe two - to learn from this job and move on. This, in part, explained why I worked so damn hard - because I had limited my time at this company from the very beginning, and wanted to make the most of it.

The first few interviews went well. And then I landed what I thought was a sweet deal - the post of a web development executive in a 4-man operation. It was a work-from-home gig as there was no office space. I would get a minor pay rise upon joining, and a substantial one after passing the probationary period. The boss of the outfit was even willing to fork out half the expense of a new laptop for my use. Incidentally, it's the very same one I'm using to type this blogpost. Yes, it's lasted this long!

My old workhorse.
Tough, like its owner.

My soon-to-be ex-boss took the news like a gentleman. He threw me a farewell lunch and my colleagues pooled their resources for a parting gift. I sensed he was really sorry to see me go.

Nice classy pen. Rarely used.

Everything was looking up. But that was the calm before the proverbial storm.

Next

The hardest six months of 2011.


Friday 8 January 2016

Web Tutorial: Star Wars Scroll Text


Use the Force! Star Wars returned to the silver screen last month with Episode VII: The Force Awakens, and with it legions of slavering fanboys (your Teochewness included!).



With that in mind, I think it's only appropriate to style this month's web tutorial on the Star Wars scroll text. You know that starry background with the introductory text emerging from the bottom of the screen to a point in the distance? Yep, that's the one.

We'll start with a black background here.
<!DOCTYPE html>
<html>
    <head>
        <title>Star Wars</title>

        <style type="text/css">
        body
        {
            background-color:#000000;
        }
        </style>

        <script>

        </script>
    </head>

    <body>

    </body>
</html>


So space is black, but we're missing the stars that give space its twinkly goodness. Add this to the body. It's the overlay that will hold all the stars we'll generate.
    <body>
        <div id="star_wrapper">

        </div>
    </body>


Add this to the CSS. This ensures that the star_wrapper div is positioned on top of everything and covers the entire screen.
        <style type="text/css">
        body
        {
            background-color:#000000;
        }

        #star_wrapper
        {
            position:absolute;
            z-index:500;
            left:0;
            top:0;
            width:100%;
            height:100%;
        }
        </style>


Now, we're going to make stars. Each star is a div with the CSS class star. It's circular, thus border-radius is set to 50%, and it'll be given a position of absolute so that it's position doesn't interfere with the rest of the stars inside the star_wrapper div.
        <style type="text/css">
        body
        {
            background-color:#000000;
        }

        #star_wrapper
        {
            position:absolute;
            z-index:500;
            left:0;
            top:0;
            width:100%;
            height:100%;
        }

        .star
        {
            border-radius:50%;
            position:absolute;
        }
        </style>


OK, what next? We could manually include divs into the star_wrapper div, but that's too much like work. How many would you type in - a hundred? A thousand? No, we're going to make JavaScript do the work for us, much the same way we implemented the snowflakes last Christmas. Make these changes to your HTML and add the stars() function. Here, we define a variable wrapper which will be used to represent the star_wrapper div. Another variable, node, will represent each star as it is created. nodesize, nodeopacity, nodex and nodey are variables to hold the randomly generated values for each node.
        <script>
        function stars()
        {
            var wrapper=document.getElementById("star_wrapper");
            var node;
            var nodesize,nodeopacity,nodex,nodey;
        }
        </script>
    </head>

    <body onload="stars();">


Now we'll add the standard function generaterandomno(), which will be used to create stars with random appearances and positions. Using a For loop, we'll create 500 stars. This is not set in stone; if you want a thousand or just ten, change the value.

Each star is small, so we'll set the range from 1 to 3 pixels for height and width. nodeopacity will be a number from 1 to 10, and it'll be used to determine how bright different stars are. And of course, nodex and nodey are given a number from 1 to 99. That's the percentage each star is offset from the top left hand corner.
        <script>
        function stars()
        {
            var wrapper=document.getElementById("star_wrapper");
            var node;
            var nodesize,nodeopacity,nodex,nodey;

            for (var i=0;i<500;i++)
            {
                nodesize=generaterandomno(1,3);
                nodeopacity=generaterandomno(1,10);
                nodex=generaterandomno(1,99);
                nodey=generaterandomno(1,99);

                node=document.createElement("div");
                node.className="star";
                node.style.width=nodesize+"px";
                node.style.height=nodesize+"px";
                node.style.backgroundColor="rgba(255,255,255,"+nodeopacity/10+")";
                node.style.left=nodex+"%";
                node.style.top=nodey+"%";

                wrapper.appendChild(node);
            }
        }

        function generaterandomno(varmin,varmax)
        {
            return Math.floor((Math.random() * (varmax-varmin+1)) + varmin);
        }
        </script>


Run your code. We have a starry space background!


That's just the beginning. We'll be making the scroll text next. For that, we'll use a nested div. Add this to your HTML.
    <body onload="stars();">
        <div id="star_wrapper">

        </div>

        <div id="diagonal_wrapper">
            <div id="text_wrapper">
                <p>A long long time ago, in a galaxy far far away...</p>
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
                <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
             </div>
        </div>
    </body>


Add the CSS for the diagonal_wrapper div and the text_wrapper div.
        .star
        {
            border-radius:50%;
            position:absolute;
        }

        #diagonal_wrapper
        {
            position:relative;
            z-index:50;
            width:70%;
            height:600px;
            margin: 0 auto 0 auto;
            border:1px solid #FFFFFF;
        }

        #text_wrapper
        {   
            z-index:50;       
            width:100%;
            height:200%;
            margin-top:100%;
            font-size:3em;
            font-weight:bold;
            font-family:arial;
            color:#FFFF00;
        }


The diagonal_wrapper div is so named because at some point, we'll be rotating it along its X-axis. It is 70% as wide as the full screen and set in the middle. An arbitrary height of 600px has been set. I've also given it a white border so you can see clearly what we're doing.

The text_wrapper div holds the scrolling text, and is set to be as wide as the diagonal_wrapper div, and twice as tall. margin-top has been set to 100% so that at the start of everything, it appears under the diagonal_wrapper div. The font size and color are cosmetic, but I've set the text color to yellow. Very Star Wars-y, yes?

This is what you should be seeing. You won't see the yellow text unless you scroll down.



Now add this to your text_wrapper CSS specification. We're going to animate it. The movetext keyframe specification moves the text_wrapper div from the bottom of the diagonal_wrapper div to the top. Since the text_wrapper div's height has been set to 200%, in order for it to appear at the top, margin-top has to be set to -200%. And that's what we've done in the movetext keyframe specification.
        #text_wrapper
        {   
            z-index:50;       
            width:100%;
            height:200%;
            margin-top:100%;
            font-size:3em;
            font-weight:bold;
            font-family:arial;
            color:#FFFF00;
            -webkit-animation-name: movetext;
            -webkit-animation-duration: 20s;
            -webkit-animation-delay: 0s;
            -webkit-animation-iteration-count: infinite;
            -webkit-animation-timing-function: linear;
            animation-name: movetext;
            animation-duration: 20s;
            animation-delay: 0s;
            animation-iteration-count: infinite;
            animation-timing-function: linear;
        }
           
        @-webkit-keyframes movetext{
            from {margin-top:100%;}
            to {margin-top:-200%;}
        }
           
        @keyframes movetext{
            from {margin-top:100%;}
            to {margin-top:-200%;}
        }


Refresh your browser. Does the text move?


Modify the CSS. This will ensure that you won't see the text_wrapper div once it moves beyond the diagonal_wrapper div's boundaries.
        #diagonal_wrapper
        {
            position:relative;
            z-index:50;
            width:70%;
            height:600px;
            margin: 0 auto 0 auto;
            border:1px solid #FFFFFF;
            overflow:hidden;
        }


Refresh your browser. The text should now appear from the bottom of the diagonal_wrapper div and disappear at the top.

Now the appearance and disappearance of the text is a little abrupt, don't you think? We'll rectify this by adding a gradient layer on top of the diagonal_wrapper div. Add this to your HTML.
        <div id="diagonal_wrapper">
            <div id="overlay"></div>
            <div id="text_wrapper">
                <p>A long long time ago, in a galaxy far far away...</p>
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
                <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
            </div>
    </div>


Now style your overlay div with this. Its position property is set to absolute and its z-index property is set to 100, which is higher than the text_wrapper div's z-index property. So it will cover the entire diagonal_wrapper div and appear over the text_wrapper div. The gradient background was generated at ColorZilla. It goes from an opaque black to full transparency, then back to an opaque black again.
        #overlay
        {
            position:absolute;
            z-index:100;
            top:0;
            left:0;
            width:100%;
            height:100%;
            background: -moz-linear-gradient(top,  rgba(0,0,0,1) 0%,rgba(0,0,0,0) 40%, rgba(0,0,0,0) 60%, rgba(0,0,0,1) 80%,

rgba(0,0,0,1) 100%); /* FF3.6-15 */
            background: -webkit-linear-gradient(top,  rgba(0,0,0,1) 0%,rgba(0,0,0,0) 40%,rgba(0,0,0,0) 60%, rgba(0,0,0,1)

80%,rgba(0,0,0,1) 100%); /* Chrome10-25,Safari5.1-6 */
            background: linear-gradient(to bottom,  rgba(0,0,0,1) 0%,rgba(0,0,0,0) 40%,rgba(0,0,0,0) 60%, rgba(0,0,0,1)

80%,rgba(0,0,0,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
            filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#000000',GradientType=0

); /* IE6-9 */

        }


Run your code. Watch as the scrolling text fades in from the bottom and fades out at the top. Isn't this like magic?


Now, we're going to rotate the diagonal_wrapper div. Encase it inside another div, and set the id to perspective_wrapper. Because when you're doing a 3D transformation with perspective, this is required.
    <div id="perspective_wrapper">
            <div id="diagonal_wrapper">
                <div id="overlay"></div>
                <div id="text_wrapper">
                    <p>A long long time ago, in a galaxy far far away...</p>
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
                    <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
                </div>
        </div>
    </div>


Style the perspective_wrapper div, like so. This ensures that the perspective_wrapper div fills the while screen. The perspective property has been given a low number, at 150px, to exaggerate the skewing of the diagonal_wrapper div.
        #perspective_wrapper
        {
            width:100%;
            height:100%;
            overflow:hidden;
            -webkit-perspective:150px;
            -webkit-perspective-origin:50% 50%;
            perspective:150px;
            perspective-origin:50% 50%;
        }


Next, we rotate the diagonal_wrapper div along its X-axis. Just 10 degrees should do it.
        #diagonal_wrapper
        {
            position:relative;
            z-index:50;
            width:70%;
            height:600px;
            margin: 0 auto 0 auto;
            border:1px solid #FFFFFF;
            overflow:hidden;
            -webkit-transform-origin:50% 50%;
            -webkit-transform:rotateX(10deg);
            transform-origin:50% 50%;
            transform:rotateX(10deg);
        }


We're getting warm. Very warm.


Now all we have left to do is remove the white border.
        #diagonal_wrapper
        {
            position:relative;
            z-index:50;
            width:70%;
            height:600px;
            margin: 0 auto 0 auto;
            border:0px solid #FFFFFF;
            overflow:hidden;
        }


And there you go. This is a live demo, and it works.

A long long time ago, in a galaxy far far away...
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


Sure brings back memories, doesn't it? Well, until the sequel arrives, this should keep the Jedi (or Sith) in you alive.

Yes, this is the web tutorial you're looking for.
T___T

Tuesday 5 January 2016

FreeBas(ic)ing the Facebook way

Freebasing... OK, I know. Terrible, terrible pun.

Anyway, if you haven't already guessed, today I'll be talking about Facebook's new initiative, Free Basics. As some of you may know, Facebook launched Internet.org last year and it was renamed "Free Basics" in the final quarter of that same year. Its purpose? Broadly speaking, to provide free internet access for less fortunate folks who can't afford to pay for it.

Free Basics


How's that supposed to work?

Interested parties providing web services and applications apply to join the platform, which is carried out by Facebook and an Internet Service Provider. Anyone using the a special sim card to access these sites/services/apps does not get the charges added to the bill. So the point, ostensibly, is that people who can't afford to pay for data charges can use these services for free.

Reactions

Response from India has been mixed despite Free Basics' potential for reducing the massive wealth gap. The majority of the online chatter seems to be denouncing it. Comedy group All India Bahchod (AIB) released a few skits which will effectively sum up their concerns. I particularly like this one by Schitz en Giggles. It's pretty funny and explains the reactions far better than I ever could.

But what the hell, I'm gonna try anyway.

See, the ruckus is about Net Neutrality.

Net neutrality (also network neutrality, Internet neutrality, or net equality) is the principle that Internet service providers and governments should treat all data on the Internet the same, not discriminating or charging differentially by user, content, site, platform, application, type of attached equipment, or mode of communication. - wikipedia.org

Activists are concerned that this compromises the principles of Net Neutrality if only certain services approved by Facebook and the ISP are allowed to take part in Free Basics. This excludes entities who are competitors of the ISP, or who do not conform to technical specifications set by Facebook. Which effectively means that those using the Free Basics platform will get free access only to a certain segment of the internet.

Mark Zuckerberg, founder of Facebook, has voiced his opinion to the contrary. I'm not sure I entirely buy his message that Free Basics fully respects Net Neutrality. Because, if we go by the definition above; the way Free Basics is being implemented, the very fact that interested parties need to be approved by Facebook and the ISP, contradicts that principle.

Due to the outcry, Telecom Regulatory Authority of India (TRAI) has temporarily ceased the implementation of Free Basics, at least till January 7th, 2016.

So in a nutshell, this is about the principle of Net Neutrality. The principle is admirable. But as a developer, my faith in principles do not supercede my faith in results. Punctuality is an admirable principle too. If you had to choose, would you rather have a developer who comes in late every damn day but meets all his delivery deadlines, or a habitually punctual developer who doesn't deliver? Again - results. If you had a fire to put out and someone handed you bottled water, would you refuse to use it because of ethical issues?

I'm not saying that the naysayers don't have a point. In fact, they have an excellent point. But let's look at this again. The problem is that a sizable percentage of India's population do not have the means to pay for long-term internet access, and lack of access to information and services will further disadvantage the poor. Free Basics will alleviate that problem swiftly. Does Net Neutrality matter to the ones that Free Basics is supposed to benefit? I think fucks given: zero isn't too far off the mark here. (Far off the mark, geddit? Heh heh)

Facebook is not being altruistic

Facebook stands to gain from this. It stands to gain big. Increased exposure to the masses, increased growth... the opportunities are huge. So yes, all that slick marketing Facebook is doing to promote Free Basics as an noble endeavor, is just so much doggy-doo.

Free Basics poster
So what?

Last time I checked, Facebook isn't a non-profit organization. So Facebook found a way to benefit itself and the poor, without robbing anyone (jury's out on that one, though). Why is that a problem, again?

Tim Berners-Lee has argued that customers should "just say no" to offers of a cut-down Internet.  Now, I respect TimBL as much as the next web geek, but wouldn't "customers" in this context be the target demographic that Free Basics is aiming for? I can't see them complaining about getting free stuff. And those not wanting to participate are certainly not being held at gunpoint to do so.

Facebook's tyranny

Which brings me to another point - the activists who cry "Who is Facebook to decide what services poor people should and should not get?"

Hmm, you guys got me there. Not so long ago, I was looking over hosting plans from Hostinger. Now apparently there's a free plan where you don't have to pay a cent. What Hostinger gives you is 2000 mb of storage, 2 MYSQL databases and 100 gb of data transfer, among other things. But guess what - if you want more stuff, you have to pay, like, 2 gbp per month.

God damn it! Who is Hostinger to dictate what services that I, an impoverished web developer, can access on their free hosting?!

Alternative solutions

Recognizing the fact that giving unfettered free internet access is economically unfeasible, some activists and concerned citizens have raised alternative ideas in place of Free Basics.

One such idea involves providing free internet, with no restrictions, for a period of, say, 3 months. I don't think that's such a hot idea. If the goal is to provide access to people who have never had internet access, the learning curve here may turn out to be costly. Surfing the web is a no-brainer. But surfing the web productively, to gain access to useful information and services, is something that can only be learned over time. And almost certainly not in the space of 3 months, unless one dedicates an entire 3 months to learning productive web navigation. Just a wild guess - the target demographic is a little too preoccupied trying to make ends meet.

Another idea: Provide internet access, with no restrictions, with the first 300mb of data free. You're kidding, right? All these guys need to do is watch a few YouTube videos and the 300mb will be gone faster than you can say "Save The Internet". Unfettered access, remember? Plenty of options. Too many choices. An overwhelming number of options.

Possible consequences

This could lead to Facebook getting a stranglehold on the Internet. By limiting free access only to certain sites, Facebook can control what poor people see and think. How deliciously insidious.

Here's an idea - get off the Internet. Or, if you want to access anything outside of the free stuff Free Basics is giving you - pay for it like everyone else.

If Free Basics does not go through, Facebook loses nothing. India will still have the problem of a struggling, under-developed segment of its population with no internet access. If Free Basics does go through, all that happens is that these people get stuff they didn't have before - at no cost. I fail to see a downside to that, at least. As an interim solution, Free Basics is ugly but effective.

What is TeochewThunder's position?

Hey wait. This is India we're talking about. I don't live there. No skin off my back. I'm just a web geek writing about interesting occurrences in my industry.

But, if you insist on supporting one side or the other, the link to Save The Internet's petition is here. And the link to support Free Basics is here.

Stay tuned. This appears to be TRAIing times for Facebook!
T___T

Friday 1 January 2016

Five Bad Workplace Habits to drop in 2016

Happy New Year! It's 2016. Another year beckons, and it's time to get down to an old tradition - making resolutions and failing to keep them. In that same spirit, here are five bad workplace practices that should go the way of the dodo, at least as far as I'm concerned.

Productive, aren't we?

1. Staying back after work

Make no mistake - there will be times when you're required to stay back after work. Maybe there's too much work and too little time. Maybe it's a client requirement (these pesky time zones!). Or maybe you think it makes you look good in front of management.

If there's too much work (or bugs you can't solve), the trick here is to only stay back when necessary. And, if possible, not to make it necessary. Productivity tends to go down the longer you're at it. At 9pm, you're not going to be plugging away at the code with the same verve you exhibited at 9am. Spending more time in the office is not going to help you. Walk away. Recharge those batteries. Reboot that brain.

If it's a client requirement - sorry honey. That doesn't count as staying back after office hours. As far as the company is concerned, those are your working hours.

If it's just to show your boss that you're worth keeping, for the love of God, stop working for half-wits who think that the number of hours you show your pretty face in the office equals value for money. That may be true if you're a novice. Noobs need to pay their dues. But after you have a few years of experience under your belt, it doesn't look good anymore. In fact, it looks bad. Really bad. If a supposedly experienced developer needs to stay back after office hours to do work he should know like the back of his hand by now, something's very wrong.


Rise and shine, buttercup.

2. Sleeping late

There are 24 hours in a day, and about 6 to 8 hours of it are supposed to be spent in blissful slumber. In bed. Not in the office.

It's gotta be tempting to make the most of your day. Watch that last YouTube video. Complete that last stage on that mobile game. Read that last chapter in that crime thriller. Solve that last bug in your pet project. The list goes on.

But bear in mind your body needs sleep. And sleep deprivation is something that builds up over time. I won't even bother listing down all the negative effects on your physical and mental health, because this is about how it affects your performance at work. That's what makes sleeping late a bad workplace habit.

Even assuming you manage to make it to the office on time, you're operating at sub-optimal levels. A sleep-deprived brain makes mistakes that an experienced web developer has no business making. A sleep-deprived brain tends to produce sloppy code.

Obey your human limitations. They're there for a reason.


That ain't gonna fly.

3. Keeping long fingernails

You must be thinking, you gotta be kidding, right? What has long fingernails got to do with anything? Your fingernails are your prerogative, right?

Correct - to a point. Hygiene and image aren't the reasons behind this, though on that score, it certainly wouldn't hurt. No, the entire point is about work performance.

Let's conduct an experiment. Let your fingernails grow to about a quarter of an inch. Then flip to a random page of your favorite novel and try typing out the entire page. Any difficulty there? Now trim your fingernails and type another page. Are you feeling the difference yet?

The standard paragraph in English would cause you a certain amount of difficulty. Now think how much more difficult typing program code and HTML will be. All those curly brackets, parentheses and special characters. Sound appealing to you? I didn't think so.


Born in the Year of the Octopus.

4. Trying to do too much at once

Productivity is a catchphrase in the industry today. A much overused catchphrase. The more an employee accomplishes within x hours, the more productive he is. Hence the temptation to stick one's fingers into as many pies as possible, at the same time. While Task A is compiling, work on Task B and C. While Task B is being processed, check on Task A and resume Task C. On paper, it's certainly productive. In practice, the human brain functions best when focusing on one thing at a time.

Think about it - when you switch tracks, are you more likely to screw up? Does it take a certain amount of delay before you can fully clear your brain of the last task and concentrate on the task at hand? Therein lies the risk. Sure, there's the possibility that you could pull it all off flawlessly. But the likelihood of missing something is unacceptably high.

Remember this - doing two things right trumps doing five things half-fucked. Because five items half-fucked equals zero items accomplished to satisfaction. Do I need to pull out the tired old cliche "quality over quantity"? I shouldn't have to - because it's true.

Again, obey your human limitations.


Talk to the hand.

5. Being a yes-man

Say no more often. Especially when it's warranted. Sure, everyone likes an easygoing and obliging colleague. They're so easy to exploit.

I want to emphasize here that there's absolutely no harm being helpful - until it starts interfering with your job. Your job - you know, the one the company pays you to do? The completion of which is in your annual KPIs? Yep - that job.

Your colleagues may not realize what an interruption does to your work. You may be on a roll, coding and debugging like a boss, when someone asks you to help unjam the office copier. Or look at their Outlook. Don't blame them - if they were that savvy, you wouldn't be needed now, would you? No, the onus is on you to refuse - and refuse in a manner that discourages further negotiation.

One colleague recently complained that when she interrupted my programming process to ask for help screwing in a lightbulb (I kid you not), I answered with a sneer. My manager explained to her quite nicely that if she so wished, he would get me to stand by to help her screw in all the lightbulbs she wanted - as long as she was willing to take responsibility for all my project delays. I never got any such request ever again.

Phew, what a list!

Those are the bad practices I'd like to discontinue in 2016. They impede effectiveness. But this requires a mindset change too. That probably means leaving the office on the dot so I can go home and trim my fingernails and be in bed by midnight.

No sweat. Er, right?

So make like a bunch of stripper nuns, and drop those habits!
T___T