Saturday, 30 May 2015

Amazing Programming Tools For Kids

Top Ten Amazing Programming Tools For Kids 

        The world is changing and it's changing faster, towards a better future. If programming is taught from an initial age, then the young generation may even surpass older generations.Technology is getting developed and getting involved with education, even in kids' education. Kids' programming skills need further encouragement and here we've listed top ten tools to teach programming to kids, which are not necessarily to be taught through school curriculum but at home too.
1. Alice:

This is a tool to create animations, which are quite entertaining. It teaches 3D programming to kids in an interactive mode. It also offers hands-on tutorial for creating animated films and video games too.

2. Crunchzilla Code Monster:

It's designed for kids and has 59 lessons. The speech bubble allows moving from one lesson to the next and the lessons are quite easy as well as interactive. The tutorial introduces variables and parameters in JavaScript coding and it also explains errors. Kids may love the JavaScript tools and the simple graphics. It allows kids play with coding in colourful ways.

3. Scratch:

Scratch is a tool which is developed by MIT Media Lab and it's a visual programming language, meant for 6+ kids. It was released in 2007 and since then more than 800,000 users have joined the tutorial which is related to games and animations. Projects are also shared from this website and projects are uploaded to the site under the license of Creative Commons attribute. It's free and it can be accessed on all major platforms including Mac, Windows and Linux.

5. Etoys:

This tool is aimed at parents to teach programming to kids. They can make graphics, write own stories, develop simple games and so on. It's also free of charge which also gives access to music, animated objects, graphics and sound effects.

6. Logo:

Logo is actually one of the oldest programming languages used for education purposes. Created in 1967, this language is used for educational use and basics of computer science. It implemented Turtle Graphics and it has several resources like Turtle Logo and FMS Logo. Kids enjoy the moving turtle and also the location commands to draw shapes and lines.

7. Hackety Hack:

This is an application which is open source and it teaches programming basics in Ruby language. It's an interactive tutorial which runs on Windows, Mac and Linux operating systems. It also teaches the basics of Ruby syntax and it gives students a solid foundation in Ruby language.

8. Hopscotch:

Hopscotch teaches programming to children in the simplest possible way. It can be downloaded for free on iPad and kids are taught to develop and create animations, games and stories in an interactive manner through drag-and-drop methods. This tool makes programming fun and enjoyable.

9. Waterbear:

It's a very recent development and inspired by Scratch. It also has drag-and-drop objects and it runs on JavaScript. The program allows children provide the logic via parameters and this learning environment is offered on browsers and now through any download. Waterbear is in its initial stage though, which has to undergo several developments.

10. Kodable:

This app is free and iPad users can use it to teach programming to kids, aged 5 and above. The interface is quite a child-friendly one and it's very simple to understand. Programming becomes fun with this tools too which can be enjoyed by all – from 2nd standard children to 12th graders.

Saturday, 21 March 2015

An attempt to answer the frequent question "What happens when you type google.com into your browser

What happens when...

This blogpost is an attempt to answer the age old interview question "What happens when you type google.com into your browser and press enter?"
Except instead of the usual story, we're going to try to answer this question in as much detail as possible.

The "enter" key bottoms out

        To pick a zero point, let's choose the enter key on the keyboard hitting the bottom of its range. At this point, an electrical circuit specific to the enter key is closed (either directly or capacitively). This allows a small amount of current to flow into the logic circuitry of the keyboard, which scans the state of each key switch, debounces the electrical noise of the rapid intermittent closure of the switch, and converts it to a keycode integer, in this case 13. The keyboard controller then encodes the keycode for transport to the computer. This is now almost universally over a Universal Serial Bus (USB) or Bluetooth connection, but historically has been over PS/2 or ADB connections.
         In the case of the the USB example: the USB circuitry of the keyboard is powered by the 5V supply provided over pin 1 from the computer's USB host controller. 17.78 mA of this current is returned on either the D+ or D- pin (the middle 2) of the keyboard's USB connector. Which pin carries the current is rapidly toggled between the two creating a high speed bitstream (the rate depending on USB 1, 2, or 3) serially encoding the digital value of the enter key. This serial signal is then decoded at the computer's host USB controller, and interpreted by the computer's Human Interface Device (HID) universal keyboard device driver. The value of the key is then passed into the operating system's hardware abstraction layer.

Interrupt fires...

The keyboard sends signals on its interrupt request line (IRQ), which is mapped to an interrupt vector (integer) by the interrupt controller. The CPU uses the Interrupt Descriptor Table (IDT) to map the interrupt vectors to functions (interrupt handlers) which are supplied by the kernel. When an interrupt arrvies, the CPU indexes the IDT with the interrupt vector and runs the appropriate handler. Thus, the kernel is entered.

(On Windows) A WM_KEYDOWN message is sent to the app

         The HID transport passes the key down event to the KBDHID.sys driver which converts the HID usage into a scancode. In this case the scan code is VK_RETURN (0x0D). The KBDHID.sys driver interfaces with the KBDCLASS.sys (keyboard class driver). This driver is responsible for handling all keyboard and keypad input in a secure manner. It then calls into Win32K.sys (after potentially passing the message through an 3rd party keyboard filters that are installed). This all happens in kernel mode.
     Win32K.sys figures out what window is the active window through the GetForegroundWindow() API. This API provides the window handle of the browser's address box. The main Windows "message pump" then calls SendMessage(hwnd, WM_KEYDOWN, VK_RETURN, lParam). lParam is a bitmask that indicates further information about the keypress: repeat count (0 in this case), the actual scan code (can be OEM dependent, but generally wouldn't be for VK_RETURN), whether extended keys (e.g. alt, shift, ctrl) were also pressed (they weren't), and some other state.
          The Windows SendMessage API is a relatively straightforward function that simply calls the main message processing function (called a WindowProc) assigned to the window handle (hWnd).
The window (hWnd) that is active is actually an edit control and the WindowProc in this case has a message handler for WM_KEYDOWN messages. This code looks within the 3rd parameter that was passed to SendMessage (wParam) and, because it is VK_RETURN knows the user has hit the ENTER key.

Is it a URL or a search term?

Parse URL...

Check HSTS list...

Convert non-ASCII Unicode characters in hostname

  • The browser checks the hostname for characters that are not in a-z, A-Z, 0-9, -, or ..
  • Since the hostname is google.com there won't be any, but if there were the browser would apply Punycode encoding to the hostname portion of the URL.

DNS lookup...

  • Browser checks if the domain is in its cache.
  • If not found, calls gethostbyname library function (varies by OS) to do the lookup.
  • If gethostbyname does not have it cached then a request is made to the known DNS server that was given to the network stack. This is typically the local router or the ISP's caching DNS server.
  • The local DNS server (or local gateway's) MAC address is looked up in the ARP cache. If the MAC address is missing, an ARP request packet is sent.
  • Port 53 is opened to send a UDP request to DNS server (if the response size is too large, TCP will be used instead).
  • If the local/ISP DNS server does not have it, then a recursive search is requested and that flows up the list of DNS servers until the SOA is reached, and if found an answer is returned.

Opening of a socket

1.Once the browser receives the IP address of the destination server it takes that and the given port number from the URL (the http protocol defaults to port 80, and https to port 443) and makes a call to the system library function named socket and requests a TCP socket stream - AF_INET and SOCK_STREAM.
2.This request is passed to the Transport Layer where the extra love that TCP/IP requires for ensuring packet delivery and ordering is added and then a IP packet is fashioned.
3.The IP packet is then handed off to the physical network layer which inspects the target IP address, looks up the subnet in it's route tables and wrapped in an ethernet frame with the proper gateway address as the recipient.
4.This address lookup and wrapping of datagrams continues until one of two things happen, the time-to-live value for a datagram reaches zero at which point the packet is dropped or it reaches the destination.
5.This send and receive happens multiple times following the TCP connection flow:
  • Client chooses an initial sequence number (ISN) and sends the packet to the server with the SYN bit set to indicate it is setting the ISN
  • Server receives SYN and if it's in an agreeable mood:
    • Server chooses its own initial sequence number
    • Server sets SYN to indicate it is choosing its ISN
    • Server copies the (client ISN +1) to its ACK field and adds the ACK flag to indicate it is acknowledging receipt of the first packet
  • Client acknowledges the connection by sending a packet:
    • Increases its own sequence number
    • Increases the receiver acknowledgement number
    • Sets ACK field
  • Data is transferred as follows:
    • As one side sends N data bytes, it increases its SEQ by that number
    • When the other side acknowledges receipt of that packet (or a string of packets), it sends an ACK packet with the ACK value equal to the last received sequence from the other
  • To close the connection:
    • The closer sends a FIN packet
    • The other sides ACKs the FIN packet and sends its own FIN
    • The closer acknowledges the other side's FIN with an ACK

UDP packets

TLS handshake...

TCP packets

HTTP protocol...

HTML parsing...

  • Fetch contents of requested document from network layer in 8kb chunks
  • Parse HTML document
  • Convert elements to DOM nodes in the content tree
  • Fetch/prefetch external resources linked to the page (CSS, Images, JavaScript files, etc.)
  • Execute synchronous JavaScript code

CSS interpretation...

  • Parse CSS files and

Friday, 6 February 2015

What u can do wid linux....not much..think again

   They say Canonical founder Mark Shuttleworth is aiming for world domination. Well, can you blame him...?All of  this recent years have been a hurricane for Linux and open source. Riding on the back of the Android Wave, Linus Torvald's kernel is going to systems many would never have even imagined. That said, let's look at some of the many things people say you can do with Linux. Try your hand at them too if you can.

  1. Inventory your collection in a database. Linux comes packed with many different types of database tools. For example: You could run a database server with MySQL then use Calligra to connect to it and get a visual overview of your databases.
  2. Fully customize your desktop. I know this seems like a lame thing to throw in the middle of a list of cool things to do, but we all love making Linux our own and Linux offers more options for desktop customization than most OS's. You can even change your window manager.
  3. Learn to program in python, C, C++, Assembler, Scratch, or another language with the wealth of compilers, debuggers and visual editors in Linux.
  4. Test hardware with software like memtest86 or one of the hundreds of tools in the Phoronix Test Suite.
  5. Face off against your friends in a friendly 3D game of Alien Arena.
  6. Host you own cloud server with OwnCloud.
  7. Virtualize other operating systems with virtualization software like Xen, VirtualBox or VMWare.
  8. Go Wardriving for access points: wardriving.com has a lot of links to Linux wireless software.
  9. DJ a party or just remix music you like with Mixxx.
  10. Security and surveillance. You can set up a simple web camera streaming to a website with Camstream or opt for a more professional solution using Zoneminder.
  11. Check out the stars with astronomy and space simulation software (Celestia).
  12. Build a MAME cabinet and run retro games all from one box. One guy's blog about building a mame cabinet.
  13. Hunt hurricanes - older Linux Journal article.
  14. Build a cluster with PelicanHPC - we've actually tried this and it takes less than 20 minutes to set up.
  15. Make movies. Linux has lots of great software that can be used to edit and cut movies including: OpenShot, Kdenlive, LIVES, Toonloop, Avidemux, Kino (old) and Cinelerra.
  16. Write a blog. If movies aren't your thing, but you can write, Linux has lots of software that can connect to blogs (Blogilo), check spelling (spell), or just give you a distraction-free slate (pyroom) to write on.
  17. Edit, organize and publish photographs to social networking sites with software like F-Spot, Shotwell, Fotoxx, Digikam or Rawtherapee.
  18. Create PDFs without expensive software (LibreOffice).
  19. Boot Linux from a Live USB key for troubleshooting or just keeping your surfing secure on a different computer.
  20. Record a podcast with Audacity, and create the music with different midi software (Rosegarden).
  21. Conduct biological sequence analysis. Link to what looks spammish but is actually a large collection of Linux biological sequence analysis software at Bioinformatics.org.
  22. Create 3D models and renderings for your movies or games with Blender.
  23. Build a custom Personal Video Recorder (PVR) with MythTV. Want to never worry about drive space on your PVR? Put a few 4 terabyte drives in a system and run MythTV.
  24. Build a robot using an embedded board and Linux. Linuxpcrobot.
- If you’re a programmer, then Linux has a number of compilers, visual editors and debuggers to offer. These will aid you in your endeavours in programming languages like C++, Scratch, Assembler, Python and others.