Category Archives: C#
Restrict date range within DatePicker component
So I had to restrict days in the WPF DatePicker component. Only the days falling within a specific range should be available for selection and all others (past & future values) should be disabled. The solution is to use the DisplayDateStart & DisplayDateEnd properties on the DatePicker <DatePicker Name="dtPicker" DisplayDateStart="5/10/2012" DisplayDateEnd="5/20/2012" />
Achieving optimal performance in code
Is there any difference between the following two expressions\statements? def func1(a): return a == ‘TRUE’ def func2(a): return True if a == ‘TRUE’ else False Well, both of them do the same thing but interestingly, the former one is faster in terms of performance by atleast one CPU cycle! Let’s tear into assembly language of […]
Logging in Java, C# and Python
In Java & C#, the most commonly used logging utilities are log4j and log4net. Python has it’s own inbuilt logging module which includes the exact same features as other log4X brethren! Setting up logging module in python >> import logging def initLogger(appName=’Application’, handlerType=’StreamHandler’, \ loggerLevel=’INFO’, handlerLevel=’DEBUG’): ”’ * There are many handler types available such […]
Iterating over a custom ‘Jagged Array’ in Python
A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an "array of arrays." C# natively differentiates between a jagged and a multidimensional array. To iterate over a every single element of a Jagged Array in […]
Login