ads

Search ContentKenya

Showing posts with label Mobile Technology. Show all posts
Showing posts with label Mobile Technology. Show all posts

Thursday, August 6, 2009

Why Cloud Computing is the Future of Mobile

Source: readwriteweb

The term "cloud computing" is being bandied about a lot these days, mainly in the context of the "future of the web." But cloud computing's potential doesn't begin and end with the personal computer's transformation into a thin client - the mobile platform is going to be heavily impacted by this technology as well. At least that's the analysis being put forth by ABI Research. Their recent report, Mobile Cloud Computing, theorizes that the cloud will soon become a disruptive force in the mobile world, eventually becoming the dominant way in which mobile applications operate.

You may be wondering: what does the term "mobile cloud computing" really mean? Basically, it refers to an infrastructure where both the data storage and the data processing happen outside of the mobile device. Today, there are already some good examples of mobile cloud computing applications including mobile Gmail, Google Maps, and some navigation apps. However, the majority of applications today still do most of the data storage and processing on the mobile devices themselves and not in the cloud. In a few years, that could change.

Why Mobile Cloud Computing?

With a Western-centric view of the world, it can sometimes be hard to remember that not everyone owns a smartphone. There are still a large number of markets worldwide where the dominant phone is a feature phone. While it's true that smartphones will grow in percentage and feature phones will become more sophisticated in time, these lower-end phones are not going away anytime soon. And it's their very existence which will help drive the mobile cloud computing trend.

Not only is there a broader audience using feature phones in the world, there are also more web developers capable of building mobile web applications than there are developers for any other type of mobile device. Those factors, combined with the fact that feature phones themselves are becoming more capable with smarter built-in web browsers (and more alternative browsers available for download), will have an impact on mobile cloud computing's growth.

How Will Mobile Cloud Computing Become a Disruptive Force?

There are two primary reasons why ABI believes cloud computing will become a disruptive force in the mobile world. The first is simply the number of users the technology has the power to reach: far more than the number of smartphone users alone. The second reason has to do with how applications are distributed today. Currently, mobile applications are tied to a carrier. If you want an iPhone app, for example, you have to first have a relationship with the mobile operator who carries the iPhone. If you want a Blackberry app, the same rule applies. But with mobile clouding computing applications, as long as you have access to the web, you have access to the mobile application.

Moves by PaaS Players Could Change Everything

When you think of Plaform-as-a-Service (PaaS), one of the first companies that springs to mind is probably Salesforce. With their Force.com platform, business applications can be built and run "in the cloud." But Salesforce is not the only major PaaS player out there today - Amazon Web Services (AWS) and Google's App Engine are also two platforms that could have a major impact on this trend.

Currently, AWS is used by over half a million developers and Google's App Engine hosts 45,000 applications. Now imagine if those two companies along with Force.com all of a sudden started aggressively marketing their mobile capabilities. Today, neither AWS nor Google offers this, and Salesforce's mobile offering is limited to smartphones (Windows Mobile, Blackberry, and iPhone). But if the companies decided to make building for the mobile web as easy as building for the web, you could have a mobile revolution on your hands.

But People Like Apps!

Saying that "mobile cloud computing" is the future doesn't mean phones will be filled with links to websites that work in any browser instead of special, downloadable applications, some of which you can even purchase. Instead, mobile applications will exist in both formats. As for the downloadable applications themselves, they will still appear to be your typical mobile app - end users won't even notice a difference. However, there will be a difference - it will just be on the back-end. Mobile applications will begin to store your data in the cloud as opposed to on the mobile device, and the applications will become more powerful as processing power is also offloaded to the cloud.

The first mobile apps powered by the cloud will likely be business-focused mobile productivity applications where collaboration, data sharing, multitasking, and scheduling are key factors. For consumers, though, navigation and mapping applications will be the most obvious examples of the trend. Plus, there are some specialty applications today which already function as mobile cloud apps - for example, Schlage offers a remote keyless entry system which lets you mobilely control your home from a distance. You can let someone into your house, manage your lights, your thermostat, your camera system, etc. There are also a few applications in the iPhone app store that let you remotely manage your PC and your DVR, too.

Potential Problems

Of course, there are some potential issues that could be barriers to this shift in mobile computing. The most notable problem is the lack of speedy mobile Internet access everywhere. Here in the US, for example, 3G coverage is spotty outside urban areas, leading to intermittent connection issues and slow speeds. Other markets may have it even worse.

However, new technologies like HTML5, which does local caching, could help mobile cloud apps get past those sorts of issues. And there's even a chance that the browser could one day be replaced - at least in some markets - with another technology altogether which provides a better way to access the mobile web. ABI Research mentions initiatives like OMA's Smartcard Web Server, essentially a souped-up SIM card that connects directly with the carrier to push applications to mobile phones. There's also TokTok, a company whose technology allows access to web services like Gmail and Google Calendar by voice. With voice-enabled search like this, mobile apps could talk directly to the service itself which sits on the edge of the network, as opposed to needing the user to launch a web browser and navigate through the mobile web.

When Will Mobile Cloud Computing Really Take Off?

According to ABI, this change is only a few years away. By 2010, we'll see one or all of the major PaaS players marketing their mobile capabilities, they say. But first, API standards from open-source mobile collaboration group BONDI will go into effect. Later, in 2011, we'll see more of HTML5, and the OneAPI standard will come into play. (OneAPI involves standardized apps for networks allowing developers to consistently access parts of network providers' capabilities, such as location services). All these factors combined will help drive the move to the cloud.

The changes will occur with differing speeds depending on the market. Markets with higher Internet participation will obviously lead the way, as will markets with higher subscriber penetration. That includes Western Europe, North America, and parts of Asia. Other markets will then follow. By 2014, mobile cloud computing will become the predominant application development strategy. By that time, our PCs will be more like thin client devices than they are today, and now it seems our phones will too.

Monday, August 3, 2009

How to Simply Create Your Own Mobile Website

Mobile web browsing is gaining popularity and acceptance thanks to the extensive proliferation of iPhones and other mobile appliances with surf-friendly interfaces. As a result it is becoming more and more important to offer a mobile-friendly alternative to your current website.

The reality is, however, that many website owners seem to have no inclination to spend money on a medium that (as far as they know) is unproven and could generate zero income. Fortunately there is a way for every website owner to create an alternative to their website and not only is it exceedingly simple but it is FREE. Now no one has an excuse to ignore this growing medium!


Before I begin I have great news for WordPress users! If your blog or website is run on WordPress there is a simple plug-in you can install that will make your website instantly mobile friendly!! That means that part of this article will not be useful to you but I can assure you a great deal of it is still worthwhile reading; I touch on mobile optimization, promotion, and mobile behavioral profiling.

First Make a Plan

Before you create your mobile website you need to determine what it is going to offer. For example, you may be a service provider and wonder why would anyone would want to visit your website using a mobile device. According to this InformationWeek article, Google breaks mobile users into three behavioral camps that really rings true, according to my personal mobile experience. These are:

  • Repetitive Now: users that are repetitively checking the same information (i.e. stocks, sports scores, weather, etc.).
  • Bored Now: users who want to surf the web while they wait.
  • Urgent Now: users that need information immediately. These are task based users who want a fast, clean and efficient mobile experience.

For the purposes of this article let's accept that that anyone visiting your website from a mobile device falls into the Bored Now and Urgent Now ballparks. So in this context users want to quickly acquire your contact information or they want to read your latest blog post. Great, the hard work is done! Now that you know why people may visit your mobile website you can begin creating it.

What Free Mobile Website Solution is Best?

There are many ways to create a mobile website that cost you money but very few high quality options are available for free. I offer two options that I prefer so far: one is using mobiSiteGalore to create a website very simply one page at a time, and the other is meant only for those with an aim to provide mobile access to their RSS feed content.

Option 1) The Answer for a Complete Mobile Website
I started this article researching and writing about various free mobile solutions but ultimately I found mobiSiteGalore. I realized I was wasting my time so I deleted all of my research; none of the competing tools seemed to measure up. mobiSiteGalore was the only 100% free service I found with an amazing site creation wizard and the option to host the freely created website wherever without strings attached; they openly state they make their money from donations and licensing agreements with large hosting companies.

Here is a link to a web viewer that will allow you to see the mobile website I created for StepForth this week using mobiSiteGalore. Unfortunately it isn't perfect quite yet but its getting there.

Option 2) How to Easily Provide Access to Your RSS Content
Do you have an RSS feed from a blog or a great news mashup you created that you think would be great for your mobile visitors to read? If so Google offers a mobile conversion tool that happens to do an excellent job of converting RSS feeds into a mobile-friendly web page; it also tries to convert complete websites but that isn't often as successful. All you have to do is enter the URL of your RSS feed and voila! The result will be a beautifully formatted page based on the feed content.

Here is an example of how Search Engine Guide's RSS feed looks after this simple mobile conversion. Note how, if you click on any of the articles, you are taken to a page that is also formatted for mobile; so at no time within the first level of content (one click from the main page) are you shown unconverted content. This capability is exceptionally slick because if you were to simply point mobile visitors to your unconverted RSS feed and they were to click on an article they would be taken to the non-mobile version; a very bad idea that can cost viewers a lot of money (sadly this is especially true in Canada) while they try to download unwieldy images on their mobile device.

Once you have converted your RSS feed just copy and paste the URL into a note pad for later use. Now in order to provide access to this new mobile content you or your Webmaster has to create a 301 redirect in a section of your website which will be used to send mobile visitors to the mobile-friendly content (the URL you saved).

So what area of the website should be home to your mobile content? I recommend using either www.xyzname.com/mobile/ or m.xyzname.com or the .mobi version of your domain name (xyzname.mobi) which you have hopefully purchased already.

Ultimately, pointing your mobile users to this external Google website (even if it is still your content) is not the most desirable option but if it means not having mobile content at all I would suggest at least having this option until you are ready to invest the time to create a complete website with mobiSiteGalore or hire a professional designer.

Mobile Discovery

So now you have taken the time to create some mobile-friendly content for your website. How do people find it? No I don't mean SEO (that's coming later), what I mean is how can you send your mobile-friendly information to a visitor before you scare them off with the unfriendly content? The answer is dependant upon the programming language your website was built on. If your website is built using PHP, ASP or ColdFusion I have assembled instructions for you to properly redirect mobile traffic. If your website is simply using HTML then you may need to try the less accurate .htaccess redirect option I presented in the "Other Options" section of the redirect tutorial. If you are not using any of those programming languages previously noted (highly unlikely) then I am afraid you will have to invest in your own research; when you get the answer please let me know (email me: ross at stepforth dot com) of the solution so I can list it on the page.

Mobile Content Optimization

Mobile content is optimized similarly to normal web content except that optimizers must keep in mind that they usually have significantly less content to optimize so every word must count.

Here are my top tips specifically for optimizing mobile content:

  • Make sure the file size of the page is as low as possible to minimize load times.

  • Order the navigation keeping in mind what links visitors are most likely to want to click first.

  • JavaScript, Frames, Flash, and pop-ups are examples of technologies not supported by most mobile devices with the exception of most Smartphones.

  • Choose to optimize only keywords comprised of 2 to 3 words because mobile searchers tend not to type in more than 2 or 3 word searches.

  • Title tags, description Meta tags, heading tags and filenames should be carefully crafted with target keywords to maximize the little optimizable content available.

  • Ensure that all phone numbers within your mobile content are formatted to be clickable; this will allow visitors to call you simply by clicking on a link.

  • For those creating a site from scratch you will want to design the website so that the main navigation utilizes "accesskeys" for faster keyboard navigation; this is automatically done within mobiSiteGalore. For example, for a person to access the first menu item they would press the #1 on their phone. Here is an example of how a simple hyperlink can be upgraded to offer this functionality:
    Press #1 To Visit the StepForth SEO Blog

  • Ensure your mobile website offers an XML sitemap for search engine spiders to rapidly index it. This option is already brilliantly included in mobiSiteGalore.

  • If your mobile content has its own top-level-domain (TLD) such as StepForth.mobi then you should register this domain with Google Webmaster Tools. Once you are registered submit your mobile sitemap so you can monitor how Google is crawling your mobile website and address any issues that may arise.

    How To: Submit your sitemap under "Sitemaps" + "Add Sitemap" and then select "Mobile Sitemap" from the types of sitemaps available to submit. Once you have it submitted the "Mobile Crawl" report is found under "Diagnostics" after you access your verified mobile domain in Google Webmaster Tools. Here are some concise instructions from Google on adding a mobile sitemap if you find you require assistance.

  • Submit your mobile sitemap to Yahoo Site Explorer as well after you have verified your account. Here are some tips from Yahoo on creating a great mobile website.

Mobile Content Promotion

Once your mobile content is online and ready for prime time I strongly suggest creating some buzz about your achievement using the following techniques:

1) Launch a press release using PRWeb; aside from the added publicity this action will provide some short and long term link popularity to your new content.

2) Submit your mobile website to the growing list of mobile-only web directories. Here are a few sites to start with:

3) Include your mobile content address on your business card and other stationary so that prospects can preview your services/products at convenient times. In this day to day hectic world it really pays to have sales content available at nearly any stage of a prospect's busy day.


In Conclusion

The advent of a great number of web accessible mobile devices over the past year is radically increasing the validity of having a mobile website and thanks to sites like mobiSiteGalore it is not that much work to make one. Take some time and invest in the creation of a small but efficient mobile website so you at least know you have another base covered in the realm of online marketing. You can also take some satisfaction in knowing you are one-step ahead of the Jones'... for now.

Tuesday, July 28, 2009

All You Want to Know About a Mobile Website

Introduction

Nowadays, many more people are going to develop their websites specially designed for mobile devices.

The reason for doing so is simple. The Website owner can reach a dedicated mass that are always having a specific search. Mobiles are handy, people are always connected and now we even don't forget to carry them as we don't forget our purse!

Mobile Web pages are slightly different than standard Web pages. Mobile Web pages will have smaller content and smaller images. An idle mobile Web page should be rendered on any mobile device in less than 2 seconds. So we should always limit the Webpage to a smaller size.
Key Point

The Website should be displayed on mostly all GPRS enabled mobile phones, PDAs and all 1G, 2G and 3G mobile devices. This is a real challenge as you will not find a common solution for all the devices. I had Googled a lot for a common solution, but to my disappointment I could not find a common one for all. And this is the fact which led me to write this article.
What Changes are Required in Order to Convert a Normal Web Page into a Mobile Web Page?

There are two things which are important for a mobile browser. You should set both of them.

1. DOCTYPE

A DOCTYPE (Document Type Declaration) instructs the validator which version of the (X)HTML your Web page is using. You must write it to the very first line of your Web page. It helps to validate your markup and CSS.
Collapse

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

2. Content Type

The content type of a mobile Web page can be any of the following:
1. application/vnd.wap.xhtml+xml
2. application/xhtml+xml

Which one is correct from a or b depends on the mobile device. Some devices support a, some supports b and many of them supports both. The best way is to write a function which checks the Request Headers and then set the content type accordingly. I have presented that function below:
Collapse

///
/// Function to set the content type dynamically.
/// You need to call this function on each mobile web page.
///


public void setContentTypeDynamically(HttpRequest Request, HttpResponse Response)
{
if(Request.Headers["Accept"].ToString().IndexOf
("application/vnd.wap.xhtml+xml") != -1)
Response.ContentType = "application/vnd.wap.xhtml+xml";
else if (Request.Headers["Accept"].ToString().IndexOf
("application/xhtml+xml") != -1)
Response.ContentType = "application/xhtml+xml";
else
Response.ContentType = "text/html";
}

The function is fairly easy to understand. It reads the value of server variable Request.Headers["Accept"] and sets the ContentType of response object accordingly. Here the order to check the ContentType is important, as many modern mobile browsers may support all of them!

Images are Special. Render them According to the Screen Size of a Mobile Device.

The general width of a mobile device was 255 pixels. But this has changed dramatically as mobile manufactures are producing N number of models with various screen sizes. You can check the screen size of a mobile device from X-Wap-Profile XML file. I have discussed the X-Wap-Profile in another point below.

The best way for image displaying is - Store a single image of 255 pixels in database and then resize it on ISS according to the requested screen width and height.

For example: Motorola L7 has 176 x 200 screen size (Width x Height), BlackBerry8800 has 320 x 240 screen size and Nokia2630 has 128 x 160 screen size. For the perfect view of the image, it must be resized on IIS accordingly and then you should point the correct URL to the image tag.

To ease the process, I have created a table in database. This reads the “X-Wap-Profile” on first request and stores model name of the mobile, URL of the X-Wap-Profile, screen width, screen height, supports 3gp, mp4, etc. information in the database table.

I don't go to read the 'X-Wap-Profile' each time a request comes for a Web page. Instead I do this only for the first time a new mobile is requested. On first request, all the device info is stored in the database table and for all the subsequent requests, I can look for height and width of a screen directly in my database. This will lessen the efforts of requesting the “X-Wap-Profile” each time and can serve a Web page faster to the client.

Note: The code to read the image from database and to resize the image is beyond the scope of this article. Please search The Code Project for this!
Single Domain, Two Different Web Sites

Sometimes, you may have only a single domain registered and you want two different Websites pointing towards the same domain name.

Let’s understand this with an example. You have a domain something like http://www.yourwebsitename.com. You will develop two different websites: Website ‘A’ fully dedicated for normal desktop browser and website ‘B’ with mobile Web pages which are smaller in size and specially designed for mobile browsers.

Now, if http://www.yourwebsitename.com is requested from a desktop browser, you want to show the home page of your normal website ‘A’ and if the request comes from any GPRS enabled mobile device, you will want to show them the home page of your mobile page Website ‘B’.
Why You Want the Same Domain Name for Both of the Websites?

The answer is simple:

1. You get the benefit of SEO on both of the pages.
2. The same brand value and customer credit can be received on both of the sites.
3. Marketing and Advertisement can be shared between both of the websites.
4. You may also have the domain http://www.yourwebsitename.mobi but this makes more sense to show a user mobile home page rather than a normal Web page, if it is requested from a mobile device.

Code to Detect a Mobile Browser

Following is the code which solves the above issue. I have created a function which checks for the ‘X-Wap-Profile’. If it is found, then I redirect them to my mobile Web pages, else I redirect the request to normal Web pages.
Collapse

// Declare a boolean variable for mobile browser
bool IsMobi = false;

// If request header can find the X-Wap-Profile, then it is a mobile browser
if (Request.Headers["X-Wap-Profile"] != null)
{
if (Request.Headers["X-Wap-Profile"].ToString().Length > 0)
{
IsMobi = true;
Response.Redirect("index.aspx", true);
}
Else
{
Response.Redirect("web/index.aspx", true);
}
}

What are Request.Headers?

HTTP request headers allow the client to provide information about itself to the server. They give additional details about the nature of the request like its content type, Accept-Charset, Accept-Encoding, Accept-Language, etc.
What is ‘X-Wap-Profile’?

When you request a mobile browser, it sends much more information back to the server. One of them is the link to the ‘X-Wap-Profile’.

* X-Wap-Profile: http://gsm.lge.com/html/gsm/LG-KG220.xml

X-Wap-Profile is an XML file which provides all the detailed information about a mobile device. You can find the screen size of the mobile device, supported audio and Video types, Model name of the device and many more things.

This XML file is provided by the phone manufacturer for the use of the outer world.
Will Only This Code Do For All GPRS Enabled Mobile Devices?

The answer is NO. But the trick is not much harder than above. Some mobile device don't have the attribute X-Wap-Profile. Instead, they may have any of the following:

* X-Wap-Profile
* X-Wap-Profile:
* Profile
* Profile:

Moreover, in my experience some Samsung and LG devices also have different writing style of the same attribute as shown below:

* X-Wap-Profile
* x-wap-profile
* X-WAP-PROFILE

The best way is to check all of them in a single function and according to value of IsMobi boolean variable, redirect the user to a relevant Web page.
Some Tips and Tricks

1.

Put the mobile pages in parent folder and normal Web page in a child folder.

This will avoid any redirection if a request comes from any mobile device. It can save your valuable CPU cycles. It will also help you to give a faster response to the user. No user can wait for more than two seconds for rendering of a page. An ideal mobile page should be rendered on any mobile device in less than 2 seconds.
2. Iphone is a special device and I want my Website to render as a normal desktop Web page on Iphone. What should I do for this?

In this case, you will check the name ‘iphone’ OR ‘ipod’ from the User Agent. If it is found, then you will need to set the Viewport attribute in a metatag. In the below example, I have to take a literal named ‘iphone’ in the Header section of the page like this.
Collapse





And in the code behind, I check it as shown below:
Collapse

// If requesting User Agent is an IPhone or IPod than set the iphone label
if (Request.UserAgent.ToLower().Contains("iphone"))
{
// Set the Viewport attribute.
iphone.Text = " device-width height = device-height \" />";
}
else if (Request.UserAgent.ToLower().Contains("ipod"))
{
// Set the Viewport attribute.
iphone.Text = " device-width height = device-height \" />";
}

Conclusion

In my experience, I have tested the above code on more than 200 mobile devices and it has worked fine.

I have not included a demo project as the code shown above is very simple to understand and apply. Feel free to contact me if you have any questions in understanding the concept.

Creating a Mobile Application with SQL Server Compact Edition

In this walkthrough, you will learn how to create an application in Microsoft Visual Studio 2005 that uses Microsoft SQL Server 2005 Compact Edition. The SQL Server Compact Edition database will be a Subscriber to a SQL Server 2005 Publication and will use merge replication to download information from a SQL Server 2005 database to the SQL Server Compact Edition database.

In this walkthrough, you will follow these steps:

1. Configure a SQL Server 2005 publication.
2. Configure Internet Information Services (IIS) for replication.
3. Create a SQL Server Compact Edition subscription.
4. Create an application.
5. Deploy the application and test the subscription.

Prerequisites

To perform this walkthrough as it is written, you must have the following:

* A computer that has Windows XP and IIS installed.
* SQL Server 2005 Service Pack 2 (SP2) or a later version, installed on the same computer as Visual Studio.

SQL Server 2005 Tasks

Before you create the application, you must configure a publication in SQL Server 2005. In the following steps, you will create a sample database and then publish data from that database. You will create the database by using a prebuilt script file, and then create the publication with the New Publication Wizard
Create a database and populate with data

1.

Open SQL Server Management Studio.
2.

When you are prompted to connect to a server, type (local) for the Server Name, and then click Connect.
3.

Open a new query window. Create a SQL Server Compact Edition database and populate the database with data.

USE master;
GO
IF EXISTS (SELECT * FROM sys.sysdatabases WHERE name = 'SQLMobile')
BEGIN
DROP Database SQLMobile;
END
GO
CREATE DATABASE SQLMobile;
GO
USE SQLMobile;
GO
CREATE TABLE MembershipData (MemberID INTEGER IDENTITY (1,1)
CONSTRAINT pkMemberID PRIMARY KEY, MemberName NVarChar (50));
CREATE TABLE FlightData (MemberID INTEGER FOREIGN KEY REFERENCES
MembershipData(MemberID), Destination NVarChar (50), FlightStatus
NVarChar(50), ArrivalDate DATETIME, FlownMiles INTEGER);
INSERT INTO MembershipData (MemberName) VALUES ('Mr Don Hall');
INSERT INTO MembershipData (MemberName) VALUES ('Mr Jon Morris');
INSERT INTO MembershipData (MemberName) VALUES ('Ms TiAnna Jones');
INSERT INTO FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (1, 'Seattle', 'Flight Delayed 1 hour', '8/25/00', '20000');
INSERT INTO FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (2, 'London', 'Flight on time', '9/12/00', '15000');
INSERT INTO FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (3, 'Sydney', 'Flight Gate Closing', '11/5/00', '30000');
INSERT INTO FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (1, 'Tokyo', 'Delayed Fog', '5/25/00', '25000');
INSERT INTO FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (2, 'Minneapolis', 'Flight on time', '5/1/00', '1000');
INSERT INTO FlightData (MemberID, Destination, FlightStatus, ArrivalDate, FlownMiles)
VALUES (3, 'Memphis', 'Flight Gate Closing', '1/5/00', '1000');
GO

4.

Click Execute (!) to run the script and create the database. The script runs and creates a new database named SQLMobile.
Note:
You can also press F5 or choose Execute from the Query menu to run the query.

5.

To confirm that the database was created, in Object Explorer, expand (local), expand Databases, and then expand SQLMobile. If the SQLMobile database is not listed, update the list of databases by right-clicking Databases and selecting Refresh

Prepare the Server for Publishing Data

Before you create a publication, you must prepare the server for publishing by creating a snapshot agent user account and creating a shared folder in which the snapshot files will be stored. When the snapshot folder is created, it is used for all publications on the server. If you have created publications previously on this server, you can skip these steps.
Create the snapshot user account

1.

Open Computer Management from Administrative Tools in Control Panel.
2.

In Computer Management, expand System Tools, expand Local Users and Groups, right-click Users, and then choose New User.
3.

Type the following information in the New User dialog box, and then click Create:

Field Value

User name


snapshot_agent

Password


p@ssw0rd

Confirm password


p@ssw0rd

User must change password at next logon


Not selected

Password never expires


selected
Important:
These settings should be used for testing only. In a production environment, make sure that your user account settings are in compliance with the network security requirements. Frequently, you will use a domain user account instead of a local user account for the snapshot agent.

Create the snapshot folder

1.

In Windows Explorer, create a new folder named snapshot. For this walkthrough, you can create the folder in the root directory of drive C at c:\snapshot. Right-click the snapshot folder and select Sharing and Security.
2.

On the Sharing tab, select Share this folder, and then click Permissions.
3.

In Permissions for snapshot, click Add.
4.

In Enter the object name to select, type computername\snapshot_agent where computername is the name of the local computer, click Check Names, and then click OK.
5.

In Permissions for snapshot, select snapshot_agent, assign the Change and Read share permissions, and then click OK.
6.

Select the Security tab.
7.

Click Add.
8.

In Enter the object name to select, type computername\snapshot_agent where computername is the name of the local computer, click Check Names, and then click OK.
9.

Select snapshot_agent and add the Write permission to the list of enabled permissions. The snapshot_agent account will now be granted the following permissions:
* Read and Execute
* List Folder Contents
* Read
* Write
10.

Click OK to close the snapshot Properties window.
11.

Close Windows Explorer.

Create a publication

1.

In Object Explorer in SQL Server Management Studio, expand the (local) node if it is not currently expanded, and then expand Replication.
2.

Right-click the Local Publications folder and select New Publication.
3.

In the New Publication Wizard introduction screen, click Next.
4.

If you have not created a publication on this computer before, you will be prompted to configure a Distributor. Select the first option to use the local computer as its own Distributor, and then click Next.
5.

If you have not created a publication on this computer before, you will be prompted to specify a snapshot folder. Type the share path of the snapshot folder that you created in the previous procedure. Type the share path in the form \\servername\share instead of the local path. In this walkthrough, we recommend that you type \\computer\snapshot, where computer is the name of your computer, and then click Next.
6.

In the list of databases, select SQLMobile, and then click Next.
7.

In the list of publication types, select Merge publication, and then click Next.
8.

In the Subscribers Types page, select Yes to enable support for SQL Server Compact Edition subscribers, and then click Next.
9.

In the list of objects to publish, select the Tables check box. If you expand Tables, you will see that both tables in the SQLMobile database are selected. Click Next.
10.

You are notified that unique identifiers will be added to the tables. All merge articles require a uniqueindentifier column. Click Next.
11.

In the Filter Table Rows page, you can now add filters to the published data. For this walkthrough, you will not filter the data. Click Next.
12.

On the Snapshot Agent page, you can configure when the snapshot will be created and how frequently the Snapshot Agent runs. Click Next to accept the default settings.
13.

In the Agent Security dialog box, click Security Settings.
1. In the Snapshot Agent Security dialog box, enter the logon information for the account you created in the previous procedure. The process account is computer_name\snapshot_agent (where computer_name is the name of your computer) and the password is p@ssw0rd.
2. Click OK to save the settings.
3. Click Next on the Agent Security page.
14.

On the Wizard Actions screen, you can determine when the publication is created and whether you want a script file to be created. Clear Create a snapshot immediately, and then click Next.
15.

On the Complete the Wizard screen, type SQLMobile for the name of the publication, and then click Finish.
16.

The publication is created. When the wizard finishes, click Close.

Setting Permissions

You must grant permissions for the Snapshot Agent account and for the IIS anonymous user account. You must also add the IIS anonymous user account to the Publication Access List (PAL).
Set database permissions

1.

In SQL Server Management Studio, in Object Explorer, expand Security, right-click Logins, and select New Login.
2.

In the New Login dialog box, select Windows Authentication, click Search, type computername\snapshot_agent in the Enter the object name to select box, where computername is the name of your computer, click Check Names, and then click OK.,
3.

In the Navigation Pane, choose the User Mapping pane.
4.

In the list of databases, select distribution and the db_owner role, select SQLMobile and the db_owner role, and then click OK.
5.

Right-click Logins, and select New Login.
6.

In the New Login dialog box, select Windows Authentication, click Search, type computername\iusr_computername in the Enter the object name to select box, where computername is the name of your computer, click Check Names, and then click OK.,
7.

In the Navigation Pane, select the User Mapping pane.
8.

In the list of databases, select distribution and SQLMobile, and then click OK.

Granting publication access

1.

In Object Explorer, expand Replication, expand Publications, right-click the [SQLMobile]:SQLMobile publication, and then click Properties.
2.

In the Navigation Pane, select Publication Access List.
3.

Click Add. In the Add Publication Access dialog box, the IUSR account is listed. Select it, and then click OK.
4.

Make sure that the IUSR account is now in the PAL, and then click OK.

Creating the Publication Snapshot

Before you can initialize a subscription to the SQLMobile publication, you must create the publication snapshot.
Create the publication snapshot

1.

In SQL Server Management Studio, in Object Explorer, expand the (local) computer node.
2.

Expand the Local Publications folder, select the publication name, right-click SQLMobile, and then click View Snapshot Agent Status.
3.

In the View Snapshot Agent Status dialog box, click Start.

Make sure that the snapshot job has succeeded before you continue.

Configuring IIS and SQL Server 2005 for Web Synchronization

Now that SQL Server has been configured with a publication, you must make that publication available over the network to SQL Server Compact Edition clients. SQL Server Compact Edition connects to SQL Server through IIS. Specifically, you create and configure a virtual directory that makes the SQL Server Compact Edition Server Agent available to the clients.
Install the SQL Server Compact Edition server components

1.

In Windows Explorer, locate the following directory:

C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE
2.

Double-click sqlce30setupen.msi to run the installation program.
3.

On the introduction screen of the Setup wizard, click Next.
4.

Read and accept the Microsoft Software License Terms, and then click Next.
5.

On the System Configuration Check screen, make sure that all items pass. The last item on the list will be listed as a warning if you do not have SQL Server 2000 installed. Because you are using SQL Server 2005, this is not a problem. Click Next.
6.

Click Next on the following screen, and then click Install to start installation.
7.

Click Finish.

Configure the publication for Web synchronization

1.

In SQL Server Management Studio, in Object Explorer, expand the (local) computer node.
2.

Expand the Local Publications folder, select the publication name, right-click and then select Configure Web Synchronization.
3.

On the introduction screen of the wizard, click Next.
4.

On the Subscriber Type screen, choose SQL Server Compact Edition, and then click Next.
5.

On the Web Server screen, type the name of your computer in the computer running IIS text box, if it is not already provided, and then click Create a new virtual directory.
6.

In the tree that is displayed, expand the computer, expand Web Sites, and then select Default Web Site.
7.

Click Next.
8.

In the Alias text box of the Virtual Directory Information screen, type SQLMobile, and then click Next.

If you receive a warning dialog box, click Yes.
9.

In the Secure Communications screen, select Do not require security channel (SSL).
10.

Important In a production environment, you should enable SSL encryption to protect data exchanged over the Internet between the Subscriber and the Server Running IIS Client Authentication screen, select Clients will connect anonymously, and then click Next.
11.

On the Anonymous Access screen, accept the default settings by clicking Next.
12.

On the Snapshot Share Access screen, type \\computer\snapshot, where computer is the name of your computer, and then click Next.

If you receive a warning that the snapshot share is empty, click Yes.
13.

Click Finish.
14.

Click Close.
15.

In Internet Explorer, enter the URL http://localhost/SQLMobile/sqlcesa30.dll?diag in Address and then click Go. This connects to the server in diagnostic mode. Make sure that the SQL Server Compact Edition Server Agent Diagnostics report shows success.

SQL Server Compact Edition Tasks

Before developing an application that will use SQL Server Compact Edition, it is frequently time-saving to pre-create the SQL Server Compact Edition database and subscription. SQL Server Management Studio lets you create and work with a SQL Server Compact Edition database on the local computer. You can then use this database when you develop your application.
Create a new SQL Server Compact Edition database

1.

In SQL Server Management Studio, in Object Explorer, click Connect, and then choose SQL Server Compact Edition.
2.

In the Database File field, choose .
3.

In the file name text box, type c:\sqlmobile.sdf, and then click OK.

If you receive a warning about a blank password, click Yes. The database in this tutorial is not password protected or encrypted.
4.

In the Connect to Server dialog box, click Connect.

A new node named SQL Server Compact Edition [My Computer\...\sqlmobile] is added to Object Explorer.

Create a new subscription

1.

In Object Explorer, expand the SQL Server Compact Edition node, expand Replication, right-click Subscriptions, and then choose New Subscription.
2.

On the introduction screen, click Next.
3.

On the Choose Publication screen, in the Publisher drop down list, choose .
4.

In the Connect to Server dialog box, type or choose the name of the local computer, and then click Connect.
5.

On the Choose Publication screen, in the list of publications, expand SQLMobile, select the SQLMobile publication, and then click Next.
6.

On the Identify Subscription screen, type SQLMobile for the subscription name, and then click Next.
7.

On the Web Server Authentication screen, type the URL for the virtual directory you created in the previous procedure. In this walkthrough, you created a virtual directory with a URL of http://localhost/SQLMobile.
8.

Click The Subscriber will connect anonymously, and then click Next.
9.

On the SQL Server Authentication screen, click Next to accept the default settings.

On the final screen, the wizard displays sample code that you can use when you create a subscription in your application. Select the sample code (either Visual Basic or C#, depending on the language you will use to create the application) and copy the code. To do this, select the code and press CTRL+C. Start Notepad or another text editor and paste the sample code. You will use this code when you create the application in the following procedures.
10.

After you have copied the sample code, click Finish.
11.

Click Close.

Building an Application
Create a new Smart Device project

1.

Open Visual Studio 2005.
2.

On the File menu, select New Project.
3.

In the New Project dialog box, in the Project Types tree, expand your development language and then select Smart Device.
4.

In the list of templates, select the type of project you want to create. For this walkthrough, select Pocket PC 2003 Application.
5.

Provide a name and location for the project, and then click OK. For this walkthrough, name the project SQLMobile.

Visual Studio creates a new project and displays Form1 as it will appear on a smart device.

Add references

1.

In Solution Explorer, right-click References and choose Add Reference.
Note:
If the References folder is not listed in Solution Explorer, click Show All Files at the top of Solution Explorer.

2.

In the list of .NET assemblies, select System.Data.SqlServerCe, and then click OK. If System.Data.SqlServerCe is not listed, follow these steps:
1. Click the Browse tab.
2. Locate the following directory:
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
3. Select System.Data.SqlServerCe.dll, and then click OK.

The list of references in Solution Explorer now includes System.Data.SqlServerCe, and your project can use this assembly.
3.

In Solution Explorer, right-click Form1.cs or Form1.vb and choose View Code.
4.

At the top of the code for the form, add a directive to use the System.Data.SqlServerCe namespace:

[C#]

using System.Data.SqlServerCe;

[VB]

Imports System.Data.SqlServerCe

Add a data connection

1.

In the main window, switch back to the Design (default) view for Form1.
2.

From the Data menu, click Add New Data Source.

Note If Add New Data Source is not displayed, select the Design view for Form1, and then see the Data menu again.
3.

On the Choose a Data Source Type window, select Database, and then click Next.
4.

In the Choose Your Data Connection dialog box, click New Connection.
5.

If an Add Connection dialog box is displayed, click Change.
6.

In the Choose Data Source dialog box, under Data Source, select Microsoft SQL Server Compact Edition (if there was an existing connection, this dialog box might be called Change Data Source). In the list of data providers, choose .NET Framework Data Provider for SQL Server Compact Edition. Click Continue or OK.
7.

In the Add Connection dialog box, under Data Source, select My Computer.

In the Connection properties section, under Database, click Browse, and then browse for the database that you created in a previous procedure. If you have followed the steps, the database is located at c:\sqlmobile.sdf.
8.

Click Test Connection, and then click OK to create the new data connection.
9.

In the Choose Your Data Connection dialog box, click Next.
10.

If a dialog box is displayed that asks you to copy your data file to the current project, click Yes.
11.

In the Save Connection String window, click Next.
12.

In the Choose Your Database Objects window, select Tables, and then click Finish

Choose the data to display

1.

From the Data menu, choose Show Data Sources.
2.

Drag the MembershipData table from the Data Sources window to the Form1 Design window. A datagrid is created on Form1 with the column names automatically provided.
3.

Right-click the datagrid and then click Properties.
4.

In the Properties window, change the Dock value to Top. You can do this by clicking the top bar of the graphical representation that appears, or by typing Top in the value field. The datagrid will be moved and resized to fill the top section of Form1.
5.

In the upper-right corner of the datagrid, click the small arrow. From the menu that appears, choose Generate Data Forms.
6.

Drag the FlightData table from the Data Sources window to the Form1 Design window. A datagrid is created on Form1 with the column names automatically provided.
7.

You can use the Properties settings for this datagrid to set the Dock property to Bottom.

Adding code

On the code page for the application, you will add a string variable that holds the path and name of the database file, code to delete the database file if it already exists, and code to establish a connection to the SQL Server publication, synchronize the data, and create a new local database that contains the published data.
Add the code

1.

From Solution Explorer, right-click Form1 and choose View Code.
2.

In the code page, find the class definition for Form1. Add a string variable and assign it the path and file name for the .sdf file. The data source created by Visual Studio in previous steps expects the database file to reside in the \Program Files\ApplicationName folder, where ApplicationName is the name of the application. For example, if you named your new project SQLMobile, your string variable should be set to "\Program Files\SQLMobile\sqlmobile.sdf".
3.

The first few lines of your class definition should resemble the following code:

[C#]

public partial class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
string filename = @"\Program Files\SQLMobile\sqlmobile.sdf";

public Form1()
{
InitializeComponent();
}

[Visual Basic]

Public Class Form1

Dim filename As New String _
("\Program Files\SQLMobile\sqlmobile.sdf")

4.

Create a new method that will delete the database file if it currently exists. This will make sure that the application loads the latest data every time that it runs. The method should be named DeleteDB. Your code should resemble the following:

[C#]

private void DeleteDB()
{
if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
}
}

[Visual Basic]

Sub DeleteDB()
If System.IO.File.Exists(filename) Then
System.IO.File.Delete(filename)
End If
End Sub

5.

Create a new method named Sync that performs synchronization. To do this, you will use the code you copied from the New Publication Wizard in a previous step. When you paste the code, you must make two changes to the code:
1. Change the SubscriberConnectionString value so that it points to the correct path and file name, as specified in the file name variable.
2. Change the AddOption value from ExistingDatabase to CreateDatabase.
When complete, your Sync method should resemble the following:
[C#]

private void Sync()
{
SqlCeReplication repl = new SqlCeReplication();

repl.InternetUrl = @"http:///sqlmobile/sqlcesa30.dll";
repl.Publisher = @"";
repl.PublisherDatabase = @"SQLMobile";
repl.PublisherSecurityMode = SecurityType.NTAuthentication;
repl.Publication = @"SQLMobile";
repl.Subscriber = @"SQLMobile";
repl.SubscriberConnectionString = @"Data Source='" + filename +
"';Password='';Max Database Size='128';Default Lock Escalation
='100';";
try
{
repl.AddSubscription(AddOption. CreateDatabase);
repl.Synchronize();
}
catch (SqlCeException e)
{
MessageBox.Show(e.ToString());
}
}

[Visual Basic]

Sub Sync()
Dim repl As New SqlCeReplication()
repl.InternetUrl = "http:///SQLMobile/sqlcesa30.dll"
repl.Publisher = ""
repl.PublisherDatabase = "SQLMobile"
repl.PublisherSecurityMode = SecurityType.NTAuthentication
repl.Publication = "SQLMobile"
repl.Subscriber = "SQLMobile"
repl.SubscriberConnectionString = _
"Data Source='" + filename + "';Password='';" _
& "Max Database Size='128';Default Lock Escalation ='100';"
try
repl.AddSubscription(AddOption. CreateDatabase)
repl.Synchronize()
catch err as SqlCeException
MessageBox.Show(err.ToString)
end tryEnd Sub

6.

Finally, add code to the beginning of the Form1_Load event handler that calls the two methods that you recently created. Your Form1_Load event handler should resemble the following:

[C#]

private void Form1_Load(object sender, EventArgs e)
{
DeleteDB();
Sync();

// TODO: Delete this line of code.
this.flightDataTableAdapter.Fill(this.sqlmobileDataSet.FlightData);
// TODO: Delete this line of code.
this.membershipDataTableAdapter.Fill(this.sqlmobileDataSet.MembershipData);
}

[Visual Basic]

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DeleteDB()
Sync()

'TODO: Delete this line of code.
Me.FlightDataTableAdapter.Fill(Me.SqlmobileDataSet.FlightData)
'TODO: Delete this line of code ...
Me.MembershipDataTableAdapter.Fill(Me.SqlmobileDataSet.MembershipData)
End Sub

Deploy and Test the Application
Deploy the application

1.

From the Debug menu, choose Start Debugging.
2.

If the Deploy dialog box is displayed, choose Pocket PC 2003 SE Emulator, and then click Deploy.
3.

The emulator opens in a new window. The first time that you deploy the application to the emulator, the .NET Compact Framework and SQL Server Compact Edition are installed. This might take several minutes. When they are installed, your application is installed and runs.

Your application loads and displays the two datagrids. When you click a value in the MembershipData datagrid, the data in the FlightData datagrid updates automatically.
4.

Close the application, and in Visual Studio, from the Debug menu, click Stop Debugging.

Friday, July 10, 2009

SMS Share buying

Standard Investment Bank has introduced trading of shares using mobile phones.

Mr James Wangunyu, the company’s executive chairman, says investors will now be able to place their buy and sell orders by sending text mesages on their phones.

"Today we are introducing the next leap in technology that will change how we trade on the Nairobi Stock Exchange (NSE) once again," Wangunyu told a media briefing at the company’s offices in Nairobi yesterday.

"This is an important milestone in our capital markets."

Easy Hisa mobile allows orders to be processed and delivered to the exchange within an hour.

Wangunyu said mobile stock trading would eliminate transportation costs, and save on time spent by investors walking into brokerage firms to place orders.The move comes barely a week after the NSE hinted at least two of its members were in advanced stage of implementing Internet/SMS trading.

Improve efficiency

The service enables investors to— among other things— place orders, check balances in their accounts, determine the value of their shares and hold orders, if the price movement is erratic.

Other developments in the capital markets include the Central Depository System, and the automated trading system, which improved the efficiency of the trading cycle from weeks to five days.

The introduction of the Wide Area Network enabled stockbrokers to trade from the comfort of their offices.

This was expected to act as a stimulus for members of the NSE to open offices throughout the country for the Kenyan investor to access the capital markets and at the same time for Kenyans in the Diaspora to access their stock brokers remotely.

The NSE is also spearheading the implementation a standard member back office system.

The system, which will link the ATS and the CDSC, is expected to enhance the scale, efficiency and risk management capability of member back office operations.

The bourse, in consultation with the Capital Markets Authority (CMA) is already developing system standards to which members will need to adhere to.