7 Temmuz 2009 Salı

vb.net Inheritanace (Miras)

Inheritance Nedir

OOP yazarken çokca kullanılan bir işlem.Inheritance (Dahillendirme) anlamak için OOP mantığını bilmek gerekiyor.Tabiki.


Araba diye bir clasımız var mı var.Özellikleride tanımlı motoru var, 4 kapılı, direksiyonu falan filan....... tanımladınız.


şimdi BMW de bir araba doğru muyum doğru. Onunda 4 kapısı,motoru,direksiyonu var mı var şimdi arabanın tüm özelliklerini BMW için bir daha yazarsak Ayıp ederiz.
Bunun için BMW Class'ına araba Classını Inherit etmeliyiz. işte Yapısı nasıl peki ? İşte Syntax.


Public Class Araba
---
---
End Class

Public Class BMW
Inherits Araba
---
---
End Class


Bu kadar .....

Bir de örnek çakalım pekişsin.....
Imports System.Console
Module Module1

Sub Main()
Dim ss As New Two()
WriteLine(ss.sum())
Read()
End Sub

End Module

Public Class One
'base class
Public i As Integer = 10
Public j As Integer = 20

Public Function add() As Integer
Return i + j
End Function

End Class

Public Class Two
Inherits One
'derived class. class two inherited from class one
Public k As Integer = 100

Public Function sum() As Integer
'using the variables, function from base class and adding more functionality
Return i + j + k
End Function

End Class



Sonucun ne dönmesini beklersiniz. normalde ss Two Class türemiştir.onunda tek elemanı k =100 O halde sonuç 100 olur demeyin sakın :( Two class'ı One classını inherit etmiş ve doğal olarak i+j+k değerlerinide alıp 130 olarak sonuç bulunur.

Constructors Nedir

Aslında Constructer oldukca çok kullanılan Class lar içindeki Sub-End Sub parametreleri ile tanımlı (vb.net için) kod bloklarıdır. Örnek le anlatacak olursak;
Public Class Employee
Public Sub Work()
System.Console.WriteLine("I am working.")
End Sub
End Class


Work bir Constructer olarak tanımlanmış ve kullanımı ise
Dim employee As Employee
employee = New Employee()
employee.Work()
Şeklinde yazılabilir.

Base Classlarla ilgili olarak nasıl kullanabiliriz.Derseniz Inheritance konusunda biraz değineceğim fakat bir örnek olsun .net coşkun gibilerinden....
Public Class personel
Public Sub New()
System.Console.WriteLine("Personelin constructor'ü.")
End Sub

Public Sub Work()
System.Console.WriteLine(Personel Çalışıyor.")
End Sub
End Class

Public Class Patron: Inherits personel
Public Sub New()
System.Console.WriteLine("Patron constructor.")
End Sub
End Class

Patron class'ına Personel Dahil Edilerek (Inherit).onun özellikleri alınmış.
Patronda Aslında bir personeldir yaklaşımı katılmış oluyor.

Kullanımı ise şöyle

Dim manager As Manager
manager = New Manager()

Muhtemel Çıktımız ise

Personel constructor'ü.
Patron constructor.
Şeklinde olmalı gibi geliyor insanın içine.

Class ve Objeler

-Class ve Objeler
Visual Basic'de Class lar Class-End Class ifadeleri arasına yazılır.
incelemek için bir Class Syntax verecek olursak
Public Class Test
----- Variables
-----Methods
-----Properties
-----Events
End Class
Şeklinde düşünebiliriz.
Bir Classtan Yeni bir obje türetmek istenirse o obje New ifadesiyle türeterek yeni isimle oluştururuz.Örnek Olarak Dim obj As New Test()
Şimdi bir Class ve Bu classtaki nesneden türetilen bir objeyle basit bir consol uygulaması yapabiliriz.
Module Module1
Imports System.Console

Sub Main()
Dim obj As New Test()
'creating a object obj for Test class
obj.disp()
'calling the disp method using obj
Read()
End Sub

End Module

Public Class Test
'creating a class named Test
Sub disp()
'a method named disp in the class
Write("Welcome to OOP")
End Sub
End Class

Visual Basic ile OOP

OOP konularını bu başlıklar altında sınıflamak oldukca iyi olacak diye düşünüyorum.

-Class ve Objeler
-Constructors
-Inheritance
-Polymorphism
-Interfaces
-Abstract Classes
-Structures
Şimdi kısa kısa konuları özetleyeceğim.Emin değil fakat daha sonra ayrıntılı olarakda konuya girebilirim.

Böylece Nesne Yönelimli Yazılım Dilinin Üç Prensibinide içermiş olacağız. Inheritance(Miras) ,encapsulation ve polymorphism’dir

6 Temmuz 2009 Pazartesi

Ödüllü kadın yönetici erkek çıktı


"Ödüllü kadın yönetici erkek çıktı
İngiltere'de teknoloji sektöründe gösterdiği başarılarından dolayı 35 yaş altındaki “en başarılı iş kadını” ödülü alan Kate Craig'in aslında bir erkek olduğu ortaya çıktı."

3 Temmuz 2009 Cuma

MSSQL 2008 bak dosyası yükleme Error 3210 giderimi

Merhabalar elinizde *.bak dosyası varsa ve bunu mssql 2008 kayıt etmek istiyorsanız.Öncelikle nasıl yapacağınızı bilmelisiniz ve sonrada muhtemel Error 3210 nasıl giderileceğini bilmeliyiz.


Öncelikle *.bak dosyasını nasıl database yükleriz.Öncelikle Kolaylık olması için bak dosyamızı

C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Backup altına koyalım.Microsoft Sql Server Management Studio açalım database bağlanıp .
Bağlandıktan sonra Database Dalının üstüne gelerek Restore DataBase diyelim.
to database kısmına daha önce tablolarımızda olmayan bir isim yazalım.Source For Restore Kısmında dosyadan yedekleme yapacağımız için From Device düğmesini seçelim ve Backup Media için File Seçelim.şimdi Add diyerek *.bak dosyamızı seçebiliriz.
Ok diyerek pencemizden veritabanımızı seçelim ve restore işlemini tamamlayalım.
Eğer Error 3210 almışsanız ozaman
1. SQL Server Configuration Manager açın.
2.Gerekli SQL Sever sol tuşla tıklayın
3.Properties SEçin
4. Logon tab'ında Açılır kapanır menuden 'Local system' seçin.
Hatanızı çözecektir.Unutmayın Sql server yeniden başlar ve hizmetiniz bir süre aksayabilir.

28 Haziran 2009 Pazar

Kullanışlı MSDOS Komutları

addusers - add or list users to/from a csv file
arp - address resolution protocol
assoc - change file extension associations
associat - one step file association
at - schedule a command to run at a later time
attrib - change file attributes more
browstat - get domain, browser and pdc info
cacls - change file permissions
call - call one batch program from another
cd - change directory - move to a specific folder
change - change terminal server session properties
chkdsk - check disk - check and repair disk problems
chkntfs - check the ntfs file system
choice - accept keyboard input to a batch file
cipher - encrypt or decrypt files/folders
cleanmgr - automated cleanup of temp files, recycle bin
clearmem - clear memory leaks
clip - copy stdin to the windows clipboard.
cls - clear the screen
cluster - windows clustering
cmd - start a new cmd shell
color - change colours of the cmd window
comp - compare the contents of two files or sets of files
compact - compress files or folders on an ntfs partition
compress - compress individual files on an ntfs partition
con2prt - connect or disconnect a printer
convert - convert a fat drive to ntfs.
copy - copy one or more files to another location
csvde - import or export active directory data
date - display or set the date
dcomcnfg - dcom configuration utility
defrag - defragment hard drive
del - delete one or more files
delprof - delete nt user profiles
deltree - delete a folder and all subfolders
devcon - device manager command line utility
dir - display a list of files and folders
diruse - display disk usage
diskcomp - compare the contents of two floppy disks
diskcopy - copy the contents of one floppy disk to another
dnsstat - dns statistics
doskey - edit command line, recall commands, and create macros
dsadd - add user (computer, group..) to active directory
dsquery - list items in active directory
dsmod - modify user (computer, group..) in active directory
echo - display message on screen
endlocal - end localisation of environment changes in a batch file
erase - delete one or more files
exit - quit the cmd shell
expand - uncompress files
extract - uncompress cab files
fc - compare two files
fdisk - disk format and partition
find - search for a text string in a file
findstr - search for strings in files
for - conditionally perform a command several times
forfiles - batch process multiple files
format - format a disk
freedisk - check free disk space (in bytes)
fsutil - file and volume utilities
ftp - file transfer protocol
ftype - display or modify file types used in file extension associations
global - display membership of global groups
goto - direct a batch program to jump to a labelled line
help - online help
hfnetchk - network security hotfix checker
if - conditionally perform a command
ifmember - is the current user in an nt workgroup
instsrv - install an nt service
ipconfig - displays your IP address.
kill - remove a program from memory
label - edit a disk label
local - display membership of local groups
logevent - write text to the nt event viewer.
logoff - log a user off
logtime - log the date and time in a file
mapisend - send email from the command line
mem - display memory usage
md - create new folders
mode - configure a system device
more - display output, one screen at a time
mountvol - manage a volume mount point
move - move files from one folder to another
moveuser - move a user from one domain to another
msg - send a message
msiexec - microsoft windows installer
msinfo - windows nt diagnostics
munge - find and replace text within file(s)
mv - copy in-use files
net - manage network resources
netdom - domain manager
netsh - configure network protocols
netsvc - command-line service controller
nbtstat - display networking statistics (netbios over tcp/ip)
netstat - display networking statistics (tcp/ip)
now - display the current date and time
nslookup - name server lookup
ntbackup - backup folders to tape
ntrights - edit user account rights
path - display or set a search path for executable files
pathping - ip trace utility
pause - suspend processing of a batch file and display a message
perms - show permissions for a user
perfmon - performance monitor
ping - test a network connection
popd - restore the previous value of the current directory saved by pushd
portqry - display the status of ports and services
print - print a text file
prncnfg - display, configure or rename a printer
prnmngr - add, delete, list printers set the default printer
prompt - change the command prompt
pushd - save and then change the current directory
qgrep - search file(s) for lines that match a given pattern.
rasdial - manage ras connections
rasphone - manage ras connections
recover - recover a damaged file from a defective disk.
reg - read, set or delete registry keys and values
regedit - import or export registry settings
regsvr32 - register or unregister a dll
regini - change registry permissions
rem - record comments (remarks) in a batch file
ren - rename a file or files.
replace - replace or update one file with another
rd - delete folder(s)
rdisk - create a recovery disk
rmtshare - share a folder or a printer
robocopy - robust file and folder copy
route - manipulate network routing tables
runas - execute a program under a different user account
rundll32 - run a dll command (add/remove print connections)
sc - service control
schtasks - create or edit scheduled tasks
sclist - display nt services
scriptit - control gui applications
set - display, set, or remove windows nt environment variables
setlocal - begin localisation of environment changes in a batch file
setx - set environment variables permanently
share - list or edit a file share or print share
shift - shift the position of replaceable parameters in a batch file
shortcut - create a windows shortcut (.lnk file)
showgrps - list the nt workgroups a user is in
showmbrs - list the members of an nt workgroup
shutdown - shutdown the computer
shutgui - shutdown the computer
sleep - wait for x seconds
soon - schedule a command to run in the near future
sort - sort input
start - start a separate window to run a specified program or command
su - switch user
subinacl - edit file and folder permissions, ownership and domain
subst - associate a path with a drive letter
tasklist - list running applications and services
time - display or set the system time
timeout - delay processing of a batch file
title - set the window title for a cmd.exe session
touch - change file timestamps
tracert - trace route to a remote host
tree - graphical display of folder structure
type - display the contents of a text file
usrstat - list domain usernames and last login
ver - display version information
verify - verify that files have been saved
vol - display a disk label
where - locate and display files in a directory tree
whoami - output the current username and domain
winmsd - windows nt diagnostics
winmsdp - windows nt diagnostics ii
wmic - wmi command
xcacls - change file permissions
xcopy - copy files and folders more