Category Archives: Qt

How to open a 64bit command prompt from a 32bit application

Don’t create cmd64 link or or use mklink There is cleaner solution. We can execute 32 bit / 64 bit commands from 32/64 apps/commands with following pattern. SysWOW64 == 32 bit commands/apps SysNative == 64 bit commands/apps Example: Run 32 … Continue reading

Posted in Command, Qt, WINDOWS Tagged

Remove all files from directory/folder in Qt

Clean directory entries/ Empty directory/folder content 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 … Continue reading

Posted in Qt

Count all files under directory recursively in Qt

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27   //Yash – Speedovation.com : Please don’t remove this line int Cleanup::countFiles(const QString … Continue reading

Posted in Qt, Qt-Tips

converting QString to LPCWSTR, QString to const wchar_t, QString to CONST WCHAR and vice-versa

All of above means same. Below I’ve explained why Convert from QString to LPCWSTR 1 2 3 4 5 6 7 8 9 10 11 12 13 14   QString key; const wchar_t *keyName = (const wchar_t*)key.utf16();   LPCWSTR = … Continue reading

Posted in Qt, Qt-Tips

Laravel load Huge CSV file into MySQL

1 2 3 4 5 6   $csv = app_path().DIRECTORY_SEPARATOR."database".DIRECTORY_SEPARATOR."resources".DIRECTORY_SEPARATOR."locations.csv";   $query = sprintf("LOAD DATA INFILE ‘%s’ INTO TABLE locations FIELDS TERMINATED BY ‘,’ OPTIONALLY ENCLOSED BY ‘\"’ ESCAPED BY ‘\"’ LINES TERMINATED BY ‘\\n’ IGNORE 0 LINES (`location_id`, `country`, … Continue reading

Posted in Qt

Extract environmental variable and replace using Qt

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18   QString Common::parse(QString str) { int pos = 0; QRegExp rx("%([^%]+)%"); // Match env var between two ‘%’ rx.setMinimal(true); while((pos = rx.indexIn(str, … Continue reading

Posted in Qt, Qt-Tips

Windows Registry is a virtual record of physically scattered hives, containing certain system and user settings. These records are employed by system components, third party applications, hardware, user profiles, and other great deal of stuff. A contaminated registry can lead … Continue reading

Convert BYTE* to QSTRING in Qt

1 2 3 4 BYTE* pu8_RawData = (BYTE*)i_RawData.parray->pvData; DWORD u32_RawLen = i_RawData.parray->rgsabound[0].cElements;   qDebug() < < "PP: " << QString(QByteArray((const char*) pu8_RawData, (int)u32_RawLen));

Posted in Qt, Qt-Tips

Generate thumbnail in ubuntu

sudo apt-get install imagemagick for i in $(ls *.png); do convert -scale 400 $i th-$i; done

Posted in Qt

Handle Uploaded file using post in django

def receive(request): assert request.method=="POST" print "receive.META.SERVER_PORT", request.META["SERVER_PORT"], request.POST files = [] for multipart_name in request.FILES.keys(): multipart_obj = request.FILES[multipart_name] content_type = multipart_obj[’content-type’] filename = multipart_obj[’filename’] content = multipart_obj[’content’] files.append((filename, content_type, content)) import datetime # write file to the system – add … Continue reading

Posted in Qt