Send Text Messages in your application in C#

Sometimes, you want to do something that more than c# can do. In one of my projects, a deal bargain website requires to send out text messages to alert their members when pre-defined keywords match with the new deal submitted. It’s a great use of text messages alert to shopper who are looking for a particular keyword in the deal.

Continue reading “Send Text Messages in your application in C#”

Advertisement

Create A Dashboard Experience In Asp.Net MVC

In most of the time while creating a web application, a secured section for administrating the application is always needed. Something like a control panel or back end of the website(One of my client even call it a database!). No matter how you call it. You do not want to display a bunch of links when you first entered. Instead, you want to show useful data, important notifications or graphical reports using pie or bar chart before they decide where to go in the application. Therefore, a dashboard is needed for that purpose.

dashboard_aspnetmvc

Continue reading “Create A Dashboard Experience In Asp.Net MVC”

Load Google Chart by Ajax using Asp.net MVC and jQuery

If you are looking for a modern chart tool in a modern browser, you must not not to know the free one that offer by Google – Google Chart, is a HTML5/SVG technology to provide cross-browser compatibility (including VML for older IE versions) and cross platform portability to iPhones, iPads and Android. No plugins are needed. Don’t get confused by the image chart offered by Google, which was another chart tool. Now the new HTML5 Google chart provides more interaction and better rendering to users .googlechartaspnetmvc Continue reading “Load Google Chart by Ajax using Asp.net MVC and jQuery”

Amanah Dedicated Server Hosting at Toronto – 3 Month Review

I was looking for a Toronto based collocation hosting for my own business. After visiting a few data centers in Toronto, I decide to go with Amanah Tech who primary offers dedicated hosting service in Toronto (GTA).

It’s a long story about how I find them. I recalled a conversation with their sales and he was kind enough to provide me a competitive price to fit my own server into their cage. In facts, I liked Amanah’s data center where locates at 151 Front Street West which is one of the best data centers in Greater Toronto Area. It’s easy accessed by TTC subway or Go Train and only a minute walk from Union station. Perfect for me who needs to come in to perform hardware upgrade or maintenance regularly.
Continue reading “Amanah Dedicated Server Hosting at Toronto – 3 Month Review”

How to check if string array contain a string

You don’t want to write a loop to detect if a string array contains a string and ends up searching the simplest way to do it without writing a loop over internet. This is what I found that’s most efficient for .net developers.

.Net 2.0

string[] strArray = { "Dell", "Acer", "HP" };
bool exist = Array.Exists(strArray , s=>s.ToLower().Contains("Asus"));

.Net 3.5

string[] strArray = { "Dell", "Acer", "HP" };
bool exist = strArray.Contains("Asus"));

How to check if enter key pressed in jquery

In a user specific designed application or website, we want application start taking action without user click extra button. Especially in the scenario of search function. You want user be able to start searching when enter key is pressed on the textbox.

<input type="text" id="search" />
<script>
$('#search').keypress(function(e) {
    var keyCode = (e.keyCode ? e.keyCode : e.which);
    if(keyCode  == 13) {
        alert('Enter key pressed');
    }
});
</script>

How to check if enter key pressed in javascript

In a user specific designed application or website, we want application start taking action without user click extra button. Especially in the scenario of search function. You want user be able to start searching when enter key is pressed on the textbox.

function checkEnter(e){
var keyCode = (e.keyCode ? e.keyCode : e.which);
if(keyCode == 13){
//perform action
alert(‘enter key pressed’)
}
}

[html]
<input type="text" onkeypress="checkEnter(event);" />
[/html]
[javascript]
<script>
function checkEnter(e){
var keyCode = (e.keyCode ? e.keyCode : e.which);
if(keyCode == 13){
//perform action
alert(‘enter key pressed’)
}
}
</script>
[/javascript]]

Click here to see the jquery version

How to strip/remove HTML in asp.net C#

Checking a user input contains html tag or not is not unfamiliar task to any web development project. Use the following strip html function in c#, you can take the html tag away from user inputs.

public static string StripHtml(string html, bool allowHarmlessTags)
{
      if (html == null || html == string.Empty)
           return string.Empty;

      if (allowHarmlessTags)
           return System.Text.RegularExpressions.Regex.Replace(html, &quot;&lt;/?(?i:script|embed|object|frameset|frame|iframe|meta|link|style)(.|\n)*?&gt;&quot;, string.Empty);

      return System.Text.RegularExpressions.Regex.Replace(html, &quot;&lt;[^&gt;]*&gt;&quot;, string.Empty);
}