YouTube TV

Want to watch videos from YouTube at your comfort of your couch, Don’t have a smart TV, No worries.

All you need is

  • PC or Laptop – with connectivity to your TV (Name it as SCREEN)
  • Android device (Phone or Tablet) or Another laptop (Name it as REMOTE)
  • TV/Monitor with PC input via VGA or HDMI or DVI
  • Speakers (Optional if you have HDMI) or you can use Laptop’s build in speaker
  • Internet access – Off course!!

Don’t have TV, Then. All you can use is your computer / Android device to view videos.

The idea is to control YouTube (Running in SCREEN) using YouTube app (Running on REMOTE).

Wireup. Connect your laptop (SCREEN) to the Internet and to the TV/Monitor (if you have), Speakers…

1. Visit https://www.youtube.com/tv#/ on your laptop (SCREEN) with your favorite browser (Say Chrome). You can go full screen (F11 – Toggle Full screen)

2. Pairing SCREEN and REMOTE

  • Open PAIR DEVICE option from Sign In & Settings on SCREEN (Use arrow keys Up/Down to choose Sign In & Settings and Left/Right to select PAIR DEVICE)
  • on REMOTE, Android device, Open YouTube App, Settings → “Add TV”, Enter the displayed Pairing code and “Add”. You can also do a QRCode scan.
  • on REMOTE, Non-Android device, Visit https://www.youtube.com/pair, Enter the Pairing code under New TV and click “Add this TV”

3. Search Videos in REMOTE and view it in SCREEN.

Interesting Places

Enjoy!!

Interesting Libraries/Frameworks for Linux (C/C++)

 

1. CLISH (Command Line Interface SHell)

A modular framework for implementing a CISCO-like CLI on a *NIX system. Arbitary command menus and actions can be defined using XML files. This software handles the user interaction, and forks the appropriate system commands to perform any actions.
http://clish.sourceforge.net/

2. Libconfig – C/C++ Configuration File Library

Libconfig is a simple library for processing structured configuration files, like this one: test.cfg. This file format is more compact and more readable than XML. And unlike XML, it is type-aware, so it is not necessary to do string parsing in application code.
Libconfig is very compact — a fraction of the size of the expat XML parser library. This makes it well-suited for memory-constrained systems like handheld devices.
http://www.hyperrealm.com/libconfig/

3. libevent – an event notification library

The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts.
libevent is meant to replace the event loop found in event driven network servers. An application just needs to call event_dispatch() and then add or remove events dynamically without having to change the event loop.
http://libevent.org/

4. libcurl – the multiprotocol file transfer library

libcurl is a free and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos), file transfer resume, http proxy tunneling and more!
libcurl is highly portable, it builds and works identically on numerous platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HPUX, IRIX, AIX, Tru64, Linux, UnixWare, HURD, Windows, Amiga, OS/2, BeOs, Mac OS X, Ultrix, QNX, OpenVMS, RISC OS, Novell NetWare, DOS and more…
libcurl is free, thread-safe, IPv6 compatible, feature rich, well supported, fast, thoroughly documented and is already used by many known, big and successful companies and numerous applications.
http://curl.haxx.se/libcurl/

5. jsmn – Minimalistic JSON parser in C

jsmn (pronounced like ‘jasmine’) is a minimalistic JSON parser in C. It can be easily integrated into resource-limited or embedded projects.
jsmn is designed to be robust (it should work fine even with erroneous data), fast (it should parse data on the fly), portable (no superfluous dependencies or non-standard C extensions). An of course, simplicity is a key feature – simple code style, simple algorithm, simple integration into other projects.
http://zserge.bitbucket.org/jsmn.html

6. libmraa – Low Level Skeleton Library for Communication on GNU/Linux platforms

Libmraa is a C/C++ library with bindings to javascript & python to interface with the IO on Galileo, Edison & other platforms, with a structured and sane API where port names/numbering matches the board that you are on. Use of libmraa does not tie you to specific hardware with board detection done at runtime you can create portable code that will work across the supported platforms.

The intent is to make it easier for developers and sensor manufacturers to map their sensors & actuators on top of supported hardware and to allow control of low level communication protocol by high level languages & constructs.
https://github.com/intel-iot-devkit/mraa

Method Call Interception (MCI) in C++

Method Call Interception (MCI) is the technique of intercepting methods, and performing certain extra, specified, operations before / instead of / after the called method. MCI while not the same as Aspect Oriented Programming is the most common technique, used to implement AOP.

As such MCI is often used for

  • Tracing
  • Code Profiling
  • Transaction management
  • Thread safety (locking)

MCI with VC++

When you compile your code with the /Gh option, the compiler automatically adds a call to a function with the prototypeextern "C" void __declspec(naked) _penter(void);

More…

MCI with GCC

GCC has the -finstrument-functions flag which allows you to define two functions that will be called at the beginning and end of each function call:

  • void __cyg_profile_func_enter(void *this_fn, void *call_site);
  • void __cyg_profile_func_exit(void *this_fn, void *call_site);

More…

Also See

Browsing Source Code with OpenGrok

“A wicked fast source browser”

{OpenGrok is a fast and usable source code search and cross reference engine. It helps you search, cross-reference and navigate your source tree. It can understand various program file formats and version control histories like Mercurial, Git, SCCS, RCS, CVS, Subversion, Teamware, ClearCase, Perforce, Monotone and Bazaar. In other words it lets you grok (profoundly understand) source code and is developed in the open, hence the name OpenGrok. It is written in Java. OpenGrok is an open source project and is distributed under CDDL. OpenGrok uses software libraries from Apache Software Foundation.

Steps to get OpenGrok on Ubuntu and Browsing your source code

1. Install Java and TomCat 7

  • $sudo apt-get install default-jdk tomcat7

In case old version of tomcat is installed, check and uninstall before installing Tomcat 7

  • $dpkg --get-selections | grep tomcat
  • $sudo apt-get purge tomcat*

2. Check the details about tomcat

  • $cd /usr/share/tomcat7/bin/
  • $./catalina.sh

Output

    Using CATALINA_BASE: /usr/share/tomcat7
    Using CATALINA_HOME: /usr/share/tomcat7
    Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
    Using JRE_HOME: /usr
    Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar

3. Adding export vars
Edit your ~/.bashrc and include using the directory pointed by CATALINA_BASE include the following vars:
export CATALINA_HOME=/usr/share/tomcat7/
export OPENGROK_TOMCAT_BASE=$CATALINA_HOME

4. Run the tomcat and check if it is working:

  • $sudo /etc/init.d/tomcat7

Done!!! installed!!!! Check if it is running now!!! Using your favorite browser type in the web address: http://localhost:8080/
If ok you should see a web page with message “It works!”

    5. Install C tags

    • sudo apt-get install exuberant-ctags

    6. Installing OpenGrok

    • Download opengrok-0.11.1.tar.gz from java.net/projects
    • unpack into /tools
      $sudo mkdir /tools
      $sudo cd /tools
      $sudo tar –xvzf ~/opengrok-0.11.1.tar.gz
      $sudo chmod 777 –Rv /tools
    • Creating OpenGrok working directories
      $sudo mkdir -p /var/opengrok/src
      $sudo mkdir -p /var/opengrok/data
      $sudo mkdir -p /var/opengrok/etc
      $sudo chmod 777 –Rv /var
    • Deploying Opengrok
      /tools/opengrok-0.11.1/bin$sudo ./OpenGrok deploy
      Alternatively, copy OpenGrok all into Tomcat’s webapp folder
      $sudo cp /tools/opengrok-0.11.1/lib/source.war /var/lib/tomcat7/webapps
    • Checking OpenGrok – Visit http://localhost:8080/source/

    7. Specifying Source folder

    • $sudo cd /var/opengrok/src
    • $sudo ln -s /home/<username>/src_base/ src_base

    8. Indexing your source code

    • $sudo /tools/opengrok-0.11.1/bin/OpenGrok index
      Alternatively, You can invoke with path containing your source code.
    • $sudo /tools/opengrok-0.11.1/bin/OpenGrok index /home/<username>/src_base/

    9. Visit http://localhost:8080/source/ and start browsing your code!!

    Tame your Inbox with the 4 D’s

    Do it, Delete it, Defer it, Delegate it

    For every message in your Inbox:

    • If it isn’t important, delete it immediately.
    • If it can be done in two minutes or less, do it (reply, file, call, etc.).
    • If it isn’t for you or if you can, delegate (forward) it.
    • If you need to do it, but it takes longer than two minutes (including reading), defer (hold off on) it.

    Delete it

    Delete messages that you don’t need to read. If it is junk, delete it.

    Do it: The 2-minute drill

    It is amazing what can be done in two minutes. But if a message takes longer than two minutes to deal with, defer it. To get a sense of what two minutes feels like, try timing yourself.
    Once you have dealt with the message, do one of the following:

    • Delete it if it is something of little consequence.
    • File it in one of your reference folders (for example, 1-Reference).

    Delegate it

    Sometimes you receive a message that is really meant for someone else to deal with. In these cases, reply and include the person to whom you are delegating the message on the To line. If you want to follow up later, flag it for yourself before sending. In your To-Do Bar, mark the task with the “@Waiting” category.

    Defer it

    Deferring a message means that you will come back to it later, when you have time.
    Reasons to defer a message:

    • It cannot be dealt with in less than two minutes.
    • It will take a while to read.
    • It will require a carefully crafted response.
    • It requires additional action in another program (for example, “Need to add to <name> document”).

    Automation and Boost your Productivity

    1. AutoHotKey

    Fast scriptable desktop automation with hotkeys
    Creating your own apps and macros has never been easier

    AutoHotkey is a free, open-source macro-creation and automation software utility that allows users to automate repetitive tasks in Microsoft Windows. Any application user interface can be modified by AutoHotkey (for example, overriding the default Windows control key commands with their Emacs equivalents). It is driven by a custom scripting language that is aimed specifically at providing keyboard shortcuts or hotkeys.

     

    2. SmartGUI Creator for AutoHotKey

    SmartGUI Creator is an easy point-n-click GUI (user interface) creator!. You just draw a user interface the way you like and a script will be generated where you can input code deciding what happens when a certain button is pressed etc.
    http://www.autohotkey.com/board/topic/738-smartgui-creator/

    3. AutoIt

    AutoIt is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!
    https://www.autoitscript.com/