C# – Introduction to Aspect Oriented Programming with RealProxy

In many complex business applications, software developers are maybe asked for making protocol of all changes on an object. For example, in a task management system, changes of a task such as dead line, attachments, comments… by users should be logged and displayed in his history. Or in a fault management system, all changes of a fault such as status, companies, workers,… should be also recorded. Who adds what, who deletes what, tracking changes… is the point of interest. How should we solve these requirements without violating our software architecture and duplicating code? We need something that can cross the boundaries of an object or a layer and Aspect Oriented Programming (AOP) is exactly what we need. According to Wikipedia,

Continue reading C# – Introduction to Aspect Oriented Programming with RealProxy

C# – Introduction to SignalR

Mobile apps have a native support for pushing notifications from server to clients on many platforms such as Android, IOS or Windows Phone. I discussed about this feature in Android while ago in Google Cloud Messaging, ASP.NET Web Api and Android client post. Because it’s an interesting feature, we also want to have it in desktop or web application which can be done easily with SignalR, a new ASP.NET library for real-time web application. On SignalR’s homepage http://signalr.net/, you’ll find a lot of examples and codes for demonstrating how it works. In this post, I just want to show how to host SignalR on a WPF application (outside of IIS) and how SignalR basically works. The demo has a server-client model but the clients can also “broadcast” his message to other clients and the server can notify all clients with his notification.

Continue reading C# – Introduction to SignalR

C# – How to use Google Custom Search API?

Google search engine has a market share of over 60%. For some advanced features, such as searching metadata or relevant info of an object, we maybe want to integrate search result of Google search engine instead of inventing our own one. In this post, I would like to write down the steps how we can consume Google Custom Search API in .Net. The code itself is pretty short. However, because of lacking documentation it’s really time consuming to find out how the code should be, where to get the API Key or Search Engine ID for authentication. These all settings stuff drive me crazy because they locate on different control panel.
Please note that Custom Search Engine is a free API edition. For CSE users, the API provides 100 search queries per day for free. If you need more, you may sign up for billing in the Developers Console. Additional requests cost $5 per 1000 queries, up to 10k queries per day.
The other paid version is Google Site Search which is out of scope of this post.

Continue reading C# – How to use Google Custom Search API?

How to create a C++ dll with Visual Studio?

Following previous post How to create a CLR wrapper of C++ for using in C#, I will continue with C++ project in this post. C++ is not my main programming language anymore in last 10 years but I would like to keep some ‘important’ things (to me) of C++ projects before I have to leave it again in next 5 years for focusing on web development. I would like to spend more time for web development (backend and frontend) where C#, Javascript, HTML and CSS are in a more dominant position. In this post, I’ll write down the steps to create a C++ DLL by Visual Studio. This DLL can again be wrapped by a wrapper like in previous post and consumed in C#.

Continue reading How to create a C++ dll with Visual Studio?

C# – How to create a CLR wrapper of C++ for using in C#?

It has been almost 10 years since last time when I worked with C++. I don’t remember much about C++ syntax and can’t even write a small app with C++ anymore. Since Visual Studio introduces C# and CLR and a lot of changes in C++ development environment. I just ‘quit’ out of this programming language. Moreover in next years, I will focus more in web development, not only for private but also for occupational activities. That mean no chance to come back with C++. I’m afraid that many important things of C++ (that I want to keep) will go with the wind after years. When I need them again, it’ll take me days to bring them back. Creating a CLR wrapper is for me such important thing. So in this small post, I just would like to write down the steps to make a simple CLR wrapper for a C++. This is only a simple CLR wrapper, nothing special, but it always helps me a lot when I try to use C++ library in my C# program.
Continue reading C# – How to create a CLR wrapper of C++ for using in C#?

How to create relative shortcut to .exe file with icon?

One year ago I encountered a problem relevant to create a shortcut for relative path. I had to deliver a software package to customers over DVD. The app is kind of archive. It should run live on DVD, connect to a read-only SQLite database (also on that DVD) and display data in read-only mode. It’s pretty easy to deploy such software but when I copy files into a sub folder and create a shortcut to program on its parent folder. The shortcut won’t work on other machine because it uses absolute path and the icon won’t also appear. So a consideration raised if I should develop a Start.exe just to start the program or use some tricks to create a same thing.

Continue reading How to create relative shortcut to .exe file with icon?

Raspberry Pi – How to setup remote access with VNC

Last month I ordered a Raspberry Pi for learning purpose. I heard a lot of about this mini computer and waited until its 2nd generation comes to market to get one. Depending on purposes, there are a lot of kits for Raspberry Pi in the market (from starter to professional). I myself don’t know what I can do with this mini computer therefore I just buy at least hardware first (listed in next section). Just enough so that Raspberry Pi runs and I can remote access it. So my first project is pretty simple : go shopping and make a remote access to Raspberry Pi with VNC (Virtual Network Computing). In this post I will write down the steps I’ve done to finish this mini project.

Continue reading Raspberry Pi – How to setup remote access with VNC

C# – An example of OCR web service

Years ago I wrote a small post about C# – OCR library candidates for comparing between OCR libraries of Tesseract and Microsoft Office Document Imaging. Tesseract is an open source OCR framework. Unfortunately its inaccuracy is still high and can’t be used in commercial products. Last week I would like to make a small OCR web service for training myself and to test Tesseract again. The result is still as bad as last time (I guess FineReader of Abby may be the best OCR SDK but I have no full version for testing). Although Tesseract is not able to recognize complex documents, I also used it for this example because there is no other better candidate. The sample OCR web service works pretty simply, he receives a file which is uploaded from client, runs OCR and returns text back. No big deal.

Continue reading C# – An example of OCR web service