Workflow

Sun, 04/24/2016 - 09:31

It all started at 8 a.m. when I had a call from a friend to build a simple handy wireless device. The idea was simple. Two devices talking by wireless range of 60 meter at least sending two different signals: right or left. The receiver device had 2 LEDs (each delegating right or left) that light up when the other one presses one of the push buttons.

MX-FS-03V I chose for this job

I searched the web for 433Mhz antenna and found out I could use a simple 17.5cm wire. I installed and wired up my Arduino UNO for testing and connected 2 RFs to seprated UNOs to test it in action.

So this is what I wrote, compiled and uploaded using Arduino IDE for receiver device:

As I was finishing the sample product for my friend he actually came to visit me and he was surprised that it was done already! He's a developer just like me and asked me how could he do stuff like this. I was proud to introduce him Arduino platform and telling him how he could actually write javascript for code and use all the I/O modules to communicate. He soon bought one and now created a watering plant device connected to and iOS app using wifi/GSM.

We both don't intent to build these IoT gadgets for profit but for fun, making us feel like we're making Terminator robots. But what really makes us keep building these cool ugly devices is how much we learned during the process about electronic and stuff. I mean I had no idea what relays are till trying to turn on a 220V lamp with a 5V arduino using my laptop.

Tue, 07/15/2014 - 21:06

I'm about to start my personal startup. What really worries me about this project is will I ever be able to finish it on time? It's a web + mobile app both connected to eachother. It's way too much for just one man and project has a complex structure.

Since I've been having fun with AngularJS and Laravel it seems just fine for me to go through the same road again. But this time, a big portion of project is about writing single-page real-time apps. I've been thinking about how this is going to work and how I'm supposed to write the REST backend in PHP to communicate with client side. The more I think about it, the more Meteor seems a more solid option for me.

It's a startup

How time consuming and complicated this one's going to be? Meteor biggest feature that hits the market is data synchronization. Writing my client side and server side both in pure JavaScript and being able to have direct access to database, meaning no more data loading from REST endpoints.

Usually when a better solution or a new technology like Meteor comes into the market, people get scared. It's like one of those WTF moments that shocks everyone.

I asked myself:

"I was doing it wrong all this time?"

Actually not wrong. But I'm going to be wrong and stupid if I never learn it. This actually reminds me of MongoDB and RoR. How mongo tried to solve cluster database problems and how Rails introduced a whole new level of MVC best practices. People try to ignore it first, but no matter how you're going to feel about it, it's gonna find its way in to the market.

So why should you spend your time learning Meteor rather than another web framework? Leaving aside all the various features of Meteor, we believe it boils down to one thing: Meteor is easy to learn.

It's a true statement, live page updates and data synchronization made me write 100 lines of code in different languages in only 10 lines of pure JavaScript. When a user makes a change, their screen updates immediately — no waiting for the server. If the server rejects their request or executes it differently, the client is patched up with what actually happened. That's it, real-time app with zero lines of code.

After all it's called a startup and I'm scared of not being able to finish it. I'm good with JavaScript, so there's not a long learning curve for me. It's all JavaScript from client-side to server and templating. Even MongoDb console.

Scaling

Actullay the biggest challenge in any real-time web app. Real-time updates for a thousand of users shed servers to pieces. I'm not going to details about what DDP protocol is and how meteor using it, differs from other frameworks but Meteor poll-and-diff technic mixed with Mongo oplog tailing is the key difference.

Image and graphs from MeteorHacks.com

Meteor is built on top of node.js and it's amazingly fast. Like every other application, scaling and performance depends on how you write the code and design the schema. Keeping a copy of each connected user state, takes a certain amount of server's memory. It's up to you what information you want to be accessible in client side.

MongoDB integration with Meteor framework calms you down. Since Meteor 0.7.0 they've implemented oplog tailing. It's a total game changer on how Meteor used to alert clients about changes in database and how it's doing it now. Cluster and multi-core hanlding is one of the important aspects of this project. I can use MongoDB replica sets integration with Meteor now.

Diagram of default routing of reads and writes to the primary.

A replica set is a group of mongod instances hosting the same data, let's divide them to multiple cores then.

One command to compile your entire application into a tarball. Unpack it anywhere there's node.js, run one command, and you're on the air. You're never locked into a particular hosting provider; you have all the code for the platform.

You'll have nodejs + MongoDB + Meteor all in one folder, bundled together. Scaling, is the reason.

Conclusion

Eventhough I'm developing the mobile app in ionicframework using AngularJS, I prefer to use a full stack JS on website too. Meteor is still on early development and hasn't reached stable version 1.0.0 yet and It's got around 18K stars on Github already. Try Meteor once and see how it goes, you'll regret not learning upcoming technologies.

Wed, 07/02/2014 - 18:04

Honestly I mostly develop PHP. I've been using Aptana and Sublime for a while now. I started to use VIM since beginning of 2014 and it really improved my productivity. I don't think anything better could happen to me other than forcing myself to learn VIM. Sublime in the other hand was really fast and quick. It was perfect for front-end, PHP, Python... and it's got VIM built-in. I was using Sublime as much as MacVIM, both great.

April 2014, it was. I downloaded PHPStorm, activated trial and started playing around. I saw the light, it was god who guided me to this. It improves my productivity to a whole new level.

Shortcuts Changes And Tools

I own a MacBook Air and I've been using TotalTerminal since I purchased the device. I changed toggle shortcut to Cmd + 1. No need of using IDE built-in terminals when it's easier and quicker this way, and it's everywhere.

I installed KeyRemap4MacBook and remapped Esc to Right-Cmd. This is bar far the best keystroke to switch to Normal mode in VIM.

Now I could change tabs in TotalTerminal, Chrome and PHPStorm with the same shortcut, and change workspaces with an easier shortcut. I even installed VIM extension on Chrome.

I always split screen into 2 columns. in PHPStorm I use Cmd + l to move cursor into right or left splitter. To move a file into another split without touching the mouse I use Shift + Cmd + l , again a similar shortcut.

These shorcuts make me never use mouse during development. everything from switching desktops and tabs to editing and developing can be done with easy keystrokes. As I first started working with PHPStorm I missed the handy Go Everywhere command triggered by Cmd + p in Sublime, I found that pressing Shift twice does the same in PHPStorm.

Wed, 07/02/2014 - 16:32

You heard it, I finally did it. It's been a long time since I wanted to have this imaginary conversation.

Being free for couple of days or more, I made a promise to myself: launch a new personal website. The old one sucked, I think It's been around 2 years since I wanted to redesign and develop my new website. The moment I started to write the first <?php tag it reminded me of new coming Drupal 8. So why not take a look?

Goals I first wrote on paper about this decision

It was June 29, 2014 that I opened my Evernote and started to write general thoughts on this. I started to think small and all I wanted was a blog and one about page. And then I realized deep down I'm a pure geek, maybe there's too much nerdiness in me. So I decided to make a good resume out of this and use all the latest technologies I know. Well I've been wanting to make a Drupal 8 website for a while now. Nobody wanted me to build their website on a newborn alpha release, not tested platform. So this was my only chance to learn more about it.

Use Drupal 8

This is where it gets interesting cause it's not just about drupal 8 I had to learn. I've been around since early of drupal 6 and before, but this was more about learning symfony-twig not just API changes. Drupal 8 has changed structure. The moment I read the feature list, I got exicted about OOP and MVC new changes to drupal.

I started cloning 8.x HEAD. The moment I began developing theme layer I found more and more changes and a really small amount of docs to back me up. Some APIs were changing back and forth every week. Articles I found about Drupal 8 theme layer were mostly not working and someone in comments keeps mentioning changes. It was certainly not the best time to start using Drupal 8.

First tiny problem I faced was not being able to use $ sign to call jQuery. jQuery Dollar module wasn't ported to Drupal 8 and I didn't have time to open an issue so I made my own sandbox to support this in Drupal 8.

I can't stress enough how happy I am about using .yml files beside symfony routes and services beside DIC. I never thought this would happen in Drupal platform, a framework full of hooks and APIs, storing everything in database. It was painful, I admit it. However seems like some folks aren't happy about these changes, saying it's too much.

Design Clean

I've been desigining and animating for quite some time now, but I never liked it as much as I like developing. What I wanted was a simple, clean, easy-to-read content-based standard typography design, not a fancy home page with parallax effect on top. It needed to be clean.

I added a cool drawing-look menu item, still simple to design, I really like.

Be Responsive

I've done front-end development as much as PHP. I had to make it responsive and I didn't have much time though. I quickly downloaded Foundation and started working. That menu I just told you about is a Reveal effect of Foundation.

I don't like Bootstrap cause it doesn't let me see what's happening behind the scene and makes me use class names all over the place (however you can rebuild bootstrap with less to avoid this) making all the internet look the same. I like Foundation more cause it's just a foundation and I can just use the grid.

95% of web is typography

Don't remember who said this quote right now but I tried. I didn't want to use embedded fonts, just some font stacks. It needs to be readable.

It's not just about the grid that had to be responsive, it's about fonts, images, javascript effects and more. I made use of Prefix-Free, Modernizr and TweenMax.

More Than A Blog

Although it's not completed yet as I'm writing this but I made Projects and Books sections too. It's not just about bloging and a showcase of what I've done. It had to suite my needs for future. Mostly because I've been researching and reading books more and more and I'm trying to be more active in open source projects.