Thursday, February 14, 2019

Tastatura nasušna

Korisne prečice na M$ Windows-u:
Windows taster - otvara start meni
Windows + E - Otvara program windows explorer
Alt + F - otvara meni File
Tab - kretanje unapred kroz opcije 
Alt + F4 - zatvara aktivan prozor
Windows + M - minimizira sve prozore i prikazuje radnu površinu
Windows + R - otvara RUN, za pokretanje programa
Alt +Tab - omogućava prelazak iz jedne otvorene aplikacije u drugu
Ctrl + F - pretraga
Ctrl + O - otvaranje postojećeg dokumenta
Ctrl + S - komanda za čuvanje dokumenata
Ctrl + N - otvaranje novog dokumenta 
Ctrl + A - selektujte sve fajlove i foldere
Ctrl + X - za premeštanje fajlova i foldera
Ctrl + C - Copy, za kopiranje
Ctrl + V - Paste, nalepljivanje 
Ctrl + Z - Undo, poništava poslednji korak 
Ctrl + Alt + Delete - koristi za stopiranje nekog programa
Ctrl + T - otvara novi tab (karticu) na internetu


---------------------


Prečice na tastaturi za Mozillu Firefox
Shift+Alt+1 - povratak na početnu stranicu
Shift+Alt+2 - pregled Timeline-a
Shift+Alt+3 - prikazivanje the Friends Requests liste
Shift+Alt+4 - prikazivanje Messages liste
Shift+Alt+5 - otvaranje Notification liste
Shift+Alt+6 - Account setting stranica
------------------------

Prečice na tastaturi za Google Chrome:
Alt+1 - povratak na početnu stranicu; Alt+2 - pregled Timeline-a
Alt+3 - prikazivanje the Friends Requests liste
Alt+4 - prikazivanje Messages liste
Alt+5 - otvaranje Notification liste
Alt+6 - Account setting stranica
Alt+7 - Account privacy konfiguracija
Alt+8 - Facebook fans group stranica
Alt+9 - Facebook-ova izjava o odgovornosti
Alt+0 - Facebook Korisnički centar
Alt+m - Kreiranje nove poruke
Alt+? - Kursor u polju za pretragu



[]


Wednesday, February 13, 2019

PHP ćirilica u ošišanu latinicu

Ako ste radili sa nazivima datoteka u PHP-u onda znate da je najbolje kada koristite ošišana engleska slova za nazive datoteka na serveru.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<?php
//setlocale (LC_ALL, 'sr_RS');
setlocale(LC_ALL, "en_US.UTF-8");

$string = 'Ћирилица Караџића Вука, иде Миле лајковачком пругом, ШЂљњЏџ.docx';

$patterns = array();
$patterns[0] = '/А/';
$patterns[1] = '/а/';
$patterns[2] = '/Б/';
$patterns[3] = '/б/';
$patterns[4] = '/Ц/';
$patterns[5] = '/ц/';
$patterns[6] = '/Д/';
$patterns[7] = '/д/';
$patterns[8] = '/Е/';
$patterns[9] = '/е/';
$patterns[10] = '/ф/';
$patterns[11] = '/Ф/';
$patterns[12] = '/Г/';
$patterns[13] = '/г/';
$patterns[14] = '/Х/';
$patterns[15] = '/х/';
$patterns[16] = '/Ј/';
$patterns[17] = '/ј/';
$patterns[18] = '/К/';
$patterns[19] = '/к/';
$patterns[20] = '/Л/';
$patterns[21] = '/л/';
$patterns[22] = '/Ч/';
$patterns[23] = '/ч/';
$patterns[24] = '/Ћ/';
$patterns[25] = '/ћ/';
$patterns[26] = '/Ж/';
$patterns[27] = '/ж/';
$patterns[28] = '/Ш/';
$patterns[29] = '/ш/';
$patterns[30] = '/Р/';
$patterns[31] = '/р/';
$patterns[32] = '/Т/';
$patterns[33] = '/т/';
$patterns[34] = '/З/';
$patterns[35] = '/з/';
$patterns[36] = '/У/';
$patterns[37] = '/у/';
$patterns[38] = '/И/';
$patterns[39] = '/и/';
$patterns[40] = '/О/';
$patterns[41] = '/о/';
$patterns[42] = '/П/';
$patterns[43] = '/п/';
$patterns[44] = '/С/';
$patterns[45] = '/с/';
$patterns[46] = '/В/';
$patterns[47] = '/в/';
$patterns[48] = '/Н/';
$patterns[49] = '/н/';
$patterns[50] = '/М/';
$patterns[51] = '/м/';

$patterns[52] = '/Ђ/';
$patterns[53] = '/ђ/';
$patterns[54] = '/Љ/';
$patterns[55] = '/љ/';
$patterns[56] = '/Њ/';
$patterns[57] = '/њ/';
$patterns[58] = '/Џ/';
$patterns[59] = '/џ/';



$replacements = array();
$replacements[0] = 'A';
$replacements[1] = 'a';
$replacements[2] = 'B';
$replacements[3] = 'b';
$replacements[4] = 'C';
$replacements[5] = 'c';
$replacements[6] = 'D';
$replacements[7] = 'd';
$replacements[8] = 'E';
$replacements[9] = 'e';
$replacements[10] = 'F';
$replacements[11] = 'f';
$replacements[12] = 'G';
$replacements[13] = 'g';
$replacements[14] = 'H';
$replacements[15] = 'h';
$replacements[16] = 'J';
$replacements[17] = 'j';
$replacements[18] = 'K';
$replacements[19] = 'k';
$replacements[20] = 'L';
$replacements[21] = 'l';
$replacements[22] = 'C';
$replacements[23] = 'c';
$replacements[24] = 'C';
$replacements[25] = 'c';
$replacements[26] = 'Z';
$replacements[27] = 'z';
$replacements[28] = 'S';
$replacements[29] = 's';
$replacements[30] = 'R';
$replacements[31] = 'r';
$replacements[32] = 'T';
$replacements[33] = 't';
$replacements[34] = 'Z';
$replacements[35] = 'z';
$replacements[36] = 'U';
$replacements[37] = 'u';
$replacements[38] = 'I';
$replacements[39] = 'i';
$replacements[40] = 'O';
$replacements[41] = 'o';
$replacements[42] = 'P';
$replacements[43] = 'p';
$replacements[44] = 'S';
$replacements[45] = 's';
$replacements[46] = 'V';
$replacements[47] = 'v';
$replacements[48] = 'N';
$replacements[49] = 'n';
$replacements[50] = 'M';
$replacements[51] = 'm';

$replacements[52] = 'Dj';
$replacements[53] = 'dj';
$replacements[54] = 'Lj';
$replacements[55] = 'lj';
$replacements[56] = 'Nj';
$replacements[57] = 'nj';
$replacements[58] = 'Dz';
$replacements[59] = 'dz';

echo preg_replace($patterns, $replacements, $string);

?>
</body>
</html>

Friday, February 8, 2019

Delphi pravi malu decu

An open source machine learning framework for everyone

Julia programming language

https://julialang.org/


MORE TIPS:

Go is not just a slightly better version of C.
In fact, Go is a completely different language and has very little similarities to C.
  • C and Go approach memory management in totally different ways: Go is garbage-collected while C is manually managed. This difference alone is already humongous since these approaches require totally different techniques of writing code. GC makes Go much easier to write than C but adds overhead compared to carefully written C code. C takes much more effort, time and knowledge to get right in terms of memory management. It’s also much easier to get a memory leak in C than it is in Go, and if you happen to run into a segmentation fault - C won’t tell you where it happened by default (only a debugger will) while Go will always give you a detailed stack trace.
  • Go is inherently concurrent and non-blocking, C is not. A Go program is executed by a so-called “goroutine” and can spawn millions of other goroutines which are all multiplexed through an internal pool of system threads. C is inherently single-threaded and while you still can use system threads in a C program - the techniques of writing asynchronous and concurrent code in Go and C are totally different!

    For example, it’s fine to block a goroutine with a blocking operation like an HTTP request, a filesystem operation or a database query because under the hood the goroutine scheduler will swap it out for another goroutine preventing the program from blocking a system thread, but you can’t do this with C because you’d block an actual system thread which you can’t create many of, so you’ll have to use totally different techniques like work-stealing pools, event loops, callbacks etc.

    Creating system threads in C is also much more expensive than creating a goroutine in Go. Go allows you to write a server where each connection is handled by a separate goroutine and it’s going to be non-blocking and multi-threaded by default while equivalent C code is going to be much more complicated!
  • Go is strongly statically typed, while C is rather loosely statically typed. For example, you can’t just cast pointer types to any other pointer type in Go, the compiler won’t let you, but in C that’s easily done and I’ve seen people do it a lot. In Go, you’d have to use unsafe.Pointer and it’s there for very rare cases, it isn’t used often (the package isn’t called “unsafe” without a reason).
  • Go has much better tooling than C, it has built-in testing, benchmarking, linting (go vet for example), a race detector, different built-in profilers, gofmt etc. and it feels like it’s cast in one piece. C, on the other hand, doesn’t have all that by default making it harder to work with.
  • Go is much easier to cross-compile than C. Cross-compiling a Go program to ARM Linux on an x86 Windows machine (and vice-versa) is as easy as GOOS=linux GOARCH=arm go build, C, on the other hand, requires a rather complicated setup in order to cross-compile properly.
  • Go isn’t just “slightly” easier to read and write, it’s significantly easier to write than C and it’s also much easier to read and make sense of!

    For example, Go doesn’t have a preprocessor, which adds a hell of a lot of complexity in C because it generates confusing compilation errors and sometimes makes C code incredibly hard to read and understand.

    Go has interfaces, struct “constructors”, methods, type-switches, channels, and much much more. All this makes C feel like Assembly code.
  • Compared to C, Go has rather sophisticated dependency management.
    Go programs are made of packages, some of which can easily be included with go dep from 3-rd party Git sources (Go Modules will make dependency management even better, yet they’re currently experimental but will be coming soon). C has an outdated and cumbersome header-based dependency management approach, where the preprocessor first concatenates the source files and then compiles them. If you, for example, happen to include a header file multiple times in C then you’ll have a problem! Or if two headers define a similar macro - you’ll have another problem! Working with 3-rd party libraries is usually much harder in C than it is in Go.
  • C is much more interoperable than Go. Go has an unusual stack design where each goroutine has a ~4 kb stack by default which grows as needed to allow large amounts of goroutines to exist at the same time and this makes Go much harder to interoperate with languages like C/C++, Rust etc. C FFI, on the other hand, makes C much easier to get working with other languages and platforms.

    C compilers also target a much wider list of platforms and CPU architectures than current Go compilers.
  • C compilers are much better at optimizing the hell out of your code, while Go compilers tend to compile your code much faster. The official Go compiler doesn’t do heavy optimizations as of now because that extra 5-10 % of raw computing power isn’t really worth the effort of complicating the compiler and making it slower since in Go’s usual use cases it makes more sense to scale both vertically and horizontally.
Finally, I’d like to add, that C and Go not only originate from different epochs, they’re also designed for completely different purposes. While Go, in fact, is a general-purpose programming language, C is rather more general purpose than Go (which is neither better nor worse) because Go was originally designed to replace C++ for writing networking software at Google. This is also the reason why Go doesn’t have user-space generics (actually, Go does have generics, they’re just built-in to types like mapsslices, and channels), it didn’t really need generics that much so the authors decided to not further complicate the language as well as the compiler to implement a feature they didn’t need back then (although now they're considering to add generics in Go 2 since Go gained much greater attention than its authors initially expected).
Go is “glorified” for its rather unique combination of a great concurrency model, great tooling, and minimalistic language design that helps engineers get problems solved fast and easy. It’s great for writing automation tools, CLI apps, networking software, APIs and web services, writing a device driver in Go instead of C though - probably isn’t a good idea.
P.S. Go and Python, are humongously different as well, but that’s a-whole-nother story.

python desktop win api forms