Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Sunday, January 19, 2014

mono: Running C#, ASP.NET under Ubuntu

Mono is not monotone at all, it makes Microsoft-centered technologies available on various platforms including Ubuntu. Mine is 12.04.

sudo apt-get install mono-devel mono-gmcs gtk-sharp2 

Compile and execute

Fetch the example files at Console helloword program

gmcs hello.cs
mono hello.exe

Compile and execute gtk program

Source Here

dmcs hello-gtk.cs -pkg:gtk-sharp-2.0
mono hello-gtk.exe

Install ASP server xsp2 and start server

sudo apt-get install mono-xsp2 asp.net-examples
xsp2

When server is on, it gives

Listening on address: 0.0.0.0
Root directory: /home/user
Listening on port: 8080 (non-secure)
Hit Return to stop the server.

Now you can visit your .aspx files under http://localhost:8080/yourfile.aspx

Friday, January 3, 2014

Ubuntu: Burn Fedora ISO to USB Stick

For a complete burning techniques, refer Fedora: How to Create and Use Live USB

Startup disk creator only works for Ubuntu ISOs.

Use Disk Utility to get know of where your usb is mounted. In my case, it is /dev/sdc, and the name of downloaded Fedora iso file is there in the command line.

sudo dd bs=4M if=Fedora-Live-Desktop-x86_64-19-1.iso of=/dev/sdc

Note that dd is in bs mode, which means it write in BYTES at a time.

Aside (From USB img to HD)

dd can also copy iso image from USB to your hard disk:

sudo dd if=/dev/sdb of=usb-image.iso

Friday, September 6, 2013

Show Skype icon on top bar and launcher on Ubuntu

Problem: Skype icon not showing on panel tray (top bar) and launcher (left bar)

Affected: Ubuntu 12.04

Cause: installation from .deb

Solution:

sudo apt-get install sni-qt sni-qt:i386
gsettings get com.canonical.Unity.Panel systray-whitelist
gsettings set com.canonical.Unity.Panel systray-whitelist "['JavaEmbeddedFrame', 'Wine', 'Update-notifier', 'Skype']"

Source:

How do I Get the Skype Status Icon Back on Panel Tray

Friday, August 9, 2013

A Note on Ubuntu Dash Icons

In principle, dash application icons are located under /usr/share/icons/hicolor/apps, however, this can be customized. For instance, the configuration for a program named ScicosLab lies in /usr/share/applications/scicoslab.desktop, it has the following content:

[Desktop Entry]
Name=ScicosLab
Comment=Scientific Computing using ScicosLab
TryExec=/usr/bin/scicoslab
Exec=/usr/bin/scicoslab
Icon=/usr/lib/scicoslab-gtk-4.4.1/config/puffin-gtk48.png
Terminal=false
Type=Application
Categories=Education;Science;Math;
StartupNotify=false
X-Desktop-File-Install-Version=0.15

One can restart the system to see the effect.

To regenerate the cache

sudo gtk-update-icon-cache --force /usr/share/icons/hicolor

Monday, April 22, 2013

Ubuntu: Display Tibetan Characters

To display Tibetan characters on Ubuntu/Linux, one need to install Tibetan language support. First go to Dash (press Win Key or on Mac ), search language support, click Install/Remove Lanugages button, and select Tibetan from the list, then Apply Changes.

Wednesday, April 10, 2013

Safe Ways to Force Reboot Ubuntu

(Credit: link)

If lucky,

CTRL + ALT + DEL

If still lucky, call a terminal

CTRL + ALT + F1/.../F5

If not so lucky,

ALT + SysRq (PrtScr) + K

Ah, everything fails. Here is the magic wand for Linux kernel

CTRL + ALT + SysRq (PrtScr)

That is to hold Ctrl+Alt, tap SysRq, then type in order:

REISUB

which is BUSIER in reverse order.

Reference

  1. Freezes - Linux Guide - WikiBooks
  2. Magic SysRq Key - Wikipedia

Friday, March 8, 2013

Enabling root user on Ubuntu

We need to create a password for root

sudo password root
su root

To unable

sudo password -l root

Sunday, January 20, 2013

File Permission and Ownership

To show file permission and ownership (owner, group), use

ls -l

For instance,

-rw--w-r-- 1  mzt mzt    37 2013-01-20 08:57 code.py
drwxrwxr-x 2  mzt root 4096 2013-01-20 08:57 foo

To change the owner to root

chown root code.py

To change the group to root

chgrp root code.py

File permissions are given as code r (read), w (write), x (execute), d marks it is a directory. There are three classes of codes per file/directory, respectively they are for owner, group, others.

To add execute permission for the owner,

chmod u+x code.py

To set exactly read permission for the others,

chmod o=r code.py

To add both write and execute permission for the group,

chmod g+wx code.py

To remove execute permission for everyone,

chmod a-x code.py

To recursively apply write permission for both the owner and the group on a folder,

chmod -R ug+w foo

Note that performing these modifications may also affect your right on these commands. A non-root user can't modify a file/directory which belongs to root.

Monday, November 26, 2012

dpkg: Input/output error

This error is usually not hardware-wise (some say your hard disk has bad blocks). Actually, the dpkg database (/var/lib/dpkg/status) is not remembering things well. This leads package management to fail in any case, automatic repairs don't work.
dpkg: unrecoverable fatal error, aborting:
 reading files list for package 'emacs23-common': Input/output error
Due to an archive post by gartss (Refer link), it is repairable by manually removing the error-causing package records in status file.
Here is the sketch.
cd /var/lib/dpkg
sudo cp status status.backup
sudo vi status //remove the error package records (not those of dependencies)
sudo dpkg --configure -a
sudo apt-get -f install

Saturday, October 27, 2012

Upgrading to Ubuntu 12.10: Restoring Grace

Caution: Upgrading the operating system is especially dangerous, and Quantal Quetzal is not coming without this risk.

Restoring Launch-bar and Top-bar

The reason of low and limited resolution after upgrading is that proprietary fglrx video driver (for AMD/ATI) is no longer compatible with x-server 1.13 equipped in Ubuntu 12.10. At this moment, one can choose downgrading to x-server 1.12 (see details here).

sudo add-apt-repository ppa:makson96/fglrx
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fglrx-legacy

System font

Personally, I favor the nice 12.04 fonts. One can use gnome-tweak-tool to achieve the following,

  • Default: Ubuntu 11
  • Document font: Sans 11
  • Monospace font: Ubuntu Mono 13
  • Window title font: Ubuntu 11

or simply use gsettings from terminal,

gsettings set org.gnome.nautilus.desktop font "Ubuntu 10"
gsettings set org.gnome.desktop.wm.preferences titlebar-font "Ubuntu Bold 10"
gsettings set org.gnome.desktop.interface document-font-name "Ubuntu 10"
gsettings set org.gnome.desktop.interface font-name "Ubuntu 10"
gsettings set org.gnome.desktop.interface monospace-font-name "Ubuntu Mono 11"

Removing Dash Online Results

Not every search is mattering a http request, let alone the ads-like results. Go to Dash, search Privacy, turn off include online search result, or drastically

sudo apt-get remove unity-lens-shopping

Saturday, September 1, 2012

Ubuntu: Enabling a webcam

The webcam is not detected. It indicates probably the driver is not installed, so we need to find the certain driver, and make it loaded by default. I am running Ubuntu 11.04 64bit on a Sony Vaio.

Use lsusb to find the device ID, as the case for me,
05ca:1839
It is reported as a Ricoh R5U870 webcam, the driver is not preinstalled, among all the online drivers provided, the following one works, containing no compiling error and it has enabled the camera perfectly.

https://bitbucket.org/ahixon/r5u87x/downloads

I quote the installation instructions here,
 $ sudo apt-get install libglib2.0-dev libusb-dev build-essential gcc 
  automake mercurial
 $ hg clone http://bitbucket.org/ahixon/r5u87x/
 $ cd r5u87x
 $ make
 $ sudo make install
 $ sudo r5u87x-loader --reload
It recalls me of my experience on enabling the wireless function on a DELL Inspiron long ago. As ubuntu is designed to be universal, it still faces both legal and technical issues to include all possible drivers. This requires the holders of proprietary drivers to consent the public use such as in a Ubuntu release.

Friday, August 31, 2012

Ubuntu: Uninstall User Fonts

User Fonts are installed easily by Font Viewer, but to uninstall, one can open a terminal:
cd ~/.fonts
rm foobar.otf foobar.ttf
This is needed for a font designer. When one updates a font, he has to install it once again. Unless removing it from the user fonts folder, one gets an install failed error.

Sunday, August 26, 2012

Ubuntu: Overheating Fix

[Update] Caution: Before reading the rest part of the fix (which is mainly the software side), be sure that the overheating is NOT caused by hardware problem. I have just performed a thorough cleaning inside my another DELL notebook, especially the fan (two years running without opening). I've found a thick layer of fluffy and dark dust, which was the major fact why my notebook is extremely hot and can't cool down properly. After that, every thing works like a charm. See how I cleaned the fan of a SONY vaio (step-by-step pics, link).

I was running Ubuntu 11.04 64-bit on a Sony vaio equipped with an Intel Mobile GM965 VGA card. It was said that a non-proprietary GPU driver caused the overheating, on which Ubuntu shuts down for security (>crit). Mine is loaded with i915 driver for video card (not the case here, Intel, however, launches their open Linux drivers via intellinuxgraphics.org.

To see your CPU temp,

sudo add-apt-repository ppa:alexeftimie/ppa
sudo apt-get update
sudo apt-get install lm-sensors indicator-sysmonitor

The System Indicator Monitoris shown on the panel, go to its Preferences, select the sensors for temperature and Add selected sensors. I prefer this tiny indicator. Also, you can type at the terminal

sensors

to get the following result

acpitz-virtual-0
Adapter: Virtual device
temp1:        +49.0°C  (crit = +94.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +41.0°C  (high = +80.0°C, crit = +90.0°C)
Core 2:       +47.0°C  (high = +80.0°C, crit = +90.0°C)

Before applying the fix provided below, it would run up to 90+ Celsius degree then inevitably the automatic shutdown follows.

Fix Confirmed

The fix is to add few lines to let Ubuntu load several modules at the booting time,

sudo vi /etc/modules

Append these lines and reboot,

battery
ac
thermal
processor
acpi-cpufreq
cpufreq-userspace

Open your monitor to track the CPU temp again. This time, when it rises high (>60) you feel the fan cooling off the CPU. The indicator monitor coincides with such change. Although it stays at 40+ when there is no engagement.

I've tried lm-sensors + sensors-dectect + pwmconfig + fancontrol, without success.

From time to time, I find many fixes are always tiny but magic, whilst a lengthy workaround doesn't help us out. The more steps are, the less compatible a fix might be.

Personally, I believe 11.04 is much better in its user interface than that of 12.04.