@shijitht

August 19, 2010

C boolean

Filed under: C — Tags: , — shijitht @ 3:52 pm

C do not have a built-in boolean type. In C, zero means false and non-zero means true. So we don’t have to use boolean types in comparison operations. If a comparison say  using  “== ”   succeeds, one would be returned. Zero in case of a failure. Run the program to remove debuts,

main()
{
         printf("False = %d True = %d\n",1==0,1==1);
}

August 9, 2010

df

Filed under: Commands — Tags: , , , — shijitht @ 12:03 pm
df (1)               - report file system disk space usage

df is used for checking file system size, used size and available size. By default it reports in numbers of 1k block. Two useful options are

-P
            Use 1024-byte block units when writing space figures.
-h
            Display in human readable format, Kb, Mb, or Gb.

Use man to find more.

August 7, 2010

BloGTK WordPress setup

Filed under: Tools, WordPress — Tags: , , , , , , , — shijitht @ 6:39 pm

BloGTK is an application for blogging. We can use it for posting new articles, instead of browser. It has everything offered by word press editor. Install the software first.
DEB family type “apt-get install blogtk” and RPM group type “yum install blogtk” as root in the terminal. After installing, select it from Application/Internet/BloGTK Webblog Client. If it is not starting, take terminal. Type blogtk to start it. It might show an error like “no module named gtkhtml2”. Then you should install python-gtkhtml2. If apt-get or yum fails to find such a package, you can get it here, python-gtkhtml2. Select appropriate package from the liked site and double-click to install. If installed correctly, blogtk would run.
The settings are, go to Edit/Account and Settings and set

Server URL : http://you.wordpress.com/xmlrpc.php
Username : username
Password : password
Blogging System: Movable type
Press OK and select Connect in File.

Now you are ready to post. Select the desired Blog and Category to start writing new posts. You can see 3 tabs. Edit Post for normal editing, Advanced for tags etc and Preview shows preview. The demerits are no text formatting, HTML editor, grammar checking etc. This my first post using BloGTK. I finished it early but I don’t have the usual satisfaction using Word Press. I think you can use it as an offline tool for blogging. It is good tool for a blogger having limited Internet access.
Thanks to this..

Text pre formatting in WordPress

Filed under: WordPress — Tags: , , , , , — shijitht @ 2:11 pm

To insert a code or a pre formatted text, you can use “Preformatted” instead of “Paragraph” in visual editor. For html editor corresponding tag is pre. In html editor enclose the text in these tags.

<pre> text </pre>.

For writing code you can use code tag.

<code> code </code>.

For coloring the code according to language syntax and proper listing, use sourcecode tag. Use it as

<em>code</em>

lang could be

  • actionscript3
  • bash
  • coldfusion
  • cpp
  • csharp
  • css
  • delphi
  • erlang
  • fsharp
  • diff
  • groovy
  • javascript
  • java
  • javafx
  • matlab (keywords only)
  • objc
  • perl
  • php
  • text
  • powershell
  • python
  • ruby
  • scala
  • sql
  • vb
  • xml

For more details go to http://en.support.wordpress.com/code/.

Facebook Like button for your site

Filed under: WordPress — Tags: , , , , — shijitht @ 1:43 pm

WordPress editor allows only text in posts and sidebar. It strips off scripts(js) and rich html like iframe, forms etc while saving. WordPress did this for security. But it restricts users from using many amazing functionalities of social network as they offer. Facebook provides Like button code in iframe format and as javascript. We can’t use it in wordpress.com. Getsociallive provides a service for Like buttons. It gives a Like button. And on click, it goes to a Getsociallive page. The destination page has Like button service + Adds. It’s OK, but I thought a Facebook page will do better. So replaced the destination link of Getsociallive code with the Facebook Like service link. Resulting code for my site is

<p><a title="Like This!"
href="http://www.facebook.com/plugins/like.php?
href=http%3A%2F%2Fshijitht.wordpress.com%2F&amp;layout=standard&amp;
show_faces=true&amp;width=450&amp;action=like&amp;
colorscheme=light&amp;height=80" scrolling="no" frameborder="0"
style="border:none; overflow:hidden;
width:450px; height:80px;" rel="nofollow" target="_blank">
<img style="border:0;margin:0;padding:0;"
src="http://getsocialserver.files.wordpress.com/2010/08/gslk2.png"
width="49" height="23" alt="Like This!" /></a></p>

Replace shijitht.wordpress.com in the above code with your site address to make it yours. If you like, you can generate code at http://developers.facebook.com/docs/reference/plugins/like. Put the code in the text widget and add it to sidebar to get a Like button like mine. Like This!

August 6, 2010

Malayalam font

Filed under: Tools — Tags: , , — shijitht @ 12:44 am

We could hardly understand words of a Malayalam site. The problem is lack of correct font. For example go to manoramaonline. At the first look, you will close it. As many of our doubts, googling resolves it. But many consider it a huge effort, I don’t know why ?.

You get a Malayalam font, double-click and press install. Manorama.ttf is at the bottom. If fails or something unexpected happens, go ahead with following commands. As root

# mkdir /usr/share/fonts/manorama
# cp  Manorama.ttf /usr/share/fonts/manorama
# fc-cache  -fv

First we created a folder manorama in font directory(/usr/share/fonts/). Then copied Manorama.ttf font to that. The third command updated font information cache files. Restart your browser to start reading in mother-tang.

Click to download Manorama.ttf 

August 5, 2010

Enabling root in Ubuntu !

Filed under: Commands — Tags: , , , — shijitht @ 11:15 pm

If you notice, you will find that Ubuntu never asks for a root password while installing. The thing is, root account disabled as default. This is not true in almost every case. So how can we enable it ?. sudo can do the trick. It means ” Super User DO “.If you are not a power user, you don’t need to activate root account. If you are ever asked to type a root privileged command, you could use  sudo. To run using sudo
$ sudo  < command to execute >
This will prompt for a user password.

If you are someone having lots of fun in terminal, activate the master.
To enable
$ sudo passwd
This will prompt for new root password and once you confirm it, you can start using root account. There is another option, type  $ sudo -i  for a root console.

Disable root by
$ sudo passwd -l root

For more administrative task use visudo, a privileged command which can change the power of users and groups.

vim configuration

Filed under: Commands — Tags: , — shijitht @ 6:43 pm

If you are a vim editor fan and a C programmer, you could get frustrated by typing commands for line number, C indentation and syntax. To automate this, install vim-runtime package. This includes rules for language-specific syntax highlighting and indentation, color schemes etc.

Create a file .exrc in home directory. $vim  ~/.exrc
Add these lines to the file
set nu                 ” for line number
set cindent         ” for C indentation i.e. correct spacing for better understanding
syntax on           ” for coloring according C syntax

A lot more options could be added for user related customizations.

August 3, 2010

IRC > Forms

Filed under: Tools — Tags: , , , — shijitht @ 12:10 pm

Joining an IRC channel can solve doubts more quickly than posting at linux forms. IRC named ##linux would be filled with more than 850 users every time. And I never waited more than 10 sec for a question. At least 3 answer pops up in that time. I have never seen such an active channel elsewhere. If you have any doubts (after googling), I strongly suggest you put that in ##linux. For joining an IRC channel, you should have

* A client say Pidgin

* Add an account specifying IRC as protocol

* On receiving a prompt or chat window type /join ##linux

* Use a nick name,  /nick <name>  is enough. Registering that nick if you are a regular visitor.

* For more details you can google IRC/freenode.

Here is a fine link for clients you might like

August 1, 2010

wvdial.conf

Filed under: GNU/Linux — Tags: , , , , — shijitht @ 6:44 pm

For airtel use

[Dialer Defaults]
Init = AT+CGDCONT=1,”IP”,”airtelgprs.com”,””,0,0
Phone =*99#
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyACM0
Stupid Mode = yes
Password =any thing
Username =any thing

————————————————–

For Docomo

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Phone = *99***1#
Username = Docomo
Password = Docomo
Modem Type = USB Modem
Stupid Mode = yes
Baud = 460800
Dial Command = ATDT
Modem = /dev/ttyACM0
ISDN = 0
Carrier Check = yes
Auto Reconnect = yes
————————————————–

If any problem occurs run #wvdialconf.

In some cases nameserver won’t get updated in /etc/resolv.conf.

That case you need to add it manually.

Format is

nameserver IP

IP -> IP address of DNS server (you can get it while running wvdial).

« Newer PostsOlder Posts »

Blog at WordPress.com.