Wednesday, August 8, 2012

Git Bare Repo - Concept Summary

Do you get the below error: on GIT PUSH ?????

remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.


Understand the concept: : )



Notice 1, 2, 3, 4

2 - is the bare repo

To update the source of truth repo, you have to pull

To update the shared repo from the working , you have to push to it.

Sunday, August 5, 2012

Groovy Patterns - I just forget!


 http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html



def thePattern = /foo/
def theString = "boo foo";
def theMatcher = theString=~thePattern


//1.
//it's "true" if it has at least one match,
if( theString =~ thePattern){
println "true";
}else{
println "false"
}


//2.
//print the the matcher to see
println theMatcher;
//note theMatcher is an array
println theMatcher[0];


//3
def stringToMatch = '''abc quick brownfox ? blah blah'''

def myPattern = /blah/

def m = stringToMatch=~myPattern
println m[0] + m.size()

Thursday, July 5, 2012

Debian file permissions

list file permissions with ls -l

-  rwx   r_x    _wx
 

  • The first "-"  says the file type. d|f|s (directory, file, or symlink)
  • The next three chars "rwx" are the privileges for the user
  • And the next "r_x" are the privileges for the group.
  • "_wx" are the privileges for others

Note the "_"  means denied. or not set.

chmod u-r myfile means , remove read privileges from the user.

e.g.
nano myfile.
touch myfile.
echo "blah" >> myfile
cat myfile.

Restore Xorg.conf file in Debian/Mint/Ubuntu (Dual Monitor configuration in mint)


Heres what happend, I edited the xorg.conf file and when I restarted my PC, i got blank screens in both my monitors.

How I resolved it:?

1) Booted my PC with a Bootalble Linux Live Mint CD (same as OS),
2) Type "gparted"  into the filter text box  of the start menu or in terminal  window.
3) Once the partitions window is open , locate the partition name  that points to your hard drive's Linux partition.
Most probably it will be marked with /ext4/ . You should be able to figure it out, by looking at the details in 'gparted.'
4) Now mount it:  type: sudo mount /dev/sda1 /mnt  (Note: My mount location was /dev/sda1,..yours may be different)
5) cd /mnt/etc/x116) create a default xorg.conf file with the following content.
     
        Section "Device"
        Identifier      "Default Device"
        Option  "NoLogo"        "True"
        EndSection

7) Restart your machine everything should be fine.8) If you want dual monitor configuration, type NVedia X Server in the Start filter box, and use that application to configure your second monitor.Cheers.

Sunday, June 17, 2012

Quick Start C++ in Linux Mint/Ubuntu/Debian Hello World

1) Install C and C++ Compilers in Mint 

      sudo aptitude install build-essential 


2) Compile the first Program sudo gedit first.c add the following lines save and exit the file



            #include int main() { printf("Hello world\n"); return 0; } 


3) Firstly compile the code using the following command 

     cc -c first.c 
 that would produce an object file you may need to add to the library.


 4) then create an executable using the following command 

 cc -o first first.c


 5) Now run this executable using the following command

 ./first

Tuesday, January 31, 2012

Fix Broken Packages

Debian, fix broken package installations sudo apt-get -f install Running a .DEB file sudo dpkg -i skype-ubuntu_2.2.0.35-1_amd64.deb