Category: Technical

Script to import HTML files into Zendesk Forums

Weeks ago, I was given with a task to import bunch of HTML files into Zendesk Forum as articles. As there were thousands of files and it’s tough to copy paste them manually. I got to know that Zendesk offers a rich set of API’s to manage Forum and it’s contents. I have created a Python script to import bunch of offline HTML files into Zendesk Forum creating Topics/articles in a Forum under Categories

We can perform either of the following features in Forum section.

  • List Forums
  • Show Forum
  • Create Forum
  • Update Forum
  • Delete Forum

Example request available in the Zendesk developers page is using curl.

curl https://yoursubdomain.zendesk.com/api/v2/topics.json -H "Content-Type: application/json" -v -u email:password -X POST -d '{"topic": {"forum_id": 79161, "title": "My Topic", "body":"This is some code", "topic_type": "articles", "access": "logged in users" }'

The above example had a limitation of adding HTML code into<code>, which is impossible when we had thousands of files to be uploaded. Thus I wrote a Python script tweaking the above example, so that I can refer an external file to fetch HTML contents and import it as an individual Topic.

Source can be found here..

https://github.com/ijeyanthan/zendesk-import-into-forum

To know more, visit http://developer.zendesk.com/documentation/rest_api/forums.html for the list of possible JSON requests available in Zendesk.

Is this an Eagle or a Vulture or a Hawk?

Today, while I was at my bay, there sat a bird screaming on the other side of our bay window. It’s sound has immediately driven everyone’s attention and there arose a debate about the bird, whether it was an Eagle or a Hawk or a Vulture.

After a bit of conversation, we ended up concluding it was a Hawk!. I was anyways not sure of it’s difference and agreed to what they said.

Ah! What is the difference between these all birds?

The eagle and hawk are predators while the vulture is a scavenger, feeding mostly on the carcasses of dead animals.

Eagles are differentiated from other broad-winged birds of prey mainly by their larger size, more powerful build, and heavier head and bill. Most eagles are larger than any other raptors apart from the vultures.

Most hawks are mainly woodland birds that hunt by sudden dashes from a concealed perch. They usually have long tails and high visual acuity.

But all of them do belong to the “Old World vulture”, belonging to the family “Accipitridae”.

Source : http://en.wikipedia.org/wiki/Old_World_vulture

That’s a new learning today 🙂

Now, hold on – how do we call it in Tamil ?

All started suggesting various names for this and after a bit of Googling, I found it to be called as ‘Parunthu’ (பருந்து)

Then what is it for Eagle ? – Well, it is ‘Kazhugu’ (கழுகு)

.. and for Vulture? – It is ‘Rajali’ (ராஜாளி)

For those Whatsapp SPAMmers, here is the solution from developers !

I have undergone a deep vexation of late due to the recent Whatsapp spam that’s spreading and this post is dedicated to all those pathetic users who blindly forward to their contacts without thinking logically.. An important element called “common sense” is missing these days among people using smart phones (or are they loosing their smartness just because their phones are getting smarter?!)

(Here you will find the spam message that is being forwarded – – Click here)

Yes, I understand when you go to your contacts and look at everyones status, you see —- error: status unavailable.

To help those victims, I have personally raised an issue to Whatsapp team to check the status error issue. The following is what they had to say!!

Hi,

**We are currently experiencing server problems affecting status messages. Our team is working to fix this issue as soon as possible. Sorry for the inconvenience and thank you for your patience! **

Thanks for contacting WhatsApp. We are working on answering everyone’s question as soon as possible. In the meantime, please look at our FAQ to see if your question is answered there.

FAQ page: http://www.whatsapp.com/faq/

Below are the answers to some commonly asked questions:

1) Is my device supported?
http://www.whatsapp.com/faq/en/general/20951556

2) Can I recover deleted messages?
http://www.whatsapp.com/faq/en/general/21197296

3) How do I enter my friend’s number so they appear in WhatsApp?
http://www.whatsapp.com/faq/en/general/21016748

If you submitted a suggestion, thank you very much for sharing your feedback. Please note that we cannot comment specifically about plans and developments, but we value your feedback and have taken note of your suggestion.
To add any updates to your request, please respond to this email. We are here to help!

Thanks!
WhatsApp Support Team

.. and there is also a blog from Whatsapp team to make sure users don’t fall for the spammy campaign and PLEASE DO NOT believe in such messages !

http://blog.whatsapp.com/index.php/2012/01/it-is-a-hoax-really-it-is/

You may also have to follow @wa_status to know WhatsaApp’s server status !!

Now will you please stop SPAMMING and use your brain?

UPDATE 

I got the following mail from them again

Cristina , Nov 29 13:41 (PST):

Sorry for the inconvenience.
We were experiencing a temporary outage. Our service is now restored.

In the future, you can check our Twitter account for updates on our system status: http://www.twitter.com/wa_status

Thank you for your patience.
That message is a hoax and did not come from WhatsApp.  Please disregard the message and do not resend it.
We do not use WhatsApp to mass message our user base, nor would we ever send you a message advertising gifts or asking you to forward a message to your contacts.

**WhatsApp works on a yearly service subscription model. The subscription includes all of our features, such as messages and multimedia. The lifetime of the subscription is determined by the platform you are using:

For WhatsApp for iPhone, there is a one-time charge of 0.99USD upon downloading the app. There are no additional charges beyond this one-time fee.

For WhatsApp for Android, Blackberry, Nokia and Windows Phone, there is a one-year free trial period. Once the free trial period ends, there is an annual subscription fee of 0.99USD.

For more details on WhatsApp costs, please see this help article: http://www.whatsapp.com/faq/en/general/20965922

For more information about hoax messages in general, please read our blog: http://blog.whatsapp.com/index.php/2012/01/it-is-a-hoax-really-it-is/
If you have any other questions or concerns, please feel free to contact us. We would be happy to help!

—-
Best / Un saludo
Cristina Trujillo

English Support / Soporte en español
WhatsApp Support Team

 

Install offline GIT Web help !

Today, I realised there is a HTML version of offline help manual available for GIT while running the following command.

$ git help –web grep

But then I realised the local HTML docs were not installed, when I tried to run. Thus running the following command gets it working.

$ sudo git clone git://git.kernel.org/pub/scm/git/git-htmldocs.git /usr/share/doc/git-doc

Updating the docs is just a command away.

$ cd /usr/share/doc/git-doc
$ sudo git pull

The following are few of the important links that comes handy (as mentioned in man git).

NOTES

1. Everyday Git

file:///usr/share/doc/git-doc/everyday.html

2. Git User’s Manual

file:///usr/share/doc/git-doc/user-manual.html

3. git concepts chapter of the user-manual

file:///usr/share/doc/git-doc/user-manual.html#git-concepts

4. howto

file:///usr/share/doc/git-doc/howto-index.html

5. GIT API documentation

file:///usr/share/doc/git-doc/technical/api-index.html

What is the difference between >> and 2> – Standard Input and Output Redirection explained

Off late I happen to get used to a lot of I/O redirection involved in coding and executing commands. Thus I thought summarizing them as a blog for my own reference.

The shell and many UNIX commands take their input from standard input (stdin), write output to standard output (stdout), and write error output to standard error (stderr). By default, standard input is connected to the terminal keyboard and standard output and error to the terminal screen.

The way of indicating an end-of-file on the default standard input, a terminal, is usually <Ctrl-d>.

Redirection of I/O, for example to a file, is accomplished by specifying the destination on the command line using a redirection metacharacter followed by the desired destination.

C Shell Family

Some of the forms of redirection for the C shell family are:

Character Action
> Redirect standard output
>& Redirect standard output and standard error
< Redirect standard input
>! Redirect standard output; overwrite file if it exists
>&! Redirect standard output and standard error; overwrite file if it exists
| Redirect standard output to another command (pipe)
>> Append standard output
>>& Append standard output and standard error

The form of a command with standard input and output redirection is:

% command -[options] [arguments] < input file > output file 

If you are using csh and do not have the noclobber variable set, using > and >& to redirect output will overwrite any existing file of that name. Setting noclobber prevents this. Using >! and >&!always forces the file to be overwritten. Use >> and >>& to append output to existing files.

Redirection may fail under some circumstances: 1) if you have the variable noclobber set and you attempt to redirect output to an existing file without forcing an overwrite, 2) if you redirect output to a file you don’t have write access to, and 3) if you redirect output to a directory.

Examples:

% who > names
Redirect standard output to a file named names
% (pwd; ls -l) > out
Redirect output of both commands to a file named out
% pwd; ls -l > out
Redirect output of ls command only to a file named out

Input redirection can be useful, for example, if you have written a FORTRAN program which expects input from the terminal but you want it to read from a file. In the following example, myprog, which was written to read standard input and write standard output, is redirected to read myin and write myout:

% myprog < myin > myout

You can suppress redirected output and/or errors by sending it to the null device/dev/null. The example shows redirection of both output and errors:

% who >& /dev/null

To redirect standard error and output to different files, you can use grouping:

% (cat myfile > myout) >& myerror

Bourne Shell Family

The Bourne shell uses a different format for redirection which includes numbers. The numbers refer to the file descriptor numbers (0 standard input, 1 standard output, 2 standard error). For example, 2> redirects file descriptor 2, or standard error. &n is the syntax for redirecting to a specific open file. For example 2>&1 redirects 2 (standard error) to 1 (standard output); if 1 has been redirected to a file, 2 goes there too. Other file descriptor numbers are assigned sequentially to other open files, or can be explicitly referenced in the shell scripts. Some of the forms of redirection for the Bourne shell family are:

Character Action
> Redirect standard output
2> Redirect standard error
2>&1 Redirect standard error to standard output
< Redirect standard input
| Pipe standard output to another command
>> Append to standard output
2>&1| Pipe standard output and standard error to another command

Note that < and > assume standard input and output, respectively, as the default, so the numbers 0 and 1 can be left off. The form of a command with standard input and output redirection is:

$ command -[options] [arguments] < input file > output file 

Redirection may fail under some circumstances: 1) if you have the variable noclobber set and you attempt to redirect output to an existing file without forcing an overwrite, 2) if you redirect output to a file you don’t have write access to, and 3) if you redirect output to a directory.

Examples:

$ who > names
Direct standard output to a file named names
$ (pwd; ls -l) > out
Direct output of both commands to a file named out
$ pwd; ls -l > out
Direct output of ls command only to a file named out

Input redirection can be useful if you have written a program which expects input from the terminal and you want to provide it from a file. In the following example, myprog, which was written to read standard input and write standard output, is redirected to read myin and write myout.

$ myprog < myin > myout

You can suppress redirected output and/or error by sending it to the null device/dev/null. The example shows redirection of standard error only:

$ who 2> /dev/null

To redirect standard error and output to different files (note that grouping is not necessary in Bourne shell):

$ cat myfile > myout 2> myerror

 

P.S. This works the same way in all operating system and is universal.

Courtesy : http://www.mathinfo.u-picardie.fr/asch/f/MeCS/courseware/users/help/general/unix/redirection.html

Linux File System Hierarchy

Do you need to know the file system hierarchy. You don’t have to search in Google to get familiarized with it. It’s there within your distro. Yes, Just type the following command to list the manual containing a detailed information about the file system hierarchy.

$ man hier

Playing around with fbcmd [HOWTO]

This post has been lying around my Drafts for about a month. While I was looking for ways to find mutual friends between two persons in Facebook, I realized that it is a painful job which involves a lot of playing around with Facebook API’s to get mutual friends listed. Whereas finding Mutual friends in Twitter is quite simple and so does with Identica too. You may find how to find them in this blog.

Let’s see how to achieve this..

1. Install fbcmd as per the blog post

2. Open your terminal and type the following to find mutual friendship between you and your friend

$ fbcmd mutual “<Enter_your_friend’s_full_name_within_quotes>”

For Example :

$ fbcmd mutual “vigneshwaran Raveendran”

NAME                     FRIEND_NAME

Vigneshwaran Raveendran  Kashi Vishwanath Revathy Ganesan

Karthikumar SK

Dhameswaran Natarajan

Mohindar Amarnath

Kamesh Jayachandran

[snip]

Isn’t that awesome. The following are a few commands that I felt it interesting..

How to list [and optionally save] all your friend’s profile photos ?

$ fbcmd ppics =all /tmp/fbcmd/ppics/

How to list [and optionally save] all photos where friend(s) are tagged

$ fbcmd fpics

How to list any friends who are currently online

$ fbcmd fonline

How to export all your friend’s B’day date in csv format ?

$ fbcmd finfo birthday_date -csv

How to know your profile ID ?

$ fbcmd whoami

How to set your status update
$ fbcmd status “is excited to play with fbcmd”
What not? Start playing with this app
$ fbcmd help #is your friend..
With this application, you can even schedule for a list of status updates with the help of a cron job 🙂
for additional help, examples, parameter usage, flists, preference settings,
visit the FBCMD wiki at:

[HOWTO] Access facebook through command line interface (CLI)

A majority of linux users prefer sticking to their terminal rather than accessing through a GUI for most of their daily tasks. Have you ever wondered if there is any way to access facebook from terminal? The answer is Yes… Now, it’s possible to access facebook from terminal. fbcmd application gives you a command line interface for Facebook. It is surprisingly available for Windows OS as well.

Installation of this app in Linux is pretty simple.

Make sure you have php installed in your system. If not, install as follows

$ sudo apt-get install php5 php5-cli

To test your PHP environment, try typing at a command prompt:

php -r “echo phpversion();”

While you’re at it, make sure this outputs “1”.

php -r “echo ini_get(‘allow_url_fopen’);”

Download fbcmd.zip from the this link and Unzip the file

$ unzip fbcmd.zip

$ cd fbcmd

To finish the installation:

$ sudo php fbcmd_update.php sudo

$ php fbcmd_update.php install

type fbcmd to begin

$ fbcmd

Welcome to fbcmd! [version 1.0-beta5-dev1]

This application needs to be authorized to access your facebook account.

You are almost done! This application needs to be authorized to access your facebook account. This is a one time process.

Step 1: Allow basic (initial) access to your acount via this url, execute:

$ fbcmd go access

 

Step 2: Generate an offline authorization code, execute:

$ fbcmd go auth

Step 3: Obtain your authorization code (XXXXXX) and then execute:

$ fbcmd auth XXXXXX

Step 4: Most FBCMD commands require additional permissions. To grant default permissions, execute

$ fbcmd addperm

You are done !

To know the syntax , execute

$ fbcmd help

Start playing around with it and let me know your comments.

Don’t forget to visit the following post to continue reading this..

http://www.ijeyanthan.com/blog/archives/playing-around-with-fbcmd-howto

[HOWTO] Enable Maximize, Minimize buttons on the title bar in Gnome 3

Though there are many blog posts available to show how to enable Maximize, Minimize buttons on the title bar in Gnome 3, this post is for my personal reference ;).

As you know, there will be no title bar controls for minimize, maximize/restore. To enable them, open up the terminal and type in (or copy/paste) the following command:

I prefer the buttons to be in right corner.

gconftool-2 –set /desktop/gnome/shell/windows/button_layout –type string :minimize,maximize,close

Now, press Alt+F2, type in “r” without quotes and press enter. This will reload Gnome-Shell and the changes will come into effect.
If you login with fallback mode, you may still find the icons showing at left.

$ sudo apt-get install gconf-editor

Press Alt+F2 to bring up the Run Application dialog box, enter “gconf-editor”

The key that we want to edit is in apps/metacity/general

Change the text in the button_layout key Value text field to:

menu:maximize,minimize,close

Phew, We are done.

[Info] Madurai International Airport

Madurai Airport (IATA: IXM, ICAO: VOMD) is a customs airport serving Madurai, in the state of Tamil Nadu, India.The airport is located about 12 km (7.5 mi) from the Madurai railway station. The airport was established in 1957.

  1. A 17,600 Sq.m New Integrated terminal building was inaugurated recently which is the second largest terminal in Tamilnadu,next to Chennai.
  2. Seating Capacity : 250 + 250
  3. Check-In Counters : 27 + 9
  4. Immigration Counters : 20
  5. Baggage Conveyors : 3 + 1
  6. CISF staff Strength : 105+
  7. Aero-bridges : 3
  8. Apron : 6
  9. Parking Lot : 7 Parellel
  10. Taxiway : 2
  11. Runway : 7500 ft.
  12. ILS : Available
  13. Firestation : 5 firefighters including 3 Brand New ROSEN BAUER highly advanced Firefighters
  14. Fuel-stations : Reliance & IOCL tanks
  15. Cargo/Frieght handling : Available.
Madurai airport has a strong Domestic network and handles 43000 passengers per month on an average. It has direct connectivity with major indian cities such as Chennai, Bangalore, Mumbai,New Delhi & Hyderabad. A Public demand is there for Ahmedabad, Kolkatta, Pune, Jaipur, Cochin and Tirupati in domestic-side and Dubai, Singapore, Kualalampur, Colombo, Kuwait, Muscat, Abu dhabhi, Sharjah, Doha, Jeddah and Maldives in International destinations. Connections to France, Germany, US, UK and Japan are feasible with One stop-over at any Metros like Chennai/Mumbai.

A Huge demand is there for above mentioned destinations from Madurai & its Hinterland. Madurai Hinterland includes 10 districts: 1. Madurai 2. Ramnad 3. Sivaganga 4. Virudhunagar 5. Theni 6. Dindigul 7. Tirunelveli 8. Tuticorin 9. Some parts of Pudukottai 10.Some parts of Kanyakumari.

Five Operators operate daily flights from Madurai. They are Spicejet, Paramount airways, Indian Airlines, Jet airways and Kingfisher airlines. International operators such as Srilankan airlines, Air Asia, Air Arabia,Air India Express and Silk air are expected to start their operations to Various International destinations from Madurai shortly. More than 10 airlines have evinced interest in operating to Madurai.