All Articles by Sangkrit

Register/transfer domain names at http://system.sangkrit.net and mail to system@sangkrit.net to get your web/app made/managed as per the budget allocated.

3891 Articles

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: http://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.