South-Africa Tourist Visa Extension with 90 days

south africa tourist visa extensionSouth-Africa gives a 90 day tourist visa to most Western countries (I’m Dutch, so this probably/hopefully will work for most EU countries). There are possibilities to extending another 90 days. With this tourist visa extension guide you can stay up to 180 days in total.

UPDATE: While having done this visa extension myself I only got an extension for 90 days from the visa extension date, not from the expiry date. VFS tells that I should have done a visa extension 7 days before expiry instead of 60 days before expiry. This is very confusing. So, ask a VFS of visa service company very clear about this. Else you would get (just like me) a shorter extension than 90 days. Read more about is on this blog.

While being in this situation myself, I’ve written this article to prevent wasting hours of time for you. Use this article on your own risk.

Apply for an extension as soon as possible as you enter the country, since it may take up to eight weeks. In order for one to apply for an extension of your existing visa, an extension application needs to be made 60 days prior to the expiry of your current visa and must be submitted in person at one of the VFS Global centres in South Africa.

How to extend your 90 days visa with another 90 days?

Step 0) Go to a VFS office

VFS Global is the office that runs the visa/immigration service in SA. They will explain you what you need to extend your tourist visa. In my case:

  • Flight return ticket within these 180 days, your return date determines the amount of extra days you’ll get (a flight reservation is fine, which you can do at Flight Centre)
  • Copy of passport / visa
  • Proof of enough financial incomes
  • Letter of support

Step 1) Fill in the form

  • USE INTERNET EXPLORER: or the browsers VFS advice. Safari (or maybe even Chrome) won’t work!
  • Don’t forget your password! The password forget tool of VFS does NOT work!

VFS gave me a form with what to fill in and what you need and where you need to fill in this form https://www.vfsvisaonline.com/DHAFOSOnlineVAF/gatewaypage.aspx. That may differ for your situation.

In my case, I filled in these details (check if the visa in your passport also says 11(1) or call VFS):

VFS Form - what to select

 

Then you can create an account, fill out the requested forms, pay by credit card and create an appointment (this only works with Internet Explorer). From then it can take some time for your visa to be renewed.

2) Make an appointment

Make an appointment, this only works in Internet Explorer. The VFS office will help you further to get your tourist visa extended. In this appointment letter you will find the documents you need to bring along (like a flight reservation until your new desired stay date, copy of passport & visa, motivation letter, etc.).

3) Go to the appointment

In the appointment you’ll need to bring all the documents as requested in your appointment letter and checklist which will be emailed to you after you scheduled an appointment. The VFS member takes all your documents and gives a trace-number you can use to track your application.

4) Wait

It could take a while to hear about an update. Check if your trace number is in the system and if so, just wait a while.

Following this article is at your own risk. Not sure what to do? Go to a VFS office or call them.

Good luck with your visa extension!

More info on tourist visa extension:

NB. This is just a guideline. Use at your own risk.



Moneybird koppelen met PayPal transacties

Doe je ook je boekhouding met Moneybird en ben je online actief? Grote kans dat je dan wel eens een PayPal transactie hebt moeten koppelen in Moneybird. Daarvoor heb je twee mogelijkheden:

  1. Aan de PayPal transactie de één of meerdere facturen die erachter horen koppelen in het tabblad “banktransacties”.
  2. Een aparte PayPal-bankrekening bijhouden waarin alle transacties gekoppeld worden, zoals Moneybird vermeldt.

Als je veel transacties hebt en regelmatig een positief saldo hebt bij PayPal heb je al snel met optie 2 te maken. Je moet volgens Moneybird PayPal transacties één voor één inboeken.

Aparte rekening aanmaken met MT940 software

Je kunt ook CSV-export doen van PayPal en de CSV omzetten in MT940. Gebruik daarvoor de MT940-creator. Zelf gebruik ik het volgende stappenplan:

  1. Ga naar PayPal, selecteer een datum, eventuele overlap mag, maar let goed op het begin- en eindsaldo. Het makkelijkste is een moment waarop deze allebei 0 zijn.
  2. Exporteer als CSV met bedragen die ‘invloed op saldo’ hebben (selecteer deze optie).
  3. Check begin en eindsaldo in CSV, bij voorkeur allebei 0
  4. Voer in in MT940 creator
  5. Check de begin- en eindsaldo’s of deze kloppen
  6. Controleer of PayPal valutafilter op EUR staat
  7. Rekeningnr = 222222222 (een fictief rekeningnummer, ik gebruik de ABN-Amro unstructured export soort)
  8. Klik op opslaan als en voer in bij de bank van Moneybird
  9. Check in Moneybird bij Rapporten bij Balans of het saldo van rekening 222222222 klopt per de maand van het eindsaldo. Als het saldo 0 is staat de rekening er niet tussen.

Vervolgens kun je alle transacties koppelen in je nieuwe fictieve 222222222 PayPal rekening.

MT940 PayPal Moneybird account

Beste optie: API

Iemand tijd en zin om een API te bouwen die dit bovenste automatisch doet? Ik zou er geld voor over hebben. Is het je gelukt? Of heb je inmiddels een betere workaround? Laat het onderstaand weten.

 



Laravel 5 socialite with Facebook integration

Would you like to offer a Facebook login functionality next to a regular e-mail based login? This is a tutorial to achieve that with Laravel 5 and the Socialite plugin. This tutorial is based on Matt Stauffer’s tutorial.

First of all pull in Laravel Socialite via composer:

composer require laravel/socialite

Create the users and password_remember migration:

$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('avatar');
$table->string('password', 60);
$table->boolean('is_admin');
$table->rememberToken();
$table->timestamps();

Get your Facebook developer id and secret at: https://developers.facebook.com/.

Insert the Facebook credentials into the app/services.php file:

'facebook' => [
        'client_id' => env('FACEBOOK_ID'),
        'client_secret' => env('FACEBOOK_SECRET'),
        'redirect' => env('FACEBOOK_URL'),
    ],

In my case, I store them in the .env file as environment variables:

FACEBOOK_ID=xxx
FACEBOOK_SECRET=yyy
FACEBOOK_URL=http://myapp.devapp/auth/facebook/callback

Create a users model and make sure that some fields are fillable:

<?php

namespace App;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'users';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['name', 'email', 'password', 'avatar', 'facebook_id'];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = ['password', 'remember_token'];
}

So the model and migrations are prepared, if necessary, run your migration:

php artisan migrate

Register a new controller in your routes file (if there’s an auth controller already, do it above the auth controller):

Route::get('/auth/facebook', 'Auth\SocialController@redirectToProvider');
Route::get('/auth/facebook/callback', 'Auth\SocialController@handleProviderCallback');

Create the Facebook Social Auth Controller (app/Http/Controllers/Auth/SocialController.php):

<?php

namespace App\Http\Controllers\Auth;

use Illuminate\Http\Request;
use App\User;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Auth;
use Socialite;

class SocialController extends Controller
{
    /**
     * Redirect the user to the Facebook authentication page.
     *
     * @return Response
     */
    public function redirectToProvider()
    {
        return Socialite::driver('facebook')->redirect();
    }

    /**
     * Obtain the user information from Facebook.
     *
     * @return Response
     */
    public function handleProviderCallback()
    {
        $user = Socialite::driver('facebook')->user();

        $authUser = $this->findOrCreateUser($user);

        Auth::login($authUser, true);

        return redirect()->back();
    }

    /**
     * Return user if exists; create and return if doesn't
     *
     * @param $fbUser
     * @return User
     */
    private function findOrCreateUser($fbUser)
    {

        if ($authUser = User::where('facebook_id', $fbUser->id)->first()) {
            return $authUser;
        }

        return User::create([
            'name' => $fbUser->name,
            'email' => $fbUser->email,
            'facebook_id' => $fbUser->id,
            'avatar' => $fbUser->avatar
        ]);

    }
}

You can now link to your social auth controller from somewhere in your blade view:

<a class="btn btn-primary" href="{{ action('Auth\SocialController@redirectToProvider') }}"><span class="glyphicon glyphicon-thumbs-up"></span> Login with Facebook</a>

Important safety note

If you’d like to keep the possibility for people to login, make sure that you’ve empty password validation checks, so that people can’t sign in with only Facebook e-mail addresses.

That’s it. Do you’ve additions to this tutorial? Let me know in the comments.



Magic Trackpad Rubber Replacement Tutorial

Lost your Apple Magic Trackpad rubber feet / mouse button?

It happened to me that the rubber feet of the Magic Trackpad suddenly was lost. Problem is that you aren’t able to buy them at the Apple store. My solution was simple. Get a pencil’s eraser. And cut a small slice off.
Magic Trackpad Pencil
And glue tape it under the trackpad in order to see if the height of the feet is good. If it is good glue it with a small point at the trackpad. Make sure that you don’t glue too much, else the trackpad isn’t able to click. Doing this is at your own risk of course.



Magento Direct SQL Queries

Queries for fetching in an array


    /**
     * Get the resource model
     */
    $resource = Mage::getSingleton('core/resource');
     
    /**
     * Retrieve the read connection
     */
    $readConnection = $resource->getConnection('core_read');
     
    $query = 'SELECT * FROM ' . $resource->getTableName('catalog/product');
     
    /**
     * Execute the query and store the results in $results
     */
    $results = $readConnection->fetchAll($query);
     
    /**
     * Print out the results
     */
     var_dump($results);

Fetching one query

Therefore use the method fetchCol() instead of fetchAll, so like:

$sku = $readConnection->fetchCol('SELECT sku FROM ' . $table . ');

Read more at FishPig.

Queries for wrtiting

$resource = Mage::getSingleton('core/resource');
	$writeConnection = $resource->getConnection('core_write');
	
	$query = "INSERT INTO abc_hit SET
			  visitor_id = :visitor_id,
			  hit_date = :hit_date,
			  ";
	$binds = array(
    'visitor_id' => $_SESSION['visitor_id'],
    'hit_date' => date("Y-m-d H:i:s"),
	);
	
	$writeConnection->query($query, $binds);

Get Last Inserted ID

$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "INSERT INTO .......";
$write->query($sql);
$lastInsertId = $write->lastInsertId();

Thanks to sbditto85.



IWD Checkout refresh review after payment selection

With the IWD onestep checkout plugin, there’s a free method for one step checkouts.

Though it still has a problem when you want to select a payment method, because it doesn’t refresh the review summary. This is feature is vital for payment methods that add service fee. Thanks to this plugin I found a code workaroud.

Just enable jQuery $j and add the following code in the checkout process (onepagecheckout.phtml):

$j(function($) {
      $j('input[name*="payment[method]"]').live('click', function() {
              checkout.update({
                    'review': 1,
                    //,'shipping-method': 1
                    'payment-method': 1
              });

             setTimeout(function(){
                        checkout.update({
                            'review': 1
                            //'payment-method': 1
                        });
             }, 5000);
      });

      $j('input[name*="shipping_method"]').live('click', function() {
              checkout.update({
                    'review': 1
                    ,'payment-method': 1
                    //'shipping-method': 1
              });
             setTimeout(function(){
                        checkout.update({
                            'review': 1,
                            //'payment-method': 1
                        });
             }, 500);
        });
	});

Now IWD One Step checkout works with payment methods with service costs, because the review/summary is refreshed.

Having too much problems with IWD, than just try OneStepCheckout.



Add an image field in your admin plugin (by example AW Blog)

Schermafbeelding 2013-07-03 om 14.28.17

Add an image field to plugins like AW Blog

Edit in /app/code/community/AW/Blog/Block/Manage/Blog/Edit/Tab/Form.php

$fieldset->addField('filename', 'file', array(
'label' => Mage::helper('blog')->__('Image'),
'required' => false,
'name' => 'filename',
'after_element_html' => 'Formaat 125 x 118 pixels',
));

Edit in /app/code/community/AW/Blog/controllers/Manage/BlogController.php after:

public function saveAction() {

if ($data = $this->getRequest()->getPost()) {

Add:

if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
try {
/* Starting upload */
$uploader = new Varien_File_Uploader('filename');

// Any extention would work
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
$uploader->setAllowRenameFiles(false);

// Set the file upload mode
// false -> get the file directly in the specified folder
// true -> get the file in the product like folders
// (file.jpg will go in something like /media/f/i/file.jpg)
$uploader->setFilesDispersion(false);

// We set media as the upload dir
$path = Mage::getBaseDir('media') . DS ;
$uploader->save($path, $_FILES['filename']['name'] );

} catch (Exception $e) {

}

//this way the name is saved in DB
$data['filename'] = $_FILES['filename']['name'];
}

Further add an field ‘filename’ in your db (table ‘aw_blog’).

And finally in /app/code/community/AW/Blog/Block/Blog/Edit/Form.php make sure that $form variable is defined as follows, so it works with multipart/form-data:

$form = new Varien_Data_Form(array(
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
'method' => 'post',
'enctype' => 'multipart/form-data',
)
);



Magento upgrade to 1.7

Upgrading Magento Commerce 1.4, 1.5 and 1.6 to 1.7

Magento is a pretty complex program that hasn’t an easy upgrading solution. Because following the standard guides gives quite a lot of errors, I wrote my own upgrade guide with thanks to Duntuk.com and Turnkeye.

For versions lower than 1.4.2, you’d first have to follow the steps from Turnkeye for lower versions.

Pre-upgrading steps

  • MAKE A BACKUP!
  • Install a fresh install of Magento on a subdirectory or other host on a new database (don’t overwrite your own version of course).
  • With the db repair tool from Magento you can compare your own database versus the fresh database you just installed. The db repair tool looks for errors in the database and can upgrade them.
  • Open SSH and remove your cache:
    rm -rf var/cache/*
    rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*

Upgrading steps

  • Chmod the mage file: $ chmod 550 ./mage
  • Upgrade the site (according to Duntuk and Turnkeye):$ ./mage mage-setup .
    $ ./mage sync --force
    $ ./mage list-upgrades #(in order to see if there are upgrades)
    $ ./mage config-set preferred_state stable
  • Start the upgrade
    $ ./mage upgrade-all --force
  • If the upgrade is finished you'll see rows like:
    Package upgraded: community/Mage_Locale_en_US 1.7.0.2
  • Remove cache and sessions
    $ rm -rf var/cache/* var/session/*
    $ rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
  • Visit the homepage which will trigger the upgrade process. It can take up to 30 minutes. By doing it by SSH safes memory:
    $ php -f index.php
  • Sometimes it’s safer to trigger the index.php multiple times until it gives a blank return
  • Than visit the admin and make sure the version number is the number of the upgraded version

Aftercare

Reindex the website if the upgrade is succesful:

$ php shell/indexer.php reindexall

Set all the permissions back:

$ find . -type f -exec chmod 644 {} \;
$ find . -type d -exec chmod 777 {} \;

$ chmod 755 mage
$ chmod o+w var var/.htaccess app/etc
$ chmod -R o+w media
$ chmod -R 777 var/package var/locks var/report var/export downloader

Hopefully your site is upgraded now! If you’ve any questions respond below!

Issues

Error: Mage registry key “_resource_helper/core” already exists

rm -rf var/session/*
rm -rf var/cache/*

If that doesn’t work restart caching tools like Memcached!



Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

When having trouble with the error: “Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction” or when your place order / order confirmation gets stuck.

Fixing the order process getting stuck:

According to the Magento Forum, in MySQL, try:

TRUNCATE `log_customer`;
TRUNCATE `log_quote`;
TRUNCATE `log_summary`;
TRUNCATE `log_summary_type`;
TRUNCATE `log_url`;
TRUNCATE `log_url_info`;
TRUNCATE `log_visitor`;
TRUNCATE `log_visitor_info`;

Of course create a backup first. Doesn’t this fix the problem or do you have a better solution? Comment it!