October 20, 2016

AWS.Net - Simple library for AWS services. i.e. S3, SQS & SES

Have worked on many AWS projects but found their library wasn't designed for simplicity. So thought of writing my own library for my pet projects with AWS. It's very simple and easy to integrate S3, SQS & SES.

Visit my Github project for more details on how to use it.  - https://github.com/ludmal/AWS.Net

For example, sending a message to the SQS is easy as this. 
var service = new SqsService<EmailMessage>(new AwsCredentials
{
  RegionEndpoint = RegionEndpoint.USWest2
});

service.QueueUrl = ConfigurationManager.AppSettings["EmailQueue"];

var response = service.Push(new HelloEmail());

And retrieving the message with Generic object is very simple.
var service = new SqsService<EmailMessage>(new AwsCredentials
{
 //SQS Service Region
 RegionEndpoint = RegionEndpoint.USWest2
});

//SQS Queue Url
service.QueueUrl = ConfigurationManager.AppSettings["EmailQueue"];

var items = service.Process();

April 22, 2016

Chalk

Chalk is a simple library written by me to output console text with different colors. Enough said! Get the nuget package and start using it.

Install-Package Chalk

How to use:
Chalk.Blue("Blue")
Chalk.Red("Red")
Chalk.Green("Green")
Chalk.Gray("Gray")
Chalk.Yellow("Yellow")

Here is the Github link with Examples.

May 29, 2015

Better AngularJs service for SignalR


SignalR makes our lives easy when buidling realtime webapps. Needless to say AngularJs has already found a permanant role in our webapps. Here is a quick AngularJs service which I wrote to integrate SignalR broadcasts.


 var app = angular.module('signalr', []);  
 app.factory('SignalRService', ['$rootScope', '$window', function ($rootScope, $window) {  
   var srv = {};  
   srv.init = function (hub) {  
     var connection = $.hubConnection();  
     var proxy = connection.createHubProxy(hub);  
     proxy.on('broadcast', function (jobs) {  
       angular.forEach(jobs, function (item) {  
         console.log(item.EventName, item.Data);  
         $rootScope.$broadcast(item.EventName, item.Data);  
       });  
     });  
     connection.start()  
      .done(function () {  
        console.log('Connected');  
      })  
      .fail(function () { console.log('Failed to connect!'); });  
   };  
   return srv;  
 }]);  

August 12, 2014

Future of Web Development : AnuglarJs + REST API ?

It's a paradigm shift in web development. Unlike the days we used to develop web apps using classic Asp, Asp.Net or Php, the focus has changed into decoupling the frontend and backend. More and more web apps are adapting this methodology mainly due the evolution of mobile usage.

With mobile & tablets revolution, developers are constantly finding ways to develop a single app to support all of the different devices and their browser sizes. It has been always difficult and costly to develop native apps for various different mobile platforms. Although the responsive design was the solution, it is extremely hard to avoid unnecessary page reloads while using the web app on mobile devices.

SPA - Single Page App concept was the solution to the problem. However until the release of AngularJs, it wasn't very enjoyable development for the developers. There were plethora of MVC JavaScript libraries but none of them was even nearly good as AngularJs. While the AnugularJs solves the frontend problem, the backend lies in RESTful API's. The main advantage in this architecture is the app is decoupled hence frontend and backend can be developed using different technologies. For example, while the frontend is AngularJs, the backend API can be developed in Node.js, Asp.Net Web API or any other API provider technology.

The basics of AngularJs + API driven Web app.


This should be the preferred approach for any new web application development. However for the apps which are monolith or legacy could still gain the benefits by modularizing the APIs as shown in the following example.  For example, some parts of the apps can be decoupled using an API layer on top of the legacy/monolith web application.


One of the best approaches to write a scalable backend API is by using micro-services architecture, which will be discussed in my next post.

Writing scalable & high performance web applications have been a challenge, by making it device agnostic is even challenging. It is evident that AngujarJs + APIs solve the challenging nature of web apps to support multiple devices and increase the performance. 



February 11, 2014

Sending Emails using Templates

Here is a simple Python module to send emails using HTML/TEXT templates. Feel free to use the code.

https://github.com/ludmal/pylib

Step 1:

Create a TEXT/HTML file with the Keys as below
Hi [username],

Thank you for your registration.

Best regards,
[from]
[url]

Step 2:

Create a template passing the values to replace with the keys in template
values = {}
values['username'] = 'Ludmal de silva!'
values['from'] = 'The Team'
values['url'] = 'http://www.ludmal.com'
temp = EmailTemplate(template_name='welcome.txt', values=values)

Step 3:

Create a Mail Server
server = MailServer(server_name='smtp.gmail.com', username='', password='', port=0,   require_starttls=True)

Step 4:

Create a mail message and send the email
msg = MailMessage(from_email='ludmal@gmail.com', to_emails=['ludmal@gmail.com'], subject='Welcome')
send(mail_msg=msg, mail_server=server, template=temp)
Follow me on Twitter @ludmal

February 7, 2014

Python File Archiver

I always wanted to quickly cleanup my harddrive without manually searching files and moving them. So here is the solution, a simple File Arhicver python script which I wrote to clean up my hard drive. It will search for files older than a given time period & size (parameterized) and then move to a Arhicve folder. I'll try to improve the code when I get some free time and here is the script file, download and feel free to use it.

https://github.com/ludmal/pylib/blob/master/file_archiver

November 27, 2013

tf-idf, Term Frequency–Inverse Document Frequency

tf-idf is stands for Term Frequency - Inverse document frequency and it is one of the effective algorithms to extract the keywords from a given document. It is often used in NLP and IR. The extraction is performed in a statistical measure by calculating the weight of a word in a document list or a corpus. Many search engines using the benefits of tf-idf to extract keywords, frequently with combinations of other algorithms. Word's weight or importance is measured by the word frequency in a document and offset by the same word's frequency in the given corpus.

tf-idf = term frequency x inverse document frequency

For example, if the word 'peace' appears 6 times in a document with 100 words the tf is 6/100 = 0.06. And if the corpus or document list contains 1000 documents and if 'peace' appears in 200 documents in the corpus then the idf is 1000/200 = 5. Hence the tf-idf for the word is 0.06 x 5 = 0.3. The weight or tf-idf is directly related to the importance word, i.e. if the tf-idf is higher then the importance of the word is high.



I've written a python module to extract the keywords from a given corpus. This is useful if you want to extract the keywords from a given website links and categorized them according to the keywords. You can use the code freely by downloading from the following Github location.

https://github.com/ludmal/pylib

Complete sample of the usage can be found here: https://github.com/ludmal/pylib/blob/master/sample.py



July 23, 2013

GIT Tortoise

I've recently moved all my projects to GIThub.com This is mainly due to the fact the popularity gain by GITHub compare to Google code. I was a big fan of Tortoise SVN and luckily it is now available for GIT as well. You can download it from the following location:
https://code.google.com/p/tortoisegit/

Also if anyone wants to use GIT with Visual Studio, here is how;

1. Install GIT for windows
https://code.google.com/p/msysgit/downloads/list?q=full+installer+official+git

2. Install GIT source control provider
http://gitscc.codeplex.com/

and your done! Don't forget to select GIT from the VS Source control settings.




September 8, 2011

Google Buzz


After months of inactivity, I finally decided to disable buzz. Sorry but I’m no longer on Buzz.

Reducing number of news streams helps me to focus on things which are relevant and important. By disabling buzz I reduced my social focus to Twitter, Google+, LinkedIn and Facebook. I also reduced people I follow in Twitter. Last few months I was overloaded with few things and could not read as much I used to.

I’m not a big fan of Facebook, so I will be mainly using my twitter account for updates. And those updates will be automatically added to my Google+, LinkedIn and Facebook accounts. So if you’re interested, Twitter will be my main source for updates. Follow me @ludmal

August 26, 2011

Is Silverlight really dead?


When Silverlight initially released I was skeptical about it. It was meant to replace Adobe Flash back then. There were quite a few arguments I had with my colleagues about Silverlight and its future. But today, after 4 years of Silverlight’s initial release how many web sites do we see in Silverlight?

The future of the web depends on HTML 5 and Javascript. Open standards and 3rd party libraries are the main reasons for this adaption. I clearly don’t see a potential for another technology. However I’m really impressed with Windows 7 Mobile and MVC from Microsoft. I see a potential in terms of web and mobile. I also heard that Microsoft is working on a new UI application model --“Jupiter” which is simlier to Windows 7 Mobile.

August 5, 2011

Visual Studio LightSwitch

New product in Visual Studio family to create rapid data-centric applications for both desktop and cloud.

Resources:
http://msdn.microsoft.com/en-us/lightswitch
http://msdn.microsoft.com/en-us/magazine/hh335065.aspx
http://msdn.microsoft.com/en-us/magazine/hh335061.aspx

Hope this helps!

Follow me at twitter @ludmal for quick updates

July 28, 2011

Moving your business into the Cloud

Cloud computing is ideal for medium and small scale business. Most of the large scale businesses however, are reluctant to move into the cloud. Mostly because they have already invested on their IT infrastructure or fear of exposing their corporate data. Entrepreneurs are finding cloud computing is more beneficial to their businesses. Mainly because to start their businesses with minimum cost on IT infrastructure.

In Cloud Computing--computing power is used like water or electricity, pay only for usage. This has gained significant benefits for businesses. Scalability is vital for any business and cloud computing allows them to grow computing power with minimum cost. Business can run the IT infrastructure without support of internal tech staff hence save money on payroll.

Drawbacks of using cloud computing are very low compare to its benefits. However, service outages are a major drawback on cloud computing. But those outages are significantly low with major service providers like Google, Salesforce and Amazon.

It is vital for businesses to keep their operation costs to minimum. By moving to cloud computing businesses can gain significant benefits like low operation cost, scalability and availability. For example Google Apps for Business is ideal cloud solution for an small and medium scale business.

July 20, 2011

Most of my personal projects will be retired soon

Finally, I decided to retire most of my personal projects. It was too long ago I developed those software projects and it is time now to put them aside and move on with new ideas. Some of the projects however never actually completed. Following are the projects which are going to retire end of this month and domains are already on sale. Please let me know if anybody interested in purchase.

boilcode.com / codeswave.com – Online code snippet management library for developers.

facebook-stats.com – Facebook statistics such as frequency of updates, user base, top users etc.

twitter-stats.com – Twitter statistics such as frequency of updates, user base, top users etc.

groupon.lkGroupon.com like site for Sri Lanka, i.e. to get best deals in town.

newsflippers.com – This project is actually similar to http://fastflip.googlelabs.com/. Currently the concept still remains but with a different presentation in my new project www.channells.com

prodznet.com – An effort to categories the cheap and best products by price and user reviews on the internet.

qnote.us – Online notepad with offline writing ability.

webexten.com – Replacement for extensible-web.com but decided to keep the name as it is—extensible-web.com

However my XWT Framework project , Extensible-web and Channells.com site still in active development, also some of my new ideas yet to be released.

All the above domains are for sale, but if anybody requires source code please email me and I would be more than happy to send them.

July 16, 2011

SOA

Most of the IT guys must have heard the term “SOA”, but there are very few who understand the concepts of it. There are many aspects to SOA in various standpoints. For example a view on SOA can be different from a Business owner to a Technical architect. SOA is not simply a “Web Service”. It is a design paradigm—to develop software as a service.

In technical perspective, it is to expose application functions as services so that the various applications can communicate each other regardless of the various platforms and boundaries. It is an architectural approach which matured from component oriented development and object oriented development.

In business perspective, it is an application design paradigm which will eventually increase the business ROI and reduce the TTM (Time to Market). Business process changes can be easily reflected on the application functions with minimal time & effort. It can also reduce the cost of application maintenance and integration.

SOA is not just a technical artifact—it is a design paradigm which embraces separation of concern and reuse.

April 26, 2011

Let's make the web faster

This is very useful for web developers, Tips and Tricks to improve web application performance. (obviously from Google) http://code.google.com/speed/articles/

April 25, 2011

Ludmal.net in Chrome store

I just submitted ludmal.net to chrome web store. You can install it from here and please don't forget to leave a comment. :-)

https://chrome.google.com/webstore/detail/clcenpmkmbdaglnanmdcginkhmhphdog

Why moving to Cloud?

Internet is everywhere and literally it is impossible to survive without internet. Moving to cloud is a smart decision I've made. I have all my documents, photos & projects on Dropbox and I have access to those with my Mac, Office PC and iPhone whenever, wherever required. But while I encourage my friends to move in to the cloud, there are some frequently asked questions. Have a look at them and my answers.


Question: What is the guarantee that my data wont be lost?
Answer: Well, what is the guarantee that your hard disk wont break or your laptop wont get stolen?


Question: Is my data secure? 
Answer: Is your data secure today anyway? what happens if somebody steal your laptop or  hack to your computer. The best practice is not to save any of the confidential data on laptops or personal computers. (Credit Card, Bank account or Passwords)


Question: But I need internet to access to cloud?
Answer: You don't have to connect to internet 24/7 to access your data. For example www.dropbox.com provide an easy way to sync your local folders with their cloud service. So online or offline you will have access to your data.


Question: Why should I move to cloud?
Answer:
    • how many times you wanted to send your resume or a document but had to wait until you go home and access your home PC? 
    • how many times do you take backups or photos or docs?
    • what happens if your hard disk burnt or someone steal your laptop?
    • what if you want to share a document with your friend and work with him/her collaboratively?
    • how much hassle to go through if you want to re-install your PC?
    • how hard is to find a photo of your last vacation?
    • how many times do you send emails just to access a file on the go?
By answering to the above questions, if you already feel unsecured or unorganized then move in to The Cloud. 
Email me if you need any assistance or consultation on how to setup your working environment. 
Read my other relevant posts;
http://www.ludmal.net/2010/12/transformation.html

Install drop box - http://db.tt/2fpKw7n

March 8, 2011

Few ways to improve Visual Studio Performance.

Few ways to improve Visual Studio Performance.

1. Switch off Auto Recovery. Tools > Options > Environment > Auto Recovery
2. Show empty environment at start up. Tools > Options > Environment > Start up
3. Disable HTML Validations. Tools > Text Editor > HTML > Validation (clear Show Errors check box)
4. Switch off Animate environment tools. Tools > Environment > General
5. Turn off Track changes. Tools > Text Editor ( clear Track Changes check box)
6. Uninstall startup plugins. (if you install any)
7. For C#, disable Navigation bar. Tools > Text Editor > C# (clear Navigation bar check box)
8. Set HTML Designer to Source View. Tools > HTML Designer
9. Start Visual Studio from Command prompt. Start > Run > then type “devenv”