Category Archives: General

Safer event handling with jQuery namespaced events

How you apply and remove event handlers may also cause problems that can be really hard to troubleshoot. E.g if you had attached a function to the window.resize event. Calling the following script will remove all window.resize handlers:

$(window).unbind(‘resize’);

jQuery provides an easy way to avoid this: Namespaced Events. When binding a function to an event, simply add a namespace:

$(window).bind(‘resize.mynamespace’, function () {

// Do something useful

});

Now if you need to unbind the function from the event, you can do it safely without affecting other scripts that use the same event:

$(window).unbind(‘resize.mynamespace ‘);

References:-

http://www.456bereastreet.com/archive/201205/safer_event_handling_with_jquery_namespaced_events/

How to View Email headers or Email Source in Outlook 2010

I web browser it is easy to seem the source of you HTML email but in clients like Outlook it is a bit difficult by default.

Here are some steps to do it:-

  1. Right click an chose “CUSTOMIZE THE RIBBON”

  1. Choose “All commands” and then “Message Options”

I am only able to find this L

Reference:-

http://absoblogginlutely.net/2010/04/view-headers-or-source-in-outlook-2010/

List of twitter web clients working in pakistan

  1. https://seesmic.com/web/index.html
  2. http://yfrog.com

More to come. Just try these for now

Time Saving Web Apps for CSS Web Designers

The web has advanced so much that we can’t even compare to the Internet of 5 years ago. So many modern tools and apps are based in browser these days. And many of these can be useful for the average web designer. I’ve included tools for not only designers, but graphics artists, CSS and HTML developers. Let us know your favorite tools in the comments below.

CSS3 Generator


html2canvas


Phoenix Image Editor


Color Scheme Designer


Resize my Browser


Ultimate CSS Gradient Generator


CSS Layout Generator


Grid Layout Generator


Custom CSS Grid Builder Online


Privacy Policy Generator


Typesetter


HTML Column Layout Generator


Form Style Generator


CSS Grid Builder


FAARY – CSS Forms


HTML-Ipsum


CSS3 Menus


Awesome Font Stacks


References:-

Copied from http://designm.ag/resources/18-time-saving-web-apps-for-cssweb-designers/

How to get browser version in Zend php framework

It can be simply get through.

var_dump($_SERVER['HTTP_USER_AGENT']);

Or you can use Zend_Http_UserAgent class

$userAgent = new Zend_Http_UserAgent();
$device = $userAgent->getDevice();
$browser = $device->getBrowser();
var_dump($browser);
$browser = $device->getBrowserVersion();
var_dump($browser);
$browser = $device->getAllFeatures();
var_dump($browser);
$browser = $device->getUserAgent();
var_dump($browser);               

15 Highly-Useful Resources for Cross Browser Testing

Browser testing is one of the parts of the design and development process that is necessary but never really enjoyable. With the number of browsers and operating systems that are available, it can be a very time-consuming process to test your website in the environments of visitors. There are a number of tools and resources that have been created to help with this situation, and we’ll profile 15 of them in this post.

Adobe BrowserLab
Adobe BrowserLab is a free resource that allows you to see how your site looks in a wide variety of browsers in Windows XP or Mac OS X (you will need an Adobe account). Once you’ve chosen a browser and an operating system you can enter the URL to see how it looks. You can view one at a time or side-by-side from two different browsers.

BrowserShots
BrowserShots is a popular and free resource for getting screenshots from various browsers and operating systems. Enter a URL and wait a few minutes (sometimes longer) and your screenshots will load. Priority processing is also available that will cut out the waiting time and allow you to get as many screenshots as you want of any site. The price is $29.95 per month.

Litmus
Litmus produces screenshots from major browsers on Windows and Mac OS X, plus there are features for bug tracking and testing private sites. Litmus also includes features for testing emails in various email clients. A limited free plan is available, and paid plans start at $39 for 14 days.

Browsera
Browsera is a bit different from many of the other resources listed here because it runs reports and sends you the details. It detects differences in a site’s rending in browsers to make your testing a bit easier. Browsera can also test private pages protected by a login. A limited free plan is available and paid plans start at $39 for 14 days.

CrossBrowserTesting
CrossBrowserTesting is a premium service (with a one-week free trial) that allows you to pick a browser and an operating system and test a site. This allows you to test a live website rather than just producing a screenshot, and automated screenshots are another feature. The Basic Plan offers 150 minutes of testing for $19.95 per month.

Browser Sandbox
The Browser Sandox is a free tool that allows you to run any of the major browsers on your system. Click on the browser that you want, it will open and you’ll be able to test any website live in that browser (note:  this service does not appear to work in Chrome).

Expression Web SuperPreview
Microsoft’s Expression Web SuperPreview is a free download for Windows. Web SuperPreview is a standalone application that will allow you to test in various browsers and operating systems.

IE NetRenderer
IE NetRenderer is a convenient, free resource for testing in IE5.5 – IE8. Simply choose the version of IE that you want and enter a URL. You’ll be able to see the full length of the page, but you can’t interact with the page in the browser.

BrowserCam
BrowserCam allows you to test a site live (as opposed to screenshots) in any brower and operating system. It also includes features for testing on mobile devices, and testing emails. There are a number of different plans to choose from based on your needs and the length of subscription that you want. A 24-hour free trial is available that will allow you up to 200 screen captures.

Multi-Browser Viewer
Multi-Browser Viewer is software (Windows) that can be purchased to help with testing your sites and designs. It offers 16 virtualized browsers and 48 screenshot variations. You can run any of the browsers quickly and easily. A single-user license costs $129.95 and 14-day free trial is available.

NetMechanic
NetMechanic’s Browser Photo will provide you with screenshots from a wide selection of browsers and operating systems. Browser Photo is available for $150 per domain per year, or $15 for one-time use.

Test iPhone
Test iPhone is a free iPhone simulator that allows you to preview how pages will look on an iPhone, and you can also interact with pages through the simulator. Note: if you want to access a mobile version of a site you will need to enter the URL of the mobile site.

iPhoney
iPhoney provides a 320 by 480-pixel canvas (powered by Safari) so you can test sites as they may appear on mobiles (it is not an iPhone simulator, just an appropriately-sized browser). iPhoney is available for free download from MarketCircle.

IETester
IETester from DebugBar is a free web browser (Windows) that allows users to test websites in IE8, IE7, IE6, and IE5.5.

ViewLike.us
ViewLike.us isn’t a tool for testing your site in different browsers, but while you are doing your browser testing you may also want to test at various screen resolutions. With ViewLike.us you can choose a resolution and enter a URL to see how it looks. It’s a quick way to test a page or site for a variety of resolutions.

Copied from:-

http://designm.ag/resources/browser-testing/

Best way to execute a project

  1. Be Clear:-

    Try to be crystal clear from the start what you have to achieve.

  2. Scope:-

    Try to finalize the scope with client. The Sloppiest part; to be rigid with the scope aspect, tries to make the stuff in black in white. (Still client say is the veto, but at least you can restrict him to some boundaries).

    1. Person Responsible for scope:-

      Dedicatedly assign a person for scope management, mere it a project manager or a business consultant or any person in charge. But his say should be considered as full and final and he should be the only accountable person for scope as well. He should have been given the powers to say Yes or No to the client, irrespective of any pressure from higher ups.

    2. Centralized Scope management document:-

      There should be a centralized location where all documents should be kept. Scope document should be under a version control system (e.g. SVN) to log the changes, rather than creating copies of document.

    3. Create Wireframe:-

      It’s nearly impossible for client to visualize all, what you have documented. His thinking will start once you deliver the project. So it’s better to create wireframe for the application you are going to create.

    4. Create a realistic deadline:-

      Once you know your entire requirements, try to break up all in small tasks. The more specific you are; more on target you will be. Don’t be ashamed to consult the person, doing the job, for estimation.

  3. Start:-

    “Nobody can go back and start a new beginning, but anyone can start today and make a new ending.”

    “If you start soon enough, you won’t have to run to catch up.”

    Once you start up you will find certain thing, for sure, that you might have or haven’t planned for.

  4. Changes:-

    Once you proceed with the project, you clients mind will start working and he will come up with new changes and requirement, try to analyze the impact of each and every possible change. For each and every change your immediate response should be “NO”. Then use negotiation to turn this “NO” to “YES”. Any big change should never be allowed in middle of the project, it will surely spoil you whole project and waste your time, effort and money.

    Changes should be incorporate in any future release.

@@Identity, Scope_Identity() and Ident_Current(‘tablename’)

  • @@Identity
    • Returns the last identity produced on a connection
  • Scope_Identity()
    • Returns the last identity value produced on a connection and by a statement in the same scope.
    • This return the last identity value you explicitly created, rather than any identity created by any trigger.
  • Ident_Current(‘tablename’)
    • Returns the last identity value produced in a table, regardless of connection. It also accounts so roll backed item let say if you have 2 rows insert and two rolled back it will contain 4 instead of 2.

Formatting date in php

All you have to do is to use strtotime

<?php date(“Y-m-d”, strtotime(“2011-W17 Saturday”)) . “\n”; ?>

Case Sensitive

DAYS
d – day of the month 2 digits (01-31)
j – day of the month (1-31)
D – 3 letter day (Mon – Sun)
l – full name of day (Monday – Sunday)
N – 1=Monday, 2=Tuesday, etc (1-7)
S – suffix for date (st, nd, rd)
w – 0=Sunday, 1=Monday (0-6)
z – day of the year (1=365)

WEEK
W – week of the year (1-52)

MONTH
F – Full name of month (January – December)
m – 2 digit month number (01-12)
n – month number (1-12)
M – 3 letter month (Jan – Dec)
t – Days in the month (28-31)

YEAR
L – leap year (0 no, 1 yes)
o – ISO-8601 year number (Ex. 1979, 2006)
Y – four digit year (Ex. 1979, 2006)
y – two digit year (Ex. 79, 06)

TIME
a – am or pm
A – AM or PM
B – Swatch Internet time (000 – 999)
g – 12 hour (1-12)
G – 24 hour c (0-23)
h – 2 digit 12 hour (01-12)
H – 2 digit 24 hour (00-23)
i – 2 digit minutes (00-59)
s 0 2 digit seconds (00-59)

OTHER e – timezone (Ex: GMT, CST)
I – daylight savings (1=yes, 0=no)
O – offset GMT (Ex: 0200)
Z – offset in seconds (-43200 – 43200)
r – full RFC 2822 formatted date

jQuery Plugins that enhance and beautify HTML form elements

Introduction

This article will cover the following elements:

Form Skinning

Frustrated with the form elements inconsistency among different browsers? With these jQuery plugins, you can unify the look and feel of all your form elements.

Form Validation

It’s always good to have client side form validation. These jQuery plugin will save your times and works by reusing already made form validation.

Masking

Masking can help to avoid human mistake. I found these plugins are very helpful to guide users and decrease the chances of bad data.

File Uploader

These file uploader transform the orginal input file element into a more robust file uploader that able to upload multiple files and having a progress bar to indicate the upload progress.

Checkbox & Radio Button

Spice it up your checkbox and radio button with these jQuery plugins!

Spin Button & Slider

Spin button can be useful sometimes. The other alternative will be a slider.

Auto Complete

You must have seen the auto complete functionality from Apple.com, google.com and all the major websites. With the following plugins, we, too can implement it in our websites easily.

Calendar & Time picker

The old school method to let user select date and time are using drop down lists (day, month and year). Now, we can use a calendar, timepicker to replace the old way. Since it’s picked from calendar, it decreases the chances of invalid date. I like them.

Drop Down Menu (Select Element)

Want to do more with drop down menu? These plugins able to add more capabilities to drop down menu.

Color Picker

If you are building some online tools that involve colors, I guess you will like the following plugins. JQuery based color pickers!

Textarea

Sometimes, we get really annoyed when we have to type in message in such a small space (a textarea), and we have to scroll up and down, left and right (sometimes) to read the entire message. Say no more to scrolling! Add this autogrow/resizer capability to textarea to avoid that.

Using Email template in Asp.net using AlternateView

You can simply send an email using the template as an html using following code

private void SendEmail()
{
try
{
string subject = “Email Subject”;
AlternateView htmlView = GetEmailViewFromTemplateTemplate(“Wahab Hussain”);

System.Net.Mail.MailMessage Msg = new System.Net.Mail.MailMessage();
System.Net.NetworkCredential SmtpUser = new System.Net.NetworkCredential();
SmtpUser.UserName = “youraccount@gmail.com”;
SmtpUser.Password = “YourAccountPassword”;
Msg.To.Add(“youraccount@gmail.com”);

System.Net.Mail.MailAddress fromAddress = new System.Net.Mail.MailAddress(“youraccount@gmail.com”, “Your Name”);
Msg.From = fromAddress;

Msg.Subject = subject;
Msg.Body = null;
Msg.IsBodyHtml = true;
Msg.AlternateViews.Add(htmlView);

System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient();
SmtpServer.Credentials = SmtpUser;
SmtpServer.Port = 587;
SmtpServer.EnableSsl = true;
SmtpServer.Host = “smtp.gmail.com”;

SmtpServer.Send(Msg);
}
catch (Exception ex)
{

}
}

private AlternateView GetEmailViewFromTemplateTemplate(string toName)
{
StringBuilder emailTemplate = new StringBuilder();
string filePath = Server.MapPath(“emailTemplate.htm”);

AlternateView htmlView = null;
if (System.IO.File.Exists(filePath))
{
emailTemplate = new StringBuilder(System.IO.File.ReadAllText(filePath));
emailTemplate.Replace(“<%Name%>”, toName);

htmlView = AlternateView.CreateAlternateViewFromString(emailTemplate.ToString(), null, “text/html”);

}

return htmlView;
}

protected void btnSendEmail_Click(object sender, EventArgs e)
{
SendEmail();
}

Here is the template

 <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title></title>
</head>
<body>
Hello <%Name%>
Congratulations!
How are you? you have received an email via email templating.

</body>
</html>

How to host websites other than htdocs in apache /Creating a virtual directory in apache

All you need to do is to create a virtual directory to host your website at any location other than htdocs

Locate httpd.conf it is located inside “Apache2\conf\ 

Locate <Directory /> in httpd.conf and add following line below to create an alias

Alias /yourwebsite “D:\Work Folder\yourwebsite”

<Directory “D:\Work Folder\yourwebsite “>

Options Indexes FollowSymLinks MultiViews ExecCGI

AllowOverride All

Order allow,deny

Allow from all

</Directory>

Now you can simple browse you website using the same http://localhost/yourwebsite  pages will be served from new directory

 

Ambulance Services in Karachi

  1. Edhi Ambulance http://edhi.org/
    1. Contact Number: 115
    2. Fund: Rs.200/- (You can pay additional at your own will)
  2. Chhipa Ambulance http://www.chhipa.org
    1. Contact Number: 111-111-134
    2. Fund: Rs.300/- (You can pay additional at your own will)
  3. Aman foundation Ambulance http://amanfoundation.org
    1. Contact Number: 111-112-626
    2. Fund: Rs.400/- Atleast

Radio Cabs Contact Number in Karachi

  1. Metro Radio Cab
    1. 111-222-787
    2. 111-222-227 (DHA, Clifton)
    3. Compliant Number 021-3439 3341

Z-index not working when Flash file is used

Z-index usually do not work when you have a flash file embedded, for this you have to set wmode to transparent


Following are the two main things that need to be changed or added

<param name=”wmode” value=”transparent”>
and
wmode=”transparent” inside the
etc. tag.

wmode is an optional parameter in Internet Explorer 4.0 and higher, that allows you to take advantage of the layering, absolute positioning, and transparent movie features. When you add the parameter tag for wmode and edit it into your embed src tag (it must be in both), it lets you set all non-object areas of the Flash movie to transparentopaque, or window. The later creates a separate rectangular window.

Reference:-

http://animation.about.com/od/flashanimationtutorials/ss/flashwmode_4.htm

Severe pain in back ear and back of head

It is merely for my reference only(Yet Public :-) ). (You can use it at your own risk)

Symptoms:-

Having severe pain in right ear seems like a pain in back ear. Also having headache in my half back-head lowering back to throat on right side.

Diagnosis:-

Diagnosed as, referred pain from throat.

Medication:-


Windows 7 built in filtering

Here is an easy but unnoticed (at least for me) built in filtering mechanism in Window 7. Hope this might help you in daily tasks.

 

 

How to host a facebook application into a facebook page tab

  1. Create a new app

  2. Enter App name and app namespace

  3. Enter basic information

  4. Enter app related information ( here the application is hosted via local host)

  5. Page tab and its url her

  6. Now you need to mention on which page this tab should be added

    E.g. www.facebook.com/dialog/pagetab?app_id=YOUR_APPLICATION_ID&next=https://localhost:443/yourapplication/home.aspx

  7. Select the page on which you want to add the tab

  8. Now you can go to your facebook page and use the application from there as a tab.

    That all now you can use your application

The web server process that was being debugged has been terminated by Internet Information Services (IIS) 7.5

Go to IIS server (run – > inetmgr – >Application pools – > Advanced Settings – > either change ping period or permanently disable ping enabled as shown below

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I recently run into a problem where I using following connection string for a csv file

this.ConnectionString = @”Driver={Microsoft Text Driver (*.txt; *.csv)};Extensions=asc,csv,tab,txt;Dbq=” + @FolderPath;

But I always give me Data source name not found and no default driver specified error. I was using Window 7, 64 Bit and Office 2010 (it’s 32 bit app) Installed. The suggested solution was to

  1. Uninstall any 32-bit Office apps.
  2. Install the Access 64-bit drivers
  3. Re-install any 32-bit Office apps

If you try to install access 64 bit without un-installing 32 bit office products it gives following error


Un-installing 32-bit office was sort of impossible solution for me, so I opted for another solution

I Opened the registry editor and browse to the location

HKEY_CLASSES_ROOT\Installer\Products\ 00002109030000000000000000F01FEC

Here most of the keys are related to MS office application so I renamed them to include a prefix of “.” E.g .00002109030000000000000000F01FEC


Then I installed Access 64-bit drivers, It worked like a charm. Then I re-booted the system and again renamed all them back to their original name excluding only one shown below.

Other step I have to was to change connection string to

this.ConnectionString = @”Driver={Microsoft Access Text Driver (*.txt, *.csv)};Extensions=asc,csv,tab,txt;Persist Security Info=False;Dbq=” + @FolderPath;

References:-

  1. http://stackoverflow.com/questions/6490543/data-source-name-not-found-and-no-default-driver-specified
  2. http://social.msdn.microsoft.com/Forums/nl-NL/adodotnetdataproviders/thread/abf34eea-1029-429a-b88e-4671bffcee76
Follow

Get every new post delivered to your Inbox.

Join 331 other followers