Powered By Blogger

Monday 30 November 2015

DEVELOPERS INDEED(INTEL XDK)






Hi readers, I am extremely happy you are looking at this right now. From the header I can confidently ascertain that  you are either a software developer, programmer, coder, software engineer or what not. If you are none of those listed up there, you are probably a lover of technology.

My subject today is focused on the PRESTIGIOUS INTEL XDK. Well, I raised my eyebrows as to this new development. I as a growing software developer personally dislike writing codes with IDEs except in rare cases where the environment requires that I do. For example, developing Android applications requires that I use have eclipse installed with the neccesary plugins or that I do with an the Android sdk.Another instance is developing for Windows mobile, one needs the Visual Studio sdk (That's as far as I can go, not a fan anyway).

It bothers me when I see young developers like me (not me) writing Java, PHP, html, programs in Eclipse, InteliJ, Netbeans and every other SDK they can lay their hands on. However, I get booed when they find me do my thing on a text editor that gives me crazy stress.

WHY?
SDKs make you get through bugs as easily as possible, and also places a very large opaque and ridiculous wall just in-front of your eyes, restricting you from digesting vital informations. I personally code Java using a very beautiful text-editor (Sublime_Text). I like to do that because I tend to take note of specific details while I code and on the long run I can write as long as 50 lines of code to perform interesting tasks and then pop up my cmd.exe and launch my app with no errors. That was amazing.

So, here is my point, Keep calm and Code on. No shortcuts. It actually pays off. Use the XDKs if you have to, don't jus make them a lifestyle until you are well grounded.

Look at some examples:
James Goslin, creator of Java and Computer Science graduate. He probably never handled an IDE while designing and building Java. 

Linus Tovarld, creator of Linux O.S (2% of the whole thing tho). He did this without these tools we all clamour about.

I get your point, of course life gets better, easier and funner and I'm not saying don't use IDEs, Just set a standard. That's all.

Sorry about all these arrangements, I'm still an amatuer blogger or let's say, an hobbyist. Enjoy

Tuesday 28 July 2015

FRESH, INTERESTING AND AMAZING UPDATE IN JAVA 8

HI GUYS

It's been a minute, (a while). I've been pretty busy doing a few things you do not need to know. However, this write-up explains how to read from files. This is a new update on the Java8 jdk and it's really an amazing  development.

Java 8 has added a new method called lines() in Files class which can be used to read a file line by line in Java. The beauty of this method is that it reads all lines from a file as Stream of String, which is populated lazily as the stream is consumed. So, if you have a huge file and you only read first 100 lines then rest of the lines will not be loaded into memory, which results in better performance. This is slightly different than Files.readAllLines() method (which reads all lines into a List) because this method reads the file lazily, only when a terminal operation is called on Stream e.g. forEach(), count() etc. By using count() method you can actually count number of lines in files or number of empty lines by filtering empty lines. In fact, you can do a lot more than just reading content from file, you can filter them on some criterion e.g. filter lines which are not starting with a specific word, filter lines whose length is greater than 100, trim all lines to remove leading and trailing space, convert each lines into uppercase or lowercase etc. In short, you can use different methods from java.util.stream.Streams class to process lines read from file before printing them or returning them to caller. It's not just lambda expression, which is introduced in Java 8, there are many more goodies like this which are hidden behind aura of big features like lambdas and streams. You can read Java SE 8 for really impatient or Java 8 in Action to learn more about such hidden gems.

How to Read File line by line in Java 8

In this short example, I have discussed three ways to read a text file line by line in Java 1.8. My first example is about the classical approach of reading file line by line using BufferedReader. You can also use Scanner in place of BufferedReader if you are using Java 1.5 but you can see that its not smooth. You need to first create a FileReader to read file, which uses platform's default character encoding for converting bytes to character. Than, you need to wrap that inside BufferedReader to take advantage of in memory buffering and readLine() method of BufferedReader class. This method can be used to read file line by line, it returns null if there is no more lines to read. If you also want to count total number of lines or want to display line numbers along with each line, you can use a count variable as shown in our first example.  You can see, almost 9 to 10 lines of code is required to read a file line by line prior to Java 8.


There are couple of ways to read file line by line in Java 8 e.g. by using Files.readAllLines() method, which returns a List of String, which are nothing but lines from File. There are two overloaded version of this method, one which accepts a character encoding and other which uses UTF-8 charset. Only problem with this method is that its not lazy like the next method, I am going to show you guys, but it also has an inherent advantage, it ensures that file is closed when all bytes have been read or an I/O error, or other runtime exception is occurred. You can see this Java 8 tutorial to see this method in action.


Better way to read a text file line by line in Java 8 is by using Files.lines() method which take advantage of Stream API introduced in Java 8. This method is lazy and only reads lines when some terminal operation is performed on Stream e.g. when you call forEach() method to display lines from file or call count() method to calculate total number of lines form file. This method also comes in two overloaded version, one which accept a given character encoding and other which by default uses UTF-8 encoding to convert bytes to character from file. Only disadvantage of this method is that it doesn't ensure that file is closed once all lines are read. The returned stream by this method encapsulates a Reader and if you don't want to rely on operating system for disposing file handlers, you make sure to call this method inside try-catch, try-finally or try-with-resource block to ensure that close() method is called once stream operation is completed. I have not wrapped code inside try-with-resource statement to improve readability but that is must if you are doing it for production code.

HERE IS A CODE EXAMPLE.

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;


/**
 * Java Program to demonstrate how to read a file line by line in Java 8
 * @author Javin Paul
 */
public class Java8FileReader {

    public static void main(String args[]) throws IOException {
        
        // reading a file line by line before Java 8
        FileReader fr = new FileReader("manifest.mf");
        BufferedReader bufr = new BufferedReader(fr);
        
        int count = 1;
        String line = bufr.readLine();
        System.out.println("Old way of reading file line by line in Java : ");
        while(line != null){
            System.out.println(count + " : " + line);
            line = bufr.readLine(); count++;
        }
        
        bufr.close();
        
        // reading file line by line in Java 8
        System.out.println("Reading file line by line using Files.lines() in Java 8");
        Files.lines(Paths.get("manifest.mf")).forEach(System.out::println);
        
        // You can do even better, you can read all lines
        // trim them and filter out all empty lines
        // before printing as shown in following example 
        System.out.println("Doing more things than just reading file using Java 8 Streams");
        Files.lines(new File("manifest.mf").toPath())
                .map(s -> s.trim())
                .filter(s -> !s.isEmpty())
                .forEach(System.out::println);
        
        // You can also filter line using String methods
        // e.g. print only lines which starts with "
        System.out.println("Printing lines which startswith );
        Files.lines(Paths.get("build.xml"))
                .map(s -> s.trim())
                .filter(s -> s.startsWith("))
                .forEach(System.out::println);
    }


}

Friday 16 January 2015

IF YOU WILL DIE TOMORROW

I had the habit of giving these excuses
1. I have a bad computer
2. My computer has no electricity backup
3. I was not able to get it done
4.I tried all I can....

In my heart I really want to be consented to, and I feel like, "DON'T YOU JUST GET???" I tried, I just could not make it up. I always experienced an heavy throat while this happened, that tears were almost coming out of my *butts >lol<.. This was because I was sure I did try a lot BUT not enough to get the work done. So, what's the point in trying so hard when eventually you could not get the Job done. I call that crap (I've been in several craps of such anyway).

There was this one thing I discovered one thing |LAZE|. That was it. Your spirit wants it but your body can't help you get it done. You need to begin to listen less to your body else you'll get nothing done.

REMEMBER:

The reason you're trying to get it done is because it's worth it, If it's worth a try, then it's worth getting done.

Friday 19 December 2014

SEE WHAT BILL CLINTON AND OTHER SAY ABOUT PROGRAMMING

PRESIDENT BILL CLINTON

At a time when people are saying "I WANT A GOOD JOB- I GOT OUT OF COLLEGE AND I COULDN'T FIND ONE", every single year in America, there is a standing demand for  120,000 people who are training in computer Science.

BILL GATES 

CHAIRMAN-MICROSOFT
Learning to write programs streches your mind and helps you to think better, creates a way about doing things that i think is helpful in all domain.             

CHRIS BOSH
(wrote code in high school)
NBA-ALL STAR_MIAMI HEAT
Coding is very important when you think about the future, where everything is going. With more phones and tablets and computers being made, and more people having access to everything and information being shared. I think its very important to be able to learn the language of coding and programming.

MARCO RUBIO
SENATOR-FLORIDA
Computer programmers are in great demand by American businesses, across the tech sector, banking, entertainment, you name it. These are some of the highest paying Jobs, but there are not enough graduates to fill these opportunities

MARK ELLIOT ZUCKERBERG
FOUNDER _ FACEBOOK
Our policy at Facebook is literally to hire as many talented engineers as we can find. There just aren't enough people who are trained and have these skills today. 

RANDY WEINGARTEN
PRESIDENT- AMERICAN FEDERATION OF TEACHERS
Computers have and will continue to change our world, and programmers will continue to be essential, but I know first by studying FORTRAN, that many of us get intimidated by it and we shouldn't be. Computer Programming has become far more accessible to teach and learn , and our country needs more students to learn it.

Culled from code.org




QUOTES BY DANIEL





Hi readers, what i have here is a list of quotes i wrote. Inspired by God as a result of my experiences. 


 "SUCCESSFUL PEOPLE DEFY THE ODDS TO ACHIEVE GREATNESS"
                                                                                    DANIEL 


"I WAS WONDERING IF I COULD JUST SEND GOD AN E-MAIL TELLING HIM  ALL MY PROBLEMS"
                                                                                    DANIEL


"THERE IS NO LIMIT TO WHAT YOU CAN THINK, THERE IS NO LIMIT TO WHAT YOUR THOUGHTS CAN PRODUCE, THERE IS NO LIMIT TO HOW MUCH YOUR MIND'S PRODUCTS CAN AFFECT LIVES (+VELY), THERE'S NO LIMIT TO WHICH THOSE LIVES CAN CHANGE OUR WORLD. REMEMBER, IT ALL ENVISAGED FROM YOUR MIND, STARTED FROM YOUR THOUGHTS"
                                                                                    DANIEL


"A THOROUGH<>THINKER CAN BE A BEST DECEIVER, ONLY BECAUSE HE THINKS THOROUGHLY, "

Monday 15 December 2014

REFLECTIONS

I dropped this post on my Facebook account few days ago, I'll love to share it with my blog readers. Its still about my mentor. It's not meant to imply that this blog is all about my mentor, but what will I do to surprise my someone who played a v.important role in my life(mentor) ? Just like MT N's current Christmas question, my answer to it is TELL HIS STORY TO THE WORLD. That's just what I'm doing. Also, the idea of telling his story to the world is not from  MTN, it's my IDEA! I was overwhelmed to discover that promo. I'll probably vote him in.

HERE WE GO:

Reading through our previous chat motivates me, although he rarely replies my WHATSAPP chat, but as busy and tight as his schedule may be, he makes out time to say "Hi Daniek", and then spells it right, Hi Daniel(typographical error tho)lol. Presenting my line of codes full of bugs (i should rather say, "presenting bugs to him>> because nothing seemed to work right") and unfinished work scares the spongy stuff in my chest and it accelerates faster. On observing the anxiety on my face, he gently says, let's see what Daniel has here.

while (daniel expects heartwarming comments){
       he checks out the code;
       comments;
       daniel gets dissapointed in himself and is challenged to make it look better next time;
}

He will emphatically say>> "This is logic error" (I never knew what that meant, i just read about it recently). Thank God!!!! It was not Syntax Error.(because i knew what syntax error is). Even if he did explain, i never understood what logic eror meant, and the day i did, i recalled what he said in one of our meetings *I QUOTE*

 "99% OF WHAT YOU'LL LEARN IN PROGRAMMING IS NOT FROM WHAT I TELL YOU, IT'S WHAT YOU LEARN AND DISCOVER ON YOUR OWN".
                                                                                                     

 If you intend to program it should be something you need to know, and do not forget if you are reading this, I should be you mentor because you saw it here:::on my blog.|just kidding|. As warped as it may seem, meeting someone like him is more that inspiring, LIKE I SAID, 10 lines of his story swept me off my feet.


Wednesday 10 December 2014

Until he mentioned that his hobbies include arguments and his unwillingness to submit to someone Else's knowledge as a result of a perfect certainty of what he knows, I would have insisted he's a phlegm. His words were "I love to argue out what I know, else I'll rather keep mute". At that point I discovered he's choleric. Stern at my act of laze in not being able to write simple loops to get works done, and my flimsy excuses for such occurrence. As much as I thought I had excuses, ten lines of his story. swept me off my feet. Most surprising was how he got his first computer 213mb Ram, (cant recall the hdd size).