Monday 30 December 2013

delete the dashboard screen on os x mavericks

open terminal and type

defaults write com.apple.dashboard mcx-disabled -boolean true

press enter

then type

killall Dock

to relaunch and dashboard should be gone

Friday 6 December 2013

install rabbitmq management plugin ubuntu

First install rabbitmq from the website.

Download the .deb package and run, this is the best way to get the latest code.

once installed, run the following commands:

/usr/lib/rabbitmq/lib/rabbitmq_server-x-x-x/sbin/rabbitmq-plugins enable rabbitmq_management

you should see:

The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_mochiweb
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management

now run:

/usr/lib/rabbitmq/lib/rabbitmq_server-2.7.1/sbin# service rabbitmq-server restart

now go to

http://localhost:15672

in your browser, all running :)


Thursday 5 December 2013

install maven 3 ubuntu

cd ~/Downloads
wget http://apache.mirrors.timporter.net/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
tar -xzvf apache-maven-3.1.1-bin.tar.gz
sudo mkdir -p /usr/local/apache-maven
sudo mv apache-maven-3.1.1 /usr/local/apache-maven

export M2_HOME=/usr/local/apache-maven/apache-maven-3.1.1
export M2=$M2_HOME/bin
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$M2:$PATH

put the above 4 lines in your ~/.profile

Monday 18 November 2013

Where can I download m2eclipse? the drag the install button does not work

Open eclipse, go to

help -> install new software

paste

http://download.eclipse.org/technology/m2e/releases

check both boxes, click next and finish..

done

Thursday 7 November 2013

nosql with sql - prestodb is open sourced

http://prestodb.io/

WHAT IS PRESTO?

Presto is an open source distributed SQL query engine for running interactive analytic queries against data sources of all sizes ranging from gigabytes to petabytes.

Presto was designed and written from the ground up for interactive analytics and approaches the speed of commercial data warehouses while scaling to the size of organizations like Facebook.

WHAT CAN IT DO?

Presto allows querying data where it lives, including Hive, HBase, relational databases or even proprietary data stores. A single Presto query can combine data from multiple sources, allowing for analytics across your entire organization.

Presto is targeted at analysts who expect response times ranging from sub-second to minutes. Presto breaks the false choice between having fast analytics using an expensive commercial solution or using a slow "free" solution that requires excessive hardware.

WHO USES IT?

Facebook uses Presto for interactive queries against several internal data stores, including their 300PB data warehouse. Over 1,000 Facebook employees use Presto daily to run more than 30,000 queries that in total scan over a petabyte each per day.

Leading internet companies including Airbnb and Dropbox are using Presto.

Presto is amazing. Lead engineer Andy Kramolisch got it into production in just a few days. It's an order of magnitude faster than Hive in most our use cases. It reads directly from HDFS, so unlike Redshift, there isn't a lot of ETL before you can use it. It just works.
Christopher Gutierrez, Manager of Online Analytics, Airbnb

We're really excited about Presto. We're planning on using it to quickly gain insight about the different ways our users use Dropbox, as well as diagnosing problems they encounter along the way. In our tests so far it's been rock solid and extremely fast when applied to some of our most important ad hoc use cases.
Fred Wulff, Software Engineer, Dropbox

Wednesday 6 November 2013

bingiton results

To be honest, I am surprised google got 5 out of 5, but it was a fair test.

I switched between left and right choices, so they do not keep bing on one side and google on the other.

Some insight in to why I made my choices:

Ebay results coming top, I did not like that.

When I searched my blog I got no results on bing! but then it is hosted on google :)

For mongodb I preferred results that pointed me towards the mongodb documentation rather than stackoverflow answers, which should rightly appear a bit further down the results.

The other searches were just better quality results in my opinion.

Try it yourself: http://www.bingiton.com/


bingiton results

Tuesday 5 November 2013

Mongodb - Find items where a property in a nested array does not contain a string

Give the following json document (below) stored in mongo, how can I find elements which meet all the below:

SearchTerm equal to a specified string
DisplayURL in the nested Ads collection which does not contain a specified string
Position in the nested Ads collection which does not contain a specified string

The query to do this is at the bottom of the page. First a bit of background.

My mongodb instance contained 3 million of these records. When I ran the query the first time, it took around 7-8 seconds to complete. I made the index:

ensureIndex({ SearchTerm:1 }, { "Ads.DisplayURL":1 })

It then took less than 0.1 seconds to run.

Here is the json document I am using:

{
  "LocalDay": "2013-11-05T00:00:00",
  "PageIndex": 1,
  "PageId": 961425400,
  "Ads": [
    {
      "Rating": "",
      "DisplayDomain": "",
      "Title": "(ACE) Top 25 at home exercises - American Council On Exercise",
      "ClickURL": "http:\/\/www.acefitness.org\/acefit\/fitness-programs-article\/2863\/Top-25-At-Home-Exercises\/",
      "Rank": 1,
      "DisplayURL": "www.test.com",
      "Description2": "",
      "UrlDomain": "",
      "Description1": "",
      "Position": "N"
    },
    {
      "Rating": "",
      "DisplayDomain": "",
      "Title": "The Ultimate Home Workout - Shape",
      "ClickURL": "http:\/\/www.shape.com\/fitness\/workouts\/ultimate-home-workout",
      "Rank": 3,
      "DisplayURL": "www.test.com",
      "Description2": "",
      "UrlDomain": "",
      "Description1": "",
      "Position": "N"
    }
  ],
  "PagesDeep": 1,
  "DBStoreTime": "2013-11-05T09:56:12.627",
  "HTML": "",
  "LocationId": 2,
  "VariantId": 2,
  "NumNatural": 10,
  "SearchTerm": "exercise at home",
  "BrowseTime": 1516,
  "ServerId": 2454,
  "Blocked": "False",
  "Page1TopAds": "",
  "EngineId": 6,
  "utcstoretime": 1383645873,
  "SearchTermId": 1643017
}

The working query:

db.extractedads.find({
"SearchTerm" : "some search"
}, {
"Ads": {
$elemMatch: {
Position: { "$regex" : "^((?!somestring).)*$" },
DisplayURL: { "$regex" : "^((?!somestring).)*$" }
}
}
})

Or in one line so that you can run in the mongodb console:

db.extractedads.find({"SearchTerm" : "somestring" }, {"Ads": { $elemMatch: { Position: { "$regex" : "^((?!somestring).)*$" }, DisplayURL: { "$regex" : "^((?!somestring).)*$" } } } })

Friday 25 October 2013

hdfs commands

hadoop fs -cmd <args>

hadoop fs -ls /

hadoop fs -lsr /

hadoop fs -mkdir xxx/xxx

hadoop fs -put file.txt

hadoop fs -cat file.txt | head

hadoop fs -tail file.txt

hadoop fs -rm file.txt


Compiling and running a Hadoop java program

create classes from .java code file

javac -classpath hadoop-core-1.2.1.jar:lib/commons-cli-1.2.jar -d code/classes code/WordCount.java

create .jar from classes 

jar -cvf code/wordcount.jar -C code/classes/ .

run the program

hadoop jar code/wordcount.jar org.apache.hadoop.examples.WordCount inputdir outputdir

view the results

hadoop fs -cat output/*

Wednesday 23 October 2013

Hadoop Pseudo Distributed Mode

The pseudo-distributed mode is running Hadoop in a “cluster of one” with all daemons running on a single machine. This mode complements the standalone mode for debugging your code, allowing you to examine memory usage, HDFS input/output issues, and other daemon interactions.

edit conf/hadoop-env.sh

so that the line below points correctly to your java installation:

#The java implementation to use. Required.
export JAVA_HOME=/usr/local/jdk1.7.0_45
Edit the xml files in /conf dir

core-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
<description>The name of the default file system. A URI whos scheme and authority determine the FileSystem implementation.</description>
</property>
</configuration>

mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
<description>The host and port that the MapReduce job tracker runs at.</description>
</property>
</configuration>

hdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>The actual number of replications can be specified when the file is created.</description>
</property>
</configuration>

In core-site.xml and mapred-site.xml we specify the hostname and port of the NameNode and the JobTracker, respectively. 

In hdfs-site.xmlwe specify the default replication factor for HDFS, which should only be one because we’re running on only one node. 

We must also specify the location of the Secondary NameNode in the masters file and the slave nodes in the slaves file. Make sure you are in the conf dir:

cat masters >> localhost

cat slaves >> localhost

While all the daemons are running on the same machine, they still communicate with each other using the same SSH protocol as if they were distributed over a cluster. Section 2.2 has a more detailed discussion of setting up the SSH channels, but for single-node operation simply check to see if your machine already allows you to ssh back to itself.

ssh localhost

If it does, then you’re good. Otherwise try entering the following:

sudo apt-get install openssh-server
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa

cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

You are almost ready to start Hadoop. But first you’ll need to format your HDFS by using the command

bin/hadoop namenode -format

We can now launch the daemons by use of the start-all.sh script. The Java jps command will list all daemons to verify the setup was successful.

bin/start-all.sh

jps

connect to host localhost port 22: Connection refused

if you are using ubuntu or mint, ssh server is not installed by default, only the client is, so run the following and this should fix the problem:

sudo apt-get install openssh-server

Saturday 19 October 2013

Install Sun Java on Mac OS X and set JAVA_HOME path

First, go here:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Click on JDK download box. This takes you to a new page with all the downloads on it.

Download the correct installation for your machine. For this tutorial, we will use the one that says Mac OS X x64. So, download the dmg file, then, when it completes downloading, double click it, and install like any other software.

What we want to do now is let our operating system know where this installation lives. Once we do this, and other software that you use that would like to use Java, will be able to use this operating system variable to find our Java installation.

These "operating system variables" are known as Environment Variables.

Run these two lines in your terminal:

export JAVA_HOME=/Library/Java/Home
export PATH=$PATH:$JAVA_HOME/bin

Now, to check that it has been set correctly, you can run:

echo $JAVA_HOME

and the output should be the location that you just set above.

To see the version of java you have installed, run

java -version

thanks

Monday 14 October 2013

How do I move tempdb location SQL Server

This is how to move your tempdb location.

Why?

Maybe they have grown too big and the existing drive does not have enough space.

It can improve database disk read speed as they can be read in parallel.

Below are instructions to move the existing tempdb files to new drives, g and h.

Open management studio and connect to your server. Start a new query, and run the following sql to get the current location of your tempdb files:

USE TempDB
GO
EXEC sp_helpfile
GO

The results should show the name of the files and their location.

The names of the files are usually tempdev and templog. Location should be something like:

C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\tempdb.mdf

Remember the names, they will be used in the next statement:

Run the sql below to move mdf and ldf tempdb files.

USE master
GO

ALTER DATABASE TempDB MODIFY FILE (NAME = tempdev, FILENAME = 'd:datatempdb.mdf')
GO

ALTER DATABASE TempDB MODIFY FILE (NAME = templog, FILENAME = 'e:datatemplog.ldf')
GO

zoomquilt is pretty amazing

Take a look herre: http://zoomquilt.org/

Sunday 13 October 2013

How can I see where python is installed? Linux - Ubunutu - Mint

to see which directories make up your python installations, you can type:

whereis python

simple as that.

you can type

which python

to see the default installation location

and you can type

python 

on its own to get the version

Saturday 12 October 2013

vmware workstation path is not a valid path generic kernel headers

Before installing Vmware Workstation you need to install build-essential and linux headers

sudo apt-get install build-essential linux-headers-$(uname -r)

and then

sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h

now install vmware tools

Wednesday 9 October 2013

Install Sun Java on Mint, Ubuntu, or any linux dist

First, go here:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Click on JDK download, and download the correct installtion for your machine. For this tutorial, we will use the tar.gz version.

So if you are using a 64bit linux distribution, the file will look something like: jdk-7u40-linux-x64.tar.gz (version permitting)

What we want to do is extract the contents, then let our operating system know where this installation lives. Once we do this, and other software that you use that would like to use Java, will be able to use this operating system variable to find our Java installtion.

These "operating system variables" are known as Environment Variables.

Once you have downloaded the file, open terminal, cd to where the file is located. Good practice is to first move the file to a better location than Downloads. So:

sudo mv jdk-7u40-linux-x64.tar.gz /usr/local

then

cd /usr/local

now you are in the correct directory, and so is your java download. To extract the contents, issue the command:

tar xzf jdk-7u40-linux-x64.tar.gz

Now, add or change these two lines in your ~/.profile to point to the installation:

export JAVA_HOME=/usr/local/ jdk-7u40

export PATH=$PATH:$JAVA_HOME/bin

Wednesday 2 October 2013

SQL Server Express through firewall on AWS

This is just to help anyone that gets caught out.

SQL Server Express does not, by default, run on port 1433 like SQL Server.

It can be set to run on a random port.

To find the port your instance is running on:

Open SQL Server Configuration Manager

Under protocols for SQL Express: "enable all"

In TCP/IP properties, go to the bottom of IP addresses, change or note the port.

Now open up AWS firewall for that port and you are ready to go :)

Tuesday 10 September 2013

Python virtualenv on windows 7 quick tutorial

Install virtualenv via pip or easy_install

pip install virtualenv

Make sure site_packages (C:\Python27\Lib\site-packages) is in your env path

See here if you dont know how to set an environment variable in windows

http://objectisnull.blogspot.co.uk/2013/10/set-python-environment-variable-windows.html

Best practice is to make a directory where all your virtual environments will live. So, maybe in your home dir,

mkdir virt_env

The default python interpreter that will be used is the one that you used to install virtualenv.

To create a new virtual env, enter:

virtualenv name_of_dir

So typing "virtualenv virt1" (ignore the quotes) will create a new directory called virt1, and it will have your default python instance, easy_install, pip, its own package directory and everything else you need.

A couple of useful arguments that you can pass when creating your virtual env are:

--no-site-packages (this means give access to the global site packages in your virtual env. I think this is the right way to do it, otherwise things can get messy)

--python=path_to_a_python_interpreter (this is how you create a virtual env for a specific python interpreter, probably the most useful thing you can do with virtualenv)

Now, to use a virtual env that you have created. Just execute activate inside the virtualenv's scripts directory:

virt_env\virt2\scripts\activate

You will now see your command window change to show that you are using that virtual environment. Try using pip install some_package, and you will see that the newly downloaded package is installed in your virtualenv, and not in the main python installations site_packages/

Enjoy

Friday 2 August 2013

Visual Studio 2012 Database Project sqlproj project type not supported

I just encountered this problem, so thought id post it here for my future ref, and in case you find it, it may help..

You are running vs 2010 and 2012 side by side, you try and create a sql server db project in 2012 and get a "this project type is not supported", relating to the project type sqlproj..

To fix this, you just need to install sql server data tools for VS 2012. You can download them from the link below.. Hope it fixes your issue..

go to the link below and click the link "Download SQL Server Data Tools for Visual Studio 2012"

http://msdn.microsoft.com/en-us/jj650015

Saturday 20 July 2013

Set Python Environment Variable - Windows 7

Unlike when you install ruby, when you install python on windows 7 the environment variable is not set. This means that you will have to put the full path of your python installation in to the command line to execute any commands.

To set the path of your python installation in an environment variable follow these steps:

click the start buttong

right click computer and select properties

click "advanced system settings" on the left

the system properties windows should open

make sure the "advanced" tab is selected

click the environment variables button at the bottom of the tab

you will see a window open split in to 2 windows "user and system variables"

click new on the top one (user variables)

click new and enter "Path" as the variable name

"C:\Python26;C:\Python26\DLLs;C:\Python26\Lib;C:\Python26\Lib\lib-tk" (without the quotes) for variable value

switch the path to wherever your python installation is. done, reopen the command prompt and when you type python you should see details of the installed version.

Enjoy

Sunday 7 July 2013

Find out which processes are running, and what software is making out-going connections from your PC

Right click start bar -> Start Task Manager -> Select Performance Tab -> Click the "Resource Monitor" button at the bottom

In the Resource monitor, click the Overview Tab

This shows all running processes in the CPU section

All network connections are show in the Network tab

Now, in your in terminal: (start -> run -> type "cmd" hit enter)

in one window type: netstat -abfo 5

in another window, type: tasklist /svc

now correlate that info with the resource monitor, hit google for any unknown or suspicious signs, and you should finish up knowing a lot more about whats happening on your pc :)

Friday 5 July 2013

windows equivalent of linux alias - windows tip

When using command line anywhere in windows

type

doskey cdapp=cd c:\somedir\myapp\xyz

ie: dokey shortcutname=any command you want

then when you type shortcutname, the command will execute

to list all your shortcuts (macros, aliases, snippets) whatever

type doskey /macros

to delete one type
doskey shortcutname=

ie put the shortcut name followed by =

Done

Wednesday 5 June 2013

linux or mac find command for terminal

This command will find you everything in /usr/bin/ with the text "log" in it..

Type in your terminal and then press enter:

find /usr/bin/ -name *log*

(where * is a wildcard)

Note: if you are searching in protected directories, you may need to sudo this command

Tuesday 7 May 2013

Put Android ADB in your command path Linux \ Ubuntu

First of all, make sure you are in your home path so execute

cd ~

then we need to edit the .bashrc file, so type

sudo nano .bashrc

then add the line below to this file, switching user and path to suit your needs..

export PATH=${PATH}:/home/user/android-sdk-linux/platform-tools:/home/user/Downloads/Android/android-sdk-linux/tools

restart your terminal, type android to check the tools path, and adb to check the platform-tools path.

done.

Friday 12 April 2013

rvm for rails tutorial. what is it and why do I need it.. a simple explaination - for mac osx mountain lion

The information below is for mac and linux systems, but can easily be adapted for windows.

There are lots of tutorials out there on how to use rvm, this is another one..

Why? someone asked me to explain how to use rvm, and instead of writing them a long email, I thought I would write it here.. However, this is a bit different, I am concentrating more on the workflow, why would you use it, and how to use it. There are more extensive tutorials out there on actual installation and configuration, which I will provide links to at the bottom of this post, they will provide a nice compliment to this one (or vice versa).

What is RVM? RVM stands for Ruby Environment Manager. While developing with Ruby, you might run into situations where you’d need to use multiple versions of Ruby. maybe you are using Ruby 1.9.2, and someone gives you an old rails project to look in to that uses an older version, and lots of older gems that you perhaps do not want to install in to your main system Ruby installation. Another good reason would be one I used today, you had to look at someone else's code , maybe to help answer a question on stackoverflow, you dont want to install all the gems they require for this project in your system, you only want them to install for this project, and when you are finished looking at it, you would like to be able to remove them alongside the project.

Without RVM, it’s pretty difficult to have more than one version of Ruby on your computer, and impossible to store gems relating to just one project, ruby gems will install by default in your system ruby's installation path..

You may also want to try an alternate Ruby interpreter, like Rubinius or JRuby? How can you take one out for a spin without giving up your faithful MRI install? This is where RVM steps in. It’s basically a framework that handles multiple installations of Ruby for you, and makes it easy for you to switch between them.

So, weve established there are lots of reasons that you may want to install RVM, so lets install it..

1. Install RVM

First, to install rvm, type the following in your terminal.

curl -L https://get.rvm.io | bash -s stable

For more advanced installation choices, see rvm documentation, but I am assuming if you are here reading this, then you wont need those just yet. The command you ran above will create a .rvm dir in your $Home. To check that completed successfully (on a mac), type cd ~ to get to your home directory.

2. Install Ruby Versions for RVM

First thing you need to do after installation, is install some ruby versions that RVM can use. You will most likely have one already installed on your system. RVM will refer to this as your system installation.

To install newer versions, type the commands below in to your terminal:

rvm install 1.9.2

rvm install 1.9.3 (or any version that you want)

**Note, RVM needs to compile the files it downloads. If you are on a mac, you may need to install xcode command line tools, and other gcc libraries, RVM will tell you this if you do need to. If this is the case, the output in the terminal from RVM should also tell you everything you need to know to get this step working. If this is not enough, please refer to the links at the bottom of this page, they will contain full information on how to do this.

3. How to use RVM

Now you have the chance to use different versions of ruby for every project you make, and also install gems relating to just one project (for this example we are using rails projects).

Lets say you are in you home directory (get there by issuing the following command in your terminal: cd ~

First, (and you can actually be anywhere on your system when issuing this command, it wont matter), lets say we are about to create a new rails project called "myrvmtest". We want to use ruby version 1.9.2 for this, and we want to be able to install gemsets against this project only. Every time you issue a command for create or delete with RVM, first you tell it what version of ruby you will be using. So, to switch to version 1.9.2 and create the rvm gemset for myrvmtest, we type the folloiwing two commands in the terminal:

rvm use 1.9.2

rvm gemset create myrvmtest

This has created a new gemset in rvm for our new project that we are about to create.

As a side note, if you are on a mac, a nice GUI interface for rvm is JewelryBox, it is worth installing, but you really should know how to use RVM properly first before using it.

http://unfiniti.com/software/mac/jewelrybox

So, we now have a gemset for the new project, lets create the new project. At this stage, this could be a new project, or an existing rails project, the only step that would be different for an existing one, is that you would skip the rails new project step.

Now, create a new rails project: rails new myrvmtest

cd in to that directory: cd myrvmtest

Create a new file named .rvmrc inside the root of this directory touch .rvmrc

What this file will do, is each time you enter this directory, it will use RVM to switch to the appropriate gemset. We tell it to do this, by putting the following line in to the .rvmrc file. Open your favourite text editor, and put this in the file (note, if you cant see the file, it is because it is hidden, all files on mac and linux beginning with a . are hidden files. If you dont know how to view hidden files on your operating system, you should google it to find out)

rvm 1.9.2@myrvmtest

Now, cd back to your home directory cd ~

The cd back in to myrvmtest cd myrvmtest

You should see a message on the screen from RVM, type yes and hit enter.

You are now using the gemset we just created. To check this, and to make sure the gems you are installing are going in to the correct directories, type:

gem env gemdir

this shows where any gems you install are going to live. so if you go to your home dir in terminal and type that, the output should be /Library/Ruby/Gems.1.8 or similar. However, when you traverse back in to a dir with a .rvmrc file, the output should be similar to /Users/username/.rvm/gems/ruby-1.9.2-p32... and you should see that the path is not your system ruby, but a path inside rvm that contains your project name. You can safely be assured now, that if you type

gem install .... the gem will install in this path, nice and clean and easy to remove.

To delete the test projects we made, type the following in your terminal

rvm use 1.9.2

rvm gemset delete myrvmtest

and it will be gone.

To delete the entire rails project, from your home directory, you would type rm -rf myrvmtest

Hope all this was helpful, Paul

useful links

http://cheat.errtheblog.com/s/rvm/

http://screencasts.org/episodes/how-to-use-rvm

http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/

Monday 4 March 2013

Extract tar tar.gz tar.bz2 files linux command

get asked this all the time, so here are the most common extract commands.

Extract the contents of "filename.tar" 
Command: tar -xvf filename.tar 

Extract the contents of "filename.tar.gz" 
Command: tar -zxvf filename.tar.gz 

Extract the contents of "filename.tar.bz2" 
Command: tar -jxvf filename.tar.bz2

Sunday 3 March 2013

mac terminal cd to network drive

You may have a nas drive, or any drive that is accessible through finder, but you would like to 'cd' to it in the terminal, perhaps to issue some git commands.

Here is how to do this..

1. First of all, in finder, look under the SHARED list, whatever your drive is called there is what you will use in the coming command. For this example, I will assume your network drive is named: nas-fe-29-23

2. We will be mounting a specific directory on that share, for this example, I will assume that directory is named "code". (//nas-fe-29-23/code)

3. Create an empty directory wherever you like, this will be turned in to the drive. To make that clearer, when you use the command to mount the drive which we will do in a few lines, it needs a directory to use as the mount point for your network share, dont worry, all will become clear.. For this example, ill assume you have created an empty folder in your home directory: ~/MyNewDir

4. Open terminal, and type the following command:

mount_smbfs //username:password@nas-fe-29-23/code ~/MyNewDir

When you press enter, the drive will be mounted. If you look in finder, the "MyNewDir" directory that you created, will now look like a drive and not a normal dir. It will also be given the same name as the network directory that you chose, so in this case "code".

Now in terminal you can cd ~/code

Have fun!

Wednesday 6 February 2013

Install, Create, or Pin Eclipse in Launcher Ubuntu Unity

Hi, this was a popular post on my old blog, so I thought I would re-post it.

Thing 1
Download the eclipse tarfile that you want to install from: http://www.eclipse.org/downloads/

See here how to extract the file if you do not know

http://objectisnull.blogspot.co.uk/2013/10/extract-tar-targz-tarbz2-files-linux.html

Thing 2
Now you have a folder called eclipse sitting in, lets say your Downloads folder. (switch Downloads to wherever you have extracted the eclipse folder)
remember, if you’re coming from windows, linux file system and commands are case sensitive, so make sure to be mindful of that when issuing the upcoming commands :)
Now we are ready to move the eclipse folder to where all application should live on our system /usr/lib/

So, our first command:

sudo mv ~/Downloads/eclipse /usr/lib/

Thing 3
So, this tutorial is about getting a nice icon on our launcher to start eclipse, but while we are here, we should also give ourselves the ability to start eclipse by typing “eclipse” in the terminal, so lets do that now. We will create a symbolic link in /usr/bin/.

sudo ln -s /usr/lib/eclipse/eclipse /usr/bin/eclipse

Thing 4
We now have everything in the right place, all we need to do is create a file that can be locked to the launcher once its opened. Remember, the launcher works differerently from other docks. You cant just drag the eclipse icon on to it. Once we are done with this step, youll open clipse, then right click on launcher and chose “lock to launcher” - anyway, lets get on with it:

so, we’re going to create a .desktop file in “/usr/share/applications”:

sudo gedit /usr/share/applications/eclipse.desktop

(you can switch gedit for vi, nano, or whatever editor you prefer to use)

now put the following content in that file:

[Desktop Entry]
Version=3.7
Name=Eclipse
GenericName=Text Editor

Exec=eclipse
Terminal=false
Icon=/usr/lib/eclipse/icon.xpm
Type=Application
Categories=IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=eclipse -n
TargetEnvironment=Unity

thats it, were all done. to test everything is wired up correctly, go in to /usr/share/applications/ via file manager, and double click the eclipse icon to start eclipse. it should launch with no problems.

once thats done, right click the eclipse icon on the launcher, and select lock to launcher..

enjoy,

Paul

Saturday 2 February 2013

After adding gitignore, remove unwanted files

First, commit any outstanding code changes, and then, run this command:

git rm -r --cached .

This removes everything from the index, then just run:

git add .

Commit it:

git commit -m ".gitignore is now working"

Saturday 5 January 2013

Show hidden files Mac OS X 10.7

I am sure ill forget this command so it is more for me than anything else. Type this in your terminal and then press enter.

defaults write com.apple.Finder AppleShowAllFiles YES


For command to take affect, you must relaunch finder. TO do this, hold ‘alt’ on the keyboard, right click on the Finder icon, and click on Relaunch


To re-hide the hidden files, follow the same process, but type the following in the terminal window:

defaults write com.apple.Finder AppleShowAllFiles NO