9/19/13

CheckInstall - Building Deb file from OpenSource Codes

Introduction


CheckInstall keeps track of all files installed by a "make install" or equivalent, creates a Slackware, RPM, or Debian package with those files, and adds it to the installed packages database, allowing for easy package removal or distribution.
IconsPage/IconTip.png Use CheckInstall instead of just running "sudo make install", as that will likely put files all over the filesystem, with no easy way of removing them if things go wrong. If in the future you try to install a package that contains the same file as the software you are compiling, you will receive errors and the software you compiled may stop working.
(In fact, checkinstall can keep track of files modified by any command line, not just a "make install", so you can use it for any type of installation task outside of apt, and it will keep track of the installation in the package manager.)
IconsPage/dont.png CheckInstall is not designed to produce packages suitable for distribution. Do not use it to produce packages intended for the Ubuntu archive or PPAs. Instead, follow the Packaging Guide.
IconsPage/warning.png From the checkinstall README: "The Debian support in CheckInstall is still new, so handle it with care. It has been reported to work OK in some Debian systems and it certainly works OK in my Slackware development system with dpkg installed. Your mileage may vary."

Installation


Install the package checkinstall from the Repositories.
For help on installing software in Ubuntu, see InstallingSoftware.
A quick method via the terminal for those who like to copy and paste:
sudo aptitude install checkinstall

Usage


Instead of
sudo make install
you will use
sudo checkinstall

When called with no arguments, checkinstall will call "make install". If you need other arguments, they can be supplied:
sudo checkinstall make install_package

The installed package can then also easily be removed via Synaptic or via the terminal:
sudo dpkg -r packagename

Example:
sudo dpkg -r pidgin

IconsPage/IconNote.png Note that the .deb package it creates can also be used elsewhere, which simplifies installation of the same program on many machines.

Use CheckInstall with auto-apt


You can use auto-apt when you want to build a simple package from source with checkinstall. You need to have auto-apt installed!
Instead of
./configure

you use:
auto-apt run ./configure

If the dependencies are available, a dialog box opens and ask you to install them.
The rest remains the same
make
sudo checkinstall

9/13/13

White balance with Canon DSLRs

White balance with Canon DSLRs

A couple of my colleagues at Northern Arizona University’s School of Communication noted how difficult it is to do manual white balance with the Canon DSLRs some of our students are using.

All I can say: Not as easy as video cameras. The Canon presets have worked pretty well for all the projects I’ve shot, but I’m using a Canon 5D Mark II where I dial in the color temperature I want. Beginning students may know what color temperature to use or just rely on presets — especially when they have to go through the steps I outline below. Or some may just want to use the simplicity of video cameras. Whatever camera you choose to shoot with, manual white balance is an important step not to neglect.

And if it’s more difficult with a DSLR, then you have to decide if it’s worth the extra effort. For me and many of my students who have purchased their own DSLRs, we realize one thing: The image quality, baby, the image quality. But knowing how to color balance is part of mastering the image quality.

Why do we even bother with adjusting color temperature in the first place? Why not just set the camera to automatic. If you’re controlling your image professionally, then you need to use the manual settings so it doesn’t do things you don’t want it to be doing.

Our eyes balance white automatically. A camera’s sensor isn’t as smart as us and it doesn’t have the multitasking capabilities of our minds. So you need to tell the camera what kind of light it’s seeing so it can find true white. White indoors is different than white outdoors. See the chart below:

Color temperature in degree Kelvins. This chart provides a list of different lamps and their corresponding color temps. (Image courtesy of Mapawatt.)

So if you’ve set your DSLR to an indoor light setting (~3700K), such as standard tungsten (a regular light bulb) and you go outdoors (~5500K), the white the camera saw indoors is now different and now has a bluish tint to it. If you’ve set your camera to daylight and you go indoors, the camera’s image now contains a warm yellow cast. See the images below.

The top image contains the bluish tint of an indoor white balance setting used incorrectly outdoors. The bottom image is too yellow — the typical problem with an outdoor setting used incorrectly indoors. The center image is properly color balanced. Photos by Kurt Lancaster (courtesy of Focal Press).

And if you are shooting a scene with multiple light sources (such as a window and a room with fluorescent lighting), you need to tell the camera which one it should see. Is the window your key light? Then dial in the proper color temperature or set the custom white balance.

8/21/13

LightDM: THE SYSTEM IS RUNNIG IN LOW GRAPHIC MODE

Fix Error: “THE SYSTEM IS RUNNIG IN LOW GRAPHIC MODE”

“THE SYSTEM IS RUNNIG IN LOW GRAPHIC MODE” erorr is a very common error forLightDM.
When you get this error, click the OK button in the graphical window and tick the box saying “run in low graphics mode for just one session”.
Next, you will have to do this:
$ sudo apt-get install --reinstall unity-greeter
$ sudo dpkg-reconfigure lightdm
Now open the /etc/lightdm/lightdm.conf (with sudo) and make the greeter-session=line look like this:
greeter-session=unity-greeter
This error fixing works for Ubuntu, Linut Mint and other Linux boxes that use lightdm.

7/12/13

Ubuntu: How to disable integrated webcam and still be able to use an external one

On a fresh kernel just echo it with zero. For example:
Search what we need to be turned off:
lsusb
This returns a list of devices:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0402:5602 ALi Corp. M5602 Video Camera Controller
Bus 001 Device 003: ID 045e:0723 Microsoft Corp. LifeCam VX-7000 (UVC-compliant)
Change 1-6 to your device ports to be disabled: cat /sys/bus/usb/devices/1-6/idProduct
This gives me 5602.
Now we've found it (to iterate search, change 1-6 to all your device ports), now just turn it off:
echo "0" > /sys/bus/usb/devices/1-6/bConfigurationValue
After making sure it works as desired, make it load every startup (for example, in /etc/rc.local.)

7/8/13

Ubuntu 12.04: Wireless network - connected, got ip, but no packets through (Fixed on 13.04)

Test if it running

Please try:
Code:
lsmod | grep iwl
See if your wireless driver is iwlagn or iwlwifi and then remove it and reload it with a parameter.
Code:
sudo modprobe -r iwlwifi
sudo modprobe iwlwifi 11n_disable=1
Any improvement? If so, we'll need to write one file to make it permanent.

----

Do if the upper_test fixs your problem

The iwlwifi driver is troubled with a bug wherein it doesn't handle N traffic at all well. It seems to clog and pass NO traffic at all. Fortunately,there is a fix; tell the driver to disable ts N capability. It's a compromise, I know, but there seem to be two choices: it works without N or it doesn't work at all.

Please open a terminal and do:
Code:
sudo gedit /etc/modprobe.d/iwlwifi.conf
Of course, use the actual name of your driver, if not iwlwifi. Write one line:
Code:
options iwlwifi 11n_disable=1
Proofread carefully, save and close gedit. 

reboot your system.

6/30/13

VÀI MẸO VẶT NÊN BIẾT



- Trị kiến: Kiến ghét dưa leo. Bỏ vỏ dưa leo gần chỗ có kiến hay ổ kiến.

- Muốn có nước đá trong và sạch: Đun nước cho sôi trước khi đông lạnh.

- Muốn làm cho gương sáng: Dùng alcohol để lau chùi.

- Muốn gỡ kẹo cao su dính vào quần áo: Để quần áo trong tủ đông lạnh khoảng một tiếng đồng hồ.

- Muốn tẩy trắng quần áo màu trắng: Ngâm quần áo màu trắng vào nước nóng có bỏ một lát chanh trong vòng 10 phút.

- Muốn cho tóc được óng ả: Bỏ một muỗng cà phê giấm lên tóc, rồi gội sạch.

- Muốn nặn nước tối đa từ trái chanh: Ngâm chanh trong nước nóng khoảng một tiếng đồng hồ, trước khi nặn nước.

- Muốn làm bớt mùi bắp cải khi nấu: Để một miếng bánh mì trên bắp cải trong nồi khi nấu.

- Ðể tẩy hết mùi tanh của cá trên tay: Rửa tay bằng một chút giấm táo.

- Ðể tránh chảy nước mắt khi xắt củ hành: Nên nhai kẹo cao su.

- Muốn luộc khoai tây nhanh chóng: Chỉ gọt vỏ củ khoai một bên mà thôi, trước khi luộc.

- Muốn luộc trứng nhanh chóng: Bỏ muối vào nước và đun sôi.

- Muốn tẩy mực dính trên quần áo: Bôi nhiều kem đánh răng vào chỗ vết mực và để cho thật khô trước khi giặt.

- Muốn lột vỏ khoai lang nhanh chóng: Ngâm khoai trong nước lạnh ngay sau khi luộc.

- Muốn đuổi chuột: Rắc tiêu đen ở những nơi bạn thấy có chuột. Chúng sẽ bỏ chạy.

6/18/13

Essential Eclipse Shortcuts

Essential Shortcuts

The list of shortcuts in Eclipse is fairly long yet readily available. In fact starting with Eclipse 3.1 the full list of shortcuts can be displayed from anywhere via Ctrl+Shift+L. Nevertheless, call it information fatigue or simply a matter of style, deserving shortcuts frequently remain overlooked.
Below is a list of those shortcuts I find essential. What I mean by that is if you don't use them then you probably need additional time to execute essential everyday tasks and are not very comfortable navigating around.
So without further ado here is the list: 
Ctrl+Shift+TFind Java TypeStart typing the name and the list gets smaller. Try typing the capital letters of the class only (e.g. type "CME" to find "ConcurrentModificationException")
Ctrl+Shift+RFind ResourceUse this to look for XML files, text files, or files of any other type. which are in your workspace.
Ctrl+EOpen Editor Drop-DownPresents a popup window listing currently opened files. Start typing to limit the list or simply use the down arrow key.
Ctrl+OQuick OutlineUse this to find a method or a member variable in a class. Start typing to limit the choices. Press Ctrl+O a second time to include inherited methods.
Ctrl+SpaceContent AssistContext sensitive content completion suggestions while editing Java code.
Ctrl+Shift+SpaceContext InformationIf typing a method call with several parameters use this to show the applicable parameter types. The current parameter where the cursor is will be shown in bold.
Ctrl+Shift+OOrganize ImportsAfter typing a class name use this shortcut to insert an import statement. This works if multiple class names haven't been imported too.
F3Open DeclarationDrills down to the declaration of the type, method, or variable the cursor is on. This works much like a browser hyperlink.
Alt+LeftBackward HistoryThis works like a browser's Back button.
Alt+RightForward HistoryThis works like a browser's Forward button
Ctrl+LGo to LineGo to a specific line number.
F4Open Type HierarchyShow the type hierarchy (downward tree) or the supertype hierarchy (upward tree).
Ctrl+Alt+HOpen Call HierarchyShow where a method is called from. In the Call Hierarchy view keep expanding the tree to continue tracing the call chain.
Ctrl+HOpen Search DialogOpens a search dialog with extensive search options for Java packages, types, methods, and fields.
Alt+Shift+RRename - RefactoringUse this to rename type, method, or field. All existing references will be refactored as well.
Alt+Shift+LExtract Local VariableUse this to create a local variable from the selected expression. This is useful for breaking up larger expressions to avoid long lines.
Alt+Shift+MExtract MethodUse this to extract a new method from existing code. The parameter list and return type will be automatically created.

Trying Out Shortcuts

A few things to keep in mind as you try the above shortcuts. If a shortcut doesn't have the described effect check if one of these is the cause of your problem:
  • Do you have an older version of Eclipse? Check the Help section to confirm the shortcut is available.
  • Is the shortcut applicable to the context (perspective) you're in? For example Ctrl+Shift+T (Open Type) is applicable in the Java perspective but not in the Resource perspective. You can find out where each shortcut is applicable by pressing Ctrl+Shift+L or by checking the Help section.
  • Is the shortcut already taken by another application? If so the other application will probably come to the foreground when you use the shortcut.
  • Is the shortcut defined twice in Eclipse? This can happen on occasion if you install additional plugins with overlapping shortcuts or more likely if you've tried to map shortcuts of your own. If there is conflict the shortcut won't work. To check this go to the Preferences or press Ctrl+Shift+L twice.

Additional Favorites


Here are some additional shortcuts, perhaps not essential but still very useful:
Alt+Shift+Up
Alt+Shift+Down
Alt+Shift+Left
Alt+Shift+Right
Select Enclosing Element
Restore Last Selection
Select Previous Element
Select Next Element
Useful for selecting context-sensitive blocks (e.g. surrounding loop, method, class, etc.)
Ctrl+Up
Ctrl+Down
Scroll Line Up
Scroll Line Down
Very handy if you want to scroll by 1 line without changing your cursor position or using the mouse.
Ctrl+Shift+Up
Ctrl+Shift+Down
Go to Previous Member
Go to Next Member
Great for stepping down through the methods of a Java source file.
Ctrl+Shift+U
Alt+Shift+U
Show Occurrences in File
Remove Occurrences Annotations
Use this to search within the same file - useful for occurrences of private fields and methods.
Ctrl+Shift+PGo to Matching BracketHelps to find the closing bracket of lengthly if-else statements.
Ctrl+J
Ctrl+Shift+J
Incremental Find
Reverse Incremental Find
The first matching occurrence is shown with each typed letter. Press again and the next matching occurrence is shown.
Shift+Enter
Ctrl+Shift+Enter
Insert Line Below
Insert Line Above
Insert a line above or below the current line.
Ctrl+/
Ctrl+\
Add Block Comment
Remove Block Comment
Comment in/out blocks of code with a key stroke.
Ctrl+MMaximize Active View or EditorMaximize the current view or editor at the expense of all other currently shown views. Press again to restore to normal view.
Ctrl+F6
Ctrl+F7
Ctrl+F8
Next Editor
Next View
Next Perspective
Learn these to switch among edited files, open views and perspectives.
Ctrl+Alt+Up
Ctrl+Alt+Down
Duplicate Lines
Copy Lines
Doesn't seem like it at first but a great shortcut once you learn to use it. Instead of select, copy and paste simply select and duplicate without affecting the clipboard.
Alt+/Word CompletionThis is excellent for code editing or writing plain help files with variables and other words having no English language equivalents. The word completion is based on the set of words already present in the current file.
Ctrl+ICorrect IndentationSelect a block of Java code or an entire class file and use this shortcut to correct its indentation.
Shift Tab
Tab
Remove Tab
Add Tab
Select one or more lines of code and use this shortcut to intent them further/less.