Dedicated to everyone who has seen those 90’s Days:
हम नाइनटीस के बन्दे, हम नाइनटीस के बन्दे!
पूरा दिन हसते खेलते,
ओर एक ही चैनल (दूरदर्शन) से भी खुश रहे लेते,
हम नाइनटीस के बन्दे, हम नाइनटीस के बन्दे!
बडे होते होते रामायण/महाभारत कई बार देख चुके होते,
शायद इसलिए जीवन जीने के हमारे फलसफे क्लियर होते
हम नाइनटीस के बन्दे, हम नाइनटीस के बन्दे!
बन्दे थे हम इतने भोले,
मूर्ति दूध पीती है इस बात बात को भी पचा लेते,
हम नाइनटीस के बन्दे, हम नाइनटीस के बन्दे!
माना हमारे पास मनोरंजन के साधन काम होते,
पर हरेक कार्यक्रम के समय/दिन बिना रिमाइंडर याद रहते,
शायद इसीलिए शाम को हम समय पर घर पर होते,
हम नाइनटीस के बन्दे, हम नाइनटीस के बन्दे!
माना की टीवी मैं चित्र इतने साफ़ नहीं होते,
पर लोगो के दिल आईने की तरह साफ़ होते,
हम नाइनटीस के बन्दे, हम नाइनटीस के बन्दे!
घर हमारे छोटे, ओर ना उनमे ऐसी होते,
पर अलग मजा था, जब हम साथ मे छत पर जाकर सोते,
हम नाइनटीस के बन्दे, हम नाइनटीस के बन्दे!
ना मोबाइल, ना वीडियो गेम होते,
पर गलियो मैं बच्चो के खेल (लुप्पा-छुप्पी, कंचे, कबड्डी, इत्यादि) अनोखे होते,
हम नाइनटीस के बन्दे, हम नाइनटीस के बन्दे!
समय बहुत था, पैसे कम थे, पर हमेशा खुश रहते,
पर जनाब अब हाल हैं उलटा, इसिलए उस समय को याद करकर अपना मन बहलाते,
हम नाइनटीस के बन्दे, हम नाइनटीस के बन्दे!
Latest Posts
ASP.NET Website Performance Basics – Part 2
Challenge:
Recap : In last part of ASP.NET Website performance basics, Dax shared basic methodology of troubleshooting ASP.NET Website performance challenges!
Where he shared, what all things we need to do, and why we should do it (Remember W-W-H theory?). And just pointers of How to do it! And as Dax promised, that he will help us to understand how part more [We all know, how well Dax keeps his promises! :)] and here he is.
In this post [Would also name it “ASP.NET Basics”], we will look at following things (Which are very IMP. to diagnose performance issues):
- When you open any website from your browser, what all happens, behind the scenes? — Not related to ASP.NET just basics, how it reaches till your ASP.NET Application
- Now, we’ve reached to ASP.NET Application, after that we will look at — ASP.NET Application LifeCycle — All about — HttpApplication,HttpContext,HttpRuntime, HttpModules etc.
- Request Queuing
- Major Performance killers ( Hanging Requests, Session can slowdown your application — Thread Agility Issue, Exceptions and performance co-relation, MaxConnections, High GC, Contentions, App Pool Recycle, Memory leak)
Above topics sounds similar? Very Basic? (Back to Basics, Stick to basics. Because a basic always works!) But still unknown? (During our interview sessions, we ask these questions to most of our candidate, And so less can answer it)Don’t worry, we will learn it, So, as Dax and his team!
Here we go!
Solution:
When you open any website from your browser, what all happens, behind the scenes?
You might know this question or learnt it during your college days. And If you are pretty much confident you know this you can skip it. But Dax recommends that even though you know it. It would be a good idea to brush up this stuff.
Because while working on performance stuff, you need to know about everything starting from Client’s Browser, DNS, Firewall, Switch — You no need to be expert in this subject. But when you troubleshoot it, You should know all these players very well.
My favorite — one is from MCTS 70-528 exam book – Chapter1-Lesson1 – Understanding the Players
Another good articles:
http://www.codeproject.com/Articles/121096/Web-Server-and-ASP-NET-Application-Life-Cycle-in-D
http://www.codeproject.com/Articles/73728/ASP-NET-Application-and-Page-Life-Cycle
Good to remember about M-H-P-M
http://www.codeproject.com/Articles/87316/A-walkthrough-to-Application-State
Thanks a lot to author of above articles. It clarifies everything. So, now you know what all happens — from browser till server — a request goes through a journey and then gets served!
Here you must’ve seen about HttpApplication object, this guy is very critical while serving your requests. HttpApplication consists of HttpModules.
http://blog.andreloker.de/post/2008/05/HttpApplication-instances.aspx
HttpApplication Gotchas:
- ASP.NET may instantiate many instances of HttpApplication as required (. In fact, it will create an instance of the class for each request that is handled in parallel on the server.
- “ASP.NET maintains a pool of HttpApplication instances over the course of a Web application’s lifetime. ASP.NET automatically assigns one of these instances to process each incoming HTTP request that is received by the application. The particular HttpApplication instance assigned is responsible for managing the entire lifetime of the request and is reused only after the request has been completed. This means that user code within the HttpApplication does not need to be reentrant.”
- You can observe asp.net pipeline instance count in the performance counters to see how many instances of your HttpApplication class are pooled at the moment.
- In Integrated Application mode — HttpApplication will called once during application initialization and another during the first request
- When ASP.NET Creates Instance of the HttpApplication class that represents your application, instance of any odules that have been registered are created. When a Module is created, its Init method is called and the module initializes itself. — and the custom module will run for all resource handler, even though resource handler is not an ASP.NET handler
- If you see More number of requests [You can check it via IIS log or performance counter] and Heavy HttpApplication Instances is Normal, Because it means that current HttpApplication Pool was not enough and ASP.NET need to spawn worker processes.
- But if you see less number of requests, and still see heavy HttpApplication instances then it is abnormal. We need to find out slow pages/handlers etc.
- ASP.NET run-time keeps two pools of HttpApplication objects. First is a special pool with HttpApplication objects used for application level events (such as Application_Start, Application_End), Second pool contains instances used in requests to serve all other types of events
- Try this out — http://lowleveldesign.wordpress.com/2011/07/20/global-asax-in-asp-net/
- HttpApplication Events
- http://support.microsoft.com/kb/312607
- http://blogs.msdn.com/b/carloc/archive/2007/12/19/application-page-and-control-lifecycle.aspx
- http://duartes.org/gustavo/articles/Asp.net-Runtime-Cheat-Sheet-HttpRequest-HttpRuntime.aspx
Huh! Load of things, correct? Useful? Dax says these information is really useful and it will clarify your understanding more on ASP.NET internals!
Request Queuing
It is really good to know about Request Queuing, lot of us already know about Request Queuing — Simple, a Request is queuing. Yes, my dear friend you are right. But there are different level of Queuing happens. And untill and unless you know your request is queued at which level, it won’t be easy to fix it!
Great post! — http://blog.leansentry.com/2013/07/all-about-iis-asp-net-request-queues/
Basically, Request Queuing can happen at mainly 4 levels:
- HTTP.SYS: Application pool queue
- IIS worker process: completion port
- ASP.NET: CLR threadpool queue
- ASP.NET: Integrated mode global queue
- [OR]ASP.NET: Classic mode application queue
Source — http://fullsocrates.wordpress.com/2013/02/28/asp-net-threadstuning-thread-parameters-12-2/
To diagnose, your level of Queuing. Best thing is performance counters [Dax, is going to share more on performance counters in his upcoming posts] and once found you can use tools like FRT, Dump analysis etc. to find a main bottleneck [Yes, Yes — Dax will post on these topics in future for you!]
Major Performance Killers
- Application Pool Recycle/Crash — If your application pool is crashing is or recycling [How Can I check that? You can check EventLog OR if your application got log do log entry [Just a note : Application_End will not get called, when your application crashed unexpectedly a.k.a. Crash] — see — http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx] periodically than it’s not good for your application’s health. Because when application pool gets recycled everything in memory [Session/Cache/Static/Application objects] gets lost, and your application need to server everything from Database and rebuild cache. You can solve this issue by checking EventLog and Configuring+Analyzing Crash Dump.http://kiranpatils.wordpress.com/2012/06/20/is-it-necessary-to-recycle-worker-process-periodically/ and http://kiranpatils.wordpress.com/2010/05/25/goo-to-know-on-asp-net-application-restarts/
- Hanging Requests — Your users are complaining that the site is loading slowly. Requests to your application are hanging. With so many possible causes of request hangs, its difficult to know where to even start. — http://mvolo.com/troubleshoot-iis-hanging-requests/
- Exceptions, handle them gracefully — Exceptions can slowdown your application. Because when your application throws an exception — It Creates objects — CLR needs to do object allocation — And after that GC for those allocation! [Analyze your application logs to see exceptions, and handle them gracefully] — http://blogs.msdn.com/b/tess/archive/2005/11/30/498297.aspx
- %Time in GC — When this time is high, your requests will get paused for a while and your end users will see slow response time during this time. If it is >=10% then you need to dig in to this issue. Also, check for Memory Leak — http://kiranpatils.wordpress.com/2012/06/05/basics-of-memory-leak/
- Contentions — If your CPU is not being utilized and you still see low throughput, you may be suffering from high contention rate. Means your code has lock on shared resources, which is taking time to process, and due to this other requests are going in Queue. Simple concept in locking — “Acquire lock as late as possible, and release it as soon as possible” http://kiranpatils.wordpress.com/2013/01/13/thread-synchronization-basics/
- Session lock – Thread agility issue — Disable session for the pages/handlers, where you don’t need them. https://github.com/angieslist/AL-Redis http://stackoverflow.com/questions/3629709/i-just-discovered-why-all-asp-net-websites-are-slow-and-i-am-trying-to-work-out
http://stackoverflow.com/questions/8068925/redis-backed-asp-net-sessionstate-provider
Good to read resources:
- http://msdn.microsoft.com/en-us/library/ff647787.aspx
- Most recommended — https://www.leansentry.com/try#course
- http://blogs.msdn.com/b/mcsuksoldev/archive/2011/01/19/common-performance-issues-on-asp-net-web-sites.aspx
- http://www.codeproject.com/Articles/23306/10-ASP-NET-Performance-and-Scalability-Secrets
- http://blog.leansentry.com/2013/07/the-server-logs-you-need-to-know-to-fix-any-iis-aspnet-error/
- http://mvolo.com/fix-the-3-high-cpu-performance-problems-for-iis-aspnet-apps/
Sorry for such a long post. But It’s good to clarify basics. Because once it is clear, you can fix any issue!
These are the common performance killers, In upcoming posts, we will see how to diagnose them! Till than Happy Performance Tunning! 🙂
ASP.NET Website Performance Basics
Challenge:
In a small city, there lived a developer named as Dax. And his boss name was Gabe. Their main goal was to develop a faster running websites and have happy clients! (So, as you!?) And they were best in the town to deliver faster running websites!
One fine morning, they faced a challenge. And this blog post is about how they overcome that challenge.
Disclaimer — All characters in this publication are entirely fictitious and any resemblance to real persons, living or dead, is purely coincidental.
Solution:
Read it from left to right
Gabe asked Dax to fix, their ASP.NET website performance issue and while working on it, Dax made a mistake, which most of us (Including me) make, it is fixing a performance issue by blindly guessing the things along with worse part, making code change which “they think” it is causing slowness! But this “stab in the dark” method doesn’t work most of the time! [Just a note : I believe that don’t fix any issue, until and unless you’ve reproduced it or understood it thoroughly, If you do it without understanding it, you never know when it will come back to you! But surely, it will!]
Y’day night Dax, sent me an e-mail and asked to share his and his team’s performance learnings with you! [You know, Jesus requested him to share his learnings with you? How honest, Dax is!]
Whatever stuff, you work on, If you follow W (What)- W (Why)- H (How) theory you can solve anything!
What are Website Performance standards?
Have seen lot of people who work on performance issues, without having a measures [Statistics and numbers are your best friends while working on performance! Because if you can’t measure anything, you haven’t improved it yet!]. How fast is really fast? [Carpentry quote : Measure twice, cut once!]
So, here are some numbers, which Dax came across while doing research and reading on website performance standards blogs and articles:
Before, we move on, let’s have a look at, good to know terminologies:
- Response time of your server : The time taken, by server to process your request, it includes time taken by Database call, File IO Operation, Time taken by .NET CLR, Request Queuing etc.
- TTFB : Time to load first byte, this is the time when browser requests HTML of your page, and server builds your whole page’s HTML to browser, and after that browser starts rendering of your page by requesting other resources like CSS/JS/images etc.
- Page Load time : This is the total time taken by your browser to completely load a page.
So, to ensure that your site is performing as per web standards, check following values for your website (Just a note : these values are standard values, it might not fit in to your environment. so, do understand your environment before you start investigating performance issues):
- TTFB should be <= 100 Milliseconds; Because if it is high then your users will see a white browser page, and nothing will get loaded until and unless it receives first HTML data from server.
- Response Time should be <= 2 seconds
- Start Render Time should be <= 2 seconds
- Page Load time should be between 2-3 seconds
Now, you must be curious to know, how we can check these values? Going at each layer, and checking logs at each level or there is a smart way? Luckily, there is a smart way available for you! We will have a look at it in “How” section soon!
Good to read:
http://www.webperformancetoday.com/2012/02/13/non-geeky-guide-to-performance-measurement/
http://www.webperformancetoday.com/2010/06/15/everything-you-wanted-to-know-about-web-performance/
Why Website Performance matters?
http://www.strangeloopnetworks.com/resources/infographics/web-performance-and-user-expectations/poster-visualizing-web-performance/
http://www.webperformancetoday.com/2012/03/21/neuroscience-page-speed-web-performance/
Above articles nicely explained everything!
In summary, just take a case, that if you got 20 Million visitors per month, and if your website is slow by just 1 second, then 20*1= 20 M seconds gets wasted, which they can spend somewhere else — with their family, friends or If you are running e-commerce, website then they might place multiple orders because of your faster running website! 🙂
And as per research, in this impatient era, where everyone wants everything to be done instantly [5G!], If your site is running slow, then people will not complaint you about it. But they will go to your competitor.
How to Improve Website Performance?
Now, how to measure, these values, there are smart tools available, which you can use to know your website’s performance values, we will categorize it in two categories, Server-Side and Client-Side:
Performance problem can be divided mainly in two categories:
- Serve-Side : If your server is not serving requests faster, then your website is suffering from server-side/back-end performance issues. Server-Side performance issues, are really very tough to find. Because in most of the cases, you will not have a specific scenario to reproduce, You will not have Visual Studio on live server, where you can debug your code! :-). But thanks to APM tools, Performance counters, Log4Net, DebugDiag and WinDbg – these are the tools who will help you to fix your back-end issues!
- Client-Side : If your website is not using minify/merge than it falls in client-side/front-end performance issues, Because server has sent response rapidly. But client [Browser] is taking time to render a page, and it happens if you are not following performance best practices while building your website. It is also known as “Front-End” time. And as per stats. “80-90% time goes in front-end!”. So, If you’ve faster servers, But if your front-end is not following performance rules, then your site will never get loaded faster!
Server-Side performance testing tools:
- APM Tools– APM stands for Application performance management, there is lot of APM tools available in market. You need to install their lightweight agent on your server, that’s it! It will report you everything via a nice web-based dashboard! But Dax’s favorite is, and tried one is New Relic [It’s costly. But worth! — Indeed “A web & mobile Developer’s Best Friend”]: http://newrelic.com/
- Profiling – You can run profiling tool on your website, mostly in local, this tool will help you to find performance issues. It mostly helps when you’ve specific scenario to reproduce. For unknown scenarios it doesn’t help much, again Dax’s favorite is ANTS Performance Profiler from Rad Gate — http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/
- Performance Counters – “Performance counters is your computers Google” Nice quote from Performance webinar, Just add performance counters [Which one to add, how to analyze that something we will see in upcoming posts]
- DebugDiag and WinDbg — Using performance counter, If you found that there is a memory leak in your application or when Request Queuing goes high your application goes slow. And now, you would like to see what is there in heap when such thing happens — then DebugDiag and WinDbg are your friends! — http://blogs.msdn.com/b/tess/archive/2008/02/04/net-debugging-demos-information-and-setup-instructions.aspx
Have Dax missed anything? Just feel free to comment!
Client-Side performance testing tools:
- WebPageTest.Org — www.webpagetest.org
- Pingdom Tools — http://tools.pingdom.com/
- Google PageSpeed Tools — https://developers.google.com/speed/pagespeed/
- Browser based tools — YSlow, HttpWatch, Firebug
Have Dax missed anything? Just feel free to comment!
Good to read:
http://yslow.org/user-guide/
http://www.webperformancetoday.com/2010/07/09/waterfalls-101/
http://www.stevesouders.com/blog/2012/10/09/webperfdays-performance-tools/
http://blog.newrelic.com/2012/09/04/improving-site-performance-with-yslow/
Still this point of time, we’ve seen how to delve in to performance issues more and find out, where you need to focus on server-side or client-side or BOTH.
Now, let’s have a look at “How” to solve them
- Client-side/Front-End site performance issues are relatively easy to find and fix! Just use any tool, follow the given rules, re-test and you are done!
- Server-side/back-end performance issues are relatively complex to find out, and once you found it fixing them might be easy! But finding back-end issue involves following level of understanding:
- Basics of ASP.NET — You must be saying this guy is crazy, come on, we are ASP.NET Professional and we’ve lot of years of experience, how ASP.NET works, we’ve developed and deployed lot of websites, And you are asking us to learn ASP.NET Basics? I agree with your thoughts, and I know you guys are experts in this field. But ASP.NET is a big topic, and when we develop something we work on more abstract layer, just drag and drop control. add some code behind stuff and we are done! But to work on performance stuff, you need to know lot of ASP.Net Internals, Like How ASP.NET spawns worker threads? What is HttpApplication? What is HttpModule? What is co-relation between them? When HttpApplication instance gets created? How many requests your ASP.NET application can handle? What is Request Queuing? What is Request Queued? What is Contention? You know Thread agility issue? Lot of questions correct, bouncer? Don’t worry Dax also had same questions. But after investing sometime he learnt it, and he will share those learnings with you in upcoming posts!
- Basics of Performance counters – Counters are your best friends! Just do learn some basics of performance counter, introduce yourself to them and vice-versa! These guys will tell you lot of secrets! (So, as your best friend!)
- Basics of IIS Tools : IIS got plenty of nice tools, like FRT [Failed Request Tracing] which will help you to see what is going on?
- Basics of Performance Testing Tools : Before fixing anything on live server, do measure it locally, and you will need performance testing tools like JMeter,WCAT,ACT,AB.exe etc. Keep them handy!
- Basics of APM : As discussed earlier, good to have APM tool in your armory!
- Basic of Dump analysis : When no one helps you, and disappoints you. Dump is a light of hope, and it won’t disappoint you for sure!
Will expand these topics in upcoming posts! So, just keep visiting, Keep reading, And if you’ve good explanation of any topic listed here, do share with us! So, as Dax! 🙂
Good to read links:
http://www.webperformancetoday.com/2013/01/31/web-performance-101-developers/
http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/entrypage/avoid-find-fix-asp-problems
http://www.softdevtube.com/2013/01/15/ten-web-performance-tuning-tricks-in-60-minutes/
http://stackoverflow.com/questions/4310719/asp-net-processmodel-configuration
http://www.guidanceshare.com/wiki/ASP.NET_2.0_Performance_Guidelines_-_Threading
http://www.aspnet101.com/2010/03/50-tips-to-boost-asp-net-performance-part-i/
Now, Dax and Gabe are really happy and they are enjoying their time! I’m sure they will keep sharing such things with us!
Have a happy faster running websites! 🙂
JQuery, JSON with ASP.NET notes
Challenge:
Before couple of weeks back, was trying to implement Facebook like live updates in ASP.NET and JSON and while doing that, faced couple of challenges. Which I thought you may find interesting!
Would like to share challenges/tasks with you. So, you can also get benefited by it when you face them!
Solution:
- Convert Generic List to JSON : Had a generic list, which comes from DB, and needs to pass it on to UI layer, in a JSON format, used System.Web.Script.Serialization.JavaScriptSerializer class for this [using System.Web.Script.Serialization]:
[sourcecode language=”csharp”]
// ……….
List<UserUpdate> userUpdates = new List();
while (sqlDataReader.Read())
{
UserUpdate userUpdate = new UserUpdate();
userUpdate.UserID = Convert.ToInt32(sqlDataReader["ID"]);
userUpdate.UpdateMessage = Convert.ToString(sqlDataReader["UpdateMessage"]);
userUpdates.Add(userUpdate);
}
JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();
string JSONString = javascriptSerializer.Serialize(userUpdates);
return JSONString;
[/sourcecode]
Just a note : If you are doing Response.Write then please do change your page’s content-type to JSON — Response.ContentType = “application/json; charset=utf-8”;
- After every 2 second update right side data using AJAX and JSON : There will be a sidebar sitting in right side of a page and after every X seconds, it should get updated with latest updates from application:
To do this, added one UL tag on page, which will hold all data:
<ul id=”user-updates”>
</ul>
Added JavaScript on page, which checks for update every 2 second and prep ends to UL tag:
[sourcecode language=”javascript”]
<script type="text/javascript">
var url = "UserUpdates.aspx"; //This page returns JSON
var userID;
$(document).ready(function() {
// Initially all data
$.getJSON(url, function(result) {
$.each(result, function(i, field) {
userID = field.UserID;
$("
<ul>
<li><i class=’icon-text-width’>" + field.UpdateMessage + "</li>
</ul>
")
.hide().prependTo(‘#user-updates’).slideDown("slow");
});
});
setInterval(function() {
$.getJSON(url, { UID: userID }, function(result) {
$.each(result, function(i, field) {
userID = field.UserID;
$("<li><i class=’icon-text-width’></i><span>" + field.UpdateMessage + "</span> </li>")
.hide().prependTo(‘#user-updates’).slideDown("slow");
});
});
}, 2000);
});
[/sourcecode]
- JQUERY Prepending an LI to an UL with Animation — When any new LI gets added to UL, it should come as an Animation – and invested, lot of time to achieve this requirement and finally, following link worked! [Thanks!]
http://stackoverflow.com/questions/2883154/jquery-prepending-an-li-to-an-ul-with-animation
- Rather than showing DateTime wanted to say “Two days ago/2 seconds ago” etc. message : – Following threads helped to do so! [Thanks!]
C# solution : http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time
JavaScript based solution : http://www.aspdotnet-suresh.com/2012/02/jquery-display-time-in-facebook-twitter.html
Simple, yet powerful? Learnt a lot!
I would suggest all of you, to take a simple project for fun and try to implement it, Trust me, It will be full of fun! And you will learn a lot, and most IMP. these learnings will not go away from you for a long time. Because you learnt it with fun! Have you forgotten how to play Cricket? How to Ride a bicycle etc.? Because you learnt it funny way not in a pressurized way! 🙂
Also, If possible do blog your learnings!
Happy Coding! 🙂
CodeMirror basics
Challenge:
In our web application, we do provide HTML/CSS/JS editing functionality. We wanted to provide Syntax Highlighting feature for that, and after doing bit of our research we finalized to use:
Code Mirror — http://codemirror.net/ It’s just awesome!
We implemented and incorporated it with our application, and it was working fine, with FF, Chrome. But but here comes IE — (I know we all face lot of challenges with IE), it was causing following issues:
- Scroll bar flickering
- When we type anything it moves it’s position
What, you are also facing the same problem? Our solution might work with you as well
Solution:
After Investing a lot of time, we found that our page’s DOCTYPE was enforcing our page to run in Quirks mode, and CodeMirror and Quirks mode — are enemies! 🙂
See following excerpt from [Supported browsers section] : http://codemirror.net/
The following desktop browsers are able to run CodeMirror:
- Firefox 3 or higher
- Chrome, any version
- Safari 5.2 or higher
- Opera 9 or higher (with some key-handling problems on OS X)
- Internet Explorer 8 or higher
- Internet Explorer 7 (standards mode) is usable, but buggy. It has a z-index bug that prevents CodeMirror from working properly.
Note that CodeMirror is only supported in standards mode. So not quirks mode, but also not the quasi-standards mode that IE gives you when you specify a transitional doctype. Simply using the HTML5-style
<!--doctype html>
is recommended.
Now, the solution is simple, just change DOCTYPE to standards mode and you are done! But “life is not as easy as it seems to be” 🙂
Because if your application’s UI has been designed as per quirks mode than you can’t change it directly, Because it might make your CodeMirror working. But can break N number of things!
Don’t worry, we got a solution for you!
In our case our CodeMirror editor was in an I-Frame and using this trick, we resolved it! — http://stackoverflow.com/questions/5391495/can-i-have-doctype-in-iframe-different-from-hosting-page
Basically, change the DOCTYPE of your I-Framed page, and you are done!
Happy Coding! 🙂
Leading is like parenting!
Thanks a lot for appreciating my first article on non-technical subject! (You haven’t had a read at it? Come on, lot of people liked it, and I hope you too! — Leadership basics!)
Your motivation has inspired me to write another blog post on same topic, leadership!
Leading is like parenting!, yes you heard right! Leading is like parenting! — This is what I’ve observed and analyzed, good leaders are like good parents! Not convinced correct? I know you are an engineer, to who E=MC2 also needs to be proved! 🙂 Let me try to prove it!
Below are few of the characteristics of good leader and good parent: (Just a note : Let me repeat, it stands true with good parent/leader. If you apply negation and read it again everything will be true in other way!)
Characteristic |
Leader |
Parent |
Takes care | They always take care of their team members, day in and day out they keep thinking about team! | Do you agree that parents do the same? Parent always think of their Kids and they take best care of them, and if they need to suffer a bit for doing so, they will do it? So, as great leaders! |
Future | They always think about their team’s future! | What’s good for their Kid! |
Appreciates | They appreciate in public | If they have identified any quality of their kids, they will appreciate it In public and lets everyone know! |
Criticizes | If something is not right, let team member know, right now. Before it gets tough to manage! | Can easily let you know, what wrong you are doing! |
Laugh with you and shout on you! | They laugh with you, But if he/she feels you are spoiled down, just give a shout in private! And you will never feel bad on their shout. Because you know they are saying for your goodness only! | They always do this for our great future! |
Holds your finger | During your initial days, will hold your fingers and help you to understand everything! | Do you remember who taught you how to walk? As far as I know, still this point of time there is no any APP in Android/App market for doing this! 🙂 |
Steps back | When you are ready to fly, you won’t come to know that he has taken a step back and watching you from a distance, that how you are performing! | Riding a bicycle, he/she will be with you still some point of time, and still the time you realize he/she is not there, you might have learnt how to ride a bicycle! |
Protective | With them you feel safe, they protect you from outsiders! | You always feel secure with them! |
Let you fail | Good leaders, always protect their team. But at times, they let you get failed! Do you know why? Because If you haven’t learnt how to deal with failure, other things are in vain. Also, failure is a lousy teacher! If success teaches you 1 lesson, failure will teach you 100! – I firmly believe that “Failure is the key to success” | They know, that If you can’t manage handle of a bicycle you will fall down. So, what? This is beginning and then only you will learn to wake up and say again! I will do it this time! |
When you are down, they will make you up! | Okay you failed, you are down! Feeling bad? Just turnaround, good leader will be standing next to you to motivate you and help you how to get out of it! | Whatever worst happens with you, they are always by your side! Because they know you are right! – And trust me with their support you can overcome any situation! |
Clear expectations | They Communicate expectations to you and vice-versa! | If you get distinction, will get you this? |
Trust you | Whatever happens they trust you! | Always have a full trust on you! |
Let you enjoy! | Let you enjoy, with task and sometime without task as well! | Let you enjoy your life without any interruptions! |
Motivates to learn | Always motivates you to learn, something new. Even though sometime you think I’ve learnt a lot. But he/she got some plans for your future! And you like it or not, will ask you to learn, learn and learn! And you see benefit of it in a longer run! | Do you remember, your parents always telling you study, study, study? And you wanted to go for Cricket, TV and Games. But they made sure that you do your studies! And see today you are Engineer! 🙂 |
Convinced?
Happy Leading! 🙂
Leadership Basics
My dear readers, thanks for your support since ~5 years for appreciating my each and every blog by your invaluable reads, comments and suggestions — It always kept me motivated! (Just a note : It’s easy to start a blog. But it’s too tough to keep it updated! Most of you must be knowing this! and I would like to thank you for your support and motivation which kept me engaged on this blog! — Cordially, thank you!)
Since starting of my blog, I was sharing Technical stuff with you, and I’m sure you must have enjoyed it! Now, going to write this first blog post, which is not on technical stuff. But on leadership stuff i.e. Management stuff.
A question may come up in your mind, Now, this guy is moving to management and will not post anything related to code. Let me correct you, it will never ever happen for sure. Because coding is my passion and can’t live without it! But thought to share leadership learning with you for following reasons:
- As per my experience and observation, have worked with few nice leaders (and at the same time few bad as well!) and would like to thank both of them. Because knowing what not to do takes more time than knowing what to do! 🙂 and the other ones helped me to do so very quickly! In this blog post, will try to summarize the characteristics of a good leader [what I’ve seen], it’s solely based on my observations and reading whatever I had during my working experience as a leader since 2 years!
- Lot of you don’t know that, there is a leader within you! (This blog will help you to identify a leader within you!) Just check how many characteristics matches with you! (Don’t worry same happened with me as well, Because before two years, when I came to know that I’ve to lead a team — I was not ready for it! 🙂 )
- Or if you would like to be a good leader or already a leader and would like to improve your leadership skills then also this post will help you!
- If you are in a senior management and would like to identify a leader for your organization, this post may give you reference pointers!
Just a note : Let me repeat, I’m not a leadership guru. Whatever characteristics I’m going to share is just based on my analysis, observations,reading and working experience!
Let’s start! (Just a note : will write pointers or one liners only. In future, will expand few points from following list If you think you need detailed explanation on any pointer, feel free to drop it in a comment)
- Honest — still honesty is the best policy!
- Give his/her best in turbulent times — Whenever any crisis happens, they are the first one to solve them! They flourish in tough time! And spot them they are the great leaders!
- Transparent — No encapsulation please!
- Learn from mistakes — Someone did something wrong, don’t worry he/she is a human being. Just analyze the mistake and make sure you don’t repeat it and move on!
- Back your guys — Always back your guys, mostly in tough time!
- Cover them — Mainly from outsiders!
- Be open to them!
- Give honest feedback — Appreciate is public variable, and criticize is private! And do it on time! — If someone did a mistake/did something good don’t wait for his/her appraisal appreciate right now!
- Promise — Always fulfill your promise! Or take a note of it!
- Never bad mouth your team
- Take care of them — And they will take care of yours! Even their small needs e.g. Mouse, Keyboard desk etc. It matters a lot!
- Communicate — Whatever small things, each one of your team member should know everything. [Obviously, not the confidential one!]
- Inspire/Motivate them — “If your actions inspire others to dream more, learn more, do more and become more, you are a leader.” especially when they feel down!
- Expectations – Communicate your expectations to them and vice-versa!
- Always challenge them and sometime it’s good to keep them on their toes!
- Know them personally — Because people perform better when they get to work what they love to work!
- Speak with them — Every time you should not discuss about work, sometime just have a casual chat with them!
- Have a one to one meeting — Monthly?
- Share knowledge with them — Don’t feel insecure!
- Always give credit to them — and never accept any credit!
- Do their HR process rightly on time!
- Laugh with them
- Never order them — Rather than saying “You have to do it?” you should say “Can you please do it for me?”
- Be thankful to them – Because they make your life simple!
- If they are stuck somewhere — help them out!
- Roll your sleeves up — If needed, don’t be afraid to roll your sleeves up and start coding! This is the most IMP. characteristics!
- Fight for them — Fight for their rights!
- Always be cool and calm before them! — Never let them know that you are angry!
- Always be accessible to them — It’s frustrating for your team mates, if your are not accessible to them whenever they need you!
- Quick thinker — Think quick! and mainly act upon it!
- Act promptly — No one likes a leader, who just takes an issue and works on it for ages, we are living in 4G world! 🙂 Take a decision and act on it!
- People feels safe while working with you!
- People love to talk to you!
- Always positive!
- Take decision and back them no matter whatever happens!
- Always smiling face! 🙂
- Focused on solution — and not the problem or the problem source
- Never blames anyone!
- Expert in the field — I remember a nice line from Bill Gates — If you don’t know how to write a good code, then you can’t be a good leader. And trust me this characteristic will only gain you respect!
- Passionate
- Problem solver!
- Organized! Disciplined! [Still we are agile!]
- Best listening skills! — Always listen you!
- Caring!
- Always ready to discuss
- ______________________________
You can add your leanings here!
Helpful? As said earlier this my first management blog post, please ignore my mistakes and share your views about it! Will surely work on it!
And If you would like me to expand any characteristic from above list, just drop it in a comment. Will elaborate it for you!
Happy leading! 🙂
XML XSLT Namespace gotcha
Challenge:
Before couple of weeks back we spent a good amount of time making XML and XSLT work, you must be thinking so easy then why this guy invested lot of time. Wait o minute coming to you.
Solution:
Basically, we had XML and we were trying to fetch few nodes via XSLT from it. But it was not working as expected. We verified everything our XPATH was correct and everything was correct then following link, pointed us towards a solution:
http://stackoverflow.com/questions/1730875/xslt-transform-xml-with-namespaces
Our XML was having xmlns deceleration, and we were not using xmlns in our XSLT document. And that was the reason why XSLT was not able to XPATH nodes. Once, we added XMLNS to our XSLT document and changed our XPATH as per XMLNS then everything started working as expected!
Firebug with Internet Explorer
Challenge:
If you are a big fan of Firebug (So, as I!) which is available as an add-on with Firefox and when you have to work on particular challenge where you need to check it in IE only where Developer Toolbar is available. But unfortunately I never enjoyed working with it! (So, as you?)
So, was wondering is it possible to use Firebug with IE, and as it has been said, When there is a will, there is a way. And here’s the way to do it!
Solution:
The answer is – Firebug Lite — It is a lightweight version of Firefox to help you debug issues rapidly!
How to use it?
- Go to — https://getfirebug.com/firebuglite
- You will find Stable/Debug/Beta/Developer channel link — Will use Stable one!
- Open a page, which you would like to troubleshoot or if you are using master page concept in ASP.NET then have it in master page.
- Now, you can download firebug lite files and have it in your website directory and give relative path or to make things simple and faster you can give direct link to firebug lite
- Open your page and Include the given code at the top of the
<head>
of your page - Run your page, and you are done!
Just a note: Sometime, I think that if Firebug would have not been around, then how tough web developer’s life would have been!
Happy Troubleshooting! 🙂
Nunit results to HTML
Challenge:
Are you searching for a solution to covert your Nunit results in to HTML format? Then this post is for you! Because couple of weeks back, we were also doing same as you, and after bit of research we found a way to do it! To make your life easy, sharing it here:
Solution:
1. Run your test using Nunit [For batch file we can use nunit-console].
2. It will create XML result “TestResult.xml”
3. Now using Nunit2Report Console application we can convert XML in to HTML.
e.g. “”c:\test\NUnit2Report.Console.Release.Mixed Platforms.v1.0.0.0\NUnit2Report.Console.exe” –fileset=”C:\test\TestResult.xml””
https://github.com/jupaol/NUnit2Report.Console/
NUnit2Report Console is a tool to transform the NUnit xml results file to an Html user-friendly report using XSL files, the tool was originally designed to be integrated with NAnt as a NAnt task and it was created by Gilles Bayon. This version converts the original NUnittoReportTask to a console version to be able to use it freely without the use of NAnt
Good to read:
http://weblogs.asp.net/thangchung/archive/2010/12/17/generating-report-for-nunit.aspx
http://sourceforge.net/projects/nunit2report/
Happy conversion! 🙂