Posts

Showing posts from 2011

Nikon D40 Intervalometer

Image
Is it possible to create time lapse pictures with Nikon D40... yes... You can find results here: result1 result2 You are a software engineer... you can do anything... it is just a matter of time ;)

C# Custom Performance Counters - First Performance Counter

Image
Table of content: I. C# Custom Performance Counters - Introduction II. C# Custom Performance Counters - First Performance Counter 1. Creating a custom Performance Counters and Performance counters category. You can create your own Performance category and Performance counters. To achieve this goal you can use Visual Studio tools, or .NET System.Diagnostics objects. In this post I’ll describe counters and category creation in a code using using System.Diagnostics; First of all you need to make a counters collection: CounterCreationDataCollection collection = new CounterCreationDataCollection(); Then you need to create performance counter CounterCreationData counter = new CounterCreationData(); counter.CounterName = "CountsPerSecond"; counter.CounterHelp = "CountsPerSecond"; counter.CounterType = PerformanceCounterType.RateOfCountsPerSecond32); collection.Add(counter); And place it into the category. As the category type you can use SingleInstance and M...

C# Custom Performance Counters - Introduction

Image
Table of content: I. C# Custom Performance Counters - Introduction II. C# Custom Performance Counters - First Performance Counter 1. Introduction There is a moment in software engineer life when it is time to check application performance. At this certain point you will ask yourself “How can I do it?”. Answer is not simple because you can do it in a very different way. You can of course find any 3 rd party application which will measure some things for you. You can make some kind of log file and insert some performance data to it, or you can use .NET System.Diagnostics namespace. In this article I’ll focus on System.Diagnostics. I’m not saying it is the best approach, I’ll just describe some elements of it and you can decide if it suits your needs or not. 2. Where I can find Performance counters in Windows. In Windows you can find some predefined performance counters. Just open Control Panel -> Administrative Tools -> Performance There you can find some predefined count...

AVRStudio and Ubuntu [ENG]

Image
Hello there!!! Here you can find a simple tutorial which shows how to install AVRStudio 4.18 on Ubuntu 10.04 and use a ZL16PRG programmer to connect to a laboratory device. 1. We need to download AVRStudio from website http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725 2. Let's install AVRStudio using Wine. 3. After connecting ZL16PRG to USB port we should be able to see it in a system. lsusb we should find our device Bus 003 Device 020: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC 4. Next step is to connect our USB device to Wine COM1 port. In my case I was able to find my USB device in: /dev/serial/by-id/usb-FTDI_USB__-__Serial-if00-port0 Now it's time to male a link between USB device and COM1 on Wine. ln -s /dev/serial/by-id/usb-FTDI_USB__-__Serial-if00-port0 ~/.wine/dosdevices/com1 5. Right now we can test if everything works fine: Have a nice programming :) Used links: https://help.ubuntu.com/c...

AVRStudio na Ubuntu [PL]

Image
Witam serdecznie. Oto prosty tutorial jak zainstalować AVRStudio 4.18 pod Ubuntu 10.04 i podłączyć układ za pomocą programatora ZL16PRG. 1. Ściągamy AVRStudio ze strony producenta: http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725 2. Instalujemy AVRStudio używając Wine (z moich doświadczeń wynika, że działa) 3. Po podpięciu Programatora ZL16PRG powinniśmy mieć nowe urządzenie USB. sprawdźmy: lsusb powinniśmy znaleźć takie urządzenie: Bus 003 Device 020: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC 4. Podepnijmy nasze urządzenie USB do COM1 na Wine. W moim przypadku urządzenie USB znajdowało się w: /dev/serial/by-id/usb-FTDI_USB__-__Serial-if00-port0 Podepnijmy więc USB pod COM1 w Wine tworząc link: ln -s /dev/serial/by-id/usb-FTDI_USB__-__Serial-if00-port0 ~/.wine/dosdevices/com1 5. Podłączmy się pod układ za pomocą programatora Wygląda na to, że wszystko gra. Miłego pisania aplikacji :) Linki zewnętrzne: h...

Ruby 1.9.1 - Change JPG image name using EXIF information.

Recently I got a lot of images from a trip. Pictures I've received were from a different cameras. I wanted to create a chronological photo gallery. Unfortunately when I copied the files, I realized that all of them have the same date and time and different prefixes. Fortunately I've noticed that all images I got, contains EXIF JPG information. That is why I've created a ruby script, which changes images names, using Date Time, taken from EXIF information. To read EXIF information use ruby exifr gem. gem install exifr Here is a code. Enjoy! require 'rubygems' require 'exifr' inputDir = ARGV[0] prefix = ARGV[1].nil? ? "IMG" : ARGV[1] if (ARGV.length >= 1) Dir.glob("#{inputDir}/*.jpg",File::FNM_CASEFOLD).each() {|file| timeTaken = EXIFR::JPEG.new(file).date_time if (timeTaken.nil? & !EXIFR::JPEG.new(file).exif.nil?) timeTaken = EXIFR::JPEG.new(file).exif.date_time_original end if (timeTaken.nil?) ...

C#- Change form language at runtime.

Image
Recently I was trying to create multi language application in C#. I found a lot of useful information in net. You can always create a resource file and use it for localization: Localization with resource file. It's quite simple, but you always need to change text properties in form constructor... Not useful if we have a lot of forms. Better solution is to localize your form in a designer. Localization in Designer It is easier to localize forms and all code is created by designer. But how we can change language at run time? All procedures described before enables localization changing when new form is created. I'll describe language change at run time in case when forms are localized using Designer. In order to change application language we need to: 1. set a proper CultureInfo mCI = new CultureInfo(language); Thread.CurrentThread.CurrentCulture = mCI; Thread.CurrentThread.CurrentUICulture = mCI; If you want to know all p...

SVN DB on portable device. UBUNTU

Recently I wanted to start a new project with version control. This will be a personal project so I don't want to use any SVN server. That is why I was looking for a way to create an SVN repository on my portable USB drive. I've found a lot of "how to create a portable source control..." but most of them were about GIT. Why I'm not using GIT? Because I know SVN and I do not want to learn how to use GIT... for now. [UPDATE 2012-12-19] GIT solved all issues I had with SVN. To make a dongle repository just create a bare GIT repository there and push your changes from PC. I stopped using SVN If you still want to use SVN here you have it: I assume that you have SVN installed on your ubuntu. Create repository on portable device. I'll create repository on PORTABLE_DEVICE in folder SVN_REPO/TEST_REPO svnadmin create /media/PORTABLE_DEVICE/SVN_REPO/TEST_REPO That is all. Repository is created and ready to use. Lets use repository. First checkout y...