Category Archives: Homeschool

Adding JavaScript Inside Your WordPress Posts

While writing any post change mode from Visual to HTML and paste your javascript there.

Excluding this there are many plugins available which allows you to add javascript in WordPress posts.

You may try this plugin also Custom fields shortcode. Although this plugin hasn’t been updated in over 2 years but it works good without  showing any error in my blog.

Useage:

Use [cf] shortcode in your post content to show the custom field value without editing any of your WordPress theme files.

For Example:  [cf] FieldName[/cf] returns value of ‘FieldName’ custom-filed.

Check similar plugins here.

Another ILL-Defined Copyright Law, This Time From Japan

Japanese would be experiencing a new rubbish  from the coming October. Japanese police is monitoring the file sharing networks so that they can raid the innocent people who are downloading videos instead of watching them online. Yes, in accordance to this law you can stream videos online but you are not free to save those digital copies locally. Other than this you can save comic strips from other websites and cut, copy and paste all text because schooled idiots from Agency for Cultural Affairs has interpreted ‘DOWNLOAD’ as audio-video recording.

Actually downoad is the process of copying data but Japanese Agency for Cultural Affairs thinks that download is just audiovisual recording.

They say that TV shows which are already been broadcast and yet not available in the market may be downloaded.

A Japanese Lawyer writes:

Many people remain unclear about what is exactly banned under the law.

For checking that the content is safe for download this agency asks Internet users to look for a recording industry trademark called the L Mark which cannot be used by just anyone because if you need to use this mark then you have to join Recording Industry Association of Japan and pay money to them. They don’t say a word for Creative Common and GPL. However if you got the audiovisual content legally then you are free to share it with your friends by mailing them because mailing and download are two different words where download looks a bit pirate type.

Listing MySQL Databases

For showing all database:

SHOW DATABASES;

In case you need to filter database by name:

SHOW DATABASES LIKE ‘pattern’;

For complex filtering of database use WHERE Clause:

SHOW DATABASES WHERE conditions;

With WHERE clause one can use regular expressions like ‘<‘ and ‘>’ operators, string functions etc. for filtering records returned by SHOW DATABASES.

PHP Array Functions

PHP Array functions need no installation. These functions are the part of PHP core.

array_change_key_case — It changes all keys in an array
array_chunk — It split an array into chunks
array_combine — It creates an array by using one array for keys and other for its values
array_count_values — It counts all the values of an array
array_diff_assoc — It computes the difference of arrays with additional index check
array_diff_key — It computes the difference of arrays using keys for comparison
array_diff_uassoc — It computes the difference of arrays with additional index check which is performed by a user supplied callback function
array_diff_ukey — It computes the difference of arrays using a callback function on the keys for comparison
array_diff — It computes the difference of arrays
array_fill_keys — It fill an array with values, specifying keys
array_fill — It fill an array with values
array_filter — It filters elements of an array using a callback function
array_flip — It exchanges all keys with their associated values in an array
array_intersect_assoc — It computes the intersection of arrays with additional index check
array_intersect_key — It computes the intersection of arrays using keys for comparison
array_intersect_uassoc — It computes the intersection of arrays with additional index check, compares indexes by a callback function
array_intersect_ukey — It computes the intersection of arrays using a callback function on the keys for comparison
array_intersect — It computes the intersection of arrays
array_key_exists — It checks if the given key or index exists in the array
array_keys — It return all the keys or a subset of the keys of an array
array_map — It applies the callback to the elements of the given arrays
array_merge_recursive — It merge two or more arrays recursively
array_merge — It merge one or more arrays
array_multisort — It sort multiple or multi-dimensional arrays
array_pad — It pad array to the specified length with a value
array_pop — It pop the element off the end of array
array_product — It calculate the product of values in an array
array_push — It push one or more elements onto the end of array
array_rand — It pick one or more random entries out of an array
array_reduce — It iteratively reduce the array to a single value using a callback function
array_replace_recursive — It replaces elements from passed arrays into the first array recursively
array_replace — It replaces elements from passed arrays into the first array
array_reverse — It return an array with elements in reverse order
array_search — It searches the array for a given value and returns the corresponding key if successful
array_shift — It shift an element off the beginning of array
array_slice — It extract a slice of the array
array_splice — It remove a portion of the array and replace it with something else
array_sum — It calculate the sum of values in an array
array_udiff_assoc —It computes the difference of arrays with additional index check, compares data by a callback function
array_udiff_uassoc — It computes the difference of arrays with additional index check, compares data and indexes by a callback function
array_udiff — It computes the difference of arrays by using a callback function for data comparison
array_uintersect_assoc — It computes the intersection of arrays with additional index check, compares data by a callback function
array_uintersect_uassoc — It computes the intersection of arrays with additional index check, compares data and indexes by a callback functions
array_uintersect — It computes the intersection of arrays, compares data by a callback function
array_unique —It removes duplicate values from an array
array_unshift — It prepend one or more elements to the beginning of an array
array_values —It return all the values of an array
array_walk_recursive — It apply a user function recursively to every member of an array
array_walk — It apply a user function to every member of an array
array — It create an array
arsort — It sort an array in reverse order and maintain index association
asort — It sort an array and maintain index association
compact — It create array containing variables and their values
count — It count all elements in an array, or something in an object
current — It return the current element in an array
each — It return the current key and value pair from an array and advance the array cursor
end —It set the internal pointer of an array to its last element
extract — It import variables into the current symbol table from an array
in_array — It checks if a value exists in an array
key — It fetch a key from an array
krsort — It sort an array by key in reverse order
ksort — It sort an array by key
list — It assign variables as if they were an array
natcasesort — It sort an array using a case insensitive “natural order” algorithm
natsort — It sort an array using a “natural order” algorithm
next — It advance the internal array pointer of an array
pos — It is the alias of current
prev — It rewind the internal array pointer
range — It create an array containing a range of elements
reset — It set the internal pointer of an array to its first element
rsort — It sort an array in reverse order
shuffle — It shuffle an array
sizeof — It alias of count
sort — It sort an array
uasort — It sort an array with a user-defined comparison function and maintain index association
uksort — It sort an array by keys using a user-defined comparison function
usort — It sort an array by values using a user-defined comparison function

PHP Arrays

Arrays are sets of data; can be defined in a PHP Script. Arrays can contain other arrays inside them without any restriction, hence building multidimensional arrays. Arrays can be referred to as tables or hashes.

You can create Arrays in two different ways. The first involves using the function array. The second involves using square brackets.

First is The Array Function Method

In the array function method you create a array in the scheme of:

$foo = bar()

For example, to set the array up to make the keys sequential numbers (Example: “0, 1, 2, 3”), use:

$foobar = array($foo, $bar);

This would produce the array as follows:

$foobar[0] = $foo
$foobar[1] = $bar

It is also possible to define the key value:

$foobar = array(‘foo’ => $foo, ‘bar’ => $bar);

This would set the array as follows:

$foobar[‘foo’] = $foo
$foobar[‘bar’] = $bar

And,

Second is The Square Brackets Method

The square brackets method allows you to set up by directly setting the values.

For example:

To make $foobar[1] = $foo, what you should do is:

$foobar[1] = $foo;

The same applies for setting up the key value:

$foobar[‘foo’] = $foo;

Other Array Lessons:

Surf The Web From Keyboard Without Using Mouse

DeadMouse, a Google Chrome extension lets you to follow webpage links directly from keyboard without using mouse.

If you want to check it live then click here

Features:

  • Follow any link by typing
  • Fuzzy-matching on link text
  • Press Enter to follow the link
  • Tab-cycle through multiple matches
  • Shift+Enter to open link in a new tab

Download:

 Note: If you don’t use this extension then also you can visit any web page by typing and pressing enter after you open Google Chrome or its new tab.

Use tab (keyboard key) for moving your selection to various links, enter for opening them and shift + enter for opening them in a new tab.

Google Maps Now Comes In 22 American Museums

Google maps are becoming prevalent to Cultural places. There are 22 museums using Google Maps:

  • The de Young in San Francisco
  • The Philadelphia Museum of Art
  • Cincinnati Museum Center
  • The Indianapolis Museum of Art
  • The American Museum of Natural History
  • Smithsonian museums

And 17 largest museum complex all over the world, consisting of 19 buildings, one national Zoo, galleries and outside Washington it will be visible on Android machines. The number of extensions of maps on the mobile system of Big G touches it the target of 10 000. The art pieces are tens of millions.

Kubuntu Office Suites

LibreOffice is GPL-licensed free and open source office suite , with Writer, Impress, Calc spreadsheet, Base relational database frontend
Install using sudo apt-get install libreoffice-kde

Open Office was installed by default in older versions of (K)Ubuntu. It has been replaced by LibreOffice (which is similar) and is no longer available in (K)Ubuntu.

KOffice suite is part of the KDE project and provides capabilities of OpenOffice suite without the licensing restrictions of OpenOffice. It can be used in any version of (K)Ubuntu. Install using: sudo apt-get install koffice

AbiWord is a fast, collaboration-enabled word processor. For the most current version see the AbiWord web site. For install from repositories: sudo apt-get install abiword

GoldenDict is multi-lingual dictionary and translator that supports Babylon and StarDict translation dictionary files and has multiple modular plugins. Install using: sudo apt-get install goldendict

Xournal is a free (GPL-licensed) GTK/Gnome-based application for notetaking, sketching, or keeping a journal using a stylus. Install using( Remember: universe repositories must be enabled): sudo apt-get install xournal

Introducing Mozilla Persona An Identity System For The Web

Mozilla Introduced Mozilla Persona An Identity System For The Web with three newly updated features:

A Better Way To Sign In:  Improved way of signing in to your websites. Instead of managing multiple usernames and passwords across your favorite sites and devices, you get more time to do the useful stuff.

You Own Your Data: Many sign-ins carry your profile data and some even share that info with other sites and social networks. Persona lets you get started with only your email address and you get the option to add profile data later on where you think it’s appropriate.

Ease for publishers: Enabling Browser ID, the underlying Persona technology, on your site only takes a few lines of code and helps build good relationships by providing users with a trusted sign-in option.

You may also try it yourself, visit here.

Also Check Personas Themes in Firefox here.

Facebook Groups Start Showing Who Saw Each Post

Yesterday Facebook introduced a new group feature on Facebook’s Newsroom. Facebook groups are the places for similar interests, activities, ideas where your are free to share things with the people having common interest on a particular subject. You can join a group to get connected with the communities, organisations etc.

Now when you visit any group  you can view who’s seen each post and you can easily get updated with the group’s ongoing activity. Like in Open Source Council (a Facebook group) if you share a link or may be your blog post then you will see who got its update.

Get Twitter Service Updates Through Its Different Accounts

@twitter: Always wondering what’s happening.

@twitterapi: The Real Twitter API. I tweet about API changes, service issues and happily answer questions about Twitter and our API. Don’t get an answer? It’s on my website.

@twittermobile: To get Mobile Updates

@spam: Suspect Twitter spam? Let us know (http://bit.ly/Tweport)! Follow @spam & @safety for helpful info, and check out our favorite tips: http://bit.ly/spamfav

@feedback: Collecting ideas and feature requests! We can’t reply to everyone but we do actively read your @mentions!

@support: Updates from Twitter User Support. We’re unable to assist with account suspension/verification.

@safety: Twitter’s Trust and Safety Updates! Twitter HQ · http://help.twitter.com/forums/10711/entries/76036 

@fledgling:A Twitter wine project that promotes literacy around the world. San Francisco · http://www.fledglingwine.com

@hope140: Now @TwitterGood Highlighting forces of good in the Twitter community.

@twitterbusiness: Twitter for your business, community group, government organization or school

@twitterads: We tweet for brands. San Francisco, CA · http://advertising.twitter.com

@twittercomms: Talking to everyone, all at once! · http://blog.twitter.com/

@twitterSF: San Francisco born and bred. Looking to make a positive impact on our hometown.

@mobilesupport: Updates from Twitter Mobile Support. · http://support.twitter.com/groups/34-mobile

@twi: The official Twitter India account

@twitter_kr: 트위터 관련 다양한 소식을 전해드리는 공식 트위터 대한민국 계정입니다! 대한민국 · http://blog.kr.twitter.com/

@twitter_es: ¡Bienvenidos a la cuenta oficial de Twitter en español! ¿Eres nuevo? Empieza aquí https://twitter.com/#!/welcome San Francisco, CA · http://blog.es.twitter.com

@twitter_fr: Bienvenue au compte officiel de Twitter en France ! Pour plus d’infos rendez-vous sur http://blog.fr.twitter.com ! San Francisco CA · https://twitter.com/welcome

@twitter_de: Der offizielle deutsche Twitter Account!———http://blog.de.twitter.com Bei Support-Fragen findet ihr Antworten unter https://support.twitter.com/forms

@twitter_pt: Bem-Vindos à conta oficial do Twitter em português!http://blog.pt.twitter.com/

@twitter-ru: Приветствуем вас на официальной учётной записи Твиттера на русском языке! Сан-Франциско, Калифорния

@twitter-tr: Twitter Türkçe resmi hesabı http://blog.tr.twitter.com

@twitter_twj: 日本語版Twitter公式アカウントです。東京 · http://blog.jp.twitter.com

@twittermedia: Tracking cool, meaningful uses of Tweets in media, tv, sports, entertainment and journalism. Send us tips! San Francisco ·  http://media.twitter.com

@jointheflock: Twitter Recruiting: All the deets about who we’re hiring, what we’re doing and why you should come and work here! Check out www.twitter.com/jobs for more. San Francisco, CA · http://www.youtube.com/watch?v=vccZkELgEsU

@gov: Updates from the Twitter Government & Politics team, tracking creative & effective uses of Twitter for civic engagement. RTs & examples≠political endorsements.

Ubuntu Linux System Backup Tools

Rsync

Rsync is the directory backup and transfer tool for Linux. Installed as default in Ubuntu. It can provide any type of backup, and options are extensive.

GRsync

GRsync is a GTK-based GUI  for Rsync. Install this by following command:

sudo apt-get install grsync

Bacula

Bacula is the most widely-used GTK-based open source (GPL-licensed) network backup utility that is used in both server and desktop installations. A catalogue of backups can be maintained using MySQL, PostgreSQL, or SQLite. For more info see the Ubuntu documentation. Both text-based and GUI frontends are available. Install the MySQL version:

sudo apt-get install bacula

SBackup

SBackup is a common backup and restore utility for the GTK-desktop. Install using following command:

sudo apt-get install sbackup

Creating WordPress Multisite Network

    • Install WordPress
    • Add the following line just above /* That’s all, stop editing! Happy blogging. */
    • define(‘WP_ALLOW_MULTISITE’, true);
    • Last step enables the Network Setup item in your Tools menu.
    • Go to Dashboard => Tools => Network Setup.
    • Do as directed. It will ask you to choose from the following two network options:
  • Sub-domains — a sub-domain based network in which sub-sites use subdomains. Example: http://lamp.sangkrit.net
  • Sub-directories — a path-based network in which sub-sites use directory path. Example: https://sangkrit.net/lamp
    • If you choose sub-domain network option then you will need to generate wild card from your c-panel check this tutorial: Subdomain Network: Adding A Wild-Card DNS In DNS Server
    • Network details get filled in automatically but you are free to make changes:
  • Server Address: The domain of the URL to access your WordPress installation.
  • Network Title: The title of your multisite network.
  • Admin E-mail:  Super admin’s email address for whole network.
  • Click the Install button.
  • Follow on screen instructions.  It provides you with cold blocks to add on your site’s wp-config.php and .htaccess files and prompts you to create a directory:
  • Create a directory for media file uploads. Directory should be writable by webserver.
  • Add the specified lines to your wp-config.php file
  • Add the specified lines to your .htaccess file
    If you do not have a .htaccess file, then create it in root directory.
  • Clear your browser’s cache and login to your site.
  • From your Dashboard at the top left corner you will see My Sites menu. Now you may visit your Network Administration from My Sites => Network Admin => Dashboard.

Google+ iPad App Is Now Available

Google+ new app for iPad is now available at iTunes App Store. Today Google announced this app’s release on its blog.

The best feature of this app is  Google+ “Hangouts”. Using this app one can start video chat with up to 9 friends anywhere, anytime. You may turn on ringing notifications to make your friends know about the Hangout. Google recently launched events feature on Google Plus, using this app you can manage them right from your iPhone.

Introducing New Features of this App. Google writes:

The Google+ app for iPad was designed with the device in mind. Your stream styles content based on popularity, type and orientation. We’ve also added unique ways to interact with the app—lean back and try these out:

  • Pinch and expand posts right in your stream to add your comments
  • Use two fingers to drag a post from your stream to easily re-share it
  • Start a Hangout from your iPad and stream it to your TV using AirPlay

Setting Up Linux Media Server And Sharing Files Between Multiple Linux Machines

You can connect your multiple machines for sharing multimedia files through a centralized web server. In this tutorial you will learn how to set up Firefly Media Server on Ubuntu Server.

What is Firefly Media Server?

Firefly Media Server (formerly mt-daapd) is an free and open-source media server or daemon for the Roku SoundBridge and iTunes. It serves media files using Roku Server Protocol (RSP) and Digital Audio Access Protocol (DAAP).

Features of Firefly Media Server

  • Support for running on Unix/POSIX platforms
  • Support for running on Microsoft Windows and Mac OS X
  • Support for running on the Apple Inc. iPhone and iPod touch
  • Support for MP3, AAC, Ogg, FLAC, and WMA
  • Support for Roku SoundBridge via RSP
  • Support for on-the-fly transcoding of Ogg, FLAC, ALAC, and WMA
  • On Windows platforms, on-the-fly transcoding of WMA Lossless, WMA Pro and WMA Voice.
  • Web-based configuration
  • Support for user-created smart playlists
  • Integration with iTunes library including reading playlists
  • Supports serving streaming radio stations

Installing Firefly Media Server

Since we are installing on a Ubuntu Server, the installation is simple:

  • Open Linux terminal
  • Run the command sudo apt-get install mt-daap
  • Enter the user password

Configuration

Open configuration file and look for this line:

mp3_dir = /home/media/music

In this line you need to change to reflect the directory from where you will serve your media.

Here I created a new sub-directory in /opt called music.  Perform this action by this command:

sudo mkdir /opt/media

Now make that directory DAAP server readable by using this command:

sudo chmod ug+r -R /opt/media

Other than this there are many more options available in the configuration file like server name, password protection, port, extensions, codec types and many more. Few options are described below:

  • Servername: Name your DAAP server will broadcast. Default is Firefly RELEASE_NUMBER HOSTNAME.
  • Password Protection: Limit access of users to the DAAP server.
  • Port: You may use a port other than the default (3689).
  • Extensions: The file types to be served by DAAP server.
  • Valid Codectypes: Configurations for the format conversion.

Starting Daemon

Complete configuration file, go ahead and move your media files into the directory and start the server using this command:

sudo /etc/init.d/mt-daap start

With this running server you can fire up a DAAP enabled client, just like iTunes or Songbird. DAAP server installation is good for small internal network where you can share multimedia files. It requires a running Linux server.

Migrating Multiple Blogs To WordPress Multisite

  • Export content of your existing WordPress installations from Dashboard=> Tools=> Export
  • Install WordPress
  • Activate Multisite by adding define(‘WP_ALLOW_MULTISITE’, true); in your wp-config.php
  • Open Dashboard of your new WordPress installation.
  • Open Tool=> Network Setup from Dashboard and do as directed.
  • Create blog for each site you like to import.
  • Import each site’s content you exported from old installations from Dashboard=> Tools=> Import
  • Install all themes and plugins of your old site if you like and network activate them.
  • If your old installations have their own domain names then Map domains to your main site using MU Domain Mapping

Embedding RSS Feed In Your WordPress Posts And Pages

Open Your themes function.php and add the following code at the bottom:

include_once(ABSPATH.WPINC.’/rss.php’);

function readRss($atts) {
extract(shortcode_atts(array(
“feed” => ‘http://‘,
“num” => ‘1’,
), $atts));

return wp_rss($feed, $num);
}

add_shortcode(‘rss’, ‘readRss’);

Save function.php and whenever you need to embed RSS in any of your post or page write the following short code inside your post:

[ rss feed=”https://sangkrit.net/feed” num=”5″ ]

In the above give short code replace https://sangkrit.net/feed with your feed address and in num=5 replace 5 with the number of posts you like to show.

Note: Remember there is no space between [ and rss feed and num=”5″  and  so after you copy the short code; check the space, remove it (if there is some space) and then publish it.

Network Monitoring With Etherape

EtherApe is a graphical utility that allows you to see in real-time where connections are being made on your network, or between your network or computer and the Internet. If you are experiencing unexpected network activity on your computer or LAN and wish to see where the activity is occurring. Both “local” user and “root user” installations are created; in general you must use the root user installation to see all your network traffic.

sudo apt-get install etherape

Features:

  • Network traffic is displayed graphically. The more “talkative” a node is, the bigger its representation.
  • Node and link color shows the most used protocol.
  • User may select what level of the protocol stack to concentrate on.
  • You may either look at traffic within your network, end to end IP, or even port to port TCP.
  • Data can be captured “off the wire” from a live network connection, or read from a tcpdump capture file.
  • Live data can be read from ethernet, FDDI, PPP, SLIP and WLAN interfaces, plus several other incapsulated formats (e.g. Linux cooked, PPI).
  • The following frame and packet types are currently supported: ETH_II, 802.2, 803.3, IP, IPv6, ARP, X25L3, REVARP, ATALK, AARP, IPX, VINES, TRAIN, LOOP, VLAN, ICMP, IGMP, GGP, IPIP, TCP, EGP, PUP, UDP, IDP, TP, ROUTING, RSVP, GRE, ESP, AH, EON, VINES, EIGRP, OSPF, ENCAP, PIM, IPCOMP, VRRP; and most TCP and UDP services, like TELNET, FTP, HTTP, POP3, NNTP, NETBIOS, IRC, DOMAIN, SNMP, etc.
  • Data display can be refined using a network filter using pcap syntax.
  • Display averaging and node persistence times are fully configurable.
  • Name resolution is done using standard libc functions, thus supporting DNS, hosts file, etc.
  • Clicking on a node/link opens a detail dialog showing protocol breakdown and other traffic statistics.
  • Protocol summary dialog shows global traffic statistics by protocol.
  • Node summary dialog shows traffic statistics by node.
  • Node statistics export to XML file.
  • Scrollkeeper/rarian-compatible manual integrated with yelp.

Don’t Buy Leon Max Lederman’s Book, “The God Particle: If the Universe Is the Answer, What Is the Question?”

People outside the scientific community call Higgs Boson as God Particle due to Leon Lederman’s book The God Particle where he calls Higgs Boson a God Particle. Nobody knows why this Nobel prize winner has done such an idiotic thing but it seems like Leon M. Lederman was more interested in the promotion of his book rather than  explaining particle physics.

Although he explains his ploy by saying that he gave Higgs Boson the nickname “God Particle”  for this, this and this reason but what you see on the cover is misleading language of  Leon M. Lederman with Dick Teresi.

Don’t Buy Samsung Galaxy

Galaxy S III owners have already complained that they are unable to hear the person on the other side of the connection due to malfunctioning of  microphone, around 30% of users are having battery problem (Check Here). 

Top 5 Problems In Samsung Galaxy SIII:

  1. Microphone Malfunction – 50%
  2. Battery Life – 15%
  3. Device Gets Hot – 15%
  4. Internet Connection Issues – 10%
  5. Other – 10%

Read “Samsung Galaxy S III top 5 issues revealed” by NDTV

Read “Samsung Galaxy S3, iPhone problems revealed by huge survey

Following are the complain lists made by Samsung Mobile Customers from India. There are two links, first link gives complain record from 2008 to 2010 and the second link from 2010 to 2012:

I have already changed my mind from New Samsung Galaxy Note Sporting 5.5 Inch Screen to Nexus 7 .