c++ notes

Q: Where are the c++ library/header files located on linux ubuntu ?
A: /usr/include/

tags:
cpp
c plus plus

Getting started with Node.js and express

# working in ubuntu 12.04

# add package to get latest version to not get errors
sudo add-apt-repository –yes ppa:chris-lea/node.js
sudo apt-get update

# install node.js and npm
sudo apt-get install nodejs npm

# install express framework
$ sudo npm install -g express
$ sudo npm install -g express-generator

# create project
$ express testexpress
$ cd testexpress
$ sudo npm install

# or if you wish to create project with hogan (handlebars) and less
$ express testexpress –hogan -c less

# to run the app
$ DEBUG=testexpress ./bin/www

# miscellaneous
$ npm install -g nodemon

// add code to bottom of app.js to run as 
// $ node app.js
module.exports = app;
/* Use PORT environment variable if it exists */ 
var port = process.env.PORT ||3000;
server = app.listen(port);
console.log('Server listening on port %d in %s mode', server.address().port, app.settings.env);

Ubuntu Adding Packages

When attempting to install a program thru apt-get the most frustrating moment is when the program cannot be found and what’s worst is not being able to add the package to install the program. In the past attempting to add packages by editing /etc/apt/sources.list has been unsuccessful but success has came from adding thru “apt-add-repository” command line command. Here are examples.

To install cmake:
# https://launchpad.net/~kalakris/+archive/cmake
$ sudo apt-add-repository ppa:kalakris/cmake
$ sudo apt-get update
$ sudo apt-get install cmake

To install emacsen-common:
# http://www.ubuntuupdates.org/ppa/kubuntu-ppa_backports?dist=precise
$ sudo add-apt-repository ppa:kubuntu-ppa/backports
$ sudo apt-get update
$ sudo apt-get install emacsen-common

To install cheese
# http://packages.ubuntu.com/precise/i386/cheese/download
# adding a line to your /etc/apt/sources.list like this:
deb http://cz.archive.ubuntu.com/ubuntu precise main universe
$ nano /etc/apt/sources.list
$ sudo apt-get updated
$ sudo apt-get install cheese

Wireless Connecting but not Internet

Today I used wireless internet at a doctors office. When I arrived back home home my Dell computer could not connect to the internet wirelessly (could connect thru a ethernet cord). It showed as connected to my router but not the internet. There were no issues with the router and the internet because my iphone could surf the internet. It seems that when I connected to the internet at the clinic it messed up my PC. Here how I fixed it.

Right clicked on the “monitor in front of monitor” icon at the bottom right corner and selected “connect to network”.

Right clicked on the internet that I was trying to connect to and selected “diagnose”.

A new window opened and I clicked on an option that said something about “resetting the the ip address” (not exactly sure) and it shwoed a loading screen saying “repairing”. And that fixed it

tags:
wireless connecting but no internet

xdebug setup

http://xdebug.org/wizard.php

copy output of
$ php -i
or
<?php phpinfo(); ?>

paste into

http://xdebug.org/wizard.php

Follow the instructions on that site after you submit

$ wget http://xdebug.org/files/xdebug-2.2.4.tgz
$ tar -xvzf xdebug-2.2.4.tgz
$ cd xdebug-2.2.4
# install apt-get install php5-dev for phpize to work
$ phpize
$ ./configure
$ make
$ cp modules/xdebug.so /usr/lib/php5/20090626+lfs

or one command setup
$ sudo pecl install xdebug

Edit /etc/php5/apache2/php.ini or /etc/php5/apache2/conf.d/xdebug.ini
Edit /etc/php5/cli/php.ini (for phpstorm interpreter)

paste
[xdebug]
zend_extension= [extension provided in xdebug.org]
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.show_local_vars=1

for phpstorm interpreter to work you need to determine what is the “Loaded Configuration File” and paste the [xdebug] code in aswell (Loaded Configuration File => /etc/php5/cli/php.ini)
$ php -i | grep php.ini

restart webserver

https://forums.netbeans.org/post-114142.html#114142

if using port 9003 because I believe fastCGI is using 9000


PHPSTORM 7 setup
Firefox add-on:
The easiest Xdebug
JetBrains Firefox extension 0.6.0

File -> Settings -> PHP

File -> Settings -> PHP -> … (next to the interpreter input)
(debugger will only show if you edit the /cli/php.ini)

File -> Settings -> PHP -> Servers

File -> Settings -> PHP -> Servers -> Validate Remote Environment

File -> Settings -> PHP -> Debug

Run -> Edit Configurations

Create javascript debug

Make sure the listener is on

Run the javascript debugger then its going to ask to install the firefox add-on but it will only work after you restart your computer.

Also make sure you set a break point and that break point is at a point in page it can arrive because if an error the page will terminate without arriving at the break point.

Went to

http://www.jetbrains.com/phpstorm/marklets/

Generated xdebug bookmarklets with idekey in the site as PHPSTORM
added to firefox bookmark ‘start debugger’
click on the bookmarklet ‘start debugger’ while in my ‘localhost’ site

WORKED

resources:

http://ubuntuforums.org/showthread.php?t=525257

Installing OpenCV python

Tested on Ubuntu 12.04.4 Desktop (32-bit)

http://releases.ubuntu.com/12.04/ubuntu-12.04.4-desktop-i386.iso.torrent

See instructions at

http://www.samontab.com/web/2012/06/installing-opencv-2-4-1-ubuntu-12-04-lts/

I created a installation script

https://github.com/baligena/opencv_installation

but found a better more successfull shell one

https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/2.4/opencv2_4_8.sh

updated 2014-08-19

Setup XMPP Openfire ubuntu

Setup instructions

https://library.linode.com/communications/xmpp/openfire/debian-6-squeeze

Web based client:
Here how to get it working on a Debian/Ubuntu server
Make sure you have HTTP Binding Enabled: from web panel go to Server Settings -> HTTP Binding -> Enabled – Clients can connect to this server using HTTP binding
Create /usr/share/openfire/resources/spank directory and copy the content of the sparkweb zip file
Next change permission:
$ chown -R openfire.openfire /usr/share/openfire/resources/spank

$ chmod -R 750 /usr/share/openfire/resources/spank
Now, restart server with
$ /etc/init.d/openfire restart
and open your web browser to http://your_server_ip:7070/webchat

resources:

http://community.igniterealtime.org/docs/DOC-2109#comment-6568