Thursday 7 February 2013

Work on Your own Field rather then following somebody else

One mind blowing interview

Interviewer : Tell me about yourself.

Candidate: I ...am Rameshwar Kulkarni. I did my Tele Communication engineering from BabanRao Dhole-Patil Inst it ute of Technology.

Interviewer : BabanRao Dhole-Patil Inst it ute of Technology? I had never heard of this college before!
Candidate : Great! Even I had not heard of it before getting an admission into it ..
What happened is – due to cricket world cup I scored badly! in 12th.I was getting a paid seat in a good college. But my father said (I prefer to call him ‘baap’) – “I can not invest so much of money”.(The baap actually said – “I will never waste so much of money on you”). So I had to join this college. Frankly speaking this name – BabanRao Dhole-Patil, can at the most be related to a Shetakari Mahavidyalaya

Interviewer: ok, ok. It seems you have taken 6 years to complete your engineering.
Candidate : Actually I tried my best to finish it in 4 years. But you know, these cricket matches and football world cup, and tennis tournaments. It is difficult to concentrate. So I flunked in 2nd and 3rd year. So in all I took 4 + 2 = 7 years.

Interviewer: But 4+2 is 6.
Candidate: Oh, is it ? You know I always had KT in maths. But I will try to keep this in mind. 4+2 is 6, good, thanks. These cricket matches really affect exams a lot.. I think they should ban it .

Interviewer : Good to know that you want cricket matches to be banned.
Candidate : No, no… I am talking about Exams!!

Interviewer: Ok, What is your biggest achievement in life?
Candidate : Obviously, completing my Engineering. My mom never thought I would complete it . In fact, when I flunked in 3rd year, she was looking for a job for me in BEST (Bus
corporation in Maharashtra ) through some relative.

Interviewer : Do you have any plans of higher study?
Candidate: he he he.. Are you kidding? Completing ‘lower’ education it self was so much of pain!!

Interviewer : Let’s talk about technical stuff. On which platforms have you worked?
Candidate : Well, I work at SEEPZ, so you can say Andheri is my current platforms. Earlier I was at Vashi center. So Vashi was my platform then. As you can see I have experience of different platforms! (Vashi and Andheri are the places in Mumbai)

Interviewer : And which languages have you used?
Candidate : Marathi, Hindi, English. By the way, I can keep quiet in German, French, Russian and many other languages.

Interviewer: Why VC is better than VB?
Candidate : It is a common sense – C comes after B. So VC is a higher version than VB. I heard very soon they are coming up w it h a new language VD!

Interviewer: Do you know anything about Assembly Language?
Candidate: Well, I have not heard of it . But I guess, this is the language our ministers and MPs use in assembly.

Interviewer : What is your general project experience?
Candidate : My general experience about projects is – most of the times they are in pipeline!

Interviewer: Can you tell me about your current job?
Candidate: Sure, Currently I am working for Bata Info Tech ltd. Since joining BIL, I am on Bench. Before joining BIL, I used to think that Bench was another software like Windows.

Interviewer : Do you have any project management experience?
Candidate: No, but I guess it shouldn’t be difficult. I know Word and Excel. I can talk a lot. I know how to dial for International phone call and use speaker facility. And very important – I know few words like – ‘Showstoppers ‘ , ‘hot fixes’, ‘SEI-CMM’, ‘quality’, ‘version control’, ‘deadlines’ , ‘Customer Satisfaction’ etc. Also I can blame others for my mistakes!

Interviewer: What are your expectations from our company?
Candidate : Not much.
1. I should at least get 40,000 in hand..
2. I would like to work on a live EJB project. But it should not have deadlines. I personally feel that pressure affects natural talent.
3. I believe in flexi-timings.
4. Dress Code is against basic freedom, so I would like to wear t-shirt and jeans.
5. We must have sat-sun off. I will suggest Wednesday off also, so as to avoid breakdown due to overwork.
6. I would like to go abroad 3 times a year on short term preferably 1-2 months) assignments. Personally I prefer US, Australia and Europe. But considering the fact that there are Olympics coming up in China in the current year, I don’t mind going there in that period. As you can see I am modest and don’t have many expectations. So can I assume my selection?

Interviewer : he he he ha ha ha. Thanks for your interest in our
organization. In fact I was never entertained so much before. Welcome to INFOSYS.

The fellow was appointed in a newly created section ‘Stress Management’ in the HRD of Infosys.

So Excellence is not the only thing Needed. Its the Unique Quality of a Person which can let anyone to Success.
One mind blowing interview

Interviewer : Tell me about yourself.
Candidate: I ...am Rameshwar Kulkarni. I did my Tele Communication engineering from BabanRao Dhole-Patil Inst it ute of Technology.

Interviewer : BabanRao Dhole-Patil Inst it ute of Technology? I had never heard of this college before!
Candidate : Great! Even I had not heard of it before getting an admission into it ..
What happened is – due to cricket world cup I scored badly! in 12th.I was getting a paid seat in a good college. But my father said (I prefer to call him ‘baap’) – “I can not invest so much of money”.(The baap actually said – “I will never waste so much of money on you”). So I had to join this college. Frankly speaking this name – BabanRao Dhole-Patil, can at the most be related to a Shetakari Mahavidyalaya

Interviewer: ok, ok. It seems you have taken 6 years to complete your engineering.
Candidate : Actually I tried my best to finish it in 4 years. But you know, these cricket matches and football world cup, and tennis tournaments. It is difficult to concentrate. So I flunked in 2nd and 3rd year. So in all I took 4 + 2 = 7 years.

Interviewer: But 4+2 is 6.
Candidate: Oh, is it ? You know I always had KT in maths. But I will try to keep this in mind. 4+2 is 6, good, thanks. These cricket matches really affect exams a lot.. I think they should ban it .

Interviewer : Good to know that you want cricket matches to be banned.
Candidate : No, no… I am talking about Exams!!

Interviewer: Ok, What is your biggest achievement in life?
Candidate : Obviously, completing my Engineering. My mom never thought I would complete it . In fact, when I flunked in 3rd year, she was looking for a job for me in BEST (Bus
corporation in Maharashtra ) through some relative.

Interviewer : Do you have any plans of higher study?
Candidate: he he he.. Are you kidding? Completing ‘lower’ education it self was so much of pain!!

Interviewer : Let’s talk about technical stuff. On which platforms have you worked?
Candidate : Well, I work at SEEPZ, so you can say Andheri is my current platforms. Earlier I was at Vashi center. So Vashi was my platform then. As you can see I have experience of different platforms! (Vashi and Andheri are the places in Mumbai)

Interviewer : And which languages have you used?
Candidate : Marathi, Hindi, English. By the way, I can keep quiet in German, French, Russian and many other languages.

Interviewer: Why VC is better than VB?
Candidate : It is a common sense – C comes after B. So VC is a higher version than VB. I heard very soon they are coming up w it h a new language VD!

Interviewer: Do you know anything about Assembly Language?
Candidate: Well, I have not heard of it . But I guess, this is the language our ministers and MPs use in assembly.

Interviewer : What is your general project experience?
Candidate : My general experience about projects is – most of the times they are in pipeline!

Interviewer: Can you tell me about your current job?
Candidate: Sure, Currently I am working for Bata Info Tech ltd. Since joining BIL, I am on Bench. Before joining BIL, I used to think that Bench was another software like Windows.

Interviewer : Do you have any project management experience?
Candidate: No, but I guess it shouldn’t be difficult. I know Word and Excel. I can talk a lot. I know how to dial for International phone call and use speaker facility. And very important – I know few words like – ‘Showstoppers ‘ , ‘hot fixes’, ‘SEI-CMM’, ‘quality’, ‘version control’, ‘deadlines’ , ‘Customer Satisfaction’ etc. Also I can blame others for my mistakes!

Interviewer: What are your expectations from our company?
Candidate : Not much.
1. I should at least get 40,000 in hand..
2. I would like to work on a live EJB project. But it should not have deadlines. I personally feel that pressure affects natural talent.
3. I believe in flexi-timings.
4. Dress Code is against basic freedom, so I would like to wear t-shirt and jeans.
5. We must have sat-sun off. I will suggest Wednesday off also, so as to avoid breakdown due to overwork.
6. I would like to go abroad 3 times a year on short term preferably 1-2 months) assignments. Personally I prefer US, Australia and Europe. But considering the fact that there are Olympics coming up in China in the current year, I don’t mind going there in that period. As you can see I am modest and don’t have many expectations. So can I assume my selection?

Interviewer : he he he ha ha ha. Thanks for your interest in our
organization. In fact I was never entertained so much before. Welcome to INFOSYS.

The fellow was appointed in a newly created section ‘Stress Management’ in the HRD of Infosys.

So Excellence is not the only thing Needed. Its the Unique Quality of a Person which can let anyone to Success. Work on Your own Field rather then following somebody else's Path
Share this Story with your Friends and Inspire People ♥♥♥
else's Path
Share this Story with your Friends and Inspire People ♥♥♥

Saturday 2 February 2013

Colour coded digital clock

Big blur
 
Fortunately I have good enough eye sight that I can read the time on my alarm clock without needing my glasses. However, if you do, how do you see what time it is at 3am in the morning? Does your clock look like this at 3:24am?
Blurry image of 3.24am

Coloured digits
 
Mono-coloured number displays come from the days before multicoloured LED's were cheap and easily available. Now with a range of colours, surely someone could make a mutli-coloured version? The numbers could look like this.
Multicoloured digits

What time is it?
 
3.24am with coloured digits

You can't read the digits, but once you've become accustomed to the colours, you can quickly see what time it is.

Is it time to get out of bed?
 
7.58am not time to get out of bed yet!

What about now?

8.05am time to get up!

Enabling Single Sign-on Using ASP.NET

You can use single sign-on to log on once and then access other system resources without logging on again. You can access information in the Windows® Home Server server software through a Remote Access page, which requires you to log on to the system. When you develop Web applications, you can use the same logon information to provide single sign-on for your applications.
You can use the authentication system that is provided by ASP.NET to determine whether a user is authenticated and what to do if the user is not authenticated. You can easily enable single sign-on of applications by copying sections of the web.config file for Windows Home Server to the web.config file for your application. For more information about using ASP.NET for authentication, see “Explained: Forms Authentication in ASP.NET 2.0” at the Microsoft Web site (http://go.microsoft.com/fwlink/?LinkId=145524).

Enable single sign-on for your application

In order for your Web application to use the same authentication as the Remote Access page of Windows Home Server, you must copy the machineKey element and the authentication element from the web.config file that is used for Remote Access to the web.config file that is used by your Web application. The web.config file that is used for Remote Access is in the C:\inetpub\remote folder.
Dd577079.note(en-us,MSDN.10).gifNote
Several web.config files are provided with Windows Home Server, but only the web.config file that is in the C:\inetpub\remote folder can be used for single sign-on.
The authentication element specifies the type of authentication to use (forms), the name of the authentication cookie (RemotePortalAuth) that is created, and the page to use for users who are not authenticated (logon.aspx). The machineKey element defines the encryption keys to use. You must also change the loginUrl property to reference the logon page for Windows Home Server. The following example shows the machineKey and authentication elements from the web.config file:

<machineKey validationKey="<MachineKey>" 
decryptionKey="<DecryptionKey>"
validation="SHA1" decryption="AES" />
<authentication mode="Forms">
<forms name="RemotePortalAuth" loginUrl="../remote/logon.aspx" protection="All" path="/" timeout="12000" requireSSL="false"/>
</authentication>

Dd577079.note(en-us,MSDN.10).gifNote
<MachineKey> and <DecryptionKey> are unique values that have not been shown for clarity.
After making this change in your Web application, if users are not already logged on through the Remote Access page, they are automatically redirected to the logon page for Windows Home Server and then directed back to the Web application page after successfully logging on.

aspnet_regiis 0x80004005 Windows 7 IIS 7

Problem
"aspnet_regiis -i" crashes when executed from command giving error code 0x80004005 on Windows 7 with IIS7
My solution
I have UAC switched on, and launched the command prompt -as administrator-. Start -> cmd -> right click "Run as Administrator". Then aspnet_regiis worked fine.
Did this work for you? please comment below for the benefit of others.

Friday 1 February 2013

Facebook Chat Authentication in C-sharp

Facebook Chat Authentication in C#

Disclaimer
By viewing this webpage you have just agreed to the following; this article is not written or endorsed by Facebook, the information contained within it may or may not be accurate, your mileage may very and that I am in no way liable for your stupidity.
X-Facebook-Platform mechanism
In order to authenticate with Facebook's chat platform, you need to use either DIGEST-MD5 (a hash of the users username/password - old skool) or if your application uses OAuth, then use Facebook's X-FACEBOOK-PLATFORM mechanism. I outline here how I implemented this authentication as part of the XDA Facebook for Windows Mobile application, which will include Facebook chat.
This article is a repeat of the X-FACEBOOK-PLATFORM in VB.NET article which I found to be very useful.
Credit goes to Joel Day pointing me in this direction and getting me started.

XMPP Conversation
Xmpp is basically a XML document conversation, where client and server 'build' their documents in parallel. From a coding point of view, I found it easier to write my own XML parser [yes, insane I know!] One of the main motivators behind this, is that an XMPP conversation deals in XML fragments.
Open a connection to chat.facebook.com
        socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(
"chat.facebook.com", 5222);
Send 'stream:stream' You initialise a conversation by opening a stream with the server. This is a "hello server" step.
<?xml version='1.0'?>
<stream:stream
id='1'
to='chat.facebook.com'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'
version='1.0' >
You should then receive a response; "hello back" followed by "list of ways to authenticate". Notice that this includes <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/> which indicates that the server supports SSL communication. There is more information which we ignore for now.
<?xml version="1.0"?>
<stream:stream
id="90854922"
from
="chat.facebook.com"
version
="1.0" xmlns="jabber:client"
xmlns:stream
="http://etherx.jabber.org/streams" xml:lang="en">

<stream:features>
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>X-FACEBOOK-PLATFORM</mechanism>
<mechanism>DIGEST-MD5</mechanism>
</mechanisms>
</stream:features>
We switch to Transport Layer Security by continuing our plain text conversation by sending StartTLS message
   <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
The expected plain text response is
   <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
In my Connection class code (which has 3 public methods 'Send' 'Receive' and now 'StartTls') I also have NetworkStream and a SslSocket members.
private NetworkStream _networkStream;
private SslStream _sslStream;

public void StartTls()
{
UseSecure
= true;

if (_networkStream == null)
_networkStream
= new NetworkStream( _socket );

if (_sslStream != null)
return;

_sslStream
= new SslStream(_networkStream, false);
_sslStream.AuthenticateAsClient(
"chat.facebook.com",
new X509CertificateCollection(), SslProtocols.Tls, false);
}
Once you have the SslStream open, use this for the reading/writing to the socket. Begin a new stream <stream:stream... as above and get new stream:features which does not include StartTls since we are using TLS.
This time we are interested the //stream:stream/stream:features/mechanisms/mechanism X-FACEBOOK-PLATFORM element.

<?xml version="1.0"?>
<stream:stream
id="90854922"
from
="chat.facebook.com"
version
="1.0" xmlns="jabber:client"
xmlns:stream
="http://etherx.jabber.org/streams" xml:lang="en">

<stream:features>
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>X-FACEBOOK-PLATFORM</mechanism>
<mechanism>DIGEST-MD5</mechanism>
</mechanisms>
</stream:features>
Select authentication mechanism by telling the server we'll use X-Facebook-Platform authorisation.
<auth 
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='X-FACEBOOK-PLATFORM' />
The service responds with...
<challenge
xmlns="urn:ietf:params:xml:ns:xmppasl">
dmVyc2lvbj0xJm1ldG....3NzlFRkJCMDVERUY2MEM=
</challenge>
This challenge ('dmVyc2...') is a Base64 Encoded string, which we can convert to a string by doing the following
string decoded = Encoding.UTF8.GetString( Convert.FromBase64String( challengeData ) );         
Which gives us: version=1&method=auth.xmpp_login&nonce=3B53CFB6EE...FB424B68 I parse this in my code by doing a Split('&') to get three name=value pairs, then Split('=') to get name / value.
We use these to create our response which includes the following fields (in & separated name=value pairs)

  • method - the Method field received in the challenge
  • api_key - your Facebook Application key
  • access_token - the Users OAuth Access Token
  • call_id - some unique value (i.e. seconds since 1970)
  • v - the Version field received in the challenge
  • nonce - the Nonce field received in the challenge
In this new version, we no longer need the to calculate a signature. We simply covert this string into a Base64 Encoded string and pass it back to the service in a response.
Convert.ToBase64String( Encoding.UTF8.GetBytes( response ) )

<response 
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
BpX2tleT1kN2Q5ZTEwODU14ZTdiYzAxY2
EwNSZjYWxsX2lkPTEzMTM0MTQwNDEm
....
bWV0aG9kPWF1dGgueG1wcF9sb2dpbiZu
25jZT1BQzQxRjE2QTBENEI0REE3ODcX2tlx

</response>
Assuming that your user has permitted xmpp_login permission during the OAuth process, you should get the response
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
Now you're ready to actually do something with the service!
NO SUPPORT COMMENTS
Feel free to comment below, but DO NOT expect answers to any questions. If you want WORKING CODE please visit the XDA Facebook project mentioned above and see my code there.

Quantum and Anti-Bugs

Anti bug
While refactoring one day, I couldn't work out why my code had broken. That's not unusual, and so I checked and re-checked the new code that I'd written. Nope, it was bug free!
This was when I discovered the Anti-Bug Pattern, which occurs when there are two bugs in a system, but which co-incidentally cancel each other out. Fixing one bug uncovers the other. Ruben Bartelink came up with the name.
Quantum / Heisenberg
This bug only occurs when you are not debugging your code. As soon as you look at your source code... the bug disappears.