Thursday, March 31, 2022

Fix Fail 0x0000007c Shared Printer Cannot be Installed

 1
2
3
4

5
6












Napunite zdjelu jednakih omjera šećera, vode, octa, bijelog vina i pet do deset kapi deterdženta za pranje. Ostavite zdjelu preko noći, te ujutro provjerite koliko ih se ‘udavilo’ u ovoj ubojitoj smjesi. Možete ih i dehidrirati stavljanjem soli, sode i octa u odvod. Prolijte ovu smjesu po odvodu tijekom noći, a ujutro ulijte lonac kipuće vode u odvod kako biste ih rastjerali




Tuesday, March 29, 2022

Golang Windows 10 initial settings

1) 

https://osdn.net/projects/mingw/


2)

https://go.dev/dl/


https://go.dev/dl/go1.18.windows-386.msi


3)

Environment variables:


GOPATH %USERPROFILE%\go;C:\go

PATH %USERPROFILE%\go\bin;C:\MinGW\bin\;c:\go\bin;C:\MinGW\


4)

https://code.visualstudio.com/



5) Install GO plugins for VSC

  #include <stdio.h>
  #include <sqlite3.h>
 
  static int callback(void *NotUsed, int argc, char **argv, char **azColName){
    int i;
    for(i=0; i<argc; i++){
      printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
    }
    printf("\n");
    return 0;
  }
 
  int main(int argc, char **argv){
    sqlite3 *db;
    char *zErrMsg = 0;
    int rc;
 
    if( argc!=3 ){
      fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]);
      return(1);
    }
    rc = sqlite3_open(argv[1], &db);
    if( rc ){
      fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
      sqlite3_close(db);
      return(1);
    }
    rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg);
    if( rc!=SQLITE_OK ){
      fprintf(stderr, "SQL error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
    }
    sqlite3_close(db);
    return 0;
  }

https://www.oazazdravlja.rs/novosti/16-kurkuma-cudotvorac


#include<stdio.h>
#include<stdlib.h>


//int main(int argc, char* argv[])
int main()
{

char const* const fileName = "ulaz.txt";

FILE* file = fopen(fileName, "r");

if(!file){
printf("\n Unable to open : %s ", fileName);
return -1;
}

    char line[500];

    char str[50];
    FILE *fp;
    fp = fopen("izlaz.txt", "w");

    if(fp == NULL)
    {
        printf("Error opening file\n");
        exit(1);
    }

 
while (fgets(line, sizeof(line), file)) {
        printf("%s", line);
//        fputs(str, fp);
        fputs(line, fp);

    }

    fclose(fp);
    fclose(file);
    return 0;
}

Sunday, March 27, 2022

Go, SQLITE, CSV, TXT, and HTML5+CSS3 are quite usable in command prompt applications with arguments

https://medium.com/hacker-toolbelt/i3wm-on-debian-10-buster-c302420853b1

https://www.codeproject.com/Articles/1127103/Introduction-to-ELENA-Programming-Language

1-read text from csv or command text file

2-sqlite

3-write text result to html


Balkan to Tokyo:

++

 +

Operations With Files

Let's read a text file line by line:

C++
import system'io;
import extensions;

public program()    
{
    // getting a file name from the command line argument
    var fileName := program_arguments[1];

    // opening a text file reader
    using(auto reader := File.assign(fileName).textreader())
    {
        // repeating until all the lines are read 
        while (reader.Available)
        {
            // read the line
            string line := reader.readLine();
            
            // print the line
            console.printLine(line);            
        };
    }    
}

Let's write into the file:

C++
import system'io;
import extensions;

public program()    
{
    // getting a file name from the command line argument
    var fileName := program_arguments[1];

    // opening a text file writer
    using(auto writer := File.assign(fileName).textwriter())
    {
        // repeating until the empty line is entered
        for(string line := console.readLine(), line != emptyString, line := console.readLine())
        {
            // save to the file 
            writer.writeLine(line)
        }
    }    
}

If the file with the specified name exists, it will be overwritten.

If we want to append to the existing file, then we should use logger() method, e.g.:

C++
using(auto writer := File.assign(fileName).logger())

Let's read a binary file:

C++
import system'io;
import extensions;
import system'collections;

public program()    
{
    // getting a file name from the command line argument
    var fileName := program_arguments[1];

    // creating a list to hold the read data
    List<byte> dump := new List<byte>();

    // opening a binary file reader
    using(auto reader := BinaryFileReader.new(fileName))
    {
        // repeating until all the file is read 
        while (reader.Available)
        {
            // read the current byte into a variable b
            // note the variable is declared just-in-place
            reader.read(ref byte b);
            // add the read byte to the dump 
            dump.append(b);
        };
    };
    
    // print the file content as a list of bytes
    console.printLine(dump.asEnumerable());
}

And finally, let's search for the files and directories:

C++
import system'io;
import extensions;
   
public program()
{
    // specifying the target directory
    var dir := Directory.assign(".");
    
    var files := dir.getFiles();
    var dirs := dir.getDirectories();

    console.printLine("Directory ", dir);
    console.printLine("files:", files.asEnumerable());
    console.printLine("directories:", dirs.asEnumerable());
}

Golang is quite usable !


Jedite bademe. Bademi sadrže veoma male količine natrijuma, što je od velike važnosti za održavanje krvnog pritiska na zdravom nivou. S druge strane, bademi su bogati kalijumom koji pomaže da srčani mišići i nervne transmisije ostanu jake. Rezultat ove bolje srčane funkcije jeste da krvni pritisak nema priliku da se podiže iznad normalnih vrednosti. Oko 60 g badema dnevno je svršena količina za očuvanje zdravlja, kažu nutricionisti.

Pijte vodu od kokosa. Istraživanja su pokazala da kalijum, magnezijum i vitamin C koji se nalaze u kokosovoj vodi ovaj napitak čine veoma zdravim. Najzdravija je ona voda pronađena u mladim plodovima.

Kuvajte sa kurkumom. Kurkuma je začin koji bi svakako trebalo da imate u svojoj kuhinji iz mnoštva razloga, a jedan od njih je što su istraživanja pokazala da 80 mg kurkume dnevno ima značajan uticaj na snižavanje povišenog krvnog pritiska. Pored toga, kurkumin koji se u kurkumi nalazi dokazano smanjuje rizik od nastanka bolesti jetre i Alchajmerove bolesti.

Više se krećite. Ako imate redovnu fizičku aktivnost, šanse da patite od povišenog krvnog pritiska su veoma male i to zato što vežbanje jača srce, a jako srce ispumpava više krvi sa manje napora. Ako se vaše srce manje napreže, snaga arterija raste, a krvni pritisak se snižava. Svega pola sata vežbanja nekoliko puta u toku nedelje je dovoljno da vam pritisak bude na zdravom nivou.

Pevajte pod tušem. Vrištite u jastuk kad ste pod stresom, plešite po kući, nađite način da se istresete i otpustite stres na bezazlen način. Kad smo pod stresom naše srce brže kuca, a kao rezultat toga, krvni sudovi se krive i krvni pritisak skače.

Odloženi stres koga se ne oslobađamo na duge staze može uzrokovati hipertenziju. Veoma je važno da se s stresom borite na vreme, i to tako da to ne utiče pritisak vaše okoline.

Friday, March 25, 2022

Ultra light Linux = MiYO Linux distro

 https://sourceforge.net/projects/miyolinux/

https://gosamples.dev/read-file/#:~:text=The%20simplest%20way%20of%20reading,by%20line%20or%20in%20chunks.

https://stackoverflow.com/questions/37122401/execute-another-go-program-from-within-a-golang-program

https://zetcode.com/golang/exec-command/

https://gist.github.com/hyg/9c4afcd91fe24316cbf0

https://www.instructables.com/Complete-Guide-for-Tech-Beginners/


Working on Golang:

package main

import (
    "fmt"
    "log"
    "os/exec"
    "runtime"
)

func openbrowser(url string) {
    var err error

    switch runtime.GOOS {
    case "linux":
        err = exec.Command("xdg-open", url).Start()
    case "windows":
        err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
    case "darwin":
        err = exec.Command("open", url).Start()
    default:
        err = fmt.Errorf("unsupported platform")
    }
    if err != nil {
        log.Fatal(err)
    }

}

func main() {

    openbrowser("d:/go/dokument.htm")

}



Working on TCC:


#include <stdio.h>
#include <wchar.h>
#include <stdlib.h>
#include <locale.h>
int main ()
{
  setlocale(LC_ALL, "en_US.UTF-8");
  FILE * fin;
  FILE * fout;
  wint_t wc;
  fin=fopen ("in.txt","r");
  fout=fopen("out.txt","w");
  while((wc=fgetwc(fin))!=WEOF){
        // work with: "wc"
        putchar(wc);
        fprintf(fout,"%c",wc);
  }
  fclose(fin);
  fclose(fout);
  printf("File has been created...\n");
  return 0;
}

https://www.calculate-linux.org/


https://www.howtogeek.com/howto/windows-vista/enable-the-hidden-administrator-account-on-windows-vista/

??:



#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>

int main(void)
{
FILE *stream;
wchar_t wcs[100];

if (NULL == (stream = fopen("fgetws.dat", "r"))) {
printf("Unable to open: \"fgetws.dat\"\n");
exit(1);

}

errno = 0;
if (NULL == fgetws(wcs, 100, stream)) {
if (EILSEQ == errno) {
printf("An invalid wide character was encountered.\n");
exit(1);

}

else if (feof(stream))
printf("End of file reached.\n");
else
perror("Read error.\n");
}
printf("wcs = \"%ls\"\n", wcs);
fclose(stream);
return 0;

/************************************************************
Assuming the file fgetws.dat contains:
This test string should not return -1
The output should be similar to:
wcs = "This test string should not return -1"
************************************************************/

}


int sqlite3_exec16(
sqlite3 *db, /* The database on which the SQL executes */
const short *zSql, /* The SQL(16) to be executed */
sqlite3_callback16 xCallback, /* Invoke this callback routine */
void *pArg, /* First argument to xCallback() */
short **pzErrMsg /* Write error messages here */
){
int rc = SQLITE_OK;
const short *zLeftover;
sqlite3_stmt *pStmt = 0;
short **azCols = 0;

int nRetry = 0;
int nCallback;

if( zSql==0 ) return SQLITE_OK;
while( (rc==SQLITE_OK || (rc==SQLITE_SCHEMA && (++nRetry)<2)) && zSql[0]
){
int nCol;
short **azVals = 0;

pStmt = 0;
rc = sqlite3_prepare16_v2(db, zSql, -1, &pStmt, &zLeftover);
assert( rc==SQLITE_OK || pStmt==0 );
if( rc!=SQLITE_OK ){
continue;
}
if( !pStmt ){
/* this happens for a comment or white-space */
zSql = zLeftover;
continue;
}

nCallback = 0;

nCol = sqlite3_column_count(pStmt);
azCols = sqliteMalloc(2*nCol*sizeof(const short *) + 1);
if( azCols==0 ){
goto exec_out;
}

while( 1 ){
int i;
rc = sqlite3_step(pStmt);

/* Invoke the callback function if required */
if( xCallback && (SQLITE_ROW==rc ||
(SQLITE_DONE==rc && !nCallback && db->flags&SQLITE_NullCallback))
){
if( 0==nCallback ){
for(i=0; i<nCol; i++){
azCols[i] = (short *)sqlite3_column_name16(pStmt, i);
}
nCallback++;
}
if( rc==SQLITE_ROW ){
azVals = &azCols[nCol];
for(i=0; i<nCol; i++){
azVals[i] = (short *)sqlite3_column_text16(pStmt, i);
}
}
if( xCallback(pArg, nCol, azVals, azCols) ){
rc = SQLITE_ABORT;
goto exec_out;
}
}

if( rc!=SQLITE_ROW ){
rc = sqlite3_finalize(pStmt);
pStmt = 0;
if( rc!=SQLITE_SCHEMA ){
nRetry = 0;
zSql = zLeftover;
while( iswspace((unsigned char)zSql[0]) ) zSql++;
}
break;
}
}

sqliteFree(azCols);
azCols = 0;
}

exec_out:
if( pStmt ) sqlite3_finalize(pStmt);
if( azCols ) sqliteFree(azCols);

rc = sqlite3ApiExit(0, rc);
if( rc!=SQLITE_OK && rc==sqlite3_errcode(db) && pzErrMsg ){
*pzErrMsg = sqlite3_malloc(1+strlen(sqlite3_errmsg16(db)));
if( *pzErrMsg ){
strcpy(*pzErrMsg, sqlite3_errmsg16(db));
}
}else if( pzErrMsg ){
*pzErrMsg = 0;
}

assert( (rc&db->errMask)==rc );
return rc;
}




Wednesday, March 23, 2022

Select data from csv file to SQLITE database

 drop table if exists <table name>;

create table <table name> (field1 datatype, field2 datatype ....);
.separator ","
.import <csv file name> <table name>
https://heads.dyne.org/

loadcsvtosqlite.cs

Process proc = new Process {
    StartInfo = new ProcessStartInfo {
        FileName = @"loadcsvtosqlite.bat",
        Arguments = @"",
        UseShellExecute = true,
        RedirectStandardOutput = false,
        CreateNoWindow = true
    }
};
proc.Start();
proc.WaitForExit();

loadcsvtosqlite.bat

sqlite3.exe "db name" < loadcsv.sql

loadcsv.sql

drop table if exists <table name>;
create table <table name> (field1 datatype, field2 datatype ....);
.separator ","
.import <csv file name> <table name>
https://stackoverflow.com/questions/2689098/how-to-bulk-insert-a-csv-file-into-sqlite-c-sharp
https://www.howtogeek.com/785314/whats-new-in-gnome-42/
https://www.howtogeek.com/247380/how-to-fix-windows-update-when-it-gets-stuck/
  1. Try running the Windows Update Troubleshooter, which you can search for in the Start menu.
  2. If that doesn’t help, you can try deleting Windows Update’s cache by booting into Safe Mode, stopping the wuauserv service, and deleting the files in C:WindowsSoftwareDistribution.
  3. If all else fails, download updates manually using the WSUS Offline Update tool.
https://tanzucommunityedition.io/download/
https://www.vmware.com/cloud-solutions/app-modernization.html

Friday, March 18, 2022

Sistem info

 systeminfo > C:\temp\SystemID.txt


wmic /output:C:\temp\InstalledPrograms.txt product get name,version


wmic bios get /?
wmic bios get releasedate
wmic bios get serialnumber


https://dev.to/gamegods3/how-to-install-gcc-in-windows-10-the-easier-way-422j




#include <stdio.h>
#include <locale.h>
#include <windows.h>

int main()
{
    SetConsoleOutputCP(65001);
    setlocale(LC_ALL, "C");
    printf("Hello World! Привет, мир!\n");
}





int _tmain(int argc, _TCHAR* argv[])



++


https://www.howtogeek.com/65291/how-to-make-your-own-custom-windows-7-icons-out-of-any-image/

https://www.phplift.net/how-to-create-a-screen-recorder-in-javascript/

Time hypocrisy...


more goodies:

https://developercommunity.visualstudio.com/t/create-a-utf8-c-runtime/351432