It’s My Story!

OLE DB (MS Access) database connection problem in 64bit operating with C#

May 19, 2009 · 2 Comments

From last couple of weeks I am developing a desktop software called “TSF Core” built with C#. This software is replacement of a web (Apache, MySQL) admin panel based one web service (WSDL). I am using MS Access as a cash database to make the more process faster.

I was getting an exception with my database connection in 64bit vista ultimate bit it was working fine in XP 32bit, 2000 and VISTA 32 bit OS.

I am using Microsoft.Jet.OLEDB.4.0; to connect with .mdb. Connection string is something like that:

new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=tsf_barcode_reader.mdb");

I got a strange result when I Googled on it. There is no OLEDB version for 64Bit Operating system.

But there is a good solution for that at least it worked for my software. We can specify the software platform in project definition. To do this please open "my_project.csproj" in notepad or any other plain text editor and add the following code under "PropertyGroup" tag.

<PlatformTarget>x86</PlatformTarget>

Code will be some ting like that:

Previouse code:

<PropertyGroup Condition=" ‘$(Configuration)|$(Platform)’ == ‘Debug|AnyCPU’ ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" ‘$(Configuration)|$(Platform)’ == ‘Release|AnyCPU’ ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

Edited Cdoe

<PropertyGroup Condition=" ‘$(Configuration)|$(Platform)’ == ‘Debug|AnyCPU’ ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" ‘$(Configuration)|$(Platform)’ == ‘Release|AnyCPU’ ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>

In this situation the operations system will call 32 bit compatible database connection provider for that software and the problem will be solved.

→ 2 CommentsCategories: 64 bit OS · C# · MS Access

Organize a C# project to customize it from outside of source code

April 1, 2009 · 5 Comments

For any project we feel to process some configuration variables so that we can customize the software from out of sources code. It is important to make those variables available in each part of the project minimizing the system load. We can put the values either in an xml or Database. In my last C# project I’ve followed an interesting process.

I used a Single Tone Pattern Class to process my variables and declare the constructor “private” so that we can’t create more than one instance with “new” keyword.

private Dictionary sconfig;

Dictionary is a fantastic element to store temporary data. Here I used it something like associative array.

private static BCReaderConfiguration _bcrConfigObj = null;
public static BCReaderConfiguration getObject()
{
if (_bcrConfigObj == null)
{
_bcrConfigObj = new BCReaderConfiguration();
_bcrConfigObj.setConfig();
return _bcrConfigObj;
}
else
{
return _bcrConfigObj;
}
}

This the most interesting part of my coding. getObject() is a static method so that I can call it from anywhere with the name of class. Like:

BCReaderConfiguration.getObject();

I have declared a private variable with the type of my configuration class (“BCReaderConfiguration”) and storing the first instance of this object. Each time I call the function form other part of my coding first I check if the object already created. If this object is not created (First time call) then it’s creating new object otherwise returning the previous one. This process will save my Physical Memory as well as time because we are using same object for thousands of calls.

Let’s consider an XML file where all configuration variables are saved. Here is the example XML file :

<sconfig>
<node><svalue soption="check_update_title">Wait Checking for update</svalue> </node> <node><svalue soption="bad_database_structure">Bad Database structure!</svalue> </node> <node><svalue soption="guest_success_msg">Welcome!</svalue> </node>
<node><svalue soption="guest_failed_msg">Sorry</svalue> </node>
<node><svalue soption="general_inconvenience_msg">Sorry! For inconvenience</svalue> </node> <node><svalue soption="about">Version 1.0</svalue></node>
</sconfig>

Each “node” tag preserving one configuration value inside the tag and attribute “svalue soption” containing the variable name.

private XmlDocument getConfigXML ()
{
XmlDocument document = new XmlDocument();
return document.Load(“xmls\\config.xml”);
}

getConfigXML() is a simple function to read the xml and return the Xml type object.

private void setConfig()
{
this.sconfig = new Dictionary();
// Collect the xml data

XmlDocument sconfigXmlDoc = this.getConfigXML ();

XmlNodeList list = null;
list = sconfigXmlDoc.GetElementsByTagName(”node”);

foreach (XmlNode val in list)
{
this.sconfig[val["svalue"].GetAttribute(”soption”)] = val["svalue"].InnerText;
}
}

This is a pretty easy section. Here I am populating all my data in a 2D Dictionary. XmlNodeList is a C# data type to process Xml node from XmlObject.

Well, we are all most done. Now we need a Public function that can return our desired configuration variable.

public String get_config(String soption)
{
try
{
return this.sconfig[soption];
}
catch
{
return “”;
}
}

I used “get_config()” method that accept a Configuration variable name as parameter and return the desired value and in case of any exception it will return an empty string.

Finally, to get any configuration variable we will call something like this:

BCReaderConfiguration.getObject().get_config(”guest_success_msg”)

Full source Code here:

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
namespace barcodereader
{
class BCReaderConfiguration
{
private Dictionary sconfig;
private static BCReaderConfiguration _bcrConfigObj = null;

private BCReaderConfiguration()
{
}

// Single Tone object generator
public static BCReaderConfiguration getObject()
{
if (_bcrConfigObj == null)
{
_bcrConfigObj = new BCReaderConfiguration();
_bcrConfigObj.setConfig();
return _bcrConfigObj;
}
else
{
return _bcrConfigObj;
}
}

private XmlDocument getConfigXML ()
{
XmlDocument document = new XmlDocument();
return document.Load(”config.xml);
}

// Populate the configuration in to array
private void setConfig()
{
this.sconfig = new Dictionary();
XmlDocument sconfigXmlDoc = this.getConfigXML();
XmlNodeList list = null;
list = sconfigXmlDoc.GetElementsByTagName(”node”);

foreach (XmlNode val in list)
{
this.sconfig[val["svalue"].GetAttribute(”soption”)] = val["svalue"].InnerText;
}
}

// Return the Configuration value
public String get_config(String soption)
{
try
{
return this.sconfig[soption];
}
catch
{
return “”;
}
}
}
}

→ 5 CommentsCategories: C#

PARTY “HAPPY NEW YEAR 2009″ @ bGlobal Sourcing LLC

January 1, 2009 · 3 Comments

We have started 2009 with a great party… I am sharing few of them


Our group


making fun…..


…… !


Three queen of bGlobal :)

More @ flickr.com… and @Facebook
Some videos here

All are dancing…

Our funny man..

Our operational Director

FUN…

→ 3 CommentsCategories: bGlobalSourcing

Azure Services Platform

December 28, 2008 · Leave a Comment

Microsoft’s web application development platform “AZURE” already released. They are calming it will be most powerful and scalable technology. AZURE will be based on .Net framework supported by different internet protocols including HTTP, SOAP and XML etc. It will also support Non-Microsoft language Like Purl, Ruby, PHP. Here is a brief that I have copy and paste from Microsoft Release notes

“The Azure™ Services Platform (Azure) is an internet-scale cloud services platform hosted in Microsoft data centers, which provides an operating system and a set of developer services that can be used individually or together. Azure’s flexible and interoperable platform can be used to build new applications to run from the cloud or enhance existing applications with cloud-based capabilities. Its open architecture gives developers the choice to build web applications, applications running on connected devices, PCs, servers, or hybrid solutions offering the best of online and on-premises.

Azure reduces the need for up-front technology purchases, and it enables developers to quickly and easily create applications running in the cloud by using their existing skills with the Microsoft Visual Studio development environment and the Microsoft .NET Framework. In addition to managed code languages supported by .NET, Azure will support more programming languages and development environments in the near future. Azure simplifies maintaining and operating applications by providing on-demand compute and storage to host, scale, and manage web and connected applications. Infrastructure management is automated with a platform that is designed for high availability and dynamic scaling to match usage needs with the option of a pay-as-you-go pricing model. Azure provides an open, standards-based and interoperable environment with support for multiple internet protocols, including HTTP, REST, SOAP, and XML.

Microsoft also offers cloud applications ready for consumption by customers such as Windows Live™, Microsoft Dynamics™, and other Microsoft Online Services for business such as Microsoft Exchange Online and SharePoint® Online. The Azure Services Platform lets developers provide their own unique customer offerings by offering the foundational components of compute, storage, and building block services to author and compose applications in the cloud.”

→ Leave a CommentCategories: Azure
Tagged:

To encrypt PHP soruce code

December 5, 2008 · Leave a Comment

Yesterday night I was looking for something to encrypt my PHP source code. Three years back I used one script to encrypt my PHP source code. Unfortunately I have lost the script.

Finally I got this service to get the job done.  They used same way that I did with the script that I lost. I am sharing with you… :)

rightscripts

www.rightscripts.com

→ Leave a CommentCategories: Uncategorized
Tagged:

Our Q3 program 2008

November 25, 2008 · 10 Comments

Recently our Q3 program was celebrated. The most important part of this program is to award employees for their achievement.

Memtot Award

Mentor Award November/2008

I’m not too much older employee here but I could archive a faith from all of my colleagues.  I was really amazed when our CEO(SAM) announced my name from stage to receive my award. I was awarded with “Mentor Award“. In the stage I tried to visualize about my work that I did in last few months. I know, I have a habit to help my colleagues but it will bring me here I was not too much expected for it. I am thankful to the jury board that selected me and also remembering those people who appointed me here. i wish i could give return to these people by my work.

→ 10 CommentsCategories: Award
Tagged:

Some non-web based desktop softwares support CSS3 better then popular web browsers…. LOL

November 13, 2008 · 2 Comments

Majority of web communities are considering CSS3 is  powerful then all previous versions and also are dreaming to use it in near future with full featured. But problem is few browsers are supporting CSS3 selectors. www.css3.info is a fantastic website to study about this new tools.

Today I have grabbed interesting information when I was reading one of the articles from this site.
css3img
Opera is a browser that support some CSS3 selectors.:( But there is a desktops software called Prince Or PrinceXML that can convert a HTML file to PDF and it support few more CSS3 selectors where some popular web browsers failed. LOL……

→ 2 CommentsCategories: CSS3

Birth day party of JPT

October 13, 2008 · 3 Comments

Today I had an exciting moment. It was first birth day party of JPT (Junior Polar Traveler). This is my first assigned project released after joining SKYLARK team in bGlobal Sourcing.

Here I am sharing some pictures. I am sorry as I can not share the pictures from SKYLARK UK members because those are not appeared in my hand when I am wringing this post. They are Arthur Irving, Paul Wilson, Hayley Richardson and Zed Retief

→ 3 CommentsCategories: project Experience

OUR Q2 Program 2008

July 28, 2008 · 5 Comments

Recently we celebrate our b Global Sourcing Q2 offset program/2008 . Here i am sharing some picture….

Mr. Samuel D. Bretzfield( CEO)

Seminar view

Discussion on QA implementation

Discussion on QA implementation

Discussion on QA implementation

Discussion on QA implementation

Presentation on QA implementation

Presentation on QA implementation

…….

Go Cart

Raceing ….

… Takeing technical brief

shahed …on the race …

Moinul on his race…

Sam declaring the wining result…

………….

Winner award part

Wining team

Wining team

See more

→ 5 CommentsCategories: bGlobalSourcing
Tagged:

The History of RSS

July 23, 2008 · Leave a Comment

  • 1997 – Dave Winer develops scriptingNews. RSS was born.
  • 1999 – Netscape develops RSS 0.90 (which supported scriptingNews). This was simply XML with an RDF Header.
  • 1999 – Dave Winer at UserLand develops scriptingNews 2.0b1 (This included Netscape’s RSS 0.90 features)
  • 1999 – Netscape develops RSS 0.91. In this version they removed the RDF header, but included most features from scriptingNews 2.0b1.
  • 1999 – UserLand gets rid of scriptingNews and uses only RSS 0.91
  • Netscape stops their RSS development
  • 2000 – UserLand releases the official RSS 0.91 specification
  • 2000 – A group lead by Rael Dornfest at O’Reilly develops RSS 1.0. This format uses RDF and namespaces. This version is often confused as being a new version of 0.91, but this is a completely new format with no ties to RSS 0.91
  • 2000 – Dave Winer at UserLand develops RSS 0.92
  • 2002 – Dave Winer develops RSS 2.0 after leaving Userland
  • 2003 – The official RSS 2.0 specification is released

Referance

→ Leave a CommentCategories: rss feed