Advertisements

#MacOsX : Reset NVRAM, PRAM and SMC

Sometimes after a software (system) or hardware upgrade even Macs can have some problems; if you have tried every solution without success you could try this.

Every Mac stores certain settings in a special memory area even if it is turned off. On Intel-based Macs, this is stored in memory known as NVRAM; on PowerPC-based Macs, this is stored in memory known as PRAM.

Resetting NVRAM and PRAM may solve lot of problems and could be required if you upgrade SSD or Mac firmware (more tips on SSDs here).

Another step to try is Resetting the System Management Controller (SMC). An SMC reset should only be attempted after all other standard troubleshooting has been performed.

 

 

Advertisements

#MacOsX : Disable Auto-Save and Versions in Mac OS X

Auto-Save and Versions are excellent features in Mac OS X, but some advanced users are annoyed by  them as they often don’t want to save intermediate versions of their work.
Moreover some apps write lots of data on disk (e.g. iMovie and iBooks Author) and this can shorten the life of SSD (look here for more tuning for SSDs).
If you know the name of the app plist you want to disable auto-save and Versions for, you can just plug the name into the defaults write command:

defaults write app-plist ApplePersistence -bool no

If you don’t know it then you can find it with the following command:

osascript -e 'id of application "NAME OF APP"'

Now if you enter the Versions window, auto-save list will be empty and there are no versions to restore to. You’ll probably want turn off File Locking too.

NOTE: some sandboxed apps require another command in addition:

defaults write app-plist AutosavingDelay -int 0

This is expecially true for TextEdit as it is the only Apple app that uses “old-style” autosaving and this causes issues with the sandbox in Lion/Mountain Lion.

NOTE2: It seems that the preference can be set globally but it may cause the login process to become very slow and possibly cause other unexpected behaviour:

defaults write -g ApplePersistence -bool no

#MacOsX : Turn Off File Locking

Mac OS X Lion has introduced automatic file locking for files that hasn’t been edited recently.

To Disable File Locking:

  • open System Preferences > Time Machine
  • click on Options
  • uncheck the box next to “Lock documents [2 weeks] after last edit” or modify the value as preferred
  • done 🙂

#IMEI : Secret Code

If you wanna find IMEI of your phone, just type:

*#06#

NOTE: it works for any phones of any era. 😉

#CryptDB : HOWTO Compile on Ubuntu Linux [UPDATE 2]

First, what is CryptDB.
A SHORT PRESENTATION, very useful to understand how it works.

Second, reference system: Ubuntu Linux LTS 12.04.x 32bit 64bit (see this comment).

Third, [NEW] installation:

sudo apt-get udate
sudo apt-get install git ruby
git clone -b public git://g.csail.mit.edu/cryptdb
cd cryptdb
sudo ./scripts/install.rb .

Done. It’s that simple now 😎
If it fails to compile, see THIS comment.

If you still do not succeed see THIS comment.

With recent version of Ubuntu (14.04 and 16.04) you might need to downgrade Bison, see THIS comment.

[OLD] installation:

  • install needed packages:
    sudo apt-get install automake bison bzr cmake flex g++ git gtk-doc-tools libaio-dev libbsd-dev libevent-dev libglib2.0-dev libgmp-dev liblua5.1-0-dev libmysqlclient-dev libncurses5-dev libntl-dev libssl-dev
  • create a directory, then download software to compile:
    mkdir $HOME/cryptdb-inst
    cd $HOME/cryptdb-inst
    git clone -b public git://g.csail.mit.edu/cryptdb
    wget http://es.csail.mit.edu/mysql-5.5.14.tar.gz
    bzr branch lp:mysql-proxy
  • compile mysql-proxy:
    cd mysql-proxy
    sh ./autogen.sh
    ./configure --enable-maintainer-mode --with-lua=lua5.1
    make
    sudo make install
  • build CryptDB on MySQL:
    cd $HOME/cryptdb-inst
    tar xzf mysql-5.5.14.tar.gz
    cp -R cryptdb/parser/mysql_mods/* mysql-5.5.14/
    rm mysql-5.5.14/sql/sql_yacc.{cc,h}
    cd mysql-5.5.14
    mkdir build
    cd build
    cmake -DWITH_EMBEDDED_SERVER=ON ..
    make
    sudo make install
    cd /usr/local/mysql
    sudo chown -R mysql .
    sudo cp support-files/my-medium.cnf /etc/my.cnf
    sudo scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/
    sudo /usr/local/mysql/bin/mysqld_safe --lc-messages-dir="/usr/local/mysql/share/english/"
    /usr/local/mysql/bin/mysqladmin -u root password 'letmein'
  • Build CryptDB:
    cd $HOME/cryptdb-inst/cryptdb
    cp conf/config.mk.sample conf/config.mk
    sed -i'' -e"1s%/home/nickolai/build%$HOME/cryptdb-inst%" conf/config.mk
    make
    sudo make install
  • now, it’s time to read cryptdb/doc/README, enjoy! 😉

NOTE1: you should create a user mysql to run DBMS for security reasons:
sudo groupadd mysql
sudo useradd -r -g mysql mysql

NOTE2: be very careful on each step and you wont fail.

#VMware Fusion : Fix Ubuntu Linux “Host SMBus controller not enabled!” [UPDATED]

Ubuntu guest instances in VMware sometimes come up with the boot error message:

piix4_smbus 0000:00:007.3: Host SMBus controller not enabled!

This error is being caused because VMware doesn’t actually provide that level interface for CPU access, but Ubuntu try to load the kernel module anyway.

How to fix it:

  • sudo nano /etc/modprobe.d/blacklist.conf
  • add the line:
    blacklist i2c-piix4
  • reboot

NOTE: for older versions use blacklist i2c_piix4 instead.
NOTE: it works both in VMWare Fusion 5 and 6, and Ubuntu LTS 12.04 and 14.04

#MacOsX : VMware Fusion 5 vs. VMware Fusion 6 vs. VMware Fusion 7 vs. Parallels Desktop 7 [UPDATED]

I will not present functionalities here; it will be just a really brief benchmark.

Configuration:

  • Hard Disk OCZ-AGILITY3 240 GB, firmware 1.15
  • Graphics  NVIDIA GeForce 9400M 256 MB
  • Memory  8 GB 1333 MHz DDR3
  • Processor  2.26 GHz Intel Core 2 Duo
  • MacBook Pro 13-inch, mid 2009
  • Software
    • Hosts: Mac OS X Lion 10.7.4 (Parallels 7, Fusion 5), Mac OS X Mavericks 10.9.4 (Fusion 5, Fusion 6), Mac OS X Yosemite 10.10.4 (Fusion 6, Fusion 7)
    • Guest: Windows 7

Some info:

  • VMs have 2,5 GB RAM allocated
  • VMs have 1 CPU allocated
  • Parallels was tested when disk was new, while Fusion with half of the space occupied
  • Parallels VM has optimize Windows performance on
  • Fusion VM has disk buffering disabled
  • Fusion 5.0.5, Fusion 6.0.4, and Fusion 7.1.2 were tested with Windows Aero OFF
Component Parallels 7.15106 Fusion 5.0.[1-3] Fusion 5.0.5 Fusion 6.0.4 Fusion 7.1.2
Processor: 4.4 4.4 4.4 4.4 4.4
Memory (RAM): 5.5 5.5 5.5 5.5 5.5
Graphics: 5.0 5.0 5.9 5.9 4.7
Gaming graphics: 4.4 4.2 5.1 5.2 4.2
Primary hard disk: 7.2 7.7 7.4 7.4 7.4

NOTE1: Fusion 5 seems to start and stop a bit slower than Parallels 7. Fusion 6 doesn’t improve, but SSD might be slower after this time than it was originally.

NOTE2: disabling Aero drastically improve Graphics performance, so do it!

NOTE3: Fusion 6 improve 3D Graphics performance over Fusion 5, but just slightly, so it is not worth an update. IMHO.

NOTE4: the combination of Mac OS X Yosemite and Fusion 7 has poor graphics performance. It is actually a big regression. I think Apple is to blame here.

#WP7 : LG Optimus 7 Unlock + Interop Unlock + Root Tools

If you want install XAP files without a developer account you can do it by modifying some registry keys:

  1. First go to MFG and follow the path 7.Engineer Menu > 6.Other Settings > Edit Registry
  2. Set the following fields:
    • Select ROOT_PATH: HKEY_LOCAL_MACHINE
    • Input SUB_PATH: Comm\Security\LVMod
    • Input KEY and Select data type:  DeveloperUnlockState   DWORD
    • Input data: 1
  3. Click Set button

To avoid Zune undo to default settings:

  1. Go to MFG and follow the path 7.Engineer Menu > 6.Other Settings > Edit Registry
  2. Set the following fields:
    • Select ROOT_PATH: HKEY_LOCAL_MACHINE
    • Input SUB_PATH: Software\Microsoft\DeviceReg
    • Input KEY and Select data type: PortalUrlProd   DWORD
    • Input data: leave this field empty
  3. Click Set button
  1. Go to MFG and follow the path 7.Engineer Menu > 6.Other Settings > Edit Registry
  2. Set the following fields:
    • Select ROOT_PATH: HKEY_LOCAL_MACHINE
    • Input SUB_PATH: Software\Microsoft\DeviceReg
    • Input KEY and Select data type: PortalUrlInt   DWORD
    • Input data: leave this field empty
  3. Click Set button

From now on your device is unlocked in developer mode, but you cannot install homebrew apps that modify registry keys. You need Interop Unlock:

  1. Go to MFG and follow the path 7.Engineer Menu > 6.Other Settings > Edit Registry
  2. Set the following fields:
    • Select ROOT_PATH: HKEY_LOCAL_MACHINE
    • Input SUB_PATH: Software\Microsoft\DeviceReg\Install
    • Input KEY and Select data type: MaxUnsignedApp   DWORD
    • Input data: 300
  3. Click Set button

NOTE1: if you want install very nasty apps then you need WP7 Root Tools.

NOTE2: Unlock & Interop Unlock works on WP7 Tango too.

NOTE3: to lock device again set DeveloperUnlockState to 0 (zero).

#MacOSX : Make your Mac a Wireless Network Bridge

Sometimes you need to extend wireless field; you can do it transforming your Mac as a Wireless Network Bridge.

Why  your Mac? Maybe a new shining Mac Book Pro? Well, let’s say your city has been hit by a big earthquake, so you had to leave your house, but your wireless network still works. Mobile Network won’t  work due to excessive overhead but you can still access internet to contact your friends and family. Sharing your internet connection give this chance also to many other people (this has been happened to me recently).

First you need a Switch or a Router or a Wireless Access Point and Ethernet cables.

Then:

  • Connect your mac to your wireless network
  • Connect Switch / Router / Wireless Access Point to Mac Ethernet port
  • Go to System Preferences -> Sharing
  • Check Internet Sharing
    • Share your connection from: Wi-Fi
    • To computers using: Ethernet and Bluetooth PAN
  • Let DHCP enabled

NOTE: this way you can connect to internet while you can maintain a secure distance from damaged buildings.

#MacOSX : Subversion Server

You know, Mac OS X is a UNIX system based on FreeBSD, so you can do a lot of NERD things out of the box.

This time you will learn how to setup a Subversion Server:

  1. Open Terminal app
  2. Type:
    mkdir -p /Library/Subversion/Repository
    cd /Library/Subversion/Repository
    svnadmin create myproject
  3. Great! Now that you have created the first repository, you need to configure it; type:
    vim /Library/Subversion/Repository/myproject/conf/svnserve.conf

    You’ll see ### commented lines. The lines with the single “#” comment marks are the ones we need to edit. You’ll want to remove the comments (#) and customize these settings to suit your project’s needs:

    • password-db : this specify text file that stores the usernames and passwords of authorized users for your repository. Unless otherwise specified, it will be assumed that this file is stored in your projects “conf” directory. When you create your repository a “passwd” file is created by default.
    • realm : realm tells clients what they are connecting to. It’s recommended you customize this to something like <Project Name> Subversion Repository.
    • anon-access : this directive indicates what anonymous users are allowed to do with your repository. You should set it to none.
    • auth-access : determines what permission level authorized users will have. In almost every case this will be set to write.
  4. Now you must edit password-db file; you can add as many users to your repository(s) as you want. Add at least one user for yourself so that you can begin committing to your repository:
    vim /Library/Subversion/Repository/myproject/conf/passwd
  5. Next you need to change permissions on the Repository directory so that svnserveis permitted to make changes to the files stored there:
    sudo chown -R root:admin /Library/Subversion/Repository
    sudo chmod -R ug+rwX,o= /Library/Subversion/Repository
  6. Start Subversion Server:
    svnserve -d -r /Library/Subversion/Repository
  7. Check if it works:
    cd
    mkdir project
    cd project
    svn checkout --username <user> --password <user_password> svn://localhost/myproject
  8. If it works you should have myproject directory in Repository. Well Done.

NOTE1: /Library/Subversion/Repository is just an appropriate example for Repository, but you can choose every other location.

NOTE2: in svnserve.conf and passwd files remove every white spaces at the beginning of non empty lines or it will not work.

NOTE3: if you want allow users to connect from internet you should set port forwarding on TCP port 3690 (svn default).

NOTE4: check Subversion Complete Reference for more info.

#MacOSX : Enable Half-Star Ratings in iTunes

iTunes allows users to rate songs on a 1 star to 5 star basis, but what if a song is somewhere in the middle of the rating scale, not quite worthy of 4 stars but not a 3 star song either?

For more precise personal ratings, enable the half-star rating option in iTunes:

  1. Open Terminal app
  2. type:
    defaults write com.apple.iTunes allow-half-stars -bool TRUE
  3. Quit and relaunch iTunes for changes to take effect. To give something a half star, click and slide the star rating scale until the 1/2 value shows.

NOTE: removing the half stars moves the song rating to the star below it, so a 3 1/2 star song would turn into a 3 star song, and so on, but the metadata of the songs are still in half-star increments.
So, if you turn the option back on again, the ‘correct’ half-star ratings would show and be intact.

#MacOSX : Customize Launchpad with Launchpad-Control

Quoting from developer’s site:

Already upgraded to Mac OS X Lion? Yes? Well then you certainly know Launchpad, the “home for your apps” like Apple says.

A huge disadvantage of Launchpad is that every app located in your /Applications folder is shown. That means that you will see little helper programs like uninstallers or updaters, too.
These apps can’t be hidden from Launchpad easily because Apple does not provide any preference pane or tool to do so.

Launchpad-Control is a small tool which allows you to easily hide/unhide apps (and groups) from Launchpad in Mac OS X Lion.

NOTE: it is free, but be kind and make a donation to the developer, he will appreciate it very much. 😉

#MacOSX : Change Launchpad Background

If you do not like default background of Launchpad you can easily change it:

  1. Go to Launchpad
  2. Hit Ctrl + Alt + Cmd + B
  3. Hit more if you want

That’s All. 🙂

 

#MacOSX : IP Scanner Pro, Network Scanning for Dummies

You are accustomed to incomprehensible command line tools???

Finally I have the right solution: IP Scanner Pro

It’s all about friendlyness!!! You can ping, wake up, insert into whitelist, etc all the devices found with just one click.

I will show you just an image, you don’t need anything else! 😉

NOTE: I have hidden MAC address.

#MacOSX : Add Dock Spacing using OnyX

Onyx is a powerfull App which does a lot of things. You can tweak user interface too; what we want to do is adding invisible spaces in the dock.

  1. Start Onyx and enter your administrator password
  2. Go to Parameters tab
  3. Choose Dock tab
  4. Click on the buttons at the bottom: Applications or Others
  5. OnyX will now reboot the Dock

This is how it look like:

#MacOSX [*NIX]: MAC Address Spoofing

MAC Address is a unique identifier of 48 bits assigned to network interfaces.

This Address is unique in the world, so it does identify you, everywhere.

From a Security & Privacy perspective this is not good at all!!!

How to modify it:

  1. Open Terminal app.
  2. Type:
    sudo ifconfig [en0-en1] ether [MAC Address]

    • where you can choose en0 for wired ethernet interface or en1 for airport interface
    • MAC Address is something like FF:FF:FF:FF:FF:FF
      where there are 6 groups of 2 exadecimal symbols separated by colons (:)
  3. Insert your Administrator password.
  4. Go to Network System Preferences, select active interface and push Advanced… button.
  5. In TCP/IP tab click on Renew DHCP Lease button.
  6. You should now see your new MAC Address in Hardware tab.

NOTE: you can set Configure: Manually in Hardware tab to manually set MAC Address and avoid using Terminal.

NOTE2: if you do not renew DHCP Lease you may loose network connectivity.

NOTE3: if you have set MAC Address through Terminal it will be restored to it own default after reboot or shutdown.

NOTE4: some Hotels or private Acces Point use MAC Filtering to prevent abuse of their network. The changing of MAC Address allow you circumviate this kind of restrictions (see MAC Spoofing). This is NOT legitimate, so if you are not an evil user and you need emergency network access, try to set your MAC Address to FF:FF:FF:FF:FF:FF (could not work of course). This way System Administrator will readily understand what is going on. 😉

#MacOSX : Display EDID [UPDATED]

EDID (Extended Display Identification Data) enables Mac OS X to know what kind of monitor is connected to it.
Why are we interested in it? If we know the exact model of LCD connected to our mac we can retrieve who is the manufacter of the panel (which often it is not the brand under the monitor is sold) and its properties (like response time, contrast and brightness) as Apple doesn’t specify they in its own products.

So here we go:

  1. Open Terminal app.
  2. Type (see this comment):
    ioreg -lw0 | grep IODisplayEDID | sed "/[^<]*</s///" | xxd -p -r | strings -6
    ioreg -lw0 -r -c "IODisplayConnect" -n "display0" -d 2 | grep IODisplayEDID | sed "/[^<]*</s///" | xxd -p -r | strings -6
  3. Second line is what we are looking for.

NOTE: if you are interested in how this work, you can type in Terminal (but be ready for a full NERD immersion):

  • man bash
  • man ioreg
  • man grep
  • man sed
  • man xxd
  • man strings

Don’t say i haven’t Warned you! 😀

#MacOSX : System Preferences Archives Pane

Mac OS X support zip & unzip files natively, but you can’t find how to configure it in System Preferences.

Archives Pane exists but it is not installed by default, so you must install it first:

  1. Go to (Shift-Command-G):
    /System/Library/CoreServices/Archive Utility.app/Contents/Resources/
  2. Double-click on Archives.prefPane
  3. Insert your admin password
  4. From now on you have Archives pane in System Preferences

NOTE: it works on Mac OS X Lion, Snow Leopard and Leopard.

#MacOSX : Taking Screenshots

You will be surprised but even without stamp key on the keyboard you can take screenshots whitout 3rd party apps! 😀

There are several keyboard combinations that can be used to take screenshots in Mac OS X. The SystemUIServer process handles these commands.

  • Command-Shift-3: take a screenshot of the screen, and save it as a file on the desktop.
  • Command-Shift-4, then select an area: take a screenshot of an area and save it as a file on the desktop.
  • Command-Shift-4, then space, then click a window: take a screenshot of a window and save it as a file on the desktop.
  • Command-Control-Shift-3: take a screenshot of the screen, and save it to the clipboard.
  • Command-Control-Shift-4, then select an area: take a screenshot of an area and save it to the clipboard.
  • Command-Control-Shift-4, then space, then click a window: take a screenshot of a window and save it to the clipboar.

From Mac OS X Leopard and later, the following keys can be held down while selecting an area (via Command-Shift-4 or Command-Control-Shift-4):

  • Space: to lock the size of the selected region and instead move it when the mouse moves.
  • Shift: to resize only one edge of the selected region.
  • Option: to resize the selected region with its center as the anchor point.

NOTE: different versions of Mac OS X have different formats for screenshots.

NOTE2: in Mac OS X 10.4 and later, the default screenshot format can be changed, by opening Terminal app and typing :
defaults write com.apple.screencapture type image_format
killall SystemUIServer

Where image_format is one of jpg, tiff, pdf, png, bmp or pict (among others). If you omit the second line, you will need to log out and in again for the change to take effect.

#MacOSX : Xlog, Logs As The Desktop Background [OUTDATED]

Ok, this is for sys admin and paranoid people.

If you want see system logging in real time on your desktop there exist an amazing app: Xlog

Here you can see a beautifull screen on how it looks like:

Sadly, Xlog is no longer available in the App Store and stopped working since Mac OS El Capitan.

NOTE: you can set Xlog preferences to start it automatically on login. 😉

NOTE2: you can choose text & background color and transparency.

%d bloggers like this: