How to implement a captcha for Google Forms

Is it possible to make a random captcha for a google form? You may search and find on google groups and other sources a hard no to this question but, in fact, there is one method that I made that works pretty well. Unfortunately, there are some catches with the method that I am about to show you, but until we get to that, we first have to ensure that we can meet a requirement that this method has.  This primary requirement is an URL/server that can generate dynamically a captcha image from a given text passed into an HTTP GET variable.

Luckily there are some free servers that can do just that. In this instance, I had used “dummyimage.com”, but if you want you can use your own server as there are many examples of code for generating an image from an HTTP get variable available in many web programming languages.

Ok so, if we met this requirement, is time to do a somewhat detailed explaining of how this method will work. First of all is important to know …

PHP Class for modifying old HTML static copies / mirrors

Ok you made a static mirror(maybe with HTTrack, maybe with something else) and you still want to host it somewhere, but you also want to make a change to all the static pages without modifying each and every one of the files. In that case, you need to load that file using a script that reads the file at the time of loading then makes the changes you want and after that displays it. Sound simple enough so I made a PHP class that does just that and I even wrote 2 flavors of the script to work on ancient PHP version( and by ancient I mean around 2010 5.3.x).

The idea is simple, first redirect all request to the script using your web server configuration here is a simple apache .htaccess example:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.html$ HaCopyAn.php

Then here is the class for newer PHP Versions(it will be instantiated in the script too):

<?php

class HaCopyAn{
    
    private $base="";
    private $rep = [];
    
    public function __construct(string $base="", array $rep=[]){
       
       $this->base = $base;
       $this->rep = $rep;
       
    } 
    
    public 

C++ Windows Detect If MBR or GPT PartitionStyle Simple Example

As the title suggest this is a Windows only example, you may notice that I used it in QT environment from qDebug() helper function, honestly, the only small project that I can think of for this function is one where you would like to change the bootloader, but as I said this is a trivial example.

A few remarks:

  • 1 CreateFile needs to be called from a process that was run as admin in order to work ( require admin in manifest )
  • 2 On MBR Fist sector/boot sector is always writeable
  • 3 L”\\\\.\\PHYSICALDRIVE0″ means the first Volume but the user might have multiple volumes and you should make additional checks

CODE:

void QtClAct::detectHddBootType(){

    HANDLE h = CreateFile ( L"\\\\.\\PHYSICALDRIVE0", GENERIC_WRITE |
    GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    if (h == INVALID_HANDLE_VALUE)
    {
      qDebug() << "Invalid Drive";
    }

    DWORD returned;
    BYTE buffer[1024];
    BOOL b = DeviceIoControl(h,               // handle to device
                             IOCTL_DISK_GET_DRIVE_LAYOUT_EX, // dwIoControlCode
                             NULL,         // lpInBuffer
                             0,            // nInBufferSize
                             buffer,       // output buffer
                             1024,         // size of output buffer
                             &amp;returned,    // number of bytes returned
                             NULL);       // OVERLAPPED structure

    if 

Avast breaks ability to create new User on Win

I had to make a new user on a windows 7 workstation machine, and the simple create user procedure failed miserably,  I thought maybe there are some permission problems.  User created with GUI ( either control panel or MMC)  or from the console with the “net user command”, spawned multiple profile and temp folders in the USERS folder, didn’t create the necessary registry entries. And if you logged in any of the created users you got a perpetual “preparing desktop” and when logged in you got an information notification that announced you: “you have been logged on with the default system profile”.

One thing that I didn’t bother to look are the logs, and that should be the first thing obvious, I did a lot of futile things like recreating the default user folder, reset the default permissions and other tricks that usually repair any problem with creating a new user.  After I saw that most of the things still didn’t resolve the issue, I looked at the logs.  Netherless to say that the problem was that the new …

WordPress 4.7.0 4.7.2 _e() function, languages and broken translations

Some time ago I read about a critical vulnerability present in WordPress 4.7.0 and 4.7.1(it was seriously severe, it primarily let attackers change data in your DB using restful API) , and I had a website that I did back in 2015, problem is that I did the theme using _e function(mostly on the front page) for translations as it was a multilingual website.

Anyway, I updated from 4.7.2 to 4.7.3 and <<BAM>> all translations were broken. It was a bit curious though why this update broke the translation if in 4.7.0 they worked fine, so started to see if any change was written in the official documentation that I could find on this links: I18n_for_WordPress_Developers and developer.wordpress.org/themes/functionality/internationalization.

But at the time of running, that update I didn’t see any major change, I made a little debugging and noticed that the Text Domain: was loading fine, as I tried an echo in the front page, but still no translation. 

Long story short I found that that is better to have the languages in your new folder from wp-content