Workstation

VirtualBox: increase screen resolution on Mac Os as a guest

I mounted¬†MacOS 10.12 Sierra as a virtual machine on a windows host. By default the screen resolution is¬†1024×768, this is small resolution especially when you have a large screen.. So how to increase it?

EFI provides two distinct video interfaces: GOP (Graphics Output Protocol) and UGA (Universal Graphics Adapter). Mac OS X uses GOP, while Linux tends to use UGA. VirtualBox provides a configuration option to control the framebuffer size for both interfaces.

To control GOP, use the following VBoxManage command:

VBoxManage setextradata "VM name" VBoxInternal2/EfiGopMode N

Where N can be one of 0,1,2,3,4,5 referring to the 640×480, 800×600, 1024×768, 1280×1024, 1440×900, 1920×1200 screen resolution respectively.

To get the machine name use vboxmanage list vms

For me I choose¬†1440×900 VBoxManage setextradata "mac" VBoxInternal2/EfiGopMode 4

From China to Berlin; the flight of a MacBook Air

Ordered a custom MacBook Air, 13″¬†from Apple Germany on the 16. August 2016 and followed its travel plane ūüôā

Berlin, Germany 08/22/2016 6:35 A.M. Out For Delivery
08/22/2016 5:00 A.M. Arrival Scan
Koeln, Germany 08/21/2016 11:53 P.M. Departure Scan
08/21/2016 10:36 P.M. Import Scan
Dubai, United Arab Emirates 08/21/2016 5:20 P.M. Departure Scan
08/21/2016 9:35 A.M. Arrival Scan
Chek Lap Kok, Hong Kong 08/21/2016 6:00 A.M. Departure Scan
Chek Lap Kok, Hong Kong 08/19/2016 7:19 P.M. Arrival Scan
Shenzhen, China 08/19/2016 5:20 P.M. Departure Scan
08/19/2016 5:00 P.M. Export Scan
08/19/2016 5:00 P.M. Origin Scan
China 08/19/2016 4:04 A.M. Order Processed: Ready for UPS

Use Babun as a terminal in PhpStorm

In order to Use Babun (or other Cygwin clones) as a terminal in PhpStorm and make it open Cygwin command in specified directory on windows then follow this easy steps:
For the PhpStorm that I’am using (v10.0.4) in Windows 10, open File > Settings… > Tools > Terminal,¬†¬†replace the shell path with :
D:\tools\.babun\cygwin\bin\env.exe CHERE_INVOKING=1 /bin/bash.exe

You may need to restart PhpStorm after this change.

I’m using Babun which installs the Cygwin in:
D:\tools\.babun\cygwin

Permanent aliases in bash

For errors installing ruby or gems please check this post answer on stackoverflow.com

  1. Add those lines to your .bashrc
    # Aliasses
    if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
    fi
  2. Create the file .bash_aliases in the root dicretory and put aliases you want on it. For example:
    # Rubygems
    alias gem='D:/tools/ruby/bin/gem'# Mailcatcher
    alias mc='D:/tools/ruby/bin/mailcatcher.bat'

 

Installing mailcatcher in windows

When working in PHP you come accross situations where you need to see the current emails sent using PHP’s mail function. For this you need a a mail catcher.

The MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailcatcher, set your favourite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out http://127.0.0.1:1080 to see the mail that’s arrived so far.

Follow those steps to get you ready:

  1. Install the ruby and rubygems as described here
  2. Install mail catcher
    gem install mailcatcher
  3. Add an alias (check also how to permanently add aliases in bash)
    alias mc='D:/tools/ruby/bin/mailcatcher.bat'
  4. Edit php.ini settings near [mail function]
    SMTP = 127.0.0.1
    smtp_port = 1025
    sendmail_from = aidrissi@example.com
  5. Restart Wamp server
  6. Now run this command to open a browser and listen for the mails!
    mc -b

    This will open a browser window with mail catcher admin.

Errors?

I had an error with utf-8  characters and fixed it by the following:

First stop the ruing mailcatcher from the browser (the quit button) then downgrade mailcatcher to the version without error with character encoding:

gem uninstall mailcatcher
gem install mailcatcher -v 0.5.12

Ruby and Rubygems in Windows vs Babun

After some trial/error I figured out that babun doesn’t support ruby/gem installed with pact.. So I to fix this I did
Remove the ruby pact packages

pact remove ruby
pact remove rubygems

The next commands must be done in the normal windows Command Prompt!
Download the Ruby [Windows-based installer](http://rubyinstaller.org/) (which installs also rubygems), during install choose to add it to PATH, so wehn you run

ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32]

It shows the version number
Add an alias to the new installed gem

alias gem='D:/tools/ruby/bin/gem'

Now if you run

gem -v
2.4.5.1

You get the version outputed.
Last step is to install the [Ruby Development-Kit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit)
Enjoy ūüôā