m1gin 37

Algoritma Tasarımı

Console.WriteLine($"x={x}, y={y}");

Console.WriteLine("{0:F2}", 3.1);
//output: 3.10

Console.WriteLine("{0,5} : {1,5}", 2, 4);
//output: ....2 : ....4

Console.WriteLine("\aBeep for this");
//beep sound

//
Console.BackgroundColor=...Red
Console.ForegroundColor=...White
Console.ResetColor();

//
for (int i=0; (i<5 && s==true); i++)

7.1.2 - StreamReader
7.1.7 - FileStream

8.1.5 Extension Methods
public static int KelimeSayisi(this string s) => s.Split().Length;
Usage:
string str="Extension for an existing class";
int sayi = str.KelimeSayisi();

8.1.8 - Override
8.1.11 - Virtual Methods
8.1.16 - Abstract Methods

virtual methods: optional to implement (override)
abstract methods: need to be implemented
sealed methods: not allowed to implement

8.1.17 - sealed classes and methods
8.1.18 - Summary

9.1.2 - Enumeration
9.1.3 - IEnumerable

 


Linux Sistem Yönetimi

 

ps aux #list processes

pstree #list process as tree

 

add system-wide parameters

cat /etc/environment

 

ls /etc/init.d/ # list services

 

run service command:

/etc/init.d/apache2 status

 

 

ls -li : list files and dirs with inode no

cd - : önceki dizine gider

file : shows file information

stat : shows detailed file information

 

cmd 2> log : hata yönlendirme.

 

!22 : runs 22nd item from history output

 

VIM

i : insert

Esc : command mode

:q : quit

:w : write

:q! : quit with force

:wq file.txt : save to file.txt and quit

 

 

su -l username # switch to user

cat /etc/group # list all groups

cat /etc/passwd #list users

cat /etc/shadow #list hashed pass

 

usermod -a -G group user # add user to group

 

chmod

4:read

2:write

1:execute

chmod 764 # means u=rwx,g=rw,o=r

 

chattr +i file #lock a file. even for root.,,

chattr -i file #unlock file

lsattr #list file's lock attributes


BASH Programlama Dili

 

tail -f file.txt # read last lines and keep following the file for changes

echo $$ #process id of the script

read -p "user:" user #ask for entry
read -sp "pass" pass #ask for password

let a=5+9
let "a=5+4"
let "b=$a*3"

expr 3 \* 4 #escape *

#until loop
c=0;
until [[ $c -gt 11 ]]; do
echo $c;
((c++));
done;

#Create a menu and do something based on the selected item:
names="option1 option2 option3 option4";
PS3="Seçiminiz:";
select name in $names;
do
echo $name;
done

 

var1="out"
test(){ local var1="in"; echo $var1; }
test
echo $var1

 

 

 

Add to: