Showing posts with label vojvodina. Show all posts
Showing posts with label vojvodina. Show all posts

Friday, July 24, 2020

Postanite profesionalni programer na Linuxu

1) Instalirajte Linux Lite

2) otvorite command promt i unesite:

sudo apt-get update
sudo apt-get lazarus-ide
sudo apt-get lazarus

Čestitamo, sada ste spremni za velika dela:




Lazarus-ide možete koristiti i za programiranje u Windows 10, ali nije u tome poenta, nego da više promovišemo open sors i Linux koji je zapostavljen u Srbiji.

https://rti.etf.bg.ac.rs/rti/ir1p1/materijal.html

https://bubblecup.org/

http://messylab.com/

Object oriented concepts and design patterns

https://medium.com/@ronnieschaniel/object-oriented-design-patterns-explained-using-practical-examples-84807445b092

https://hackernoon.com/10-oop-design-principles-every-programmer-should-know-f187436caf65

https://www.codingame.com/playgrounds/503/design-patterns/object-oriented-programming

https://www.cs.uct.ac.za/mit_notes/software/htmls/ch08s03.html

https://www.geeksforgeeks.org/design-patterns-set-1-introduction/

https://www.freecodecamp.org/news/the-basic-design-patterns-all-developers-need-to-know/

https://github.com/samsam-026/Design_Patterns

https://www.tutorialspoint.com/design_pattern/design_pattern_overview.htm


Bubble Cup finals programming environment


We are just couple of days away from the start of the finals. Compilers and IDEs available on the finals are:
  • C++
    • IDE: CodeBlocks 16.01, Visual Studio 2017
    • Compiler: MinGW 4.9.2, Visual Studio 2017
  • C#
    • IDE: Visual Studio 2017
    • Compiler: Visual Studio 2017
  • Pascal
    • IDE: Free Pascal, Lazarus 1.6.4
    • Compiler: Free Pascal Compiler 3.0.2

Thanks,
Bubble Cup Crew

Saturday, October 13, 2018

Zaboravili ste WiFi lozinku, nema problema - za korisnike M$ Window$ 7,8,10

1 .startujte cmd.exe kao administrator i otkucajte ovo:
netsh wlan show profile

2. Kada ste saznali koja su sve imena za WiFi dostupna, kucaj ovo:
netsh wlan show profile WiFi-ime key=clear

Ovde je WiFi-ime ime tvog WiFi-ja za koji ti treba lozinka.

Dakle, prva naredba lista sva IMENA WIFI UREDJAJA, a druga naredba lista izmedju ostalog i LOZINKU koja te zanima.

Ako je nekome ovo pomoglo dajte mi neku pohvalu u komentar.



Tuesday, October 9, 2018

Printeri - napredna vbs dijagnostika


Одржавате принтере, а имате рачунаре који припадају различитим генерацијама Windows XP, Windows 7, Windows 8, Windows 8.1, Windows 10, Linux,...

Имате око стотинак компјутера у корпоративној мрежи, е онда знате ко ми је.

Ова тема је веома широка, али неке битне ставке и помоћне круцијалне методе можете наслутути из даљег текста који се бави овом темом.

Предпостављамо да знате енглеси, па оригинални текст нисмо преводили.

prin2.vbs

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections

'For i = 0 to oPrinters.Count - 1 Step 2
'   WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)
'Next

Dim a
a = ""
For i = 0 to oPrinters.Count - 1 Step 2
   a = a & "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)
   a = a & chr(13)& chr(10)
Next
WScript.Echo a



prin22.bat

cscript.exe prin2.vbs
pause


Naravno pokrenete prin22.bat ako želite rezultate u command prompt-u.

Ako želite rezultate u message dijalogu onda pokrenete samo vbs fajl, ali je zbog copy-paste rezultata bolja opcija bat.

Ovako veoma brzo možete utvrditi da li postoji neki problem sa printerima u vašoj lokalnoj mreži.

Svakako, ipconfig i netstat -r naredbe takodje mogu da pomognu kod dijagnostike kvara sa mrežnim štampačima.



Open up the run command with the "Windows Key + R" key combination. Type:
printui.exe /s
and click OK.


Shared printer problem solved: 

https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb456988(v=technet.10)




Open command prompt as elevate as administrator on windows 10 computers and type each line then hit enter key

netsh int ip reset resetlog.txt

netsh winsock reset catalog

ipconfig /flushdns

ipconfig /registerdns

ipconfig /release (not really necessary to do it)

ipconfig /renew (not really necessary to do it)

You can restart the computer at the end of all the processes.




try these steps below on all your computer one at the time

ipconfig /flushdns

ipconfig /registerdns

ipconfig /release

ipconfig /renew

netsh int ip reset resetlog.txt

netsh winsock reset catalog




Now, open windows services (winlogo + X >Run type services.msc) on each of your win 10 computers take a look if these services below are starting if not start them and put the first one on automatic and the second one on manual

Function Discovery Discovery Resource Publication (Running) (automatic)
UPnP Device Host service (Running) ( manual)
Computer Browser (Running) (Manual)



Wanted to check if the issue is resolved? If not can we check if NetBIOS over TCPIP is enabled?? Go to properties on netwok card.. select TCPIP v4 and then properties. Click on Advanced tab and select Wins. Select Enable NetBIOS over TCPIp. Apply the changes. Reboot and check. Check on other computers too



If this shared printer problem persists, please try this:

on Search - type msconfig - go to the services tab- Check the box for hide all msconfig - Disable the third party services. Apply the changes - Do not reboot.






MORE TIPS:

  • In Windows, search for and open Programs and Features.
  • Select your HP printer.
  • Select Uninstall.
  • In Windows, search for and open Devices and Printers.
  • In the Devices and Printers window look for your HP Printer. If you see it listed, right-click on it and choose "Delete" or "Remove Device.”
  • Open up the run command with the "Windows Key + R" key combo.
  • Type printui.exe /s and click OK.
  • Click on Drivers tab.
  • Look for HP Printer driver. If you see it click on it and click Remove at the bottom.
  • Select OK.
  • Select Apply and OK on the Print Server Properties windows.
  • Close Devices and Printers.
Now please download and install the drivers from this link: http://hp.care/2nn1GUo
Once you install the drivers, you may try to scan: Scanning from the Computer (Windows)

HP has developed another scan software especially for Win8 and Win10 and it can be downloaded for free from the Windows store: http://hp.care/2dsHSjh

I sincerely hope this fixes the issue.

Monday, September 24, 2018

Typed Files in Delphi & Lazarus

Simply put a file is a binary sequence of some type. In Delphi, there are three classes of filetyped, text, and untyped. Typed files are files that contain data of a particular type, such as Double, Integer or previously defined custom Record type. Text files contain readable ASCII characters. Untyped files are used when we want to impose the least possible structure on a file.

Typed Files

While text files consist of lines terminated with a CR/LF (#13#10) combination, typed files consist of data taken from a particular type of data structure.
For example, the following declaration creates a record type called TMember and an array of TMember record variables.
 type
  TMember = record
    Name : string[50];
    eMail : string[30];
    Posts : LongInt;
  end;
 var Members : array[1..50] of TMember; 
Before we can write the information to the disk we have to declare a variable of a file type. The following line of code declares an F file variable.
 var F : file of TMember; 
Note: To create a typed file in Delphi, we use the following syntax:
var SomeTypedFile : file of SomeType
The base type (SomeType) for a file can be a scalar type (like Double), an array type or record type. It should not be long string, dynamic array, class, object or a pointer.
In order to start working with files from Delphi, we have to link a file on a disk to a file variable in our program. To create this link we must use AssignFile procedure in order to associate a file on a disk with a file variable.
 AssignFile(F, 'Members.dat') 
Once the association with an external file is established, the file variable F must be 'opened' to prepare it for reading and/or writing. We call Reset procedure to open an existing file or Rewrite to create a new file. When a program completes processing a file, the file must be closed using the CloseFile procedure. After a file is closed, its associated external file is updated. The file variable can then be associated with another external file.
In general, we should always use exception handling; many errors may arise when working with files. For example: if we call CloseFile for a file that is already closed Delphi reports an I/O error. On the other hand, if we try to close a file but have not yet called AssignFile, the results are unpredictable.

Write to a File

Suppose we have filled an array of Delphi members with their names, e-mails, and number of posts and we want to store this information in a file on the disk. The following piece of code will do the work:
 var
  F : file of TMember;
  i : integer;
begin
 AssignFile(F,'members.dat') ;
 Rewrite(F) ;
 try
  for j:= 1 to 50 do
   Write (F, Members[j]) ;
 finally
  CloseFile(F) ;
 end;
end; 

Read from a File

In order to retrieve all the information from the 'members.dat' file we would use the following code:
 var
  Member: TMember
  F : file of TMember;
begin
 AssignFile(F,'members.dat') ;
 Reset(F) ;
 try
  while not Eof(F) do begin
   Read (F, Member) ;
   {DoSomethingWithMember;}
  end;
 finally
  CloseFile(F) ;
 end;
end; 
Note: Eof is the EndOfFile checking function. We use this function to make sure that we are not trying to read beyond the end of the file (beyond the last stored record).

Seeking and Positioning

Files are normally accessed sequentially. When a file is read using the standard procedure Read or written using the standard procedure Write, the current file position moves to the next numerically ordered file component (next record). Typed files can also be accessed randomly through the standard procedure Seek, which moves the current file position to a specified component. The FilePos and FileSizefunctions can be used to determine the current file position and the current file size.
 {go back to the beginning - the first record}
Seek(F, 0) ;
{go to the 5-th record}
Seek(F, 5) ;
{Jump to the end - "after" the last record}
Seek(F, FileSize(F)) ; 

Change and Update

You've just learned how to write and read the entire array of members, but what if all you want to do is to seek to the 10th member and change the e-mail? The next procedure does exactly that:
 procedure ChangeEMail(const RecN : integer; const NewEMail : string) ;
var DummyMember : TMember;
begin
 {assign, open, exception handling block}
 Seek(F, RecN) ;
 Read(F, DummyMember) ;
 DummyMember.Email := NewEMail;
 {read moves to the next record, we have to
 go back to the original record, then write}
 Seek(F, RecN) ;
 Write(F, DummyMember) ;
 {close file}
end;

Completing the Task


That's it -- now you have all you need to accomplish your task. You can write members' information to the disk, you can read it back and you can even change some of the data (e-mail, for example) in the "middle" of the file.


ORIGINAL ARTICLE:

https://www.thoughtco.com/create-database-delphis-file-typed-files-1058003






NEMA ODMORA DOK TRAJE OBNOVA ---->>>>>

IDEMO DALJE ------------>>>>>

Tuesday, May 9, 2017

Lazarus String To Hex and vice versa

function StringToHex(S: String): string;
function HexToString(H: String): String;



function StringToHex(S: String): string;
var I: Integer;
begin
  Result:= '';
  for I := 1 to length (S) do
    Result:= Result+IntToHex(ord(S[i]),2);
end;

function HexToString(H: String): String;
var I: Integer;
begin
  Result:= '';
  for I := 1 to length (H) div 2 do
    Result:= Result+Char(StrToInt('$'+Copy(H,(I-1)*2+1,2)));
end;




procedure TForm1.Button6Click(Sender: TObject);
var a,b: string;
begin
 a := Edit1.Text;
 b := StringToHex(a);
 Edit2.Text := b;
end;

procedure TForm1.Button7Click(Sender: TObject);
var a,b: string;
begin
 a := Edit1.Text;
 b := HexToString(a);
 Edit2.Text := b;

end;

Friday, April 28, 2017

Elegantno merenje vremena izvrsenja PHP procedura

http://php.net/manual/en/function.microtime.php


ou can use microtime and calculate the difference:
$time_pre = microtime(true);
exec(...);
$time_post = microtime(true);
$exec_time = $time_post - $time_pre;


http://stackoverflow.com/questions/8310487/start-and-stop-a-timer-php

Koja je brzina tvog servera ? PHP

Koja je brzina tvog servera ?

<?phpif (isset($_GET['source']))
{
    
highlight_file($_SERVER['SCRIPT_FILENAME']);
    exit;
}
$maxNumKB 4096;$defNumKB 512;
if (!isset(
$_GET['numKB']) || intval($_GET['numKB']) > $maxNumKB)
{
    
header("Location: http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?numKB=$defNumKB");
    exit;
}
$numKB intval($_GET['numKB']);?><!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Jan! &raquo; PHP &raquo; speed test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    <!--
    html
    {
        font-family: sans-serif;
        color: #000;
        background: #fff;
    }
    *
    {
        font-size: medium;
    }
    #wait
    {
        border-bottom: thin dotted black;
    }
    #wait abbr
    {
        border: none;
    }
    #done
    {
        font-weight: bold;
    }
    #benchmark
    {
        padding: 1em;
        border: 1px solid black;
        background: #ffe;
        color: #000;
    }
    //-->
    </style>
</head>
<body>
<div id="benchmark">
<p>
    <strong>This not a script to benchmark or determine the execution speed
    of PHP scripts.</strong> If you're looking for one, check out the PEAR
    <a href="http://pear.php.net/package/Benchmark">Benchmark package</a>.
</p>
<p>
    This script sends <?php echo $numKB?> <abbr title="kilobyte">KB</abbr>
    of HTML comments to your client. Parsing that HTML may add to the total
    transfer time, so don't take this as your raw download speed.
</p>
</div>
<h1>Please wait</h1>
<p>
    <a href="<?php echo "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?source=1"?>">(Show source)</a>
</p>
<p id="wait">
    Transferring <?php echo $numKB?> <abbr title="kilobyte">KB</abbr>
</p>
<!--
<?phpfunction getmicrotime()
{
    list(
$usec$sec) = explode(" "microtime());
    return ((float)
$usec + (float)$sec);
}
flush();$timeStart getmicrotime();$nlLength strlen("\n");
for (
$i 0$i $numKB$i++)
{
    echo 
str_pad(''1024 $nlLength'/*\\*') . "\n";
    
flush();
}
$timeEnd getmicrotime();$timeDiff round($timeEnd $timeStart3);?>-->
<p id="done">
    <?php
        
echo "Transferred {$numKB} <abbr title=\"kilobyte\">KB</abbr> in {$timeDiff} seconds, " .
             (
$timeDiff <= "more than {$numKB}round($numKB $timeDiff3)) .
             
' <abbr title="kilobytes per second">KB/s</abbr>';
    
?></p>
</body>
</html>