ILT - Simple technique to toggle between true and false or one and zero
20/06/2013 If you want to toggle a value from 1 to 0 or 0 to 1 depending on the current value then you are at the right place. (i.e. change the value to 0 only if it's 1 now and change it to 1 only if it is 0 at the moment) You can use this to togg...

The Blood Brain Barrier
2009-01-08 I wouldn't be wrong if I say the Brain is the most vital organ in the human body. As we all know brain handles most of critical operations inside our body such as keeping and managing memories, organizing our activities, keep other org...

See the good and go for the best
See the good and go for the best   -  Cassian Menol Razeek

Quotes


A Simple JavaScript To Get English Language Definition From A Dictionary
2009-05-19 English is not my first language so I use online dictionaries frequently as a part of my daily routine to clarify and learn unfamiliar words as I read through articles in the Internet. I have been using www.ditionary.com for a long time an...

How to use LIKE operator in Dataview.RowFilter for Date Time or Numaric Fields using CONVERT
2012-01-16 // // The RowFilter property of the DataView allows to use flexible string similar to SQL or LINQ to easily filter rows wihtout having to iterate through them. I had to implement a fully flexible search module for a project I'm working...

JavaScript Null Coalesce
2016-06-07 Use || similar to ?? in C# example (mvc)

ILT - AWordADay - Taboo
Taboo: Something that is forbidden socially but not necessarily illegal. e.g. Smoking marijuana is a taboo even in counties where it is not yet considered illegal. Reference : http://dictionary.reference.com/browse/taboo Menol ILT

quote
The power of a minute can only be realised when you are left with just one. - Cassian Menol Razeek .

ILT - AWordADay - Boycott
Boycott : Voluntarily avoiding using, buying or even dealing with a person, service, product, company or a country to express a disagreement or protest. Origination: A person called Charles Cunningham Boycott was protested by a community in Ireland ...

Change the Firefox Address Bar Search Engine
17-07-2012 1. Type about:config in your address bar 2. Search and locate the key called "keyword.url" 3. Double click on the key and update the search URL to match the search engine you desire. Following are the URLs for common search engines: Goo...

How to auto save the data table in memory into database?
2010-04-01 We frequently get to fetch data from the database, update them and then write them back to the database. Most of the time we only have to write them back as individual records. How about updating a whole database table in the memory ...

Postponing (Procrastination) - Makes your goals blot away and ruins your personal life
2008-11-30 I have been postponing things since I don’t know when... I consider this as a major mistake that we all make and the most unfortunate thing is that we don’t feel we are going down because procrastination takes us down slowly. In other ...

Comparing Objects in .Net - Reference Equality
30-05-2012 Comparing two objects returns true if they point to the same entry of the heap. Public Class Person { Private String Name; Private int Age; Public Person(String Name) { this.Name = Name; ...

quote
A headache is always a simple hitch which has nothing much to care about as long as it’s in another person’s head. - Cassian Menol Razeek

Posted in General | Comments Off on

C# extension method to check if a string matches any string in given list

2016-06-16

/// <summary>
/// Note: this uses ordinal comparison
/// </summary>
/// <param name="?"></param>
/// <param name="Options"></param>
/// <param name="ignoreCase"></param>
/// <returns></returns>
public static bool IsOneOf(this string source, IEnumerable<string> Options, bool ignoreCase = false)
{
   return Options.Contains(source, ignoreCase ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal);
}

 
Posted in C#.Net | Tagged , , , , , | Leave a comment

Trigger window.resize event via javascript

2016-06-15

Use below code to trigger window.resize event.

This can be helpful to refresh some libraries like Chartist.js when a panel  or a div the control is contained in is expanded.


window.dispatchEvent(new Event('resize'));

P.S.

The above method isn’t supported by Internet explorer (failed on IE 11), therefore use below method for wider browser support.


    var fireRefreshEventOnWindow = function () {
        var evt = document.createEvent("HTMLEvents");
        evt.initEvent('resize', true, false);
        window.dispatchEvent(evt);
    };

   // call the fireRefreshEventOnWindow(); function to fire refresh event.
   // ...
Posted in Javascript | Tagged , , , | Leave a comment

Preserving milliseconds when passing dates around front end

2016-06-08

Instead of passing the datetime pass the datetime.Ticks which is a (long) numeric value so the complete datetime value will be preserved.

Then convert ticks back to datetime in the server (controller \ action method).


public ActionResult GetChartLightBox(int EmpId, long RangeStartTicks, long RangeEndTicks)
{
   var RangeStart = new DateTime(RangeStartTicks);
   var RangeEnd = new DateTime(RangeEndTicks);

   // ...

}

Posted in ASP.Net, ASP.NET MVC, C#.Net, Web Development | Tagged , , , | Leave a comment

JavaScript Null Coalesce

2016-06-07

Use || similar to ?? in C#

example (mvc)


var previousRangeSelection = @(Html.Raw(JsonConvert.SerializeObject(TempData["rangeType"]))) || "default"; 

Posted in Javascript | Tagged , | Leave a comment

Congfigure IIS to use later .net frameworks

2016/03/07

When IIS is first installed you will most probably get several errors when trying to launch your asp.net website.

This is more prevalent when your application needs a .net framework that is higher than the .net framework version supported by the IIS out of the box.

To fix these errors you need to follow the steps below:

1 – download and install the required .net framework version
2 – add asp.net features to IIS by:

i – open “turn windows features on/off” window from the control panel
ii – expand the IIS node
iii – expand the “world wide web” node
iv – expand “application development features” node
v – check the check box for “ASP.NET”

3 – register your newly installed .net framework to work with ISS:

i – when this was written, the tool that can do this is aspnet_regiis.exe. this file is shipped with the .net framework and located in the version folder.
ii – simply run this tool with the -i parameter to configure IIS to use this version of .net framework.
e.g. c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
you may want to use the Framework64 directory instead depending on the configuration of your computer and IIS. However, I just configured a 64 bit computer for IIS 7 with the normal version and it worked. Perhaps IIS 7 is working as an x86 application; let me know if not.

Note: you will also need to point your asp.net application pool to use the correct .net framework version by:
1 – click “application pools” in IIS manager
2 – select the relevant application pool and click on “basic settings” link on the action pane
3 – select the appropriate .net framework from the .net framework version drop-down.

P.S. some errors you may get are listed below (do comment if you come across other errors that get fixed this way):

  • Handler “ExtensionlessUrlHandler-Integrated-4.0” has a bad module “ManagedPipelineHandler” in its module list
  • The requested page cannot be accessed because the related configuration data for the page is invalid error
Posted in Software Deployment | Tagged , , , , , | Leave a comment

Robert E. Rubin quote

“Some people are more certain of everything than I am of anything.”
― Robert E. Rubin

Posted in General, Quotes | Leave a comment

Ego is evil

Ego is evil. – Cassian Menol Razeek

Posted in Quotes | Leave a comment

Books I have read since the beginning of 2016

These are the books I have read (or listened to their audio counterparts) since the beginning of 2016.

I am not going to write my opinion about each of these books, instead I hope you too trust the majority of the people from around the world who have recommended these great books, like I did before choosing each of these books.

Book cover image. 2016/01/05 ~ 2016/01/13

Oversubscribed: How to Get People Lining Up to Do Business with You Paperback
by Daniel Priestley

Book front cover image 2016/01/14 ~ 2016/01/21
Dreams from My Father: A Story of Race and Inheritance
by U.S. President Barack Obama
Book cover page. 2016/01/26 ~ 2016/02/05
Stop Talking Start Doing
by Shaa Wasmund, and Richard Newton
Book cover - Tribes by Seth Godin 2016/02/05 ~ 2016/02/10
Tribes
by Seth Godin
Book cover - Quiet: The Power of Introverts in a World That Can't Stop Talking by Susan Cain 2016/01/26 ~ 2016/02/05
Quiet: The Power of Introverts in a World That Can’t Stop Talking
by Susan Cain
Book cover - Ghost in the Wires: My Adventures as the World's Most Wanted Hacker by Kevin D. Mitnick 2016/02/23 ~ 2016/02/29
Ghost in the Wires: My Adventures as the World’s Most Wanted Hacker
by Kevin D. Mitnick
Book cover - The Art of Deception: Controlling the Human Element of Security by Kevin D. Mitnick 2016/03/02 ~ 2016/03/10
The Art of Deception: Controlling the Human Element of Security
by Kevin D. Mitnick
Book cover - The 21 Success Secrets of Self-Made Millionaires by Brian Tracy 2016/03/10 ~ 2016/03/14
The 21 Success Secrets of Self-Made Millionaires
by Brian Tracy
Book cover - Nudge: Improving Decisions About Health, Wealth, and Happiness by Richard H. Thaler, and Cass R. Sunstein 2016/03/14 ~ 2016/03/20
Nudge: Improving Decisions About Health, Wealth, and Happiness
by Richard H. Thaler, and Cass R. Sunstein
Charlie Munger: The Complete Investor by Tren Griffin 2016/05/01 ~ 2016/05/20
Charlie Munger: The Complete Investor
by Tren Griffin

Currently Reading…

Book cover - The Millionaire Next Door 2016/06/16 ~
The Millionaire Next Door
by Thomas J. Stanley
Posted in Advices, General | Leave a comment

ILT: [Solved] Nexus 5 Randomly Restarting After Upgrading to Marshmallow

One night I allowed my Nexus 5 to upgrade to the latest Android version (Marshmallow) but from next morning my phone was behaving very strangely.

It kept restarting randomly and became almost useless and completely unreliable.

 

The Problem

The problem seemed to be related to battery calibration information. Upgrading to Marshmallow somehow corrupted or changed this information making the phone unaware of its accurate battery state.

 

The Solution

Following these steps cured my phone.

  1. Use your phone until it drains the battery and shuts down.
  2. Keep starting the phone to make sure you drain all of the remaining battery charge. You don’t need to worry about the amount of charge that the phone tries to preserve. Just do your best as a regular user to drain the battery. Don’t try advanced stuff.
  3. When the phone is off connect your charger (A/C adapter is recommended over USB) and let the phone charge to full amount without starting the phone.
    You can check this by checking the charging indicator that is shown when you briefly press the power button. DO NOT start the phone.
  4. When the battery indicator shows a full battery, start the phone.
  5. When started check the battery status on the top of the screen. If it is NOT very close to 100% (97% ~  99% should be fine) then turn off the phone and connect to the charger (step 3).
  6. Keep repeating steps 3~5 until you are happy the phone is charged to its maximum capacity. This may be less than 100% depending the quality of the battery.
  7. Then unplug the charger and keep using the phone until it’s fully drained. Do not charge the phone before the battery is fully drained.

Continue above steps several times over a few days and this will solve the problem. It worked like charm for my phone.

 

Posted in General | Leave a comment

How Software Engineers Became Software Developers

2015-09-29

This article looks at how and why modern software projects easily become messy and extremely convoluted. This article should not be understood as against new concepts but as a promoter of software engineering education, skills, and experience that allows engineers to make rational decisions to choose when a concept should be practiced.

The History

Software development (programming) was always a sub category of software engineering. However, over the last decade, software development was pretty much forcefully divorced from software engineering.

Why?

It is human nature to make things easy for everyone. In addition to this a lot of money was invested into software related projects making everyone wanting to become a software developer.

But everyone didn’t want to go through the hard work of serious education and then starting from the bottom of the ladder to gain experience. it was not fun.

So software development technologies became very simple and the need to have proper education in IT was taken down as a compulsory qualification to become involved in serious software engineering projects.

This created a massive boom in numbers of software engineers which also resulted in a large boom in supporting services for this large crowd.

While many companies stepped forward to provide educational and other services for this crowd, more experienced already established Software Engineers became technical writers. The concept of blog and blogging was boosted by potential advertising revenue.

Soon there was a great competition among these service companies and bloggers who basically had to bring in new and unique articles (resources) to keep their businesses, websites, and blogs popular.

The Crown went to Cool from Practical

For many years software engineering (like any other engineering discipline) was practiced with main focus on providing practical and reliable solutions.

This obviously required a lot of background knowledge and experience and there was not a lot of money to be made for the booming “developer support” industry.

So the supporting industry started creating new libraries and tools to make developers life easy. The most talked about topic in the industry became “the next helpful library or tool” that would reduce developer workload.

Mushrooming Concepts

* mushrooms just pop up randomly Reliability, stability, and logic are not concerns for mushrooms. They just pop up overnight.

The critical issue was that in addition to specific tools and libraries, some experienced bloggers and companies started creating their own flavors of established concepts.

As of now, you can see many new concepts arriving at the Internet every night.

Basically, everything that an experienced developer do to implement a known concept would be written on their blogs as if it’s a new concept and will be called cooler than the original concept it inherits.

The next morning all blindly following developers will read about this new thing and do their best to implement it on their projects because it is the cool thing to do.

Mushroom Filter

While the more experienced and educated engineers had the skill set to understand and decide when to use these new branched “cool” concepts, the large potion of “software developers” do not have that critical knowledge or relevant experience to make such decisions.

Every Pie is a Mushroom Pie

So the unfortunate result we see is that eventually this coolness took over. All semi-skilled developers blindly follow whatever they read on the Internet.

Then they put pressure on the management to bring all of these cool stuff into the projects they are working on.

This is why most of the projects you see today look nothing better than the inside of a badly made mushroom pie.

Posted in Practical Software Engineering, Software Architecture, Software Engineering Concepts | Leave a comment