Archive

Archive for September, 2009

Simple class with default and overloaded constructor

September 28th, 2009 Zaur Bahramov No comments

This sample demonstrates use of default constructor, overloaded constructor, method and overloaded method in C#

Create new console C# console application.

Add the following code to Program.cs

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Classes_002
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             // create new instance of the Calculate class
  13.             Calculate calc1 = new Calculate();
  14.  
  15.             // call doCalculation method with the default Constructor
  16.             Console.WriteLine(“default constructor: “ + calc1.doCalculation()+“\r”);
  17.  
  18.             // create another instance of the Calculate class
  19.             Calculate calc2 = new Calculate(100);
  20.             // call doCalculation method with the user variable passed to Constructor
  21.             Console.WriteLine(“constructor that accepted user value: “ + calc2.doCalculation() + “\r”);
  22.  
  23.             // create another instance of the Calculate class
  24.             Calculate calc3 = new Calculate();
  25.             // call doCalculation method and pass to variables directly to method0
  26.             Console.WriteLine(“method that accepts two double values: “ + calc2.doCalculation(25.35,10.12) + “\r”);
  27.             
  28.             Console.ReadKey();
  29.         }        
  30.     }
  31. }

 

Add new class Calculate.cs with the following code

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Classes_002
  7. {
  8.     class Calculate
  9.     {
  10.         // declare private variable for the class
  11.         private int constantA;
  12.  
  13.  
  14.         // declare initial value for default Constructor
  15.         public Calculate()
  16.         {
  17.             constantA = 10;
  18.         }
  19.  
  20.  
  21.         // declare Constructor for input of user variable
  22.         public Calculate(int a)
  23.         {
  24.             constantA = a;
  25.         }
  26.  
  27.         
  28.         // method that actually does the calculation
  29.         public int doCalculation()
  30.         {
  31.             return constantA / 2;
  32.         }
  33.  
  34.         public double doCalculation(double val1, double val2)
  35.         {
  36.             return val1*val2;
  37.         }
  38.  
  39.     }
  40.  
  41.  
  42.  
  43. }

 

This is a very simple example just to demonstrate how default and overloaded constructors work in C#.

Categories: C#, Code Snippets Tags:

Калькулятор желаний в1.0 Русская версия

September 18th, 2009 Zaur Bahramov 2 comments

image

Вот и появилась русская версия версия “Калькулятора желаний”. Для того, чтобы ваше желание исполнилось, необходимо ввести ваше имя, или имя человека, для которого кодируется желание, а затем само желание. Использовать необходимо лишь клавиатуру самой программы! Оба кода необходимо записать на какой-либо части человека, для которого кодируется желание. Этот метод на основе расчетов по СИМОРОНУ уже многих убедил в своей достоверности. Желания действительно сбываются! Попробуйте и напишите, сбылось ли Ваше желание!

Download484 

Скачать

Categories: Software Tags:

Released Personal Numbers Calculator v1.0

September 9th, 2009 Zaur Bahramov 1 comment

image

Personal Numbers Calculator is a small utility that makes calculations basing on your name and last name and suggests your number. Such calculation is based on numerology. Each alphabetical letter is assigned to a number, then all numbers are added until only one digit remains.

This utility is not going to be useful for those who do not believe in numerology and related beliefs. I’ve seen on some web forums people discuss calculations of the “personal number” or “lucky number” and this utility just expedites this calculation.

To use the Personal Numbers Calculator you will need mouse to input your name and last name from the virtual keyboard.

 

System requirements:

Windows 2000/XP/Vista
Dot Net Framework 2.0

Download48 Download

 

Please, leave your comments, opinions and ideas so I can keep on adding features!

Unable to access HP LaserJet 2600n from web interface

September 7th, 2009 Zaur Bahramov No comments

 

laseret2600n Problem: After installing Internet Explorer 7 or 8 the web management interface of HP LaserJet 2600n printer is no more accessible.

Solution: Install latest firmware. Firmware download.

 

 

 

See the entire thread on HP support:

http://forums13.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=1212128&admit=109447627+1252318317348+28353475

Categories: Windows Tags: ,

Windows Feng Shui Kua Number Calculator

September 4th, 2009 Zaur Bahramov No comments

This is a beta version of my Feng Shui Kua number calculator.

Just input your year, month and day of birth and Feng Shui Kua Number Calculator will calculate your Kua number, auspicious and inauspicious directions, your zodiac sign and year.

Years can be selected in the range from 1930 to 2039. These years are based on Chinese lunar calendar, so for example, if a person was born in the beginning-middle of January 1977 his year of birth according to Chinese lunar calendar is 1976 instead of 1977.

This application is very simple but useful for those who want to have a handy desktop tool to determine horoscope signs, Kua number and auspicious directions.

image

System requirements:

Windows 2000 / XP / Vista 32/64 bit
Dot Net Framework 2.0

Download-48 Download

Please, leave your comments, opinions and ideas so I can keep on adding features!

I’ve developed this app for personal needs and I would like to share it with anybody who might need it, that’s why your comments are most welcome!

Categories: Software Tags:

PowerShell script to list any desired file type(s)

September 1st, 2009 Zaur Bahramov 1 comment

Here’s a PowerShell script that produces the list of desired file types (jpg, bmp, exe, dll, etc.)

Change $path=”C:\” to desired directory.

Change ‘.bmp’ to desired file extension.

If you need to find more that one file type, then add “-or ($file.Extension -eq ‘.some_extension’)” in the if statement, e.g.:

if (($file.Extension -eq ‘.bmp’) -or ($file.Extension -eq ‘.jpg’))

if (($file.Extension -eq ‘.bmp’)-or ($file.Extension -eq ‘.jpg’) -or ($file.Extension -eq ‘.gif’))

$path="c:\"
function showdir {
param (
$path
)
$files=Get-ChildItem $path
foreach ($file in $files) {
if ($file.PSIsContainer) {
showdir -path $file.FullName
}
else {
if (($file.Extension -eq '.bmp')) {
$f=gwmi -Class CIM_DataFile -Filter "Name='$(add_slhs($file.FullName))'"
Write-Host $file.FullName,$f.Version
}
}
}
}
function add_slhs($src) {
$dst=""
for ($i=0;$i -lt $src.length;$i++) {
if ($src[$i] -ne "\") {
$dst=$dst+$src[$i]
}
else {
$dst=$dst+$src[$i]+"\"
}
}
return $dst
} 

showdir -path $path

Enjoy!