Saturday, October 26, 2013

Linux shell cheatsheet (Can it become one?)

I love the command line, the CLI. I wish somethings were a little bit different allowing me to use CLI for every task, but the world is a cruel place, apart from stupid M$ mistakes regarding their crappy GUI. You do realize there wouldn't be such a crappy product without dependency on the GUI, right?
I'm not categorizing it right now, because there's not much to categorize actually
Show line number in "grep" output: grep "text" -n

Running your first PHP application in Google App Engine (Fix for the --php_executable_path flag () issue)

As I may (or may not) have mentioned before, I mostly blog here for the purpose of note-keeping for myself. In most of the cases I don't really care about how good the tutorials (not so much) are coming out. So, please do your homework if you are following any of my tutorials at all. This is gonna be a disclaimer somewhere, but see? I can't give a damn here. Thanks.
I was trying my hands on the Google App Engine. My system is Linux so I downloaded, followed the linux part of things from their official how-to-first-time page here [ https://developers.google.com/appengine/docs/php/gettingstarted/installing ]
As you can see from that page (yeah, that's a dependency) you
1. Download the PHP SDK
2. Extract it some nice place
3. Write a "hello world!" PHP script
4. Execute the python script (dev_appserver.py) in the the "google_appengine" (if you haven't done it otherwise) folder.
BUT ! I got stuck here for sometime, and looked up for the fix.
Source of the problem:
_PHPBinaryError: The path specified with the --php_executable_path flag () does not exist.
Which naturally implied 2 things
1. The PHP installation was NOT as the app engine wants it to be
2. God doen't want me to code anymore
I naturally believe God loves it when I'm busy with my favourite thing so number 2 was obsolete. I looked up on Google for some solutions and a sudden SO page suggested that executing the appserver executable like
./dev_appserver.py --php_executable_path="...path..to..the..php-cgi..executable..." helloworld
will solve the problem.
Following this trail I came to notice that my ignorance toward the tutorial's PHP installation paid of here. The problem was actually my PHP installtion was a CLI version. While the app engine essentially wants a CGI version. For doing so, the tutorial has very good instructions, and yes, php-cgi is NOT available in Ubuntu repos. So I did
sudo apt-get install gcc libmysqlclient-dev libxml2-dev
  wget --trust-server-names http://us2.php.net/get/php-5.4.15.tar.bz2/from/us1.php.net/mirror
  tar xjf php-5.4.15.tar.bz2
  cd php-5.4.15
  ./configure --prefix=$PWD/installdir --enable-bcmath --with-mysql
  make install
  cd -
And afterwards executed
./dev_appserver.py --php_executable_path="...path..to..the..php-cgi..executable..." helloworld
And it went smooth. :) By the way, the above method will NOT harm you normal PHP installation.

Saturday, August 17, 2013

Playing UT2004 in your desired Resolution

Well, that's more of a "Note for self" than anything else, so I'll leave it short and simple.
setres 1366x768x32

Wednesday, July 24, 2013

[Ubuntu] How to fix dependency problems

This is not a very generic method to solve dependency hells but in many obvious cases this is a very good one. It solved one of my problems with some components of "MySQL" being replaced / removed by some mysterious force. I'll pick the scenario here and try to draw a picture on the approach. The solution is based on the askUbuntu answer here [ http://askubuntu.com/questions/227978/problem-after-mysql-server-installation-i-cant-install-any-thing-in-ubuntu-12-04/228450#228450 ]

The problem: I was trying to access a web app that I was working on inside my 'localhost', but for some reason the mysql components were not functioning properly.
The server configuration: Apache2, PHP5, MySQL. The server was setup using 'Automatic virtual hosting' method.
The packages used were installed using:
apt-get install ia32-libs-multiarch build-essential ncurses-term g++ mc lfm unrar firefox apache2 apache2-doc apache2-suexec git zsh vim aria2 awesome curl chromium-browser mpd ncmpcpp git conky pcregrep unagi mysql-server libapache2-mod-auth-mysql php5-mysql php5 php-pear php5-sqlite php5-curl php5-imap php5-intl php5-mysql phpmyadmin openssh-server php5-mcrypt 
It's the full string from my server setup script, you can see the apache, php and mysql packages being used in the list.
How did I find the cause: I tried the package installation script again and it threw these errors
The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
 php5-curl : Depends: php5-common (= 5.4.9-4ubuntu2) but 5.4.9-4ubuntu2.1 is to be installed
 php5-mysql : Depends: php5-common (= 5.4.9-4ubuntu2) but 5.4.9-4ubuntu2.1 is to be installed
E: Unable to correct problems, you have held broken packages.
Then I Googled the first line (mysql) and found the askUbuntu answer page.
This indicated the cause to be a recent addition of and external repo into my repo list.
How did I fix the problem : I first removed repos that were added by me from Synaptic > Other softwares. [ Open Synaptic and then untick repos from "Other software" tab
First I executed the commands
sudo apt-get -f remove mysql-server-core-5.5 mysql-server-5.5 mysql-server-5.5 mysql-server
sudo apt-get -f remove php5-curl
sudo apt-get -f remove php5-common
Then executed the installation commands again and the problem was fixed.

Monday, June 17, 2013

Studying a bit of Data Mining

I've recently found it useful to know some data mining techniques that supposedly might increase productivity in development field.
This is where I've decided to start and these are some of the links that I'm going to use in order to kick start the process of learning.

URLs :
1. A small cheat sheet on data mining
2. I don't if I need it or not, came at the first shot of the Googling session and seemed useful
3. Couldn't resist keeping this in the queue

Books :
1. Programming Collective Intelligence
2. Artificial Intelligence: A Modern Approach
3. Data Mining: Practical Machine Learning Tools and Techniques, Third Edition
4. Data Mining: Concepts and Techniques, Second Edition

Tuesday, June 04, 2013

[Linux][Mint][13][Lisa] Fix screen going blank when Laptop lid is closed

In my workplace they have Linux Mint 13 setup for the machines. I personally hate it and my employer too, so we will be shifting to some other Distro very soon, but in the mean time I had to make do with it. We have an extra display attached to every laptop. One of the things that bugs me the most is the "Power management" doesn't have any "Do nothing" option. And if you somehow (yes, there's a way) make it appear, it does the exact same thing as "Blank screen", so yeah, "Aw snap!!". It didn't take much of googling to find Mint forum page that solved the problem though [ http://forum.linuxmint.com/viewtopic.php?t=106532&f=208 ]
Basically the problem is caused by a faulty assumption in design. It always executes and Screen Blank instruction set, when you close the laptop lid. What you have to do is just comment out one line in the event handler script.
1. First open the file, you might need root rights to edit this, so use sudo if you need
/etc/acpi/lid.sh
2. The find the line
. /usr/share/acpi-support/screenblank
3. Comment that line out with
#
It should be fixed immediately.

Monday, June 03, 2013

Linux WiFi card installation instructions collection

One way or the other I face problems with new installation of Linux distros and setting up WiFi on them. So, I'm creating a collection here for future reference. Might help somebody someday too. 1. BCM4311 [ http://askubuntu.com/questions/55868/how-to-install-a-broadcom-wireless-driver ]

Connect Rapoo MT750S with Linux (Tested on Manjaro)

 I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...