Free Programming Books

Booksor: why you should never pay for a course to learn programming.

What started as a StackOverflow question for freely available programming books, turned into a thriving GitHub repository for Free Programming Books.

The list itself can be found here. it includes guides to practically every useful (and not so useful) programming language out there.
You can find (among others) some awesome Django tutorials. I highly recommend the Django Book, which has become a pretty complete guide to Django.
There are also great PHP tutorials, though these days I’d recommend to learn the basics and move directly to MVC/CMS systems, depending on what you’re planning to do with the skill (this of course is in case you’ve already know the basics of programming).

I really enjoyed taking a look at the list of Interactive Tutorials, which might convince me to take a few hours a day to learn Go.

Among languages, you can find guides to different components/libraries such as Elasticsearch, BootstrapjQuery & AngularJS.

There’s a pretty heavy section about programming in general (algorithm, data structures & other goodies), though I’ve always been a fan of practice rather than theory.
If this is all completely new to you, I’d recommend dividing learning time and reading time (this will mean you’re going to have to add some hours to your schedule, but it’s worth it)

Where to Start?

That depends, if you’d like to start learning how to make websites (using general terms intentionally), I’d recommend the HTML/CSS section.
I think that starting from Front to Back (front being what the browser renders, back being what the server compiles & computes) make it easier to understand,
not to mention, it’ll be a lot more fun writing 3-4 lines with HTML and already seeing results!

I’d follow with JavaScript, specifically a jQuery fundamentals guide.
JavaScript is becoming a more and more powerful & relevant language every day (mainly due to the rise of NodeJS and JavaScript on the server side in general).
Don’t be confused though, we’re talking about JavaScript on the Frontend, making your pages dynamic, making ajax calls and so on.
Some people would recommend learning JavaScript thoroughly and then (if needed) learn jQuery, I think that for most parliamentary usage, jQuery should do just fine (and would save a lot of JS syntax headache).

Finally, you have to choose a Backend language for your website.
The (by far) most popular one is PHP. I think PHP is so commonly used, and the amount of information out there about the language (as well as some recent updates on the last few versions, such as the PHP web server) makes it the fastest backend language to learn.

Ruby (on Rails) is also increasing in popularity lately, but I think it would be a bit difficult learning Ruby on Rails and continuing learning other things
outside of the Rubyverse.

I don’t have time!

No one does, ever.
Or everyone does, always.

At any rate, I think if you put 1 hour every single day (at least every day that ends with y), you could be building your own website in a matter of months.
Don’t forget – if you make it 2 hours a day, you just cut your learning time in half (well not exactly, as things need to sink in)!

Tagged with: , ,
Posted in Technology

My heart bleeds for System Admins

heartbleed
If you’re working in System Administration or DevOps, you will be asked for years to come:
Where were you on the fateful day April 7th 2014 ? The day the internet had to upgrade its servers.

The versions of OpenSSL that are vulnerable to the Heartbleed bug are OpenSSL 1.0.1 to 1.0.1f (ironically if you haven’t updated your OpenSSL you won’t be vulnerable, at least not for this specific bug).

A lot of upgrades have been done on major websites (Dropbox, Yahoo, Amazon Web Services, to name a few) to make sure they weren’t vulnerable anymore, and some websites haven’t done so yet.

To check if your website is vulnerable, go to filippo.io/Heartbleed/ (which is experiencing slowdowns for obvious reasons), if you’re tech savvy, you can deploy this Go script on your own FiloSottile/Heartbleed.

adf_ly_infected.png

adf.ly , definitely not my favorite url shortener

This might be an annoying process for people, but it is highly recommended to change all your passwords to practically every service you can think of (Facebook, Tumblr, Google, Yahoo, AWS, Dropbox).
Mashable have created a fairly comprehensive list of services that were affected by the Heartbleed bug.
While we’re on the subject, I highly recommend everyone to look into Two-factor authentication on major services, some of them allow this option, and you should demand from others to allow it too.

Until the next major security vulnerability makes headlines.

Update
Relevant XKCD comics cleverly explaining the whole thing

…I remember a time when no one outside the IT community knew anything about those security problems, nowadays everyone is (sort of) aware.

Tagged with: , ,
Posted in Technology

PhoneGap InAppBrowser Tips

Because you’re going to need them…graphic_build_bot

So working with the InAppBrowser is a good way of getting external web content inside your app without too many issues, simply write the following code:

ref = window.open('http://www.google.com', '_self', 'location=no');
ref.addEventListener('loadstop', function() {
	//Page loaded! some code here..
});

Right? Wrong! Sadly it’s not always this easy.

First of all, let’s make a few things clear about the parameters used in window.open:

url – yeah I’m not going to explain this one, if you can’t figure it out, you’re out of luck.

target – So this gives you a few options:

  • _self – Cordova WebView if the URL is in the white list, otherwise in the InAppBrowser.

  • _blank – Opens in the InAppBrowser.

  • _system – Opens in the system’s default web browser

The difference between Cordova WebView and InAppBrowser is still unclear to me, and the docs are lacking on that topic.

options – some extra options, the most useful one is hiding the location bar via “location=no”.

There are some pretty useful options like clearcache for android or transitionstyle for iOS.

Now it’s time to talk about injecting JS into the InAppBrowser window, via executeScript.

Obviously going inside the function called on the event “loadstop”, executeScript should allow you to either insert the script string on call:

ref.executeSript({code: "alert(‘BLA BLA BLA’)"});

Now pay attention here if you want to attach a file, because if the InAppBrowser opens an external page, it won’t let you inject a local JS file (but string of code? sure! Odd I know).

So the creative solution would be to make an Ajax request and inject the code inside the file:

xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","main.js",true);
xmlhttp.onreadystatechange = function() {
	//checking that the request was successful
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    	onsuccess(xmlhttp.responseText);
    }
};

onsuccess = function(response) {
	ref.executeScript({code: response });
}

xmlhttp.send();

This solution works pretty well (and no need for jQuery!)

Blank Screen on Back Button

If InAppBrowser is supposed to be the main application window, when pressing the Back Button, you’ll get a blank screen (which is because the InAppBrowser is technically a different window) – which is your default index.html file (unless you changed it).

To avoid that, you’re in luck – InAppBrowser has an exit event! so just throw this in there:

ref.addEventListener('exit', function() {
	navigator.app.exitApp();
});

What works on Android, doesn’t necessarily work on iOS

I know it’s disappointing because PhoneGap is supposed to fix this, but it’s impossible to demand the exact same thing happening across all system.

I’d say PhoneGap gives you about 75%+ same behavior between platforms, but there are numerous options that are platform specific, sometimes – it’s a good thing.

Tagged with: , , ,
Posted in Technology

Mac In Cloud – Great solution for renting a Mac

macosx102
If you’re making Web Mobile Apps (based on PhoneGap, or Titanium if you insist), you have to get a Mac for deploying on an  iPhone/iPad.
Some of us not only don’t have a Mac in the house, but also don’t plan to ever use one for anything other than deploying apps
(or other necessary Mac usage).
If you’re one of those people, this service is for you.

Mac in Cloud is a rather simple service that gives you access to a Mac via Remote Desktop (Linux users: works great with Remmina).
After registering for an account, you get the configuration files (for different resolutions and bandwidths), and you’re ready to go!
The Mac you get access to is already bundled with lots of programs for developers.

I was surprised to see that even the PhoneGap CLI tool was available, and of course XCode, which made the entire iOS deployment as easy as typing:

phonegap build ios

Mac in cloud is also very cheap (50$ a month for the unlimited plan) considering you’re getting a pretty solid connection to a Mac without having to buy one.

The pricing system lets you choose between pay-as-you-go & subscription plans.
With pay-as-you-go you can buy 30 hours for 30$, whereas subscription lets you have:

3 hours a day - 20$
5 hours a day - 25$
8 hours a day - 35$
Unlimited - 45$
Dedicated Server - 49$

Honestly with those plans I don’t see why anyone would choose anything other than Unlimited,
I think they might want to consider making the prices for limited subscriptions cheaper.

All in all it’s a fast solution, it spares you the time of choosing a Mac and waiting for delivery, configuration and what not, and it’s a LOT cheaper at about 50$ a month.

So if you’re planning to develop an app for the iPhone, and you don’t want to have those extra costs up front, I think it could be a very good experience developing with Mac in Cloud.

Tagged with: , , , ,
Posted in Technology

Planet Expat Interview

PLANETexpat---Blue---Square (1)
Due to lack of time, I haven’t really had the time to write a full post this week.

So instead I decided to simply promote my interview on StartCast with the Co-Founder of Planet Expat.

It was really interesting, especially for people who’d like to go into the Startup world, there’s no better option than getting an internship in a Startup.

This is also a good opportunity for Startups getting some passionate interns!
Without wasting too much time (and words), I’ll leave this post with a promise:

I promise you that next week there will definitely be a post, and it’s an interesting one (happens)!

 
Until next week, Listen to the interview!

 
Asaf

Tagged with: , , ,
Posted in Technology

PhoneGap fixes

graphic_build_bot
or: Android device target Unknown, permissions & script injection

Recently I’ve upgraded my Smartphone (Nexus 5), and when trying to debug some Android Apps on it,
it seemed that the Android Device Chooser couldn’t show much information about the device, namely:

Serial Number: ?????????????
AVG Name: N/A
Target: Unknown

This was odd, but I assumed (correctly) that ADB wasn’t recognizing the device, and thus it wasn’t an Eclipse problem – but the android debug bridge’s problem. As soon as I restarted the adb (find adb first via “locate adb”) via:

./adb kill-server
./adb start-server //might need to sudo this one

Check that your device is now visible and good via

./adb devices

If it still doesn’t work, try disabling and enabling USB debugging on your phone.
Finally, if all those don’t work, try and review this page.

Section 2: Never forget permissions.

Working with PhoneGap can be great, but sometimes you can get errors that have zero information about them on Google.
After getting a very odd bug from PhoneGap when trying to open an external page,
I came across this explanation.
Here I was under the impression that it might be the Cordova version (which I later figured was old because my PhoneGap version was old, all hail the new NPM support!).
Eventually I realized I was just silly and forgot to add the INTERNET permission, which is kind of important, even if ACCESS_NETWORK_STATE is already there.

Section 3: Injecting JavaScript into InAppBrowser
Finally I attempted to inject JS into an inAppBrowser window via

ref.executeScript({ file: ... });

I was wonder at first why that didn’t work, but executing code did.

ref.executeScript({ code: ... });

 

After a relative small amount of information, and a big amount of debugging, I’ve realized it had something to do with the protocol (at least I think).
Because my InAppBrowser was pointing to a website (http://) as opposed to a local file (file://).

Finally I used an XMLHttpRequest to get the local file via JS, putting it inside a variable and executing the code:


xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","customscript.js",true);
xmlhttp.onreadystatechange = function() {
 //Request was successful
 if (xmlhttp.status == 200 && xmlhttp.readyState == 4) {
 execScript(xmlhttp.responseText);
 }
};
execScript = function(resp) {
 ref.executeScript({code: resp });
}

This should solve the problem, until next time!

Tagged with: , ,
Posted in Technology