Mental Jetsam

By Peter Finch

Archive for the ‘Web’ Category

Web topics

Google Chrome multiple browser session instances

Posted by pcfinch on February 6, 2012

Have you ever wanted to login to a website using the same browser, but with multiple different sessions. For example, log in to GMail, using Google Chrome, but as two different users. Normally, the moment you login as the second user you will be logged out from the first session because the session information [cookie] is “shared” between the browser windows.

Here is a simple trick. Create a new short-cut to Chrome and add “–user-data-dir=c:\temp\user2” to the Chrome command and you’ll get a second “instance” of chrome, with completely different session information. If you want another instance, use a different directory name, etc. As a new instance it will not have any of the settings from your “normal” instance but it’s great for testing websites.

C:\Users\[username]\AppData\Local\Google\Chrome\Application\chrome.exe --user-data-dir=c:\temp\user2

BTW… unless you want to use the same browser information in the future, don’t forget to remove c:\temp\user2 when your done.

Posted in Web | 1 Comment »

Google Developer Day 2011 HTML 5 Challenge

Posted by pcfinch on August 22, 2011

I entered the Google Developer Day 2011 HTML5 challenge, to create a “Google doogle” of the Developer Day Logo entirely in HTML, and I actually made the cut… top 3 in Australia, I’m very happy 🙂

Posted in HTML, javascript, Personal | Leave a Comment »

Pop-up message in JQuery Mobile

Posted by pcfinch on May 10, 2011

The following code can be used to pop-up a message in JQuery Mobile similar to an Android “toast”.

$("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h1>Sorry, what was incorrect. Please try again.</h1></div>").css({ "display": "block", "opacity": 0.96, "top": $(window).scrollTop() + 100 })
  .appendTo( $.mobile.pageContainer )
  .delay( 1500 )
  .fadeOut( 400, function(){

BTW… I Love JQuery Mobile!!!!

Posted in JQuery | 13 Comments »

Displaying XML data in .NET

Posted by pcfinch on February 14, 2011

The following is an example of displaying information from a XML document in .NET using an “xmlDataSource” and “DataList”. This is a very simple way to display record base information from an XML data source placed in the application directory like the file below (e.g. “~/data/news.xml”), and it is easy to convert to an “sqlDataSource”, in the future, by replacing the “XPath()” function with “Eval()”.

<?xml version="1.0" encoding="utf-8" ?>
 <item id='a1'>
 <title>New Website</title>
 <date>Monday, 7th Feb 2011</date>
 <short>New Development Labs website.</short>
 <item id='a2'>
 <title>New Taskbar</title>
 <date>Monday, 207th Dec 2010</date>
 <short>Released new taskbar functionality.</short>

Just insert the following code into the C# webform and masterpage.

<asp:XmlDataSource ID="newsDataSource" runat="server" DataFile="~/data/news.xml">
<asp:DataList ID="newsDataList" runat="server" DataSourceID="newsDataSource">
 <img src='images/<%#XPath("image")%>' />
 <a href='details.aspx?id=<%#XPath("@id") %>'>
 <%#XPath("title") %>
 <div><%#XPath("date") %></div>
 <div><%#XPath("short") %></div>

A subset of the XML document can be selected by adding an optional “XPath” attribute to the “xmlDataSource” tag…

  ID="newsDataSource" runat="server"

or using the following C# code.

newsDataSource.XPath = String.Format("/news/item[@id='{0}']", id);

Posted in C#.NET, HTML | Leave a Comment »