Friday, August 28, 2009

Google Translate: Web Services written in languages other than English

A utility function that can be used when dealing with web services written in languages other than English that returns value in foreign language like french, even the variable names are in that language and the error messages returned. With this utility function it's very easy to debug the application. Just add this function in one of the utility class in yur project.

public
string TranslateText(


string input,


string languagePair)

{

string url =

String.Format("http://www.google.com/translate_t?hl=en&ie=UTF8&text={0}&langpair={1}",

input, languagePair);

WebClient webClient = new
WebClient();

webClient.Encoding = System.Text.Encoding.UTF8;

string result = webClient.DownloadString(url);

result = result.Substring(result.IndexOf("id=result_box") + 24);

result = result.Substring(0, result.IndexOf("</div"));

return result;

}

Usage: you can call this function like this

TransalteText(inputString, "ar|en")

It will convert the inputString from arabic to english and return the english text

It will convert the inputString from arabic to english and return the english text

Thursday, July 23, 2009

Silverlight: What is CoreCLR?

Do you know what is CoreCLR? If not then keep reading this article, if yes then do contribute to help others understand it better.

CoreCLR is a scaled version of the original CLR that has been encapsulated within Silverlight2, Don't you think its amazing? Well i find it very interesting, with access to BCL (Base Class Libraries) you can write classic applications using Silverlight2 and now Sliverlight3 coming in with lot more new features.

Silverlight2/CoreCLR includes:

- BCL (though not complete but enough to help you write medium to complex level applications, I'll go in to its details in some other post)
- JIT ( just in time compiler)
- GC ( Garbage collector)


What are the benefits of CoreCLR?

- You have the access to the limited BCL, you can write code in C# or any other .NET language and it will run it User web browser.
- CoreCLR works for non-windows platforms also e.g MAC OS, see below figure. It uses PAL (Platform Adaptation Layer), an API written for different platforms.


Figure taken from MSDN article

- With Silverligt CoreCLR, you can manipulate DOM within C# codebehind of Silevrlight XAML page, or vise versa i.e. using C# objects in JavaScript.
- The good thing about CoreCLR is that its compatible with the original CLR because the designer of CoreCLR have kept the execution engine and virtual machine same.
- You can easily customize the existing code written for original CLR to fit for the CoreCLR but with few changes.
- CoreCLR run side by side with the desktop CLR, that too is a big advantage.
- One of the other great things with CoreCLR is that the Silverlight team has been able to keep the size of the setup in a reasonable range, so that the user don't have to wait that long.

With CoreCLR coming in to picture, its more easy for the .NET developers to write applications in Silverlight instead of using Flash and taking advantage of Action Script in Flash. They need not to learn anything new, they can take advantage of their existing C# or VB.NET skills for writing Silverlight applications business logic.

CoreCLR Web Resources:

- A must read article from MSDN on CoreCLR: http://msdn.microsoft.com/en-us/magazine/cc721609.aspx
- An interesting Video from Microsoft TechNet 09 about Silverlight2/ CLR, a must see:


Get Microsoft Silverlight

Silverlight Ideas: Making a silverlight application run out of web browser

Here I'm getting started with Sliverlight, learning the architecture, looking at demos,and sample applications.

I come across the details of running a silvelight application, out of IE and to make it a separate application running right from your desktop, just like a Flash application, it will be useful for a completely offloaded application like a single player game, or an online application that can also work in offline and syncroznie stuff when Internet become available.

Here are the details of how to make a Silvelight application to run out of IE.

- Open the Silevrlight Project settings, Right click the project, click on the properties, here you are:



- Click the checkbox, "Enable running application out of the browser", it will enable the settings and will allow a user to run it out of browser.
- You can click on "Out of Browser Settings" button for more customization, like window title, shortcut name, width and height of the window e.t.c. You can even customize the application shortcut icon and that too for different sizes.



- Now the client will see another option i.e "Install on this computer", when he will right click a Silverlight application from within the web browser.





- If you will click on this option it will ask for further details, like "Start Menu", and "Desktop", once done it will install the application.



- Now you are all set to run the application from your desktop or start menu, depending upon the option you selected while installing it.



- You can also remove the application from your desktop if you want to, for that you need to right click when the application is open and selects the "Remove Application" option.


I really liked this idea and the level of customization provided by sliverlight!

Friday, July 17, 2009

PTCL Broadband, not proving to be a wise decision

I got PTCL broadband for home a 1MB link; I thought that it's a good choice at a reasonable cost, due to their student package. Not to mention the hassle of getting it installed at my place it took me a complete month, around 50 reminder calls to their call-centre, with follow-ups to the exchange directly, and the final warning of cancelling my order, it worked though :).

While I was in Pakistan and planning to leave for UK, it worked very fine for couple of weeks and I really loved the speed, but for last couple of weeks it has been a big mess for my family, they come online we start talking and then what happens DSL goes down, they come online again and what now DSL is down again. We hardly talk due to this online/offline thing.

Hats off to their customer service, we have been launching complaints again and again but nothing so far! I wish PTCL as a company can improve their customer service, since now they are not publically owned, if it continues to happen ppl will start looking for alternatives, which I already had!

Tuesday, May 19, 2009

.NET Tricks - alterante folder for project assemblies

Few days back at work i came across a scenario in which i have lot of third party assemblies used by my C# windows application project, i wanted to put them in a separate sub folder instead of the main folder. By putting them in a sub folder it will make my life lot easier when it comes to deployment and other post release stuff.

Luckily .NET framework provides us with a tag in APP.CONFIG where we can specify the alternate folders to look for third party/ shared assemblies. Here is the code snippet that will ask the .NET framework to look into \bin and \shared folder for the shared assemblies instead of just the main folder where the exe is placed.

APP.CONFIG Sample

Thursday, July 17, 2008

Star Performer Award @ TRG

  Star Perfomer Award @ TRG :D, awarded to me for year 2007 at Annual Employee Day!
Posted by Picasa

Monday, April 14, 2008

Interview Questions: Quality Engineer

After a long time i'm posting on this blog, i'm in middle of a QA interview right now, so i though to publish some QA questions, that any QA engineer should expect as part of their technical evaluation. As before i'll not be posting the answer i want you to look for the answers on your own:

  • What are functional requirements?
  • What is a sequence diagram?
  • What is regression testing?
  • What is smoke testing?
  • What is sanity testing?
  • Difference b/w validation and verification?
  • Integration testing?
  • Security testing, SQL injection?
  • Write all the test cases for testing a telephone/ whiteboard/ laptop?
  • What is reverse engineering?
  • What is usability testing?
  • Difference b/w black box and gray box testing?
  • What is boundary value analysis?
  • What is debugging?
  • What is code coverage?
  • Any idea of test driven development?
  • What is Total Quality Management?
  • What is configuration management?
  • What is unit testing?
  • What is a test plan?
  • Difference between a defect, bug and enhancement?
  • What is load testing?
  • What is ad-hoc testing?
  • What is stress testing?
  • Are you familiar with UML?
  • Difference between Quality Assurance and Quality Control?
  • How would you ensure 100% coverage of testing?
  • What is the static analysis of code?
  • What is a good code?
  • Equivalence testing?
  • Error Guessing?
  • Ad-Hoc testing?
  • What is a build? How build management is done?
  • What’s the difference between Alpha & Beta testing?

Tuesday, November 13, 2007

Open Source: Chat Engine

Today i uploaded the code and executable for the secure multi threaded chat & P2P client application that i developed using C# 1.1 as a university project for one of my friend on Google Code.

I have made this application as an open source so anyone interested can take the code and update it according to his/her needs.

You can download the application from here.

Drop an email @ basit.tanveer@gmail.com in case you wish to discuss it in detail.


The secure multi threaded chat server & P2P file transfer client supports following feature set:

-> Multi user Server

-> Chat Client

-> P2P File Transfer

-> Secure Communication {Diffie Hellman / AES (Rinjdael)}

-> Password based authentication

-> Access DB for users

-> Passwords are saved in hashed form in data base

-> A utility to hash the password

Tuesday, September 25, 2007

Hotmail shoots to 5 GB


Today while opening my hot mail account through web browser after such a long time instead of messenger, i noticed that my email size is now 5 GB and i am just using 1% of it. Yea thats true how can i use more then 1% of it when for all my communications i prefer Gmail... Gmail rocks!!

Monday, September 24, 2007

Webpage Screenshot Utility - IECapt

I come across a nice command line utility IECapt for capturing the IE rendering of a URL in the form of a screen shot, it support saving a web page into a BMP, JPEG or PNG image file.

The usage is quite simple:

IECapt {web URL} {image name along with path}

I find this utility quite handy, hope you would love it too.

Wednesday, September 12, 2007

A new look to my blog - back to blogging


{old template}


Same old routine along with same old template for my blog for such a longer period of time with no blogging, Not Acceptable now :). Today i updated my blog template and gave it a new look altogether.


Hope you guys will like it!

Tuesday, January 09, 2007

Interesting Measures for Mining Association Rules

Back in 2004 while studying Data Mining course by Mr. Liaquat Majeed Sheikh, during my BS at FAST-NU wrote a paper on the Interestingness of Different Measures in Data Mining which was presented in IEEE-INMIC 2004 and published in its proceedings.
____________________________________________________________
Abstract:

Discovering association rules is one of the most important tasks in data mining and many efficient algorithms were proposed in literature. However, the number of discovered rules is often so large, so the user cannot analyze all discovered rules. To overcome that problem several methods for mining interesting rules only have been proposed. Many measures have been proposed in literature to determine the interestingness of the rule. In this paper we have selected a total of eight different measures, we have compared these measures by using a data set, and we have made some recommendation about the use of the measures for discovering the most interesting rules.......

Complete paper

Thursday, September 07, 2006

C# : Interview Questions

Hi,

I have uploaded the list of ASP.NET questions in my previous post, now i am uploading the list of questsion for C# interviews, Hope it will help someone in interviews :)

C#

* Does C# supports multiple inheritence?
* What is a delegate?
* What are setallite assemblies?
* Differences between Namespace, Class, Assembly?
* What is the difference between managed and unmanaged code?
* What is serialization?
* What’s a bubbled event?
* What is garbage collection? How dot net handles the garbage collection?
* Can we force garbage collector to run ?
* What is concept of Boxing and Unboxing ? Do we have the same problem in c# 2.0? if no how it is resolved? What are generics?
* What happens in memory when you Box and Unbox a value-type?
* What are the ways to deploy an assembly?
* What is the difference between the value type and reference type? Do we have value type in dot net?
* What different types of JIT compliler do we have?
* What’s a multicast delegate?

C# 2.0

* What are the partial classes? Where we can use them?
* Any idea of LINQ project?
* What are generics?


C# Distributed Application

* What different option do we have for creating distributed applications in dot net?
* What is a thread? What is multithreading?
* What is deadlock? How we can elimate the risk?
* This data structure is "Thread Safe" what does that mean?
* What are locks and why we need them? When working with shared data in threading how do you implement synchronization ?
* What are sockets? What is the difference between TCP and UDP sockets?
* Any idea of Windows Communication Foundation?
* What is the difference between a thread and a process? Can a process have multiple threads?
* How we can communicate betweem two processes?
* What is the procedure of communicating between two threads?
* What's Thread.Join() in threading ?
* What are the different states of a thread?


Thanks,
Happy Interviewing.

Friday, August 11, 2006

AJAX without XML

JSON is Java Script Object Notation, a lightweight data interchange format over the internet and is language independent.

But Why we need JSON when we have XML, the biggest issue with the XML is its parsing . while JSON is easy to parse and it gives us object which are easy to maintain and manipulate.

JSON contains:

Objects with comma seperated Key/Value pair,
Arrays with comma seperated Value.

=> Value can be String, Number, Char, Int, Exp, or an Object, Array, e.t.c.


Sample
XML


{breakfast-menu}
{food}
{name}Belgian Waffles{/name}
{price}$5.95{/price}
{description}two of our famous Belgian Waffles with plenty of real maple syrup {/description}
{calories}650{/calories}
{/food}

{food}
{name}Strawberry Belgian Waffles{/name}
{price}$7.95{/price}
{description}light Belgian waffles covered with strawberrys and whipped cream{/description}
{calories}900{/calories}
{/food}

{/BREAKFAST-MENU}


JSON

{"breakfast-menu":
{ "food":[
{"name": "Belgian Waffles",
"price": "5.95", "description":
"two of our famous Belgian Waffles with ...", "calories": "650"
},
{"name": "Strawberry Belgian Waffles",
"price": "7.95", "description": "light Belgian waffles covered with ...",
"calories": "900" }
]
}
}

Javascript

// XMLHttpRequest completion

function var myOnComplete = function(responseText, responseXML)

{
eval(responseText);
for (var i=0; i < breakfastMenu.length; i++){
document.write(breakfastMenu[i].name + "
");
}
}

See more details on the JSON @ http://www.json.org/

So now the AJAX which uses XML as a messaging language can also use JSON which is more lighter as compared to XML parsing.

Saturday, July 01, 2006

patterns & practices Guidance Explorer

Guidence Explorer is a handy tool, for searching relevent microsoft patterns & practices guidance. It includes Guidlines, Anti Pattern, Checklists, Code Samples, Patterns, Test Cases.

You can customize the views of your own choice. You can also create different search views according to your requirements. Each and every topic is tagged according to Technology (asp.net 1.1 / asp.net 2.0 e.t.c.) , Type (deployment/ development e.t.c.) and few more attributes. We can also set filter on any of the criteria.





Give it a try and explore it...

Monday, June 12, 2006

Online Office

Have you ever worked with online office suite? Do you know you can create word/ spread sheets / HTML pages online and you can save them online moreover you can also share it with your friends and family (collaboration) .

Google spread sheet provide another interesting feature along with just sharing i.e. live chatting with the people collaborating with you on the same document.

List of few known word / spread sheet / HTML page creators:

Online word processors Online spread sheetOnline HTML page creator
Whats not there ? i guess online DB and what else ????

Thanks,

Thursday, May 25, 2006

Making width and height of ASP:ImageButton to work with Safari and other browsers

If you ever come across the problem of using with specified width and height, it will work fine with the IE but the image dimensions will not be set for other browers like safari, the reason behind it is, whenever you specify the width and height of the it genertaes the Style attribute whenever HTML is rendered and embed the width and height in to it, which works fine in case of IE only.

So what do you need to make it work in each and every web browser. You need to add the width and height attributes to the object using imgBtn.Attribute.add("width","20"), then it will work fine for each and every brower.

Example:

if you have such asp.net code

" asp:imagebutton id="ImageButton1" runat="server" width="50px" height="20px" "

the HTML code generated by it is:

{ input type="image" name="ImageButton1" id="ImageButton1" alt="" border="0" style="height:20px;width:50px;" }

it works fine with IE but not with any other browser

so what needed to be changes, we need to add this

" asp:imagebutton id="ImageButton1" runat="server" "

ImageButton1.Attributes.Add("width","50");
ImageButton1.Attributes.Add("height","20");

now the HTML genertaed will be:

{ input type="image" name="ImageButton1" id="ImageButton1" alt="" border="0" height:20px width:50px }

Enjoy..

Monday, May 08, 2006

ASP.NET: Interview Questions

Hi, These are the typical questions that i usually asks while taking an ASP.NET specific interview. Hope these might help someone :)

*What is View State?
*Can you read the View State?
*What is the difference between encoding and encryption? Which is easy to break?
*Can we disable the view state application wide?
*can we disable it on page wide?
*can we disable it for a control?
*What is provider Model?
*Any idea of Data Access Component provided by Microsoft?
*Any idea of Enterprise library?
*What is web service?
*What is WSDL?
*Can a web service be only developed in asp.ent?
*can we use multiple web services from a single application?
*can we call a web service asynchronously?
*Can a web service be used from a windows application?
*What do we need to deploy a web service?
*What is the significance of web.config?
*Can we have multiple web.config files in a sigle web project?
*Can we have more then one configuration file?
*Type of Authentications?
*Can we have multiple assemblies in a single web project?
*What is GAC?
*What is machine.config?
*What different types of session state Management we have in asp.net?
*What are cookies?
*What is Cache?
*What is AJAX?
*Is AJAX a language?
*What is the difference between syncronus and asyncronus?
*What is an Assembly?
*Can an assembly contains more then one classes?
*What is strong name?
*What is the difference b/w client and server side?
*What we need for the deployment of a asp.net we application?
*what is the purpose of IIS?
*Difference between http and https?
*what is purpose of aspnet_wp.exe ?
*what is an ISAPI filter?
*what do you mean by HTTP Handler?
*What is the purpose of Global.asax?
*What is the significance of Application_Start/Session_Start/Application_Error?
*What is the difference between the inline and code behind?
*what is side by side execution?
*can we have two different versions of dot net frameworks running on the same machine?
*What is CLR? Difference b/w CLR and JVM?
*What is CLI?
*What is CTS?
*What is .resx file meant for?
*Any idea of aspnet_regiis?
*Any idea of ASP NET State Service?
*Crystal report is only used for read only data and reporting purposes?
*We can add a crystal report in aspx page using two techniques, what are these?
*What is the difference between stroed procedure and stored function in SQL?
*Can we have an updateable view in SQL?
*What is connection pooling? how can we acheive that in asp.net?
*What is DataSet?
*What is the difference between typed and untyped dataset?
*What is the difference bewteen accessing the data throgh the dataset and datareader?

Thanks,
Happy Interviewing.


Sunday, May 07, 2006

RSS Puller in ASP

I have created a sample asp page that pulls the data from RSS and displays it on the page, using an XSL fro formatting the output. You just need to change the URL of RSS in:

<%= getXML(" RSS_URL ") %>

Where:

RSS_URL: URL of the RSS whose contents we want to see.

You can change the output of the RSS by updating the XSL file.

ASP RSS Puller