Tag Archives: c#
Another way to print hex value in C++
You can simply use the std::hex base format flag! This also works with oct and dec. #include <iostream> int main() { std::cout << "Value of 10 in hex: " << std::hex << 10 << std::endl; std::cout << "Value of 10 in dec: " << std::dec << 10 << std::endl; std::cout << "Value of 10 in […]
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 […]
Login