Ubuntu: PPAs you should have installed or have in mind

How to install PPAs

 

Faster updates and installs: apt-fast

What is apt-fast:

A script that uses command line download accelerators. It drastically improves updating and installing

How to install:

sudo add-apt-repository ppa:apt-fast/stable
sudo apt-get update
sudo apt-get install apt-fast

In future you use apt-fast everywhere you would’ve typed apt-get

Example

sudo apt-fast update
sudo apt-fast upgrade
sudo apt-fast install
sudo apt-fast autoremove

Manage PPAs easily: y-ppa-manager

What is y-ppa-manager:

A tool for easy management of PPAs. You can remove/purge, update and edit source, as in the screenshot.

y-ppa-manager

How to install:

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install y-ppa-manager

Extend battery life: tlp

What is tlp:

A command line tool that automatically applies tweaks to reduce your battery usage

How to install:

sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw

It will automatically start at system start-up after you restart for the first time. However if you want to start it as fast as possible:

<codesudo tlp start

Java7: oracle-java7-installer or openjdk-7-jdk

What is the difference between JRE and JDK:

JRE (Java Runtime Environment) installs the Java Virtual Machine and enables you to use any java program on your machine

JDK (Java Development Kit) does everything JRE does and also installs the development tools to compile, debug and document your java programs.

Installing JDK from the get-go is better, so I’ll show you how to install JDK in case you decide to develop java programs in the future.

What is the difference between openjdk and oracle jdk?

How to install Oracle Java7 JDK:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

How to install OpenJDK Java7 JDK:

sudo apt-get install openjdk-7-jdk

How to test if it’s installed correctly:

Try running:

java -version

It should return something similar to:

java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.13.10.1)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

Development with Sublime Text: sublime-text-2 or sublime-text-3

Difference between ST2 and ST3:

Some plugins don’t have support for ST3 yet. If you’re just starting to use Sublime Text you won’t care about the support of plugins you don’t know, so go for ST3.
But if you’re already a ST2 user, wondering if you can switch to ST3 -> check with Can I switch to Sublime Text 3?

How to install ST2 anyway

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text-installer

How to install ST3:

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer

Stop hurting your eyes, use Redshift/f.lux: gtk-redshift or fluxgui

What do both programs do?

They adjust the color temperature of the screen to adapt to the day time. If you’re an early rise or a night owl (like me), you should stop blinding yourself and use Redshift or f.lux

What to install

I suggest Redshift because f.lux isn’t supporting Ubuntu 13.10 and probably won’t support future versions (if not updated by the developer)

How to install

sudo add-apt-repository ppa:jonls/redshift-ppa
sudo apt-get update
sudo apt-get install gtk-redshift

I suggest gtk-redshift over redshift. gtk-redshift has a toggle tray so you can toggle it on/off and quit it at any time

How to use it

Get your latitude and longitude
Example command:
gtk-redshift -l YOUR_LATITUDE:YOUR_LONGITUDE -t DAY_TEMP:NIGHT_TEMP -g GAMMA -v
You can use my settings replaced with your latitude/longitude:
gtk-redshift -l 42.697839:23.321670 -t 5700:3600 -g 0.8 -v

That’s all. If you have any suggestions, comment and I’ll add them

Ubuntu bug solution: Keyboard’s modifier keys aren’t working

What are modifier keys?

Alt, Control, Shift and Windows key are modifier keys. They’re mostly used in combination with other keys.

Examples: Ctrl+Alt+Delete, Alt+Tab and others…

The story:

As an owner of Zowie Celeritas I understood the hard way that my keyboard isn’t really supported by the Linux kernel.

Any modifier keys combinations don’t work.

The problem is not Ubuntu-specific, I tried Mint and Debian – problem still persists.

This is a common problem for other keyboards too, so the solution may or may not work for you.

The solution:

If your keyboard is PS/2 -> you shouldn’t have a problem to begin with. But you can still try with an adapter from PS/2 to USB, to see if your keyboard works.

If your keyboard is USB -> use a USB to PS/2 adapter. This has worked for many

If your keyboard is USB but you don’t have a PS/2 port (Zowie Celeritas and other mechanical keyboards in combination with a laptop) -> If you don’t have a USB to PS2 adapter buy the above one, else use the one provided with your keyboard. Afterwards buy this PS/2 to USB adapter or a similar one. It must be a real adapter and convert the signal.  The one I provided worked for me and many others.

Good luck and I hope you resolve this problem!

Making the switch to Ubuntu. How to install PPAs

If you want instructions how to make a liveCD/liveUSB and how to install Ubuntu head – > here

What is a PPA?

Personal Package Archive, stuff that isn’t included by default in the OS, mostly developed by people not affiliated to the official developers of Ubuntu (in our case).  INSTALL PPAs WITH CARE! You’ve been warned.

First of all open the Terminal (CTRL + ALT + T)

Mostly everything you’ll do in the future will involve around these commands: 

Order of installing a PPA:

1) sudo add-apt-repository

2) sudo apt-get update

3) sudo apt-get install

What do they mean?

sudo – super user (root access). Everything power user-ish, like installing, updating through the terminal is involved with sudo.

apt – advanced packaging tool (it’s actually an interface). Everything with apt- prefix is a tool which uses apt. Why use apt? Because it’s the easiest way to install stuff on Linux, without scaring yourself to death by the new OS if you’re coming from Windows (like me) or Mac

sudo add-apt-repository – adds a repository to the OS, but doesn’t install it.

Example: sudo add-apt-repository http://ppa.launchpad.net/webupd8team/java/ubuntu

sudo apt-get update – updates your software. Including stuff you just installed

Example: sudo apt-get update

sudo apt-get install – yep, installs.

Example: sudo apt-get install oracle-java7-installer

 

A full step by step how to find and install a PPA

1) Finding. Good source for PPAs is https://launchpad.net/~webupd8team and follow http://www.webupd8.org/

2) Found something interesting, how to install it?

If I want to install Java7 on my machine

I go here https://launchpad.net/~webupd8team/+archive/java

Click the green Technical details about this PPA

Copy only and only http://ppa.launchpad.net/webupd8team/java/ubuntu

Open the Terminal (CTRL+ALT+T)

Write these lines:

1) sudo add-apt-repository http://ppa.launchpad.net/webupd8team/java/ubuntu

2) sudo apt-get update

3) Now you wonder what can I install ? See in http://ppa.launchpad.net/webupd8team/java/ubuntu below the Overview of published packages

In our case we install Java7, so we must see oracle-java7-installer

Then we write: sudo apt-get install oracle-java7-installer

4) Done! But anyway test with writing: java

If no error shows up but documentation, it works!

Ubuntu: PPAs you should have installed or have in mind

Ubuntu

Ubuntu horror stories: No headphones sound?

I’ll be starting this series of blog posts about my horrible experiences with Ubuntu.
Note: of course there’ll be posts about the good sides of Ubuntu, which are many but not easy to find at first if you’re a newbie like me!

So to introduce my setup – Windows 8.1 and Ubuntu 13.10.
2 partitions, no conflicts.. or so it should be.

After 7 installations of different Ubuntu isos, I settled with Ubuntu 13.10 x64. I was getting accustomed to all the bugs in the OS, but suddenly I restart with Shutdown -> Restart, boot my Windows 8.1 and I notice that I have no sound.

Instantly what the hell, why are Ubuntu bugs chasing me in Windows? Well it seemed like this is a common problem (aren’t all Ubuntu problems common? #good-ubuntu-developers)

SO HOW DO I FIX THIS? Welp, you just have to use Shutdown -> Shutdown every time you want to boot your Windows after you’ve used Ubuntu.

Programming tips: Avoiding unbalanced parentheses errors

It’s very common for people to have unbalanced parenthesis after hours of work and hundreds of lines of code.
Also it’s one of the more common questions in exams, find the error/errors in the following code “….” and they give you way too many parentheses.

One of the more popular solutions is to use a pencil and paper to follow the code and see the mistake, but this takes resources and much more time than it should.

The easier and better way is to count. Count what? Count the parentheses.
Any opening/left parenthesis is +1, any closing/right parenthesis is -1. The result should always be 0 and never negative!
So let’s put this into examples.

((a + b) * t / 2 * (1 - t) 
1 1    -1           1    -1 

And we notice that we have 1 remaining, which means the code is wrong.

Next example

(a + b) * t) / (2 * (1 - t)
           ↑
+1   -1    -1

…. wait what? We get -1. If we get -1 the code is 100% wrong.

Good, now the time needed to track and correct parentheses is greatly reduced!

Quick reference: CSS/CSS3 Attribute selectors

The basic syntax
selector[attribute]

Exact match – finds the exact match of the value
selector[attribute=value]

Partial match – finds a partial match of the whole word value. Doesn’t find valueExample or value-Example strings
selector[attribute~=value]

Hyphen(dash) match – finds a match of the value value seperated by dash. Doesn’t matter if it’s the first or last word in the string.
selector[attribute|=value]

Start of value match – finds the value match in the start of the string only. Includes valueExample and value-example strings
selector[attribute^=value]

End of value match – finds a match of the value in the end of the string only. Also includes valueExample and value-example strings
selector[attribute$=value]

Any part of value match – same as partial match but includes valueExample and value-example strings
selector[attribute*=value]

CSS3, the 147 color names you might find useful to know!

The syntax is simple.

Apply it with color properties like  background-color or color

Example:
•inline
style="background-color:plum"
•style element or stylesheet
background-color:teal;

aliceblue antiquewhite aqua aquamarine
azure beige bisque black
blanchedalmond blue blueviolet brown
burlywood cadetblue chartreuse chocolate
coral cornflowerblue cornsilk crimson
cyan darkblue darkcyan darkgoldenrod
darkgray darkgreen darkgrey darkkhaki
darkmagenta darkolivegreen darkorange darkorchid
darkred darksalmon darkseagreen darkslateblue
darkslategray darkslategrey darkturquoise darkviolet
deeppink deepskyblue dimgray dimgrey
dodgerblue firebrick floralwhite forestgreen
fuchsia gainsboro ghostwhite gold
goldenrod gray green greenyellow
grey honeydew hotpink indianred
indigo ivory khaki lavender
lavenderblush lawngreen lemonchiffon lightblue
lightcoral lightcyan lightgoldenrodyellow lightgray
lightgreen lightgrey lightpink lightsalmon
lightseagreen lightskyblue lightslategray lightslategrey
lightsteelblue lightyellow lime limegreen
linen magenta maroon mediumaquamarine
mediumblue mediumorchid mediumpurple mediumseagreen
mediumslateblue mediumspringgreen mediumturquoise mediumvioletred
midnightblue mintcream mistyrose moccasin
navajowhite navy oldlace olive
olivedrab orange orangered orchid
palegoldenrod palegreen paleturquoise palevioletred
papayawhip peachpuff peru pink
plum powderblue purple red
rosybrown royalblue saddlebrown salmon
sandybrown seagreen seashell sienna
silver skyblue slateblue slategray
slategrey snow springgreen steelblue
tan teal thistle tomato
turquoise violet wheat white
whitesmoke yellow yellowgreen