Saturday, August 23, 2008

iPhone 3G is OUT...

... BUT is it worth it's hype? Priced at >30K is it really worth? The touch and feel feature is very nice but that's because it's a new concept (not anymore though). But an enterprise user needs more than that. Some cool feature missing from the new 3G are:
  1. It has no video recording option iPhone will disappoint you here.. This is quite surprising since video recording feature is today found in most cell phones, even those at the lower end.
  2. It has 2 mega pixel (MP) cameras. Flash and optical zoom are missing too. Despite a 2 mega pixel camera -- belie that number and turn out quite clear.
  3. One cannot simply forward a text message. Users can only send text messages or snapshots via email. Also, don't think of sending a SMS to multiple contacts as iPhone has no option for that either.
  4. Lack of multimedia messaging controls and voice dialing. It lacks support for voice-recognition to let users dial verbally
  5. No cut, copy-and-paste. Imagine you cannot even select a line of text to delete it. And how bad can it be living without copy and paste option. Especially when you want to post a URL in your blog! How tedious it would be to jot it down, word by painful word.
  6. It lacks support for multi-select. It will give users a tough time deleting every email one by one as they cannot delete mails in bulk. Same goes for photo albums. Users have to delete the same too one by one
  7. All you heavy phone users, you cannot change an iPhone battery. You will have to send it to an Apple outlet for this. Imagine how troublesome it would be to live without your phone for 2-3 days. And that is an optimistic estimate of the time that you may spend twiddling your thumbs!
  8. iPhone offers no support for wireless modem. You may pay heavy data charges to activate Internet on your iPhone, but you cannot connect it to your PC and browse when you are at home.
  9. iPhone can't sync with Bluetooth stereo or in-car Bluetooth hands free. It lacks A2DP on Bluetooth. A2DP audio devices, such as stereo Bluetooth headsets, offer high quality listening ability.
  10. you cannot share MP3, images and video files via Bluetooth, half the fun is gone.
  11. In case you wish to see those multimedia files that require Flash, you will have to do away with them. There is no support for Adobe Flash in 3G iPhone. Though, Adobe says it is working on iPhone Flash.
  12. iPhone offers You Tube support. But how? Here's a catch. Users cannot get all You Tube video, but only a few selected ones that have been rolled out for the Apple-favored H.264 video codec. So, this means you can't go on sharing your videos.
  13. please do remember, unlike the true Push platform enjoyed by Blackberry, the iPhone email client does not work in true Push fashion, but is more of a "pull" mail.
  14. Last, but not the least, be aware that as a customer you are unlikely to get much support from the operators in setting up your haloed iPhone. And since setting it up would be essential to use a number of features.
  15. Sending out the cool pics you shoot through iPhone's excellent 2 mega pixel camera will be a challenge unless you have set up the email accounts.
There might be some more features missing that you may wish for. So please invest your money wisely. Read the reviews online. Identify your needs and see if iPhone satisfies all of them. Its a big investment for many people so use brain and not heart.

And if you awant to show off and flaunt it, go ahead ;)...(Remeber the ad... Nice phone...)

Thursday, June 26, 2008

JavaScript | Print all properties of Object

To Print all properties of an object in JavaScript, use for-in as follows:


<script language="Javascript">
var obj = new Object(); //Create new object
obj["firstName"]="Davendra"; //Assign property firstName with value Davendra
obj["lastName"]="Upreti"; //Assign property lastName with value Upreti
var str=""; //variable which will hold property values
for(prop in obj)
{
str+=prop + " value :"+ obj[prop]+"\n"; //Concate prop and its value from object
}
alert(str); //Show all properties and its value
</script>

Monday, May 12, 2008

Multiple websites on XP

XP Pro IIS Admin is a free tool for using on Windows 2000/XP Pro. It allows you to create multiple websites and easily switch between those websites. Without this utility on Windows 2000/XP Professional, only one website can be created.

You can get it here: http://jetstat.com/iisadmin/

Wednesday, April 30, 2008

Not able to map Network Drive? Read on..

Ever got this problem while mapping a network drive:

The network folder specified is currently mapped using a different user name and password.To connect using a different user name and password, first disconnect any existing mappings to this network share.

And when you see your network mappings, strangely the drive is not mapped :(

Well, the solution is old reliable DOS commands. here it goes:

> net use
> net use \\SharedDrive /delete

net use command displays a list of all mapped drive. there will be a IPC$ mapping for the drive you want to connect to. Just delete the sharing and then you will be able to connect to the server.

FYI: The Inter-Process Communication (IPC) share or ipc$ is a network share on computers running Microsoft Windows. This share is used to facilitate communication between processes and computers, often to exchange authentication data between computers.

Wednesday, April 11, 2007

HTML Table Sort

Many a times we have a table populated with data and we want to sort on a specific column. It doesn't makes sense to hit the server for data that we already have. The solution is to use DOM to sort the data and repopulate table using JavaScript. There are a number of such scripts available on net and a simple Google search returns a lot of results. For e.g. try searching for "HTML table sorting". One very simple to use script is available at http://webfx.eae.net/dhtml/sortabletable/sortabletable.html.

Tuesday, February 27, 2007

Regex | Validate email

There are a number of JavaScript modules available online which validates email address. But there are instances when a valid mail address is also invalidated for e.g. some assume all domains end in .com, .net, .edu, or .org; and other invalidate mail ID with a + in the local-part. RFC 2822 (former RFC 822) describes the format of mail address.

So, here's the JavaScript code to validate the e-mail address as per RFC. Please correct it if there are any discrepancies.

function checkMail(emailAdd)
{
var regExobj = /^[-!#$%&'*+/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/0-9=?A-Z^_a-z{|}~])*@[a-zA-Z](-?[a-zA-Z0-9])*(\.[a-zA-Z](-?[a-zA-Z0-9])*)+$/;

return(regExobj.test(emailAdd));
}

.Net Free Charting Solution | ZedGraph

ZedGraph is a set of classes, written in C#, for creating 2D line and bar graphs of arbitrary datasets. The classes provide a high degree of flexibility -- almost every aspect of the graph can be user-modified. At the same time, usage of the classes is kept simple by providing default values for all of the graph attributes. The classes include code for choosing appropriate scale ranges and step sizes based on the range of data values being plotted.

ZedGraph also includes a UserControl interface, allowing drag and drop editing within the Visual Studio forms editor, plus access from other languages such as C++ and VB. ZedGraph is licensed under the LGPL.


ZedGraph Home Page: http://zedgraph.org/wiki/index.php?title=Main_Page

ZedGraph Tutorial: http://codeproject.com/csharp/zedgraph.asp

Wednesday, January 17, 2007

Create Comments Faster | Visual Studio 2005

GhostDoc is an add-in for Visual Studio .NET 2003 and 2005 that tries to automate XML documentation. With GhostDoc installed, you move the cursor into the method or property you want to document, invoke the "Document This" command using either the source editor's context (right-click) menu or a hotkey, and GhostDoc will create an XML documentation comment. The result for

public void AppendHtmlText(HtmlProvider htmlProvider){...}

would be:

///
/// Appends the HTML text.
///

/// The HTML provider.
public void AppendHtmlText(HtmlProvider htmlProvider)
{
...
}


Some more examples are:

///
/// Gets the at the specified index.
///

///
public string this[int index] {
get { ... }
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

///
/// Gets or sets a value indicating whether
/// this is cool.
///

///
/// true if cool; otherwise, false.
///

public bool Cool
{
get { return true; }
set { ; }
}


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

///
/// Determines the size of the page buffer.
///

///
/// Size of the initial page buffer.
///
public int DeterminePageBufferSize(int initialPageBufferSize)

GhostDoc can be downloaded from here.

Tuesday, January 16, 2007

Smart Paster | Add-In for Visual Studio

SmartPaster is a plug-in for Visual Studio .NET 2003 and 2005 that allows text on the clipboard to be pasted in a format compatible with C# and Visual Basic code. SmartPaster can be downloaded from here.

Wednesday, December 20, 2006

JavaScript | String Concatenation

While implementing AJAX, very frequently we cam to situation where we had to parse large XMLs and create HTML out of these. This included looping over XML nodes and appending items to HTML string.

There are some options to improve performance in these scenarios where string concatenation is required:


  • Minimize the size of the string that is being appended to (so there is less memory to reallocate) . This means use local variables inside for loop and the concatenate these small strings to main HTML string variable. e.g.:

buf += "

";
for (var i=0; i < ROWS; i++){
var row = "";
for (var j=0; j < COLS; j++){
row += "";
}
row += "";
buf += row
}
buf += "
" + CELL + "
";

  • The Array object join method provides us a way to join all the elements of an array into a single string separated by a specified string separator. If we will assign each string as an element in the Array and will join all the elements with an empty char as our separator we will have the same result as using the + operator. This method is very similar to Java's StringBuffer object. e.g.:

var buffer = new Array();
buffer[buffer.length] = "Hello";
buffer[buffer.length] = " World";
buffer.join("");

Monday, November 27, 2006

Zip-Up

In case you want to add the "zip" or "unzip" functionality in your application, Info-Zip is your best bet. Info-Zip is portable, high-quality, used in many commercial applications and best of all it's FREE.

A sample implementation for VB6 can be found HERE

Another freeware (this one for .Net) is available at kellermansoftware.com

So, Zip-Up ur application ;)

Monday, September 04, 2006

Is 0=="" true or false?

In JavaScript that's true. And it was a cause of major bug in one of our application that took us 3 hrs. to debug :(

Hope you guys don't have to go through such bugs. Best of Luck.

Monday, August 28, 2006

Impersonation in .Net

There are scenarios when you may want to impersonate in .Net. What this means is you want to execute a part of your code with different authentication information. There are numerous scenarios when you may want to do it. An example: suppose you want to write a file to shared location where the user authentication running the application doesn't have write permissions. So what do you do? Impersonate your piece of code as the user who has rights to write file.

Here's the Microsoft kb article to how to impersonate your piece of code:
http://support.microsoft.com/kb/306158/

Sunday, August 20, 2006

CTRL + C, CTRL + V

Have you ever been in a situation where a dialog box pops up with some message which you need to copy? Many times. Right? Well, at least I have in the course of my development career.

Till date I was not aware of an easy way to copy this text and was manually typing the content. But recently one of my friend showed me a very simple way to do this, CTRL+C, CTRL+V. Yes, it works for dialog boxes. Whenever a dialog box pops up, just do a copy paste and you have the contents.

That's the power of copy-paste ;)

Monday, August 14, 2006

JavaScript | Redirect Parent Window

Have you ever faced a situation where you wanted to close a child window and redirect parent window to a new URL?

Well the solution to this problem is a simple javaScript. It goes something like this (I have executed the script on page load. It can be used with any event)

<body onload="opener.location='http://google.com';self.close();">

Sunday, August 13, 2006

Interesting XSLT Problem

This weekend I worked on a very interesting XSLT problem. I had to convert an XML like:



<?xml version="1.0" encoding="UTF-8"?>
<category>
    <type>1</type>
    <value>20</value>
</category>
<category>
    <type>2</type>
    <value>10</value>
</category>
<category>
    <type>1</type>
    <value>25</value>
</category>
<category>
    <type>2</type>
    <value>40</value>
</category>
<category>
    <type>2</type>
    <value>41</value>
</category>
</categories>


to something like:


<?xml version="1.0" encoding="UTF-8"?>
<output>
    <grid>
        <type val="1">
            <value>20</value>
            <value>-NA-</value>
            <value>25</value>
            <value>-NA-</value>
            <value>-NA-</value>
    </type>
        <type val="2">
            <value>-NA-</value>
            <value>10</value>
            <value>-NA-</value>
            <value>40</value>
            <value>41</value>
        </type>
    </grid>
</output>

I spent couple of hours figuring out how to solve it. Then I came across an interesting XPATH statement at http://www.topxml.com/code/default.asp?p=3&id=v20040207215613&ms=100&l=&sw=All to retrieve distinc values. I worked upon it and wrote the following XSLT which strangely worked :)



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <Output>
            <Grid>
                <xsl:for-each select="//category[not(type=preceding::category/type)]/type">
                    <xsl:element name="type">
                        <xsl:attribute name="val"><xsl:value-of select="."/></xsl:attribute>
                        <xsl:call-template name="map">
                            <xsl:with-param name="type">
                                <xsl:value-of select="."/>
                            </xsl:with-param>
                        </xsl:call-template>
                    </xsl:element>
                </xsl:for-each>
            </Grid>
        </Output>
    </xsl:template>
    <!--Called Once for each type -->
    <xsl:template name="map">
        <xsl:param name="type"/>
        <xsl:for-each select="//category[not(value=preceding::category/value)]/value">
            <xsl:call-template name="checkAvailability">
                <xsl:with-param name="type">
                    <xsl:value-of select="$type"/>
                </xsl:with-param>
                <xsl:with-param name="value">
                    <xsl:value-of select="."/>
                </xsl:with-param>
            </xsl:call-template>
        </xsl:for-each>
    </xsl:template>
    <!-- Called once for each value -->
    <xsl:template name="checkAvailability">
        <xsl:param name="type"/>
        <xsl:param name="value"/>
        <value>
            <xsl:choose>
                <xsl:when test="//category[type=$type and value=$value]">
                    <xsl:value-of select="$value"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>-NA-</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </value>
    </xsl:template>
</xsl:stylesheet>