Sunday, April 17, 2016

What are the best blogs on BigData?

I am looking for some good bigData or Data Science there are some blogs which I found really useful 

 Hadoop Tips - Rant about Big Data and related technologies.

Most of the articles and tutorials posted are of installing and learning hadoop 1.12 which is significantly a older version of hadoop.You can check this blog:
http://technichesblog.wordpress.com



You can learn about the installation procedure and how to run hadoop from this tutorial blog it is well written and there are some demo tutorials of running a hadoop map reduce job in python.
You can download virtual machines preinstalled with hadoop to quickstart learning hadoop but i would suggest learning installation too.  
Download Hortonworks or Cloudera Sandbox
Cloudera QuickStart VM
Hortonworks Sandbox

You can also go through the data analytics materials of google
Data Mining - Research at Google

you can also check youtube for Edureka tutorials.

Edureka Tutorials


Some basic blogs Like.

There are some best books to start learning Hadoop
1.Hadoop: The Definitive Guide
2.Hadoop Beginner's Guide
3.Hadoop For Dummies
Despite of this books you need to stay in touch with some of the blog posts on Hadoop in order to know the updates of BigData like Hadoop Weekly, BigData Weekly-here every week they will publish some best blogs on Hadoop.
You can also get best blogs on BigData technologies in the below link


Happy Hadooping

Wednesday, April 13, 2016

Oozie actions with Sqoop and Pig Joining

This blog is about executing a simple work flow which imports the User data from MySQL database using Sqoop.

The below DAG was generated by Oozie. The fork will spawn a Pig action (which cleans the data) and a Sqoop action (which imports the user data from a MySQL database) in parallel. Once the Pig and the Sqoop actions are done.



Here are the steps to define the work flow and then execute it. This is with the assumption that  MySQL, Oozie and Hadoop have been installed, configured and work properly

Create Tables in SQL

  • Customer Table
 CREATE TABLE customer ( c_id INT NOT NULL,  first_name VARCHAR(14) NOT NULL, Age INT,        gender VARCHAR(20)  NOT NULL,   city VARCHAR(14),         PRIMARY KEY (c_id));

  • Sales Table
 CREATE TABLE sales (
c_id int NOT NULL,
item_id int NOT NULL,
date DATE,
Status VARCHAR(20),
quantity INT
);
ALTER TABLE sales
ADD FOREIGN KEY (item_id)
REFERENCES inventory(item_id);
ALTER TABLE sales
ADD FOREIGN KEY (c_id)
REFERENCES customer(c_id);

  • Inventory Table
create table inventory(
item_id int NOT NULL,
p_name VARCHAR(30) NOT NULL,
price int NOT NULL,
UNIQUE KEY(p_name),
PRIMARY KEY (item_id)
);
Create Job.Properties File

nameNode=hdfs://localhost:9000
jobTracker=localhost:9001
queueName=default
examplesRoot=oozie-ingesting-example
examplesRootDir=/user/${user.name}/${examplesRoot}
oozie.use.system.libpath=true
oozie.wf.validate.ForkJoin=false
oozie.wf.application.path=${nameNode}/user/${user.name}/${examplesRoot}/apps/ING
 Create Workflow.xml File
<?xml version="1.0" encoding="UTF-8"?>
<workflow-app xmlns="uri:oozie:workflow:0.2" name="cs-wf-fork-join">
    <start to="fork-node"/>
    <fork name="fork-node">
        <path start="customer-node"/>
        <path start="sales-node"/>
        <path start="inventory-node"/> 
    </fork>
    <action name="customer-node">
        <sqoop xmlns="uri:oozie:sqoop-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <prepare>
                <delete path="${nameNode}/${examplesRootDir}/input-data/customer"/>
            </prepare>
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
            </configuration>
            <command>import --connect jdbc:mysql://localhost/final --table customer --target-dir ${examplesRootDir}/input-data/customer -m 1</command>
        </sqoop>
        <ok to="joining"/>
        <error to="fail"/>
    </action>
    <action name="sales-node">
        <sqoop xmlns="uri:oozie:sqoop-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <prepare>
                <delete path="${nameNode}/${examplesRootDir}/input-data/sales"/>
            </prepare>
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
            </configuration>
            <command>import --connect jdbc:mysql://localhost/final --table sales --target-dir ${examplesRootDir}/input-data/sales -m 1</command>
        </sqoop>
        <ok to="joining"/>
        <error to="fail"/>
    </action>
    <action name="inventory-node">
        <sqoop xmlns="uri:oozie:sqoop-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <prepare>
                <delete path="${nameNode}/${examplesRootDir}/input-data/inventory"/>
            </prepare>
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
            </configuration>
            <command>import --connect jdbc:mysql://localhost/final --table inventory --target-dir ${examplesRootDir}/input-data/inventory -m 1</command>
        </sqoop>
        <ok to="joining"/>
        <error to="fail"/>
    </action>
    <join name="joining" to="pig-node"/>
    <action name="pig-node">
        <pig>
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <prepare>
                <delete path="${nameNode}${examplesRootDir}/intermediate"/>
            </prepare>
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
                <property>
                    <name>mapred.compress.map.output</name>
                    <value>true</value>
                </property>
            </configuration>
            <script>id.pig</script>
            <param>INPUT=${examplesRootDir}/input-data/clickstream</param>
            <param>OUTPUT=${examplesRootDir}/intermediate</param>
        </pig>
        <ok to="end"/>
        <error to="fail"/>
    </action>
    <kill name="fail">
        <message>Sqoop failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>
  Create Id.pig File
customer = LOAD '/user/vm4learning/oozie-ingesting-example/input-data/customer/part-m-00000' USING PigStorage(',') AS (c_id:int,first_name:chararray,age:int,gender:chararray,city:chararray);
sales = LOAD '/user/vm4learning/oozie-ingesting-example/input-data/sales/part-m-00000' USING PigStorage(',') AS (c_id:int,item_id:int,date:chararray,status:chararray,quantity:int);
inventory = LOAD '/user/vm4learning/oozie-ingesting-example/input-data/inventory/part-m-00000' USING PigStorage(',') AS (item_id:int,p_name:chararray,price:int);
C1 = JOIN customer BY c_id, sales BY c_id;
C2 = JOIN C1 BY item_id , inventory BY item_id;
B = GROUP C2 BY city;
X = FOREACH B GENERATE group, SUM(C2.price);
STORE X into '$OUTPUT';

Copy the required libraries to HDFS

bin/hadoop fs -rmr /user/vm4learning/share/
bin/hadoop fs -put /home/vm4learning/Code/share/ /user/vm4learning/share/

Copy the data related files in HDFS

bin/hadoop fs -rmr /user/vm4learning/oozie-ingest-examples
bin/hadoop fs -put /home/vm4learning/Code/oozie-ingest-examples/ /user/vm4learning/oozie-ingest-examples

Start Oozie

bin/oozied.sh start
http://localhost:11000/oozie/

Submit an Oozie workflow

bin/oozie job -oozie http://localhost:11000/oozie -config /home/vm4learning/Code/oozie-ingest-examples/apps/cs/job.properties -run

The output should appear in the /user/vm4learning/oozie-ingest-examples/finaloutput folder in HDFS after the workflow is complete.

Submit an Oozie coordinator

Modify the start time and the end time in the /home/vm4learning/Code/oozie-ingest-examples/apps/scheduler/coordinator.xml. Make sure it is 1 hr back to the system time. The job will run every 10 minutes.

bin/oozie job -oozie http://localhost:11000/oozie -config /home/vm4learning/Code/oozie-ingest-examples/apps/scheduler/coordinator.properties -run

  • Initially the job will be in the `RUNNING` state and finally will reach the `SUCCEEDED` state. The progress of the work flow can be monitored from Oozie console at http://localhost:11000/oozie/.

  •  The output should appear as below in the 'oozie-ingesting-example/intermediate/part-r-00000' file in HDFS.




Wednesday, March 30, 2016

Which is the most difficult programming language to learn and why?

Sunday, March 20, 2016

why does Microsoft Gives only 1Gb ram in 16k smart phones?



This is not to say that Windows Phone is better than Android or iOS just because it takes up less space. That would be like saying burger is better than pizza because it takes less space :P Current mobile OSes are fundamentally different. 

More of a trivia to put "optimization talks" to rest. Widows phone happens to run the most number of runtimes and graphics libraries. WP has 4 runtime and 2 Graphics stacks. Android has 2 runtimes and 1 graphics stack. iOS has 1 runtime and 2 graphics stacks.
WP has supported Silverlight and Native apps since WP7 days. It had XNA too as a game platform. WP8 added support for DirectX to make porting games easier. WP10 will add Universal runtime too while XNA was deprecated in Windows phone 8.1. It still manages to maintain backwards compatibility and performance across the board. Android hosts a Java Runtime Environment and a Native runtime. Of course you can add other frameworks at will - thanks to the customizability of Android, but they will never work well. Mobile chips just aren't powerful enough. iOS has just 1 Native runtime and that too is sooo frequently modified that you can forget about backwards compatibility. 
WP supports OpenGL and DirectX graphics libraries. DirectX support was added in WP8. Its the library behind high end Console and PC games. These two libraries are fundamentally different and this calls for a radically different Driver Model which the WP pulls off surprisingly well. Android runs OpenGL but can also run whatever the hell you want though not recommended. iOS currently supports OpenGL and Metal (both kind of similar). Metal is based on Vulkan (which is the successor to OpenGL and loosely based on AMD Vulkan) - a low overhead graphics library Developed by Khronos/AMD. This will not be the case for long as OpenGL will soon be phased out and iOS will move entirely to Metal which was introduced with iOS8.


Tuesday, March 15, 2016

What are the best websites to learn programming?

Hi , you can check this website
this website has more than 1200 course and more than 36000 videos
it contain almost all tutorial from the internet also it's free completely
if you want also you can see the all catagory of the site
this website is like the biggest resource for me in all language that i know
i hope that will help you a lot my friend :)

Monday, March 14, 2016

Change your Windows 7 Boring Logon Screen


  1. Download any wallpaper of same resolution as your screen's(should be jpg only).
  2. Make sure if the size of that wallpaper does not exceeds 250kb, if it exceeds250kb then compress it online Compress Image - Compressnow.
  3. Rename the file name as "backgroundDefault.jpg"
  4. Copy file in C:\Windows\System32\oobe\info\Backgrounds\
  5. If there is no folder named Backgrounds in info then create one.
  6. Hit Windows+R for run command.
  7. Type regedit and Hit Enter
  8. After Registry Editor's window opens up, hit Ctrl+F and find this keyword"oembackground"
  9. You will see this screen


Once you'll get this screen Double click on OEMBackground


  1. Press OK and you are done.
Enjoy new Logon Screen and spread this.

Sunday, March 13, 2016

Python script to Notify GTU exam results when uploaded.

Actually I recently made this type of script to check for my 3 Semester result. I used urllib2 and requests module to scrap through the result website.  This script does very simple thing it finds for the keyword of Result of Semester 3 if it founds nothing it goes into sleep for next 15 minutes and if it gets it sends notification to my Desktop ( I use ubuntu so notification won't work in windows ).
Here is the code.
  1. #This is a script checks for Result of 3 sem every 15 Min
  2. #Author Harit Dholakia
  3. #Just for Fun
  4. import urllib2
  5. import re
  6. import os
  7. import time
  8.  
  9. while 1:
  10.  
  11. html_content = urllib2.urlopen('http://www.gtu.ac.in/results.asp').read()
  12.  
  13. matches = re.findall('MCA SEM 3', html_content);
  14.  
  15.  
  16. if len(matches) == 0:
  17. os.system("notify-send 'Yeah' 'Result is not declared yet'")
  18. time.sleep(900)
  19.  
  20. else:
  21. os.system("notify-send 'Oops' 'Result Declared'")
  22. quit()
Here the output.
I kept this script running for two days and I was the First one the get the news of Result.
I luckily scored good marks. :) :)

Xiaomi Launches 32-inch and 43-inch Mi TV 4A in India, Price Starting At ₹13,999

After launching the Mi TV 4 in India, Xiaomi has launched two new affordable smart TVs in India. The company has introduced a 43-inch ...