Recent twitter entries...

Online(ish) shopping genius from Tesco in South Korea

Posted in Recommendations | Posted on 06-07-2011

For too long now I have been thinking to set up a regular automated weekly shop from some online Tesco / mysupermarket or other shopping behemoth but can never get around to sitting there with some clunky shopping cart trying to work out which items are most frequently bought by us in the shop and would need pretty much every week on the week that would be substantial enough to justify the delivery cost.

I get around by bicycle and car in London so if this idea below were to come here or when it comes here! it wouldn’t be much use to me but the concept is fantastic for people that spend time on their commute just standing around waiting for a train or a bus while they need to also find time to get their shopping.

The idea is to use your smartphone to scan QR codes from TV advertising billboard shopfronts which then build the shopping cart on your phone application that you order to be delivered to your home.


Bind a Dataset to a Listbox using OleDbDataAdapter

Posted in C# | Posted on 06-07-2011

Need to bind a web control to an OleDb data source in your C# web application, here’s the magic. In this case I am binding a ListBox control with an ID of ListBox1 to the ProductName field in the Products table of our old friend the Northwind database.

These are the using statements that you need to apply including the ConfigurationManager to get your web.config connection string conveniently

using System.Data;
using System.Data.OleDb;
using System.Configuration;

Here is our class that does all the work

protected void DataSetFromOleDbDemo()
    {
      string strSQL = "SELECT * FROM Products WHERE CategoryID = 1";
 
      var conString = ConfigurationManager.ConnectionStrings["Northwind"];
      string Conn = conString.ConnectionString;
 
      try
      {
        using (OleDbDataAdapter adapter = new OleDbDataAdapter(strSQL, Conn))
        {
          DataSet ds = new DataSet();
          adapter.Fill(ds, "ProductInfo");
 
          foreach (DataRow dr in ds.Tables["ProductInfo"].Rows)
          {
            ListBox1.Items.Add(dr["ProductName"].ToString());
          }
        }
      }
      catch (Exception)
      {
 
        throw;
      }
    }

And your OleDb connection string to put in the connectionStrings section of your web.config is as follows

<connectionStrings>
    <add name="Northwind" connectionString="Provider=SQLOLEDB;server=YOURSERVER;database=Northwind;uid=USERNAME;password=PASSWORD;" />
</connectionStrings>

 

 


Populate a DropDownList with the names of installed fonts with C#

Posted in C# | Posted on 04-07-2011

Need to get a list of available fonts for your application?, this little gem will retrieve the font names of all installed fonts on your server (asp.net) and use them to populate a DropDownList.

These are the namesspaces you need to import to get this running.

using System.Drawing;
using System.Drawing.Text;

Assuming your DropDownList has an ID of “ddl”

<asp:DropDownList ID="ddl" runat="server" />

Your codebehind just needs an installed font collection object created with a foreach loop to go through in your Page_Load event.

InstalledFontCollection fonts = new InstalledFontCollection();
 
      foreach (FontFamily family in fonts.Families)
      {
         ddl.Items.Add(family.Name);
      }

Stuxnet amazing quick presentations to illustrate the Stuxnet worm

Posted in Coding | Posted on 27-06-2011

Unlike most viruses that are designed to harm computer systems, the Stuxnet worm was designed to infect specific industrial systems. And it was very successful in its mission. In June 2010, this virus nearly sabotaged Iran’s nuclear program and also made its way to India and Indonesia.

Australia’s ABC1 has created a brief animation that describes the Stuxnet worm in plain English and the dangers of a weapon that’s made of pure code.

Ralph Langner, the man who solved Stuxnet

Ralph Langner, who was one of the first researchers to successfully solve the sophisticated Stuxnet worm, spoke at TED 2011 on how they discovered Stuxnet and what happened in those 15,000 lines of assembly code that formed Stuxnet.


When a tiger becomes a giraffe, a lesson in customer service

Posted in Ramblings | Posted on 21-06-2011

I found this on one of the blogs I subscribe to and thought I’d republish it as it’s just so brilliant, a young girl writes to a supermarket to ask why tiger bread is called so…

Click the images to enlarge

Tiger bread 1 267x400 When a tiger becomes a giraffe, a lesson in customer service


tiger bread 2 266x400 When a tiger becomes a giraffe, a lesson in customer service