bbpress

Mobile Device and Web

With mobile internet usage increasing, how important is to for your web presence to be mobile friendly and is also tracked?

A 2008 Nielsen Media Research highlights that there is an average lift of 13% in mobile web audience and Jakob Nielson’s alertbox says Mobile Web 2009 = Desktop Web 1998, certainly mobile web has a significant role to play. But the question is there are hundreds of devices and models, so where do we start ? Here tracking your mobile web presence is important.

While with the help of google analytics tool you can easily track screen size, bowser and the OS, but if you want to provide a remarkable experience to your audience you should also know about the models being used. Then figure out the capability of that device so you can provide a better experience.

Recently I came across a site called percentmobile.com which provides us a comprehensive analysis on mobile devices, below is a screenshot of there sample report.

Now we know enough about our site to start work :

A site developer can create a mobile friendly site without much changes in existing code, but certainly there are some important things that they should keep in mind while developing a site for mobile. They are

  1. Highest used device for his site
  2. Screen size
  3. CPU speed
  4. Network capabilities etc.

HTML 4 Specifications allows you to use specific style sheet for your target device. To know more about what works on which device, mobile test suites are listed

1. Media descriptors
2. Mobile Test Harness

Tech. Nostalgia

When I looked back and think about sharing the work done in the past, it doesn’t make sense as those technologies has limited relevance today. One may say sad, but I think its the beauty of technology as it keeps evolving. Keeps me on a journey of learning more.

Going back in time when I started my career as software developer. On the first day I was asked to do the data entry for a customer, I was stunned but I did that with full dedication and passion without any complaint resulted. I got a live project the very next day.

After that there was a 3 to 4 year journey from converting existing Foxpro projects to Visual Basic Applications and new development. In that journey I had developed applications for companies in automobile, education, garments, carpets, healthcare and chemical sectors. The software used included Visual Basic, Crystal Reports, MS Access, MS SQL and DTS services.

While working with Futurescape I have done some great projects with industry leaders. If I jog my memory these come to mind…

I feel proud to be a part of one of the first successful CRM implementation in Indian healthcare industry. While the maker of the CRM software hardly bothered to support the implementation, we still did good and it felt good to have learnt so much and also ensured smiles for our client.

I never thought I was creative but I once did something very nice with SCALA. It was just an experiment but I felt good doing it. I had mixed feelings when the client said “Everything went bad in the meeting except the presentation made by you for which I got an award”. It felt nice that my client was appreciated even though the meeting could have been better. I was really happy that i discovered another part of me.

Another time, a concept developed started as a small internal site for a HR department of a company but it got so successful that it was implemented at Global Level.

There are simple joys like developing a concept that allowed a healthcare company to send emails to people and in turn they could interact in the email to calculate their health problems .

To more complicated ones…

Isn’t it great that you have developed an analytics cubes in MS SQL Analytics Services which gives you so much information from various dimensions about business which previously took days to fetch. For the same client you create Drill Down Crystal Reports which starts from Locations -> to -> Gender -> to -> Age Group -> to -> Age -> to -> Department -> to -> Customer -> to -> Single invoice itself, thats so much data was available on the client intranet.

Pivot Table web reports developed using OWC (Office Web Component) for a client which gives information and comparison for various States, Cites, Time Period and so on. It was a challenge as most users was using various version of MS Office and finding help on OWC for Pivot Table was like going through hell.

Two years ago, when i first started my journey with open source, it was with Dot Net Nuke. It was logical since I came from a background of Microsoft tools. As you are aware DNN is based on ASP.NET. It thrills me that we used this ASP.NET based product to develop a portal for a franchisee network. It has everything that the business requires for their day to day operations. I will not bore you with the details except that it has been running successfully for the last two years and is this is also an case study for the client.

Just writing all the good memories made me smile . Wish I had started my blog earlier , because then I would have shared more and learnt even more from all the people around. But I guess it is never too late and technology always evolves.

About two years ago, i discovered WordPress and it has started a new journey. It is an appropriate time as I write this, the new BuddyPress release came out and it was satisfying and yet a huge surprise to see my name in the credits. Thank You WordPress and the team and most of all to all the clients I have worked with and helped me learn.

Some basic SSH and Linux commands

Several people have been asking me about basic SSH commands to work with Linux server, so I thought let me put some basic commands at one place to refer to.

To connect to the SSH server first of all you need a SSH client. Some of the most popular Free SSH clients are listed below:

  1. PuTTY
  2. WinSCP
  3. Dropbear
  4. OpenSSH

 
To connect with SSH Server you can use any of these command,

ssh username@yourhostname.com
# It will prompt you for password #
ssh -l username yourhostname.com
Some of SSH server may deny direct root login to the server so you need
to first login from any user and then switch to root with following command

su -
# You will be asked for the root password #
Since you are a root user and might want to check who had logged in earlier, you can use. It will give you who logged in and when.

last
 

User creation commands

To create user
adduser

For deleting user
userdel
deluser
rmuser

For changing current password
passwd

#You will be asked for entering password#
Getting general help on commands in SSH, here man stands for manual

man
 

Working with Files and Directories

To check the current path

pwd
To list all files and folders [ ls ]

ls
To show “hidden” files in current directory

ls -a
To display detailed information about all files in current directory

ls -l
To list all files and subfolders including hidden with their
permissions, owner and groups in human-readable sizes

ls -alh
To go to a particular directory [ cd ]

cd /var/www/vhosts/yourdomainname.com/httpdocs
For copy file or folder to the specified location or folder [ cp ]

cp /directory/you/want/to/copy /directory/where/you/want/to/copy/to
For moving file or folder to the specified location or folder [ mv ]

mv /directory/you/want/to/move /directory/where/you/want/to/move/to
For deleting a file or directory [ rm ]

rm
To deletes all the directory and all files including subdirectories recursively.

rm -rf
To create a folder or directory [ mkdir ]

mkdir
For removing the folder or directory [ mkdir ]

rmdir
For creating file zip or archive in a specified directory [ tar cvf ]

tar cvf filename.tar.gz /directory/you/wish/to/archive
For extracting all zip or archive files in current directory [ tar -
xvf ]

tar -xvf filename.tar.gz
To create a zip file [ zip ]

zip yourzipfile.zip filename.php
To unzip files in current directory [ unzip ]

unzip yourzipfile.zip
To change owner of directory or file [ chown ]

chown user:group
 
chown apache avatars
To change file or directory permissions

chmod permissions
 
chmod 755 avatars
Permissions

u = User who owns the file.

g = Group that owns the file.

o = Other.

a = All.

r = Read the file.

w = Write or edit the file.

x = Execute or run the file as a program.

Numeric Permissions:

0 = No permission

1 = Execute only

2 = Write or edit the file.

3 = Execute or run the file as a program.

4 = Read the file.

5 = Read and execute the file.

6 = Read and write Read the file.

7 = Read, write and execute
 

Working with SSH text editors

pico editor
pico
vi editor

vi
To LogOut from consol

logout

Simple steps for HTML to ASP

There are times when designers create html based sites but are uncomfortable about what needs to be done about making the site password protected. In such times, I have been asked to help.

However to make things simple, I have created a step wise activity so that any html based site can be converted to password protected one. It will help my designer friends and anyone else would needs to do this.

Let us take an example where we have to convert following pages into a password protected site

  1. Home page (home.html)

  2. About Us (about.html)

Following are the tasks that needed to be completed in the password protected site.

  1. Create a login page
  2. Password should be encrypted
  3. Every pages should be accessible after entering a valid password only

  4. Track each login along with IP address and store in database

Here we go…

Step 1 Database Creation

Create a database. Lets say database name is dbsite

Create 2 tables with following fields

Table 1 Name : UsersMaster
Fields : Id (int), UserName(VarChar), Password(VarChar), Name(VarChar), Organisation(VarChar), Designation(VarChar), EmailId(VarChar), Publish (tiny Int), DisplayName(VarChar)

Table 2 Name : UsersLog
Fields: UserId (Int), LoginDateTime(DateTime), IpAddress (VarChar)

Step 2

Create Following pages

  1. login.asp
  2. verifyuser.asp

Copy following code and paste in login.asp

<%
dim con, rsTemp, rsMaster, strqry
dim cn
cn="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;pwd=pwd;Initial Catalog=dbsite;Data Source=."
set con=Server.CreateObject("ADODB.Connection")
 
set rsTemp=Server.CreateObject("ADODB.Recordset")
set rsMaster=Server.CreateObject("ADODB.Recordset")
 
con.Open cn
 
function getNewId(tblname, fldname)
	if rsMaster.State=1 then rsMaster.Close
	strqry="Select max(" & fldname & ") from " & tblname
	set rsMaster=con.Execute(strqry)
	if not rsMaster.EOF then
		if not isnull(rsMaster(0)) and rsMaster(0)<>"" and IsNumeric(rsMaster(0)) then
			getNewId=rsMaster(0)+1
		else
		 getNewId=1
		end if
	else
		getNewId=1
	end if
end function
 
'FORMAT DATE
'----------------------------------------------------------------------------------------------------
function checkdate(mydate)
	if mydate="" or IsNull(mydate) or Not IsDate(mydate) then
		checkdate=false
	else
		checkdate=true
	end if
end function
 
function getdateformat(mydate)
	if isDate(mydate) then
		getdateformat=day(mydate) & "-" & monthname(month(mydate),true) & "-" & year(mydate)
	else
		getdateformat=""
	end if
end function
 
function RTESafe(strText)
	'returns safe code for preloading in the RTE
	dim tmpString
 
	tmpString = trim(strText)
 
	'convert all types of single quotes
	tmpString = replace(tmpString, chr(145), chr(39))
	tmpString = replace(tmpString, chr(146), chr(39))
	tmpString = replace(tmpString, "'", "&#39;")
 
	'convert all types of double quotes
	tmpString = replace(tmpString, chr(147), chr(34))
	tmpString = replace(tmpString, chr(148), chr(34))
'	tmpString = replace(tmpString, """", "\""")
 
	'replace carriage returns & line feeds
	tmpString = replace(tmpString, chr(10), " ")
	tmpString = replace(tmpString, chr(13), " ")
 
	RTESafe = tmpString
end function
 
Function GetSecureVal(param)
	If IsEmpty(param) Or param = "" Then
		GetSecureVal = param
		Exit Function
	End If
 
	If IsNumeric(param) Then
		'GetSecureVal = CLng(param)
		GetSecureVal = CDbl(param)
	Else
		param = Replace(CStr(param), "'", "''",1,-1,1)
		param = Replace(CStr(param), ";", ",",1,-1,1)
		param = Replace(CStr(param), "..", "",1,-1,1)
 
		//Here you can add additional code as per your requirement
 
		GetSecureVal = param
	End If
End Function%>
 
<!--#include virtual="encryptalgo.inc"-->
 
<%
session("UserId")=0
session("UserName")=""
session("UserDisplayName")=""
session("IsLoggedIn")=""
 
Dim log_success
 
log_success=1
 
if Request.QueryString("submit")=1 then
	dim loginid, pwd	
	Dim Mail
	loginid=LCase(Request.Form("txtloginid"))
	pwd=Request.Form("txtpassword")
 
   dim psw, txt
   dim strTemp
 
 
	 psw=pwd
	 txt=loginid
 
   strTemp = EnDeCrypt(psw, txt)
   pwd=server.urlencode(strTemp)
 
	strqry="Select Id, Password, Name,DisplayName from UsersMaster where UserName='" & GetSecureVal(loginid) & "' and Publish=1"
	if rsTemp.State=1 then rsTemp.Close
	set rsTemp=con.Execute(strqry)
	if not rsTemp.EOF then
		while not rsTemp.EOF			
			if strComp(rsTemp(1), pwd)=0 then
				session("UserId")=rsTemp(0)
				session("UserName")=rsTemp(2)
				session("UserDisplayName")=rsTemp(3)
				session("IsLoggedIn")="nfxkqur89124ejxtex7254241242j4bux8"
 
				strqry="insert into UsersLog values(" & rsTemp(0) & ", '" & Now() & "','" & Request.ServerVariables("REMOTE_ADDR") & "')"
				con.Execute(strqry)
 
				Session.TimeOut=30
				Response.Redirect "home.asp"
				Response.End
			end if
			rsTemp.MoveNext
		wend
		log_success=0
	else
		log_success=0
	end if
end if
%>
<html>
<head>
	<meta NAME="GENERATOR" Content="Microsoft FrontPage 4.0" />
	<title>Login Page</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
			<%if log_success=0 then
				response.write "<p><strong>Invalid Login ID or Password.</strong></p>"
			end if%>
			<span style="font-weight: 700; text-decoration: underline; font-size: 110%;">Enter your login details:</span><br /><br />
			<form id="frm" name="frm" method="post" action="login.asp?submit=1">
				<label for="txtloginid" class="lblogin">Login ID</label><br />
				<input type="text" id="txtloginid" name="txtloginid" value="" class="tbstyle" /><br /><br />
 
				<label for="txtpassword" class="lblogin">Password</label><br />
				<input type="password" id="txtpassword" name="txtpassword" value="" class="tbstyle" /><br /><br />
 
				<input type="submit" id="cmdlogin" name="cmdlogin" value="Login" class="btnstyle" />
			</form>
</body>
</html>

Note: change “nfxkqur89124ejxtex7254241242j4bux8″ and “IsLoggedIn” line in login.asp and verifyuser.asp to something unique so two webiste sessions doesn’t clash with each other.

You can write additional programming code in verifyuser.asp for extra security.

Change connection settings as per your server

Step 3

Paste following code in verifyuser.asp

<%if session("IsLoggedIn")<>"nfxkqur89124ejxtex7254241242j4bux8" then
	response.redirect "login.asp"
	response.end
end if%>

Step 4

Make following changes in all html pages
1. Change the extension of all html pages to asp, so now we have (home.asp, about.asp)

2. Paste following line just below DOCTYPE Meta in all pages converted from html to asp


3. Change all hyperlinks in pages from home.html to home.asp and about.html to about.asp

Step 5

Paste encryptalgo.inc file in root directory

Sample.zip

User Import for BuddyPress (All Fields)

With this plugin now you can import users with all xprofile fields to your BuddyPress installation.

This plugin will automatically activate all user accounts and send notification as selected by the admin at the time of import.

It currently works with WordPressMU + BuddyPress installation.
Download (Version 1.0)
 

Data formatting instructions

Formatting Data is the vital while to ensure error free import of records into Buddy Press.
For your reference, follow the examples below for each field and type.
 

Check number of Delimiter

1. Count the Number of Fields in your Buddypress xprofile installation. The screenshot provides the explanation

In the example, these are the fields.

  1. Full Name

  2. About

  3. Gender
  4. Interests
  5. Favorite Food

  6. Date of Birth

  7. Country

Thus

Fields – 7

Delimiter – Fields + 1 = 8. The | is the delimiter.

So our data string should be like :
username|email@dmainname.com|||||||
i.e. username + | + email@domainname.com + 7 Delimiters
 

Text Box Type

2. Let us now take our first field Full Name whose Field Type is textbox (Shown in 1 Image)
For textbox field type you can enter any string like : Andy, Manoj Kumar or YourName etc.
I am taking field value as “Manoj Kumar” for full name

So our data string now should be like :
username|email@dmainname.com|Manoj Kumar||||||
i.e. username + | + email@domainname.com + | + Full Name + 6 Delimiters
 

Textarea Type

3. Second Filed in my installation is of textarea type by name About
Let us assume that field value for About is “This is the field value for About field whose Field Type is textarea”

So our data string now should be like :
username|email@dmainname.com|Manoj Kumar|This is the field value for About field whose Field Type is textarea|||||
i.e. username + | + email@domainname.com + | + Full Name Value + | + About Value + 5 Delimiters
 

Radio Type

4. Our next field is Gender which is of radio type. By nature radio type field can take only one value form given options.

I have following options in my installation
Option 1 – Male

Option 2 – Female

Lets say I want to select Male value for Gender field

Note: All Field Types except textbox and textarea are case sensitive. i.e. If you enter value “male” instead of “Male” it will not work.

So now data string should be like :
username|email@dmainname.com|Manoj Kumar|This is the field value for About field whose Field Type is textarea|Male||||
i.e. username + | + email@domainname.com + | + Full Name Value + | + About Value + | + Gender + 4 Delimiters
 

Multi Select Box Type

5. Next field is multiselectbox by name Interests. Multiselect box can take one or more values, so we are delimiting values more then one by (Tilde Sign [~] ).

I have following options in my installation for Interests
Option 1 – Movies

Option 2 – Traveling

Option 3 – Driving

Option 4 – Dancing

Lets say I want to select Movies as well as Dancing value for Interests field, my data string for this field should be “Movies~Dancing”

Note: All Field Types except textbox and textarea are case sensitive. i.e. If you enter value “movies” or “mOvies” instead of “Movies” it will not work.

So now data string should be like :
username|email@dmainname.com|Manoj Kumar|This is the field value for About field whose Field Type is textarea|Male|Movies~Dancing|||
i.e. username + | + email@domainname.com + | + Full Name Value + | + About Value + | + Gender + | + Interests + 3 Delimiters
 

Check Box Type

6. Next field is Favorite Food which is of checkbox type. Data formatting for Check Box Field types are same as Multi Select Box. i.e. Delimiting more then one values by (Tilde Sign [~] )

I have following options in my installation for Favorite Food
Option 1 – Pizza

Option 2 – Hot dogs

Option 3 – Sweet potato

Option 4 – Pasta

Lets say I want to select Pizza and Hot dogs value for Favorite Food field, my data string for this field should be “Pizza~Hot dogs”

Note: All Field Types except textbox and textarea are case sensitive. i.e. If you enter value “Hot Dogs” or “hot dogs” instead of “Hot dogs” it will not work.

So now data string should be like :
username|email@dmainname.com|Manoj Kumar|This is the field value for About field whose Field Type is textarea|Male|Movies~Dancing|Pizza~Hot dogs||
i.e. username + | + email@domainname.com + | + Full Name Value + | + About Value + | + Gender + | + Interests + | + Favorite Food value + 2 Delimiters
 

Date Box Type

7. My next field is Date of Birth of datebox type. Its really simple to format datebox type field simply enter date in as “1 January 2009″. i.e. Date in numer + Space + Month (Like January, February, March etc) + Space + Year in numbers (like 1995, 2001, 2005 etc)

I am taking “1 January 2009″ as Date of Birth – This is an example

So now data string should be like :
username|email@dmainname.com|Manoj Kumar|This is the field value for About field whose Field Type is textarea|Male|Movies~Dancing|Pizza~Hot dogs|1 January 2009|
i.e. username + | + email@domainname.com + | + Full Name Value + | + About Value + | + Gender + | + Interests + | + Favorite Food value + | + Date Value + 1 Delimiter
 

Select Box Type

8. Last field in my installation is country which is of selectbox type. Formatting for Select Box Type is same as textbox and textarea type, Difference is just selectbox is case sensitive.

Note: All Field Types except textbox and textarea are case sensitive. i.e. If you enter value “india” or “INDIA” instead of “India” it will not work.

I am taking “India” as value for this field

So now data string should be like :
username|email@dmainname.com|Manoj Kumar|This is the field value for About field whose Field Type is textarea|Male|Movies~Dancing|Pizza~Hot dogs|1 January 2009|India
i.e. username + | + email@domainname.com + | + Full Name Value + | + About Value + | + Gender + | + Interests + | + Favorite Food Value + | + Date Value + | + Country Value
 

Blank or field with no value

9. If you do not have value for any specific field you can leave it as blank for example if we don’t have interests field value for a particular record our data string will look like
username|email@dmainname.com|Manoj Kumar|This is the field value for About field whose Field Type is textarea|Male||Pizza~Hot dogs|1 January 2009|India

All suggestions are welcome.

Bulk Import Members (Users) Plugin for BuddyPress Site

We wanted to provide seekers at Unstructure , with a better experience and a richer profile. Keeping this in mind, we decided to include Buddypress .

While the site has been configured with Buddypress, one of the tasks that was required was to migrate users from a standard wordpress installation to the new buddypress members format. On finding, no plugin or tool available to do the same, I decided to write one.

The following defines how the plugin works, let me know your thoughts on this

  1. You can import UserName, FirstName, Lastname and Email. Where FirstName + LastName becomes FullName for BuddyPress
  2. Delimit your data with “[|]” (pipe sign) like username|firstname lastname|email@domainname.com
  3. Paste your data in the given box
  4. Choose any of the 3 Email notification options
  5. Click on the import user button

Download plugin from here (Version 0.1)
Download For New BuddyPress 1.0.1

Unstructure 2009

The 2009 season of Unstructure Discussions has begin with a new mentor and many more in the future. Its also the beginning of new season here in India after festival Holi (According to Indian calendar Vikram Samvat).

Site is enhanced with new contemporary look and features so that seekers can contribute more to the platform.

Some of the new features are listed below

  • Extended seekers profile with more detail about seeker
  • Connect to seekers like friend connect
  • Wire post to the connected seeker for informal discussions on a topic
  • Now you can also send personal messages to any connected seeker
  • The flexibility to start or join groups on a topic of interest
  • Comment threading to all the posts, where you can reply to any comment
  • Ticker will keep track of all activities on platform
  • In the side bar now you can keep track of new, active and popular seekers
  • At the bottom of home page you can see who is currently online etc.

In the near future, many more new things are planned..

Install WordPress MU with www.

WordPress MU, by default, does not allow “www.” to be put during installation. These four characters just seem out of place but also there are instances where one might require the same.

Recently Charles (ckck) sent a message on configuring his domain with www. I found his reasons to be valid and decided to assist him on this query.

I initially made changes to the main database and it worked. In my view, however this was not satisfactory as one had to search in all the tables and edit the given domain name in the main database.

An alternate approach was identified where certain files in the original source were modified before proceeding with the installation. These files are wpmu-settings.php and index-install.php . After making the necessary changes , you can proceed with the installation.

Method 1 – make changes in the main database

1. Install WordPress MU without www.
2. While installing, choose sub-directories option.
3. Check your installation by clicking on “Hello world!” post as well as by login to your admin interface. Make sure it installed properly.
4. Login to your MySql database where you have installed you WordPress MU
5. Open database and edit all records where your domain name exists without www. (Add www. in all). You can use search to find out this.
6. Edit you wp-config.php exists in the main folder of your WordPress MU and change
define(’DOMAIN_CURRENT_SITE’, ’YourDomain.com’ );
to
define(’DOMAIN_CURRENT_SITE’, ’www.YourDomain.com’ );
7. Edit the “wpmu-setting.php” file exists in the main WordPress MU directory.
Comment line no. 9 and 10

if( substr( $domain, 0, 4 ) == ‘www.’ )
  $domain = substr( $domain, 4 );

Your installation should work .

Method 2 – Modify Files before installing

1. Open wpmu-settings.php
comment line no. 9 and 10

if( substr( $domain, 0, 4 ) == ’www.’ )
 $domain = substr( $domain, 4 );

2. Open index-install.php
comment line no. 514 and 515

 if( substr( $domain, 0, 4 ) == ’www.’ )
 $domain = substr( $domain, 4 );

comment line no. 652,653,654,655 and 656

 if( substr( $_POST[ 'basedomain' ], 0, 4 ) == ’www.’ ) {
 printheader();
 nowww();
 continue;
 }

comment line no. 665

 $_SERVER[ 'HTTP_HOST' ] = str_replace( ’www.’, ’', $_SERVER[ 'HTTP_HOST' ] ); // normalise hostname - no www.

3. Install wordpress mu with www.youdomainname.com

It should work fine.

Let me know if it worked for you or you have any other comments.