Home Classroom

Hi guys, this time I’ll write about the new Android Wear, which was announced last week. So what is it all about?

Its a new approach by Google to bring a new concept by creating a new development area with targeting only wearable devices.

It’s not a completely new OS, its the same android but made specifically for wearable device software development.

‘Google Says that the Android Extends to Android Wear. Richer Experience for the Wearable devices’ -


So this time, there are 2 types of designs unlike the galaxy gear and smart watch 1 and 2. You can see a circle one and a traditional square screen. As I have heard the square one is going to be manufactured by LG, which has less spec and smaller price tag, whereas the circle one will be made by Motorola with high specs.

For developers, Android wear SDK developer preview has been released, so you guys can download and try it out. Which will be a great experience in the future when the device is out in the market.

So with the help of the official article I managed to find out that you can do the below shown basic functionality.

functionalities

It does not mean that you have to learn anything new, you also can use the old APIs

‘You can also trigger your notifications contextually using existing Android APIs. For example, use geofences to provide glance able information to your users when they are at home, or use the activity detection APIs to send messages to your users’ wrists while they are bicycling.’

So what are you waiting for, register for developer preview, download the sdk and start developing.

:)

Reference : Android Wear|Path of a Coder.com

Hi Guys, this time I am back with some Android Game Development. I got this idea after, the popular game Flappy Bird. Hope all may have tried that game…!
Ok, so I wanted to develop a game and I did some researches and found out that there are a lot of Game engines out there. Some of them are COCOS2D, AndEngine, libGDX and many others. In this article I’ll guild you using AndEngine which is a bit easier one. In future I’ll write on libGDX.

Assumption : I assume that you guys know how to install eclipse development environment, configure java path and install Android plugin to eclipse. This post does not cover all those basic steps.

Advise : As this is a kind of a crash course, its advisable to create files the same name as I use(But it is not mandatory).

Expected Outcome : You will be able to create some lines using the AndEngine

Step 1
Download the Source(library) for the AndEngine using this link and extract

https://github.com/nicolasgramlich/AndEngine

Step 2
Create a new project and when creating select ‘Android Project from Existing Code’ and in it select the folder that we extracted in the Step1.
existing code

This is a library project. Actually this library is the ANDENGINE.
libraryproject

You can check it by right clicking on the project we created now and going to the Android tab. You can see the ‘Is Library’ check box ticked.

Step 3
Now create a new Android project and un tick the create activity. Because we are going to create AndEngine activity using the library project we created above.
createactivity

Step 4
Now you have a project with empty src folder. Right click on that folder and create a new package when naming the package use the package name available in that project ManifestFile
packagename

In my case package name is ‘”com.batz.andengsample”‘

Step 4
Now in side the empty package Download or copy the code and create LineEample.java activity using this LineExample Source Code.

You will get some errors, but don’t worry we will fix it in the next step.

Step 5
So now in your project, right click and go to Android tab and there in the below section(library section), click on the add button and select the AndEngine project and press ok. And then press Apply.
add library

Now all the errors may have gone. Some times you will have errors on the package name, if you have used your own name. So for that, click on the package name that shows as error, click ctrl key +1 key , which will bring suggestion to create a package name according to yours, and click on it to create it. And hopefully all the bugs will be fixed.

Step 6
Before going for the app launch, we have to do one more important thing, we have to specify the activity we created now in the manifest file as a launcher

So go to the manifest file and add these lines between the application tags

<activity
android:name=”.LineExample”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
manifest

LineExample is the name I gave for the activity we created, so in your one don’t forget to change that

Step 7
Now you are ready to run the app. So while you are in the the activity try running the app. it should bring a screen where you will see lots of random lines.

Step 8(For people getting error saying cannot find andengine.apk)
For some people the AndEngine folder is not getting added as library on the time of building the app. So at that point what you can do is copy the andengine.jar file from the AndEngine project libs folder and copy it into your projects’s libs folder. And right click on the newly added andengine.jar file and click on ‘Add to Build Path’ option. This is how the project structure looks after I added the jar to my project from the AndEngine project in the Step8

projectstructure

AndEngine Resources : http://www.andengine.org/

For people who got more time , for people who needs more detailed instruction on the same project guild please watch this tutorial video
Development Reference : http://www.youtube.com/watch?v=Q0kjiIH6u-M

Thank You
-Batz-

Reference:  – http://pathofacoder.com/2014/03/04/lets-try-android-game-development-with-andengine/

3845

Let’s discuss a topic that most of our front-end web developers are afraid of. IE! The most scariest thing ever invented by Microsoft company long ago.

“I wonder if there is one web developer that never blamed Microsoft about inventing the Internet explorer. “

But I should say this. If you follow the right steps and the right markup when you’re creating your project, pretty sure that you will meet your project output on later IE versions. IE is not something that we should be afraid of.

So, as you read on the headline, I’m going to point out some valuable steps to follow up when your client asks you to create an IE compatible website.  Ok then, let’s start with our 7 points.

  1. Make up your mind and think “Hey I’m not afraid of IE. I’m going deal with it”
  2. Use a CSS Re-setter.
  3. Maintain a clear and validated markup. Both CSS & HTML.
  4. Use JS/jQuery libraries that give support to the IE to work well with CSS3 & HTML5.
  5. Keep different style sheets to IE versions.
  6. Use IE’s built-in Developer Tools to debug issues.
  7. Kindly ask website visitors to upgrade their browser.

Ok guys. That’s all I’m going to explain in this article. Let’s roll.

01. Make your mind and think “Hey I’m not afraid of IE. I’m going deal with it”

This is the most important thing. Making your mind to deal with IE. If you keep telling “I hate IE, I can’t make my website to work with IE” to your mind, you’ll end up with a scary looking website on IE and you will lose your valuable client. I’ll give you one of my personal experiences.

One day I had a client and I was about to do him a personal website. So I completed the project and asked the client to test website. And after a while client called me and told,

“Hey, why is this site ugly on Internet explorer? It’s messed up! Please check it.”

Also he sent me some screen shots, but really couldn’t find that issue in my local testing machine. So I asked him his browser version. But his answer was “Why are you asking about my browser? You should be able to create the site making it available to everyone. Not just for me. I won’t tell you about my browser. Fix it anyway. ”

Yeah that was a really bad day for me. Don’t be afraid of IE. Face it.

02. Use a CSS Re-setter. 

Here we go on to important points. Almost every web browser has its in-built CSS Styles to apply to website elements. Easiest example is, because of those inbuilt styles we see different sizes for heading tags. (h1/h2/h3 etc.) . Most of the layout problems on IE are coming because of these inbuilt styles.  So by using a reset.css we can make those all inbuilt styles powerless and our styles will work well. That means, we make them all to 0.

All you have to do is download a css resetter from this site and link it in <head></head> tag. Use it as first css external file & place your other css files under that.

http://www.cssreset.com/

03. Maintain a Clear and validated Markup.

Maintaining clear markup is really important in almost every programming language. So you can get rid of lots of syntax errors and browser errors. Also it’s a good practice. So clear markup will help a lot when you or someone else customizing your project on a later day.

Use online HTML and CSS validators to check your coding errors. Most of the simple errors will automatically be fixed by Mozilla and  Webkit browsers (Firefox, Chrome & Safari). But IE won’t do that. You have to do correct coding if you wish to create an IE compatible website.

Validate html/css- http://validator.w3.org/

Its better if you can create a 100% validated markup. But its not 100% necessary because W3 validator doesn’t support and haven’t updated some of the latest HTML5 & CSS3 syntax.

Tip: Always use CSS Floating & Clearings. It’ll really help you to avoid layout issues. (Use Google to study them)

04. Use JS/jQuery libraries that give support to the IE to work well with CSS3 & HTML5.

As we all know, IE lacks HTML5 support & CSS3 Support. Even IE 10, doesn’t fully support HTML5. So we have to use some 3rd party JavaScript plugins to give IE the ability to support HTML5 & CSS3.

Did you know that IE will simply ignore HTML5 elements that it doesn’t recognize? Even IE8 behaves this way?

Here I’m listing some useful plugins that I’m also using, with a little description .

  • Selectivizr – http://selectivizr.com Selectivizr is a JavaScript utility that emulates CSS3 pseudo-classes and attribute selectors (:nth-child, :last-child, :first-child etc.)  In Internet Explorer 6-8. Simply include the script in your pages and selectivizr will do the rest.
  • HTML5SHIV – https://code.google.com/p/html5shiv html5shiv is the plugin that helps us when we want to use HTML5 on IE. This plugin will simply create HTML5 elements on IE browser by inserting element names into the DOM via document.createElement. The result allows you to continue to make use of HTML5 elements without having to worry about IE.
  • Modernizr.js – http://modernizr.com Modernizr is a small and simple JavaScript library. Modernizr  adds classes to the elements which allows you to target specific browser functionality in your stylesheet.  So you can write your stylesheet more efficiently to IE as well as other browsers supporting Rich Web technologies.

05. Keep different conditional stylesheets on IE versions.

Did you know that you can write different stylesheets to different browsers?

Simply when you are about to create an IE compatible project you can’t just depend on a single stylesheet. Because you’ll die fixing browser to browser CSS issues and using css hacks. I bet, when your website works fine on Chrome, IE will troll you. So why don’t you use different stylesheets to IE versions. You can use the exact fix just to the version of IE you want.

You only have to follow some simple steps. Check this Chris Coyier’s “How to Create an IE-Only Stylesheet” article. It includes all the steps you can follow. http://goo.gl/rh7Q2U

06. Use IE’s built-in Developer Tools to debug issues.

I think you are already using Chrome’s Developer tools & Firefox’s Firebug tool.

Using chrome’s Developer tools – http://goo.gl/FfY1Op | http://goo.gl/jE9Ykk
Using Firebug – http://goo.gl/RD5x5t

So just like these developer tools, IE also has an inbuilt set of developer tools. But they are not that much rich in features nor functionality. You can’t do much with older IE developer tools (according to my view). But IE 11′s Developer Tools are really rich and awesome when we compare to older versions. Even with IE 11′s Developer tools you can test responsive web designs.

Check this article from tutsplus if you wish to learn more about IE 11′s Developer Tools.

The new IE11 F12 tools – http://goo.gl/8S4IHl

Always use the latest IE version, so that you can check your project even from all older versions of IE.

07. Kindly ask website visitors to upgrade their browser.

This step is not just for you. It’s for the all of us. It’s a help for all web developers around the world. Kindly ask IE users to upgrade their browser or move to a rich web browser. This can be tricky, but if you are persuasive and convincing enough by explaining the reason, you might be able to make the user and the clients shift to a newer version or change their browser altogether.

This is my very first article on Digit Magazine and hope you guys got some useful tips. Please leave a comment about this article. I’ll be back with another article.

7784

What is Singleton?

Singleton is a software design pattern which ensures only one object of a type is created. This is useful when we want to create an object, which manages or coordinates some tasks in the system. A WindowManager, a FileSystem, MousePointer would be good examples for places where Singleton design pattern can be applied.

Singleton-Design-Pattern-PHP

Naive approach

The call to Singleton.getInstance()creates a new Singleton type object, provided that the variable “instance” is null and returns it. If “instance” is not null getInstance() returns the “instance”. The variable “instnace” which is null at the startup, is assigned an object at the first call to Singleton.getInstance() and subsequent call to Singleton.getInstance() returns the object created at the first call.

In this way, it ensures only one object of Singleton is there, regardless of the number of times the getInstance() is being called. This works perfectly in a single threaded environment, if only one thread calls getInstance(). But if there are multiple threads say A and B, thread A may reach to the null check where thread B initiate execution. however even at this point, instance is still null to the thread A. Now thread B executes null check the instance and creates a new Singleton. Then thread A again executes and creates another singleton since instance is still null for A. Thus, when there are multiple thread accessing the Singleton class, above code does not guarantee the Singletoness.

Multi threaded approach

To avoid the problem mentioned above, we have to ensure only one thread accesses the getInstance() at a particular moment. The solution to ensure the mutual exclusion for threads in Java is synchronizing the getInstance().

The above methods will provide singletonness. However there could be a performance issue as each and every call needs to execute a synchronized block, which will result in delaying the execution process. In an environment where get instance() is called frequently, this may generate a considerable performance degrade.

Double check approach

With the aim of mitigating the performance issues that arise due to the Multi-Thread approach, Double check approach was introduced. It goes inside to the synchronized block only after performing instance null check. If the null check fails, it will not go inside to the synchronized block.

Double check may also can be a ground to some other problems due to many reasons. One among such problems is compiler optimization. Instance = new type() seems to be a single operation, but there are multiple operations hidden inside. They are the locating memory for the instance, creating the new object by calling the constructor, assigning the newly created object to the “instance” reference. The compiler optimization may reorder these operations depending on the compiler implementation.

Step 1) Assign object to the “instance” reference

Step 2) Constructor code

If the compiler is being ordered in the above way and if another thread start executing get instance(), the instance is not null, since step 1 is over, but only the default values of the attributes of the object can be seen, without the values specified in the constructor. Thus the other objects get the wrong values.

Make instance volatile

By making the instance variable volatile above issue can be sorted out, since the partial values of volatile variables are not visible to other threads.

A better solution with java class loading(lazy initialization)

JVM guarantees a class is loaded only once. We add an inner class to store the instance. Since instance is a static, it is being initialized at the time of class is being loaded. Thus only one instance is created as the class is loaded only once. One essential thing to be noted is InstanceHolder inner class is loaded only at the first call to getInstance(), delaying the instance creation until the object is needed, which is known as lazy initialization.

 

4265

After a long break from my first post, I would like to explain in this post how to get public events from a public Facebook page into an ASP.net MVC application without having to login to Facebook. I hope having a basic understanding about Asp.Net MVC will help you to understand this article quite well.

First let’s create an ASP.net MVC application in Visual Studio (I am using 2012 version in this post), go to File=> new=>project and you will be able to see the list of project Templates available, I will use “Asp.net MVC 3 Web Application” template under “web” category (Figure 1). Give a Name and the location for your application and click ok.

NewProject

 Figure 1

Then you will be prompted to select one of the sub templates available under Asp.net MVC3

subTemplate

Figure 2

Select “Internet Application” template and set the “view engine” as “Razor” (Figure 2) and click ok. After a while you will get a fresh MVC application.

FreshMVC

 Figure 3

Now hit F5 to start debugging on the newly created application

welcometoASP

 Figure 4

If you can see the screen on Figure 4 we are good to proceed further  :)

In order to get the Events from a Facebook page, you must possess a Facebook Application, since the app token of that application will be used to authorize your request. Go to https://developers.facebook.com/  and go to the “Apps” section(Figure 5)

Apps

Figure 5

From there click “Create New App” and create a new Facebook Application (Figure 6).

CreateNewApp

Figure 6

And make sure its “Sandbox Mode” is disabled under “Basic Info” heading.

sandbox

Figure 7

Then we need to get the “App token” of our newly created application, go to tools section from the menu bar and from the set of tools in the right side of the page select “Access Token tool” (Figure 8)

AccessTokenTool

Figure 8

From there you can get the “App Token” for the newly created application (Figure 9)

AppToken

Figure 9

Next, in order to refer to our public Facebook page we need its Facebook Id. The Facebook Id of the page can be taken easily by providing the url of the page to this website (Figure 10)

http://findmyfacebookid.com/

FacebookIdFinderFigure 10

Now we have all the components require to make the request for the events. Use the following format to make the request

https://graph.facebook.com/{0}/events?access_token={1}&limit={2}&after=1&fields=owner,name,description,cover,id

Replace the content as follows

{0}= Id of your Facebook Page

{1}= App Token of your application

{2}= Maximum number of events to be received

Under “fields” parameter you can specify the required details about the event, using the phrases in the Facebook Graph API

https://developers.facebook.com/docs/graph-api/reference/event/

ex:

https://graph.facebook.com/566125203483000/events?access_token=1459623080931717|QlAXMsfKQ0YO9i3iZwFsyb5cGbQ&limit=2&after=1&fields=owner,name,description,cover,id

If we call this url inside a browser we will receive a JSON result like this ( Figure 11).

JSONResult

Figure 11

Now we have received the Data we need, as the next step let’s see how this data can be formatted and displayed inside our MVC application.

First we have to prepare our model, a JSON string like this can be easily converted into a collection of C# object using “Newtonsoft.Json” Library. In order to install this package right click on the “FacebookEventApplication” solution in “Solution Explorer” and go to “Manage Nuget Packages”. In the package manager window select the “online” category and search for “Newtonsoft” in the search box. Then select the result “Json.Net” and click “install”.

Nuget

Figure 12

After installing Newtonsoft JSON, let’s write our model class. Write click on the project go to add=> class. Select “C# class” template and give a name for your model class (Figure 13)

New class

Figure 13

First add a using statement for Newtonsoft,

using Newtonsoft.Json;

Then create properties which correspond to the fields in the JSON result we got, markup each property with the respective name in the JSON string (Figure 14). A Dictionary property has been used for “CoverInformation” since the “cover” field in the JSON result has some sub fields.

Newmodel

Figure 14

Now we are ready to make the call for the Json result inside the Index method of our Home Controller.

newhome

Figure 15

First we should create a WebClient object(line 18).  The WebClient class is used to send or receive data from a URI. Then the url which we used in Figure 11 to get JSON data is defined as downloadUrl. Then we need to create a URI object, URI class is used to represent a URI. And the URIKIND is defined as absolute since we are giving an absolute address. After creating the URI we can start downloading the events details by calling the DownloadString method in the myWebClient object while passing the URI as an argument. If we observe the JSON result we receive in Figure 11, we can see that the JSON object we receive has several properties and the property which we need is the Array called “data”. So in order to separate that array easily, first let’s create a JObject from the “downloadedJsonResult” which is a string. Then in line 30 we have selected the “data” property of that object and assigned it to a JArray. Both JObject and JArray are classes provided by NewtonSoft JSON library. The next step would be deserializing this JSON array into a list of “FacebookEvent” objects. It is done in line 32. After getting the “listOfFacebookEvents” list we pass this list into our view.

Next we have to define a view to display this data. Since we are using the Index Action Method in the HomeController which was already in the default template, a view corresponding to this action method is already available.  Right click on the “Index” word in the Index action (Figure 16)  and Select Go To View

gotoview

Figure 16

Add the following Code to the view Body

ViewContent

Figure 17

Here using a foreach loop we iterate through the list of FacebookEvents which we passed into the view at the controller. We use Html.Display to generate a label to display the name of the each event. And after that we have to use an anchor tag which allows the users to browse to that particular event on Facebook. The “href” property of the anchor tag has been assigned with the url of the particular Facebook event. Finally we have added an image tag to display the cover photo of the event. The CoverInformation property we defined in our FacbookEvent class is a dictionary, we need to take the “source” element of that dictionary by passing “source” into square brackets.

Then we can press F5 and see the functionality of our MVC application

eventDisplay

Figure 18

We can click on the “Go To Event” link of a particular event and navigate into that event on Facebook.

SampleEventTwo

Figure 19

I hope you have understood my explanation on getting Facebook Events details into an ASP.net MVC application without logging to Facebook, and I hope it will be useful for you all. Please express your views, questions on this post since they help me a lot to make my future posts much beneficial for you all !. See you again soon with another article.

Happy Coding!

Developing many Android apps I found that a lot of methods are non-application-specific which means I can extract them into a Utils class which I can then share among various projects. One of my most useful methods is Utils.isEmulator(). This allows me to write into the app behavior which will be optimized for development in case the app is running inside an emulator supplied by an SDK and optimized for end-users in case it’s running on an actual device.

Here’s a use case example. Let’s say you’re building an alarm clock for Android and you want to test the snoozing feature. Let’s say the snooze period has a minimum length of 5 minutes. It will be a waste of time for you to wait 5 minutes every time you hit snooze when you’re actually testing this on the emulator, so why not set it to 1 in this case?

final int minutes = Utils.isEmulator() ? 1 : 5;

While developing the application yourself you’ll find many such use cases. At the moment there is no full proof, recommended way of checking whether you’re running in an emulator or not but the following implementation never failed me:

private static final boolean IS_EMULATOR = android.os.Build.MODEL.endsWith("sdk");

public static boolean isEmulator() {
return IS_EMULATOR;
}

Packaging both behaviors in the same ‘shipment’ (.apk file) is also convenient because it allows you to enable a debug/development mode when you’re helping customers or when you’re just testing functionality on real devices (e.g. simply by forcing IS_EMULATOR to be true in the implementation above in case some button is pressed). In my next process tip, I’ll share another use case for isEmulator() which isn’t application specific and which you can use in every single app you build from now on.

Efficient programming on mobile devices not only saves CPU, but battery as well

Everyone uses ArrayLists these days because they’re flexible. When you iterate over it, it allows you to use the enhanced for loop:

for (MyClass object : myArrayList) {
  ...
}

You use this because it’s simple to understand and easy to use. Did you know it’s consistently 3 times slower than the way you learned to do it in high-school? :)

for (int i=0; i<myArrayList.size(); i++){
  final MyClass object = myArrayList.get(i);
  ...
}

And you can squeeze even more out of this by looping it the other way around. If you check the condition you will access the ArrayList’s size() function every time you increment the counter. But if you loop the other way around you will only read in the beginning and then countdown towards 0, a constant:

for (int i=myArrayList.size()-1; i>-1; i--){
  final MyClass object = myArrayList.get(i);
  ...
}

Don’t forget to write i–. The first time you’ll try this you’ll write i++ out of habit and you won’t know why it crashed .This subject is pretty deep and it involves the JIT (Just In Time compiler) and automatic usage of Iterators behind the scenes as well. When you’re not sure what really matters in terms of speed the best way to figure it out is to write a small test yourself and run it directly on the emulator by measuring time the good old way with System.currentMillis()!

33442

Hello everyone! Welcome to my very first article on diGit. In this article, we will look at how to perform Optical Character Recognition (OCR) in C#.

For this we will use Puma.net library which makes our task much easier. You can download it from CodePlex, which hosts Open Source Projects.

After downloading, run the downloaded file and install it in your machine. I will illustrate this to you by using a small WPF application. After installing Puma .Net go to the “Assemblies” folder in the installation location. Usually they are in C:\Program Files (x86)\Puma.NET\Assemblies (in a 64-bit machine).

You should see three DLL(Dynamic-Link Library or .dll) files as follows.

Figure (a)

Figure (a)

Next go to the properties of the”COM Server” folder which resides at C:\Program Files (x86)\Puma.NET

Go to the security tab and click edit.

Figure (b)

Figure (b)

And make sure you have given full control for the current user.

Next open Visual Studio (I am using 2012 version) and go to File=> new=> project

Figure (c)

Figure (c)

Under “Windows” category choose “WPF Application” and under “Name” give a name for your application and click  OK.

 Right click on your project and select “Add Reference” and go to “Browse” section.

Figure (d)

Figure (d)

Click on “Browse” and locate the” Puma.Net.dll” file which resides in C:\Program Files (x86)\Puma.NET\Assemblies  (in 64-bit machine) and click OK.

Right click on your project  and select “Rebuild”.  After rebuild completes right click on the project again and select “open folder in file explorer”. Go to Bin => Debug and you must  have  “Puma.Net.dll” , and “puma.interop.dll” files inside that folder. From the location in figure (a) you must copy “dibapi.dll” file into this location. Now your Debug folder must have the following content:

Figure (e)

Figure (e)

Now go to “MainWindow.xaml ” in our WPF Application and create an interface like the following by simply using the items in the toolbox.

Figure (f)

Figure (f)

The first  File Selector is used to select the source image file. We can get the output of the OCR as a string or we can directly write it into a file. The second file selector is used to select the destination file for the second scenario.

So now let’s look at the code written in event handlers.

 First let’s consider the click event of the “Select Source” button.

Figure (g)
Figure (g)

Here I have created an object from the “OpenFileDialog” class which helps us to locate the source image that we use to read. The “ShowDialog()” method in this class will open a file chooser window and it returns a boolean value which indicates whether a file has been selected or not. And I have taken the path of the selected file using the “FileName” property and set it into the first TextBox in Figure (f).

Now let’s consider the actions caused by the click event of the “Read to screen” button

Figure (h)
Figure (h)

Here we are creating an object from the “PumaPage” class and we have to pass the path of the source image file which we got in the previous step into the constructor of this object. And then we can set the output format we want (line 54), and set the language which is used in the source image(line 55). Using the “RecongnizeToString()” method we can take the output of the reading into a string. I have applied that string into a “TextBlock”  in our MainPage.xaml. Finally I have called the “Dispose()” method so this PumaPage object will be disposed allowing another PumaPage object to get hold of the source image file.

Here is the code under “SelectDestination” button

Figure (i)
Figure (i)

This has a similar functionality as the “Select Source” button in Figure (g) and it will let us select the destination file where we would like to save the output if we plan to save it in a file. And that path is assigned to the Second TextBox in the MainWindow.xaml page. 

Click event in the “Read to File” button

Figure (j)
Figure (j)

The functionality of this event is similar to “read to screen” in Figure (h). Instead of the “RecongnizeToString()” method we must use the “RecognizeToFile()” method (line 85) and pass the path of the destination file which we got in the previous step, as a parameter.

Before running the application make sure to add a reference to the “System.Drawing” assembly by going to the Reference Manager in the same way we did in Figure (d). Under “Assemblies” section select “FrameWork” and select “System.Drawing ” as shown in below and click OK.

Figure (k)

Figure (k)

This is the image which I will use for recognition:

Figure (l)

Figure (l)

Now let’s run our application by clicking on “Start” button.

This is the result which I got by clicking the “Read to Screen” button after selecting the above source file through “Select Source” button.

Figure (m)

Figure (m)

And we can also use the “Read to File” button after selecting a destination file using the “Select Destination” button.

Figure (n)

Figure (n)

Here is the destination file after the operation:

Figure (o)

Figure (o)

There are some other properties under “PumaPage” class which can be set for much sensitive and thorough recognition, just play around with them a little bit and you will understand their usage and power in no time.

I hope you understood my explanation and learned something new. If you need any further clarifications, please feel free to contact me. And since this is my very first article I very much appreciate your feedback in order to make my future work much beneficial to you all!

Let’s meet again soon with another article.

Take care :)   Happy Coding!!

13575

1st Article of the Series – SharePoint 2010 for Administrators

Aggregated Search and Indexing is one of the most important features of Microsoft SharePoint Server 2010. Today I’m going to show you, how to create a search service application and configure the crawl process.

The heart of the search process is the crawler. The crawler goes and gathers the information from the content sources and stores information in the index. After the index is built, users execute queries against the index and receive results. The crawler has to be configured by the Administrator with content sources, security and timing rules.

There is no more Shared Service Provider (SSP) in SharePoint 2010 Architecture. All services are managed separately. Different services are started and managed in different ways, search service is started as part of creating the search service application and is managed with the Search Service Application topology.

 

Creating a Search Service Application

Like all service applications, search service application is created from the Manage Service Application page of Central Administration.

 

There from the new menu you can add a new Search Service Application. [A Search Service Application will be installed with the default installation of SP 2010].

After creating, selecting the Search Service Application (not the proxy) click on the properties button on the ribbon you will see more configuration options. The initial topology with your new search service application configuration will have all components on one application server and all databases on one database server. This topology can be changed later using the Modify Topology link located on the Farm-Wide Search Administration page or from the Search Service management page.

After naming and creating, the properties page of Search Service Application looks like the one given below.

 

Leave the FAST service application set to none. Next you must specify the search service account which it must be a managed service account, and it will be the same for all search services in the farm. Just like other managed service accounts, it can be changed from the Configure Service Accounts page under the General Security section of the Security page in Central Administration.

Then set the application pools for the two web services. These application pools can be shared with other application or can be unique. The security account used as its identity must be a managed account. First the Search Admin Web Service and the second Search Query and Site Settings Web Service. If you will have search administrators who are not farm administrators, you need to give them permission to manage the search service application from the Manage Service Applications page as shown below which can be done by selecting Administration button from the ribbon.

 

Now select the Search Service Application and click on the Manage button on the ribbon to open the Search Administration with a dashboard for System Status, Crawl History and Search Application Topology.

 

There are many possible configuration changes with the System Status screen. Can change the Default content access account, change contact email address, proxy server and etc…

 

Content Sources

Creating content sources is the first administrative task in building a search and indexing topology. A content source is a collection of start addresses that are accessed with the same type connection and collectively managed. Simply a start address is the URL location where the crawler starts the process. The crawl settings define the depth and, potentially, the width for the crawl process.

Content Source Types

  • SharePoint sites
  • Web sites
  • File shares
  • Exchange public folders
  • Line of business data
  • Custom repositories defined by custom connectors

I can create new content sources, depending on content source type I can set content sources (locations/addresses). Apart from that schedule crawling, setting priority too can be configured from here.

Crawl Rules

Crawl rules allows to include or/and exclude and specify security context for content sources for crawling. Adding crawl rules is a topic has been taken separately which I will not cover in today’s article.

 

Crawl rule paths can be entered in few different ways.

 

Server Name Mappings

There can be situations where crawling has be performed on URLs other than what’s given in alternate access mapping. You can create server name mappings to override how the URLs are shown in search results and correct the name displayed to user. This is mainly needed in scenarios where the user need to crawl content using HTTP when users will access it using HTTPS and also when it is necessary to crawl with Windows authentication when the normal authentication method is not supported for the crawler, such as smart-card authentication.

 

The configuration you have done up to now is fair enough for the search to work. But there are lot more configuration that can be done regarding security permission, database configuration and etc.. depending on the farm topology used.

1127

Before proceeding with reading this post, just take a look at your email inbox. How many emails can you find there, promoting some product or a service? How many of them are actually relevant for you?

I’m sure if you are an average Sri Lankan who uses emails regularly, you will find a couple of dozens of Viagra promotions, another dozen of emails promoting Replica watches and quite a few from local email marketing agencies promoting one or more of their clients.

However, how many emails are there actually you opted in to receive? For sure, that is the least number of promotional emails you will see in your inbox.

I’m trying to get at the problem we are facing in using email as an effective marketing tool. Just as in any other form of media, there are “spoilers” who ruin the effectiveness of email marketing with their shortsighted activities on the cyberspace. Just having a technical understanding of ‘how to send a bulk email to 100,000 email addresses’ will not make you an eMail marketer, or give you the due qualification to start an email marketing agency. Sending out the email is just a one component of email marketing, but before getting there, you have to consider a lot more things to make your email marketing efforts effectiveness.

Email Marketing Defined

I define email marketing as “using email as a medium of communication to convey interactive messages to a highly relevant target audience who are willing to receive such messages from us”. Once I put forward this definition, I categorically label anything else as “Spam”.

My definition of eMail marketing contains three important basics you have to follow when carrying out email marketing.

  1. Relevant target audience
  2. Permission
  3. Interactive content

Relevant Audience

First you have to pick your target audience right. This is called prospect targeting. There are many strategies and tactics you can use when finding the right prospects to receive your email marketing. One commonly used tactic is to make your website visitors to sign-up for your mailing list. Someone visits your website, because they are interested in the content you publish on your website. That is an indication of relevancy of what you sell (product, service or idea) to the person who is about to sign up for your email list. You can directly promote your mailing list and give a voluntary sign up option on the website. Or else, you can give some ‘relevant bait’ like a free ebook, to encourage visitor to sign up for your mailing list. We use direct sign up method on www.petadivisor.org for signing up people for our ‘Pet Advisor Monthly – Pet Care Newsletter”. With this signup option, we make sure that people who receive our emails are actually pet owners and animal lovers.

Another method for making the audience relevant is by sponsoring related concepts. For example, a company in the travel industry can sponsor a “Travel Quiz” on a third party website, to collect prospects. There are prospect-targeting specialists who are specialized in conducting such contests, to collect prospective customers to your mailing list.

Permission

This is the least respected attribute of good email marketing practices. Getting the permission of the receiver is very important for increasing the effectiveness of your email marketing. Anyone who does not respect ‘permission’ are in reality, spamming the receivers even though they will find hundred and one excuses to justify their rudeness.

Permission consists of three elements.

  1. Opt in
  2. Double opt in
  3. Freedom to opt out

Out of these three elements, ‘double opt in’ is not a must have feature. However, ‘opt in’ and ‘freedom to opt out’ are two most essential elements in getting the receivers permission.

‘Opt in’ refers to making the receiver actively giving their consent to receive emails from us. This can happen with a sign up process as described in the “Pet Advisor Newsletter”, or by asking the customer to tick “I like to receive emails from you” option, at the check out stage of an eCommerce transaction. In whatever the way you are “opting in” the customer; they got to know that they are going to receive promotional emails from you in the future.

Double opt in works for confirming the customers’ decision to receive emails from you. This works in a way as verifying the validity of the email as well. Customer is expected to click on a ‘verification email’ sent to the email address he/she used for opting in. This is a highly effective thing to do, make your mailing list free of hard bouncing emails.

After a customer opts in to your mailing list, they should have the freedom of opting out from the list anytime they want. This is a legal requirement in many countries there are separate laws to govern email and direct marketing. If you don’t give a working opt out link in your emails, there’s a huge possibility that spam detectors will trigger and your mail will be marked as spam.

Can I Spam?

However, most email markets do away with the “opt in” part very easily, and stick only to the “opt out” option, and justify this with the excuse ‘law doesn’t made it mandatory to send emails only to opt in customers, and it specifically mention having an opt-out option is enough’.

If you look at this justification, you should be able to violation of the basic principles of marketing. Marketing keeps customer always in the forefront, and advocates not doing anything, which makes the customers unhappy. However, if someone advocates you to send unsolicited emails, just because the law does not specifically prohibit you doing so; be wary about such advices. Because, even though the law allows you to ‘spam’ people, in the long run that will kill your brand. Sticking to do the right things always will help you achieve success in the long run, rather than hitting short cuts for quick success.

Elements of a Successful Email Campaign

Subject Line

Objective of your subject line is to compel the user to open the mail. The subject line of your email should be short, and contain specific keywords appealing to the customers. Make it longer, you will lose the chance of opening it. Research say, having the reciever’s first name and/or ‘You’ in the subject line improves the open rate of an email. This is psychology, as most of us are quickly responding to anything addressed to our first name, or anything that specifically delivered to ‘me’. (Is this the reason why some Sinhala language radio DJs overusing the word “Oya” in their shows?)

Message Body

Get to the main point quickly. It is not the job of your receivers to read the flowery language in your email. So cut any unnecessary build up stories and get to the main point as soon as possible. Include call to actions in the mail body, to make it interactive. If you refer to any web page or a website, never forget to add the hyperlinks. It is annoying to cut and paste URLs from email.

Reply Path

Avoid do-not-reply@yourdomain.com email address to send emails. Make sure each and every email marketing message you send out carries a working reply path, which will be checked by a human being.

Choosing Your Email Marketing Agency

According to my knowledge, there is no single email marketing agency based in Sri Lanka, who practice the industry best practices. If apply industry standards, all the email marketing agencies in Sri Lanka are spammers. They use unethical tactics to collect emails (like forward chain emails promising free stuff) and their lists contain loads of unsolicited email addresses.

I recommend, you to build your own mailing list and use a web based solution like MailChimp or Awebar. This is bit costly compared to the easier route of going through one of the email marketing agencies, but if you apply the damage you are making to your brand by associating your brand with such spammers; you are much more better off in spending that money.

Summary

This is just a basic introduction for email marketing, which cannot be fully explained in a short article like this. If you are interested in learning more about email marketing best practices, you are always welcome to contact me via Twitter (@Amisampath) or by visiting my website at www.amisampath.com