Saturday, July 2, 2016

College Does Not Qualify a Programmer

Anyone who looks at college as a relevant way of qualifying a programmer's skills does not know how to program. To all of you knuckleheads out there thinking college is relevant for programming, college is a terrible format for learning how to program, because it is primarily formatted with lecturing, cumulative/aggregate learning that develops from one starting point to a more advanced understanding, memorization. The reason this is a bad format is the following:

1st Reason College is wrong format for learning programming: Lecturing
Lectures don't fit the programmer's learning process because listening and watching someone talk about programming without doing something on a computer is a waste of time. Also, Google is the only fundamental, comprehensive source of information in programming, not some professors lecture notes, which are probably outdated anyways.

2nd Reason College is wrong format for learning programming: Aggregate knowledge
Programming is horizontal stack knowledge, not vertical. Vertical is traveling from a basic to more advanced understanding, whereas horizontal is more like library knowledge where you read the things you want to use. Its not necessary to learn every stack that a program depends on in order to use it because you use apis and interfaces written by other people to do that. College is the wrong format because in order to give off the feel of learning upper level advanced things that aggregate into advanced knowledge, they try to teach people advanced concepts that aren't useful in terms of utility as a programmer, like algorithms, and how compilers work, without actually encouraging people to learn the software stack itself (the code), to be able to use it, and work with it.

3rd Reason College is wrong format for learning programming: Memorization
Testing people on memorized things doesnt fit programming, because you can always look it up online when your programming. Programming isnt a performance, and you dont need to memorize anything. And you probably shouldnt because its just wasting your energy and brainsapce, and you'll make more mistakes by trusting yourself over an online documentation or an ide code completion suggestion.


Flash is better than Web Browser Stack

A lot of people assume that writing websites with html/css/javascript is the fundamental way websites should be written, and a fundamental technology stack when it comes to making websites. However, once you begin to code websites a lot, you start to deal with standards that were developed by world wide web consortium (w3c), in order to form a standard that common browser vendors (chrome/ieexplorer/firefox/opera) implement. The problem is that by separating the web standards committee from the browser vendors, however necessary this is to allow common browser vendors to implement the same software features for developers, it still unavoidably resulted in slow iterations to allow browser vendors time to implement features. Also, since w3c is not a profitable company, it is a community organization that gets funding, the standards it has made over the years haven't developed as quickly or as creatively as they would have if they were a profitable company, that also built the web browser the api was for. The benefit of Flash, is that it is one company, Adobe, that created the entire platform, including a drag and drop web builder (Flash Builder), and iterated their api/platform for optimal developer benefit. This resulted in a better way of making 2 dimensional graphical grid, user interface programs, or in other words websites.

With modern web frameworks like angular and emberjs, the web stack is easier to work with. But Flash will always be the best. Flash has a drag/drop builder that was built by the company that made the stack/api itself, and will always be the best in terms of iterations, and improvements. Even though people will always prefer the web api with browser vendors so that everything is in public domain, the reality is that Flash is better software, and always will be. Adobe should just release it into public domain, maybe take a lot of donations from browser vendors so they can just make their browsers extensions to the Adobe Air platform, and drop Webkit/or watever their rendering engines are. They suck compared to Flash. Just imagine how easy it would be to make websites if developers were using frameworks/api's that were getting iterated on as quickly and creatively as Flash.

Developers and browser vendors should embrace creativity, and the fact is, that Flash already solved the problems Html5 tried to fix decades earlier, and is a much more creative piece of software with more creative company backing it than the community of w3c. It's a fact. Dont argue with reality. If w3c were even close as creative when it comes to web standards iteration, it would not have taken this long to make html5. And the reality is html5 still sucks. So you need other tools to make it better, like emberjs/angular, or some type of templating.

The longer people continue to support w3c and browser vendors using html5/css/javascript instead of flash, the longer people continue relying on public domain software at the expense of developer productivity. Web apis/W3c arent even close to Adobe Flash's level of creativity/software iteration capabilities. And the problem with it not being as good is that programming websites is the most common task in programming, and majority of time spent by developers is associated with websites. If the technology isnt getting iterated on by a real profitable company (or at least adopted by a company that at one point developed it for profit) time is getting wasted using api's that are not as good as possible, because people just don't want to accept Adobe's dominance in 2d graphical grid based, user interfaced technology. There's no reason web browsers cant adopt Adobe Air as dominant technology stack while falling back on html/css rendering when sites arent written with it.

Developer productivity is the only thing that matters. Public domain can get worked around with an Adobe release into public domain, and SEO can get worked around also, with bot crawler improvements. Because in the end developers make websites for money. Why support a technology stack not optimized for productivity. Developer productivity = more profit for developers.

Save yourself the trouble and don't argue with this post in the comments below, you will just be making a fool of yourself. Adobe Flash will always be incomparably better software than the web browser api. Always. You may have to live with web browser development stack, but believing it is better than Flash is incorrect. If you think web browser technology is in any way superior to Flash in terms of pure software / developer productivity, or that it ever will be in the future, you are not appreciating creative software of Flash, and the benefits Adobe's creativity brings to developers and technology.

Saturday, September 14, 2013

CallUrgency for Android

This app (CallUrgency) solves the use case where your phone is ringing and you want to know if the call is urgent, and what it is about before picking up. Any problems? Any ideas? Leave your comments below.


Get it on Google Play

Friday, July 19, 2013

Java library for retrieving SMS email gateway, mms APN settings

At the time of this post, there is currently no library written in Java for retrieving the SMS email gateways of mobile service providers, or mms APN settings given an mcc/mnc pair, or Country code and operator name. This library uses a comprehensive aggregation of mms APN settings, MCC, MNC, Operator/Carrier names, SMS email gateways, and MMS email gateways from many online sources (xda developers , cm10.1 apns-config, Wikipedia  mobile country code page, and other sms email gateways found online).

Here is the final xml: XML

Here is a download for the library: Droidprism.jar
Javadoc:    Carrier.html    APN.html

Usage:
First add Jsoup to the build path.

import com.droidprism.*;

Carrier c = Carrier.getCarrier("US","Verizon");
if(c != null) {
  String smsemail = c.getsmsemail();  
  String mmsemail = c.getmmsemail();
  System.out.println(smsemail + "   " + mmsemail); 
  //prints vtext.com   vzwpix.com
  com.droidprism.APN apn = c.getAPN();
  if(apn != null) {
     String mmsc = apn.mmsc;
     String mmsproxy = apn.proxy; //"" if none
     String mmsport = apn.port; //0 if none
     System.out.println(mmsc +"  " + mmsproxy + "  " + mmsport); 
     //prints http://mms.vtext.com/servlets/mms   0
    }
}


You can also get the carrier from android with mcc and mnc codes:
TelephonyManager tel = (TelephonyManager) 
                  getSystemService(Context.TELEPHONY_SERVICE);
    String networkOperator = tel.getNetworkOperator();

    if (networkOperator != null) {
        int mcc = Integer.parseInt(
                  networkOperator.substring(0, 3));
        String s = networkOperator.substring(3);
        //remove leading zeroes
        int mnc = Integer.parseInt(
                   s.replaceFirst("^0{1,2}",""));
        Carrier c = Carrier.getCarrier(mcc, mnc);
        c.getsmsemail();
        APN a = c.getAPN(); 
    }

Wednesday, June 26, 2013

Dealing with international numbers in Android, Java

If you are writing an application that needs to use international or national phone numbers, this post will show you how international and national numbers work, and how you can correctly handle any phone number whatsoever with libphonenumber, a Java library.


Here is how international numbers work:


International Access Code  + Country Calling Code +  National Number.

For example, here is a call from the US, dialing outside of the US, into London:


011
International Access Code
44
Country Calling Code
20 1234 5678
National Number

The international access code for the US (011) dials outside of the US, the country calling code for the United Kingdom (44) dials into the United Kingdom, and the national number (2012345678) dials the local London number. Here is a resource with international access codes ( also called international call prefix) for all countries: International Access Codes. Here is a resource with country calling codes for all countries: Country Calling Codes.

Alternatively, you can dial a plus sign (+) into a mobile phone instead of the international access code, and the phone will dial the country specific international access code on its own. The equivalent for the above example with the plus sign is: +442012345678. For international calls, Android phones will display incoming call numbers in this format (the plus sign followed by the country calling code, followed by the national number). Sometimes, depending on the phone, Android uses this format for local/national calls also, and sometimes it will display just the national number.

To parse an international phone number correctly from any of the above formats in Java, use the Java libphonenumber library written by Google. This library has its equivalents in other languages such as Php, .NET, Javascript, and iOS. The Java and Php version were tested here. The only version that can be guaranteed by this post to be reliable is the Java version. If you are dialing the number above:
PhoneNumberUtil p = PhoneNumberUtil.getInstance();
String number = "011442012345678"; //can also be +442012345678
String region = "US"; 
PhoneNumber pn = p.parse(number, region);
String nationalnumber = String.valueOf(pn.getNationalNumber()); //2012345678
String countrycallingcode =  String.valueOf(pn.getCountryCode()); // country code for Great Britain
The "US" string is the ISO country code for the United States. A list of ISO country codes can be found here: ISO codes. To get the ISO country code within Android:
TelephonyManager t = TelephonyManager.getInstance();
String country = t.getNetworkCountryIso();
if(country != null) {
country = country.toUpperCase(); // must be upper case for libphonenumber parse method
}
The reason "US" is used is because the number is being dialed from the US. If you are parsing the incoming call in London, from the US, the number will be handled in Android as +442012345678. If the number starts with a plus sign, the region is ignored. The receiving phone should use its own ISO code ("GB") if the number does not start with a plus sign.

Here is how national numbers work:


Trunk Prefix  +  National Number.
A list of country specific trunk prefixes can be found here: Trunk Prefix , or here . The trunk prefix for most countries outside of North America is 0. The trunk prefix for most countries inside North America is 1. For example, here is a call from one phone inside the UK to another inside the UK:

0
Trunk Prefix
20 1234 5678
National Number

The trunk prefix is sometimes omitted. Parsing a national number is the same as parsing an international number. The libphonenumber will recognize if there is a trunk prefix, and correctly identify the country code:
PhoneNumberUtil p = PhoneNumberUtil.getInstance();
String number = "02012345678"; //can also be 2012345678
String region = "GB"; 
PhoneNumber pn = p.parse(number, region);
String nationalnumber = String.valueOf(pn.getNationalNumber()); //2012345678
String countrycallingcode =  String.valueOf(pn.getCountryCode()); //44

The Php version was tested too, and people reading this may have a different experience. The problem with it was it threw an exception for a number like this: 2122322323 with Iso region code "US".

In conclusion, to parse a number with libphonenumber, remove all non digit characters from the number string, get the ISO code of the region from which the number is being dialed (if it is an outgoing number), or the region in which the number is being received (for incoming numbers). Then call the parse method.