mount /dev/cdrom [dir]In my case, I mount it in the existing
media
directory.
mount /dev/cdrom [dir]In my case, I mount it in the existing
media
directory.
$cd ~ $mkdir -p .config/awesome $cp -r /etc/xdg/awesome/* .config/awesomeNote that there are some other files under
/etc/xdg/awesome
besides rc.lua
, and you need to copy all the files. Otherwise there will be errors and the user configuration will be ignored (I tripped over this).xscreensaver
.
Add the following lines to rc.lua
.
# In globalkeys = ... awful.key({ modkey }, "F12", function() awful.util.spawn("xscreensaver-command -lock") end) # At the end of the file: awful.util.spawn_with_shell("xscreensaver -no-splash")
if
statementif
command is:
if TEST-COMMANDS; then CONSEQUENT-COMMANDS; fiThe TEST-COMMAND list is executed, and if its return status is zero, the CONSEQUENT-COMMANDS list is executed. The return status is the exit status of the last command executed, or zero if no condition tested true. Expression used with
if
[-s FILE]
: True if FILE exists and has a size greater than zero.=~
matches a string against a pattern. It returns character offset into the string at which the match occurred, or returns nil
if match fails. Your can put the regex first or the string first. Either way is ok. Because nit
is equivalent to false
in a boolean context, you can use the result as a condition in if
or while
statements.===
as a simple pattern match:
case line when /title=(.*)/ puts "Title is #$1" when /track=(.*)/ puts "Track is #$1" when /artist=(.*)/ puts "Artist is #$1" end
i
Case insensitive.o
Substitute once. Any #{...}
substitutions in a particular regular expression literal will be performed just once, the first time it is evaluated. Otherwise, the substitutions will be performed every time the literal generates a Regex
object.m
Multiline mode. Normally, "." matches any character except a newline. With the /m
option, "." matches any character.x
Extended mode. Complex regular expression can be difficult to read. The x
option allows you to insert spaces and newlines in the pattern to make it more readable. You can also use #
to introduce comments. #include<stdlib.h> #include<iostream> using namespace std; int * foo (int a) { int i; int* p; i = a *p = i; return p; } int main(void) { int* q; int b = 10; q = foo(&b); return 0; }The problem with this code is that the pointer
p
is not initialized before it is dereferenced. This will cause a segmentation fault. So if we change *p = i
to p = &i
, the segmentation fault will be gone. A pointer should always be initialized with an address first.
int * foo (int a) { int i; int* p; i = a; p = &i; return p; }The returned pointer points to the local variable
i
which will be out of the scope once the function returns. Even if we set p = &a
, it won't work, because a
is also a local variable in the scope of function foo
only.
So in main
, q
will not point to b
because when we call foo(b)
, the value of b
is copied to the local variable a
which has a different address than b
.
#include<stdlib.h> #include<iostream> using namespace std; int * foo (int* a) { int* p; cout << "p = " << p << endl; p = a; cout << "p = " << p << endl; return p; } int main(void) { int* q;it should work int b = 10; q = foo(&b); cout << "&b = " << &b << endl; cout << "q = " << q << endl; cout << "b = " << b << endl; cout << "*q = " << *q << endl; return 0; }
multiprocessing
. However, threading is still an appropriate model if you want to run multiple I/O-bound tasks simultaneously.RuntimeException
is not checked. Runtime exceptions represent problems that are result of a programming problem, and as such, the API client code cannot reasonably be expected to recover from them or to handle them in anyway. Such problem include arithmetic exceptions, such as dividing by zero; pointer exceptions, such as trying to access an object through a null reference; and illegal arguments exceptions. It is common practice to throw RuntimeException
when the user calls a method incorrectly. For example, a method can check if one of its arguments is incorrectly null
. If it is, the method might throw a NullPointerException
, which is an unchecked exception. For other kinds of incorrect arguments, the method can throw IllegalArgumentException
.Exception
(checked) that can be thrown by a method is part of the method's public programming interface. Those who call a method must know about the exceptions that a method can throw so that they can decide what to do about them.aspell --encoding=UTF-8 --lang=<lang> dump master > <lang>.dictwhere
lang
is the language code. Some common language codes are:$ sudo aticonfig --initial # This reinitializes your xorg.conf. # Then when you reboot, you should be able to configure multi-display with $ sudo gksu amdcccle
sudo apt-add-repository ppa:flexiondotorg/java sudo apt-get update sudo apt-get install sun-java6-jre sun-java6-plugin
sudo apt-get install openjdk-6-jdk
$ sudo apt-get install texlive-fullUpdate Texlipse's preference in Eclipse by giving the bin directory of Tex distribution:
/usr/bin
$sudo apt-get install openssh-server
paint()
is always invoked as a result of both system-triggered and app-triggered paint requests; update()
is never invoked on Swing components.paint()
by invoking repaint()
, but shouldn't call paint()
directly.repaint()
should be invoked with arguments which define only the rectangle that needs updating, rather than the no-arg version, which causes the entire component to be repainted.paint()
factors the call into 3 separate callbacks:
paintComponent()
paintBorder()
paintChildren()
paintComponent()
method (not within paint()
).
short
value. We can extract the player index and the depth using the following:
userIndex = s & DepthImageFrame.PlayerIndexBitmask; // The mask is 0x07. depth = ((ushort) s) >> DepthImageFrame.PlayerIndexBitmaskWidth; // The width is 3.
==
operator frequently causes undesirable coersion, is intransitive, CoffeeScript compiles ==
into ===
, and !=
into !==
. In addition, is
compiles into ===
, and isnt
into !==
.==
and ===
in JavaScript is here.this
/@
variable is used in a function, you need to think carefully about which context you want this variable to be bound to. When -> is used, this/@ will refer to whichever the current context is when the function is called; when => is used, this/@ always refers to the context when the function is defined.
yield
statement. You can think of yield
as being something like a method call that invokes the block associated with the call to the method containing the yield
. Whenever yield
is executed, it invokes the code in the block. When the block exits, control picks back up immediately after the yield
. Here's a trivial example:
def three_times yield yield yield end three_times { puts "Hello" }produces:
Hello Hello Hello
~> 0.8.5
is semantically equivalent to:
gem "cucumber", ">= 0.8.5", "< 0.9.0"
bundle install
installs the dependencies specified in the Gemfile if this is the first time you run it (and a Gemfile.lock does not exist). If a Gemfile.lock does exist, and you have not updated you Gemfile, bundler will fetch all remote sources, but use the dependencies specified in the Gemfile.lock instead of resolving dependencies.$sudo nvidia-xconfigThe output said there were errors in the xconfig settings and a new file is generated. So the problem is really with the Nvidia settings.
key => value
pairs in an argument list, as long as they follow any normal arguments and precede any splat and block arguments. All these pairs will be collected into a single hash and passed as one argument to the method. No braces are needed. There is also the new hash literal syntax in Ruby 1.9: class SongList def search(field, params) # ... end end list.search(:title, genre: 'jazz', duration_less_than: 270)
font-size
of the parent element.