ok

This is default featured post 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

30/12/10

Stack Traces With gdb




Stack Traces With gdb
 


Okay, you've used top or ps to get the process ID, and strace hasn't told you anything useful. What next?
The next step is to get a stack trace with gdb. A stack trace tells you not only what the program is actually doing right now at a low level (waiting on a network socket), but sometimes also higher level information (what sort of network read it was doing).
Knowing how to use gdb to get stack traces is also handy if you ever need to file a bug on a program that crashes or hangs.
Like strace, gdb uses -p and the process ID. Once it starts up, you'll get a (gdb) prompt. Type where to get a stack trace.
Here's a stack trace from Firefox when it's busy running some Javascript:


#0  0x01ad9794 in gfxPangoFontGroup::GetFontAt (this=0xa74e8160, i=0)
    at gfxPangoFonts.cpp:1936
#1  0x01ad1c11 in GetFontOrGroup (this=0xa51466b4, aKey=0xbfab1e2c)
    at gfxTextRunWordCache.cpp:899
#2  TextRunWordCache::CacheHashEntry::KeyEquals (this=0xa51466b4, 
    aKey=0xbfab1e2c) at gfxTextRunWordCache.cpp:910
#3  0x01a5cb74 in SearchTable (table=0xb45ce2d0, key=, 
    keyHash=, op=PL_DHASH_ADD) at pldhash.c:472
#4  0x01a5cc50 in PL_DHashTableOperate (table=0xb45ce2d0, key=0xbfab1e2c, 
    op=) at pldhash.c:661
#5  0x01ad2421 in nsTHashtable::PutEntry (
    this=0xb45ce2c0, aTextRun=0xa7ee0ae0, aFirstFont=0xad613d30, aStart=8, 
    aEnd=10, aHash=821, aDeferredWords=0x0)
    at ../../../dist/include/nsTHashtable.h:188
#6  TextRunWordCache::LookupWord (this=0xb45ce2c0, aTextRun=0xa7ee0ae0, 
    aFirstFont=0xad613d30, aStart=8, aEnd=10, aHash=821, aDeferredWords=0x0)
    at gfxTextRunWordCache.cpp:358
... etc.
You don't need to be familiar with Firefox source code to see that it's doing something with fonts, including something called LookupWord.
If a program is looping, it might not be doing the same thing all the time. When you run gdb -p, it stops the program so you can examine it. But you can continue it by typing c at the prompt. Ctrl-C stops it again, then another where prints another stack trace.
(gdb) where
#0  0xb686db07 in ?? () from /usr/lib/firefox-3.6.12/libmozjs.so
#1  0xb684bec9 in ?? () from /usr/lib/firefox-3.6.12/libmozjs.so
#2  0xb685cf66 in js_Invoke () from /usr/lib/firefox-3.6.12/libmozjs.so
#3  0xb6b6231b in ?? () from /usr/lib/firefox-3.6.12/libxul.so
Very different -- this one just suggests Firefox is doing something related to Javascript (JS) and XUL. Stop and start the process a few times, and you'll start to get a sense of where it's spending most of its time. You might get useful information you can use in filing a bug or searching the web for a workaround.
Stack traces can also be handy for programs that are hanging waiting for a resource. Here's that Python network app I used earlier:
(gdb) where
#0  0x006a2422 in __kernel_vsyscall ()
#1  0x0095d241 in recv () at ../sysdeps/unix/sysv/linux/i386/socket.S:61
#2  0x081301ba in ?? ()
#3  0x081303b4 in ?? ()
#4  0x080e0a21 in PyEval_EvalFrameEx ()
#5  0x080e2807 in PyEval_EvalCodeEx ()
#6  0x080e0c8b in PyEval_EvalFrameEx ()
... etc.
gdb shows the same thing strace did: it's in recv. The rest just tells you you're running inside Python, but not where you are in the Python script. How do you find out more?
Stay tuned for the next installment, which will cover techniques for debugging Python, and what to do if you don't have fancy developer tools like gdb installed on the problem machine.



Kernel_flow


Preliminaries

Refer to Net:Network Overview for an overview of all aspects of the networking kernel: routing, neighbour discovery, NAPI, filtering, ...
The network data (including headers etc.) is managed through the sk_buff data structure. This minimizes copying overhead when going through the networking layers. A basic understanding of sk_buff is required to understand the networking kernel.
The kernel as a whole makes heavy use of virtual methods. These are recorded as function pointers in data structures. In the figure these are indicated with diamonds. This article never shows all possible implementations for these virtual methods, just the main ones.
This article only discusses TCP over IPv4 over Ethernet connections. Of course, many combinations of the different networking layers are possible, as well as tunnelling, bridging, etc.

Transmission path



Layer 5: Session layer (sockets and files)

There are three system calls that can send data over the network:
  • write (memory data to a file descriptor)
  • sendto (memory data to a socket)
  • sendmsg (a composite message to a socket)
All of these eventually end up in __sock_sendmsg(), which does security_sock_sendmsg() to check permissions and then forwards the message to the next layer using the socket's sendmsg virtual method.

Layer 4: Transport layer (TCP)

tcp_sendmsg: for each segment in the message
  1. find an sk_buff with space available (use the one at the end if space left, otherwise allocate and append a new one)
  2. copy data from user space to sk_buff data space (kernel space, probably DMA-able space) using skb_add_data().
    • The buffer space is pre-allocated for each socket. If the buffer runs out of space, communication stalls: the data remains in user space until buffer space becomes available again (or the call returns with an error immediately if it was non-blocking).
    • The size of allocated sk_buff space is equal to the MSS (Maximum Segment Size) + headroom (MSS may change during connection, and is modified by user options).
    • Segmentation (or coalescing of individual writes) happens at this level. Whatever ends up in the same sk_buff will become a single TCP segment. Still, the segments can be fragmented further at IP level.
  3. The TCP queue is activated; packets are sent with tcp_transmit_skb() (called multiple times if there are more active buffers).
  4. tcp_transmit_skb() builds the TCP header (the allocation of the sk_buff has left space for it). It clones the skb in order to pass control to the network layer. The network layer is called through the queue_xmit virtual function of the socket's address family (inet_connection_sock->icsk_af_ops).

Layer 3: Network layer (IPv4)

  1. ip_queue_xmit() does routing (if necessary), creates the IPv4 header
  2. nf_hook() is called in several places to perform network filtering (firewall, NAT, ...). This hook may modify the datagram or discard it.
  3. The routing decision results in a destination (dst_entry) object. This destination models the receiving IP address of the datagram. The dst_entry's output virtual method is called to perform actual output.
  4. The sk_buff is passed on to ip_output() (or another output mechansim, e.g. in case of tunneling).
  5. ip_output() does post-routing filtering, re-outputs it on a new destination if necessary due to netfilteringfragments the datagram into packets if necessary, and finally sends it to the output device.
    • Fragmentation tries to reuse existing fragment buffers, if possible. This happens when forwarding an already fragmented incoming IP packet. The fragment buffers are special sk_buff objects, pointing in the same data space (no copy required).
    • If no fragment buffers are available, new sk_buff objects with new data space are allocated, and the data is copied.
    • Note that TCP already makes sure the packets are smaller than MTU, so normally fragmentation is not required.
  6. Device-specific output is again through a virtual method call, to output of the dst_entry's neighbour data structure. This usually is dev_queue_xmit. There is some optimisation for packets with a known destination (hh_cache).

Layer 2: Link layer (e.g. Ethernet)

The main function of the kernel at the link layer is scheduling the packets to be sent out. For this purpose, Linux uses the queueing discipline (struct Qdisc) abstraction. For detailed information, see Chapter 9 (Queueing Disciplines for Bandwidth Management) of the Linux Advanced Routing & Traffic Control HOWTO and Documentation//networking/multiqueue.txt.
dev_queue_xmit puts the sk_buff on the device queue using the qdisc->enqueue virtual method.
  • If necessary (when the device doesn't support scattered data) the data is linearised into the sk_buff. This requires copying.
  • Devices which don't have a Qdisc (e.g. loopback) go directly to dev_hard_start_xmit().
  • Several Qdisc scheduling policies exist. The basic and most used one is pfifo_fast, which has three priorities.
The device output queue is immediately triggered with qdisc_run(). It calls qdisc_restart(), which takes an skb from the queue using the qdisc->dequeue virtual method. Specific queueing disciplines may delay sending by not returning any skb, and setting up a qdisc_watchdog_timer() instead. When the timer expires, netif_schedule() is called to start transmission.
Eventually, the sk_buff is sent with dev_hard_start_xmit() and removed from the Qdisc. If sending fails, the skb is re-queued. netif_schedule() is called to schedule a retry.
netif_schedule() raises a software interrupt, which causes net_tx_action() to be called when the NET_TX_SOFTIRQ is ran by ksoftirqd. net_tx_action() calls qdisc_run() for each device with an active queue.
dev_hard_start_xmit() calls the hard_start_xmit virtual method for the net_device. But first, it calls dev_queue_xmit_nit(), which checks if a packet handler has been registered for the ETH_P_ALL protocol. This is used for tcpdump.
The device driver's hard_start_xmit function will generate one or more commands to the network device for scheduling transfer of the buffer. After a while, the network device replies that it's done. This triggers freeing of the sk_buff. If the sk_buff is freed from interrupt context, dev_kfree_skb_irq() is used. This delays the actual freeing until the next NET_TX_SOFTIRQ run, by putting the skb on the softnet_data completion_queue. This avoids doing frees from interrupt context.

Receive flow



Layer 2: Link layer (e.g. Ethernet)

The network device pre-allocates a number of sk_buffs for reception. How many, is configured per device. Usually, the addresses to the data space in these sk_buffs are configured directly as DMA area for the device. The device interrupt handler takes the sk_buff and performs reception handling on it. Before NAPI, this was done using netif_rx(). In NAPI, it is done in two phases.
  1. From the interrupt handler, the device driver just calls netif_rx_schedule() and returns from interrupt. netif_rx_schedule() adds the device to sofnet_data's poll_list and raises the NET_RX_SOFTIRQ software interrupt.
  2. ksoftirqd runs net_rx_action(), which calls the device's poll virtual method. The poll method does device-specific buffer management, calls netif_receive_skb() for each sk_buff, allocates new sk_buffs as required, and terminates with netif_rx_complete().
netif_receive_skb() finds out how to pass the sk_buff to upper layers.
  1. netpoll_rx() is called, to support the Netpoll API
  2. Call packet handlers for ETH_P_ALL protocol (for tcpdump)
  3. Call handle_ing() for ingress queueing
  4. Call handle_bridge() for bridging
  5. Call handle_macvlan() for virtual LAN
  6. Call the packet handler registered for the L3 protocol specified by the packet.
The packet handlers are called with the deliver_skb() function, which calls the protocol's func virtual method to handle the packet.

Layer 3: Network layer (IPv4, ARP)

ARP

ARP packets are handled with arp_rcv(). It processes the ARP information, stores it in the neighbour cache, and sends a reply if required. In the latter case, a new sk_buff (with new data space) is allocated for the reply.

IPv4

IPv4 packets are handled with ip_rcv(). It parses headers, checks for validity, sends an ICMP reply or error message if required. It also looks up the destination address using ip_route_input(). The destination's input virtual method is called with the sk_buff.
  • ip_mr_input() is called for multicast addresses. The packet may be forwarded using ip_mr_forward(), and it may be delivered locally using ip_local_delivery().
  • ip_forward() is called for packets with a different destination for which we have a route. It directly calls the neighbour's output virtual method.
  • ip_local_deliver() is called if this machine is the destination of the packet. Datagram fragments are collected here.
ip_local_deliver() delivers to any raw sockets for this connection first, using raw_local_deliver(). Then, it calls the L4 protocol handler for the protocol specified in the datagram. The L4 protocol is called even if a raw socket exists.
Throughout, xfrm4_policy_check calls are included to support IPSec.

Layer 4: Transport layer (TCP)

The net_protocol handler for TCP is tcp_v4_rcv(). Most of the code here deals with the protocol processing in TCP, for setting up connections, performing flow control, etc.
A received TCP packet may include an acknowledgement of a previously sent packet, which may trigger further sending of packets (tcp_data_snd_check()) or of acknowledgements (tcp_ack_snd_check()).
Passing the incoming packet to an upper layer is done in tcp_rcv_established() and tcp_data_queue(). These functions maintain the tcp connection's out_of_order_queue, and the socket's sk_receive_queue and sk_async_wait_queue. If a user process is already waiting for data to arrive, the data is immediately copied to user space using skb_copy_datagram_iovec(). Otherwise, the sk_buff is appended to one of the socket's queues and will be copied later.
Finally, the receive functions call the socket's sk_data_ready virtual method to signal that data is available. This wakes up waiting processes.

Layer 5: Session layer (sockets and files)

There are three system calls that can receive data from the network:
  • read (memory data from a file descriptor)
  • recvfrom (memory data from a socket)
  • recvmsg (a composite message from a socket)
All of these eventually end up in __sock_recvmsg(), which does security_sock_recvmsg() to check permissions and then requests the message to the next layer using the socket's recvmsg virtual method. This is often sock_common_recvmsg(), which calls the recvmsg virtual method of the socket's protocol.
tcp_recvmsg() either copies data from the socket's queue using skb_copy_datagram_iovec(), or waits for data to arrive using sk_wait_data(). The latter blocks and is woken up by the layer 4 processing.

by linuxfoundation.org

Understanding locks in networking




Understanding locks in networking

 

lock_sock and release_sock do not hold a normal spinlock directly but instead hold the owner field and do other housework as well.
lock_sock grabs the lock sk->sk_lock.slock, disables local bottom halves and then it checks to see if there is an owner. If it does it spins until this releases, sets the owner and then releases sk->sk_lock.slock. This means bh_lock_sock can still execute even if the socket is "locked" provided of course that the lock_sock call isn't in execution at that very point in time.
release_sock grabs the sk_lock.slock, processes any receive backlog, clears the owner, wakes up any wait queue on sk_lock.wq and then releases sk_lock.slock and enables bottom halves.
bh_lock_sock and bh_release_sock just grab and release sk->sk_lock.slock
Below are code samples to help illustrate the points.

lock_sock

in include/net/sock.h
extern void FASTCALL(lock_sock(struct sock *sk));
extern void FASTCALL(release_sock(struct sock *sk));
in net/core/sock.c
void fastcall lock_sock(struct sock *sk)
{
 might_sleep();
 spin_lock_bh(&(sk->sk_lock.slock));
 if (sk->sk_lock.owner)
  __lock_sock(sk);
 sk->sk_lock.owner = (void *)1;
 spin_unlock_bh(&(sk->sk_lock.slock));
}

EXPORT_SYMBOL(lock_sock);

void fastcall release_sock(struct sock *sk)
{
 spin_lock_bh(&(sk->sk_lock.slock));
 if (sk->sk_backlog.tail)
  __release_sock(sk);
 sk->sk_lock.owner = NULL;
        if (waitqueue_active(&(sk->sk_lock.wq)))
  wake_up(&(sk->sk_lock.wq));
 spin_unlock_bh(&(sk->sk_lock.slock));
}
EXPORT_SYMBOL(release_sock);
and
static void __lock_sock(struct sock *sk)
{
 DEFINE_WAIT(wait);

 for(;;) {
  prepare_to_wait_exclusive(&sk->sk_lock.wq, &wait,
     TASK_UNINTERRUPTIBLE);
  spin_unlock_bh(&sk->sk_lock.slock);
  schedule();
  spin_lock_bh(&sk->sk_lock.slock);
  if(!sock_owned_by_user(sk))
   break;
 }
 finish_wait(&sk->sk_lock.wq, &wait);
}

static void __release_sock(struct sock *sk)
{
 struct sk_buff *skb = sk->sk_backlog.head;

 do {
  sk->sk_backlog.head = sk->sk_backlog.tail = NULL;
  bh_unlock_sock(sk);

  do {
   struct sk_buff *next = skb->next;

   skb->next = NULL;
   sk->sk_backlog_rcv(sk, skb);

   /*
    * We are in process context here with softirqs
    * disabled, use cond_resched_softirq() to preempt.
    * This is safe to do because we've taken the backlog
    * queue private:
    */
   cond_resched_softirq();

   skb = next;
  } while (skb != NULL);

  bh_lock_sock(sk);
 } while((skb = sk->sk_backlog.head) != NULL);
}

bh_lock_sock

in include/net/sock.h
#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock))
#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))

general locking

in include/linux/spinlock.h:
#define spin_lock_bh(lock)             _spin_lock_bh(lock)
in include/linux/spinlock_api_smp.h
void __lockfunc _spin_lock(spinlock_t *lock)           __acquires(spinlock_t);
void __lockfunc _spin_lock_bh(spinlock_t *lock)        __acquires(spinlock_t);
in include/linux/spinlock_api_up.h:
#define _spin_lock_bh(lock)                     __LOCK_BH(lock)
#define _spin_lock(lock)                        __LOCK(lock)

#define __LOCK(lock) \
  do { preempt_disable(); __acquire(lock); (void)(lock); } while (0)

#define __LOCK_BH(lock) \
  do { local_bh_disable(); __LOCK(lock); } while (0)

#define __LOCK_IRQ(lock) \
  do { local_irq_disable(); __LOCK(lock); } while (0)

#define __LOCK_IRQSAVE(lock, flags) \
  do { local_irq_save(flags); __LOCK(lock); } while (0)

#define __UNLOCK(lock) \
  do { preempt_enable(); __release(lock); (void)(lock); } while (0)

#define __UNLOCK_BH(lock) \
  do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0)

#define __UNLOCK_IRQ(lock) \
  do { local_irq_enable(); __UNLOCK(lock); } while (0)

#define __UNLOCK_IRQRESTORE(lock, flags) \
  do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
in include/linux/spinlock.h
#define spin_lock(lock)                        _spin_lock(lock
by linuxfoundation.org

25/12/10

From Noob to Ninja

 From Noob to Ninja

Every Linux user has been new at some point, and unless you’ve got a history of UNIX administration, the transition was likely a bit daunting. Many people began learning Linux before sites like Google and StackExchange made it easy to find answers, and ended up having to figure everything out in their own. While inconvenient, this approach can force you to challenge yourself and learn things about the system that you might otherwise never find out.
Usually here at MakeTechEasier, we focus on specific topics for our tutorials. This time we’re taking a different approach, and providing a high-level overview of series of steps designed to hone the skills of a Linux beginner, and turn them into the kind of geek who compiles a new kernel for fun.

Step 1 – Install an “Easy” Linux in Real Partitions

There’s a good chance that if you’re reading this, you’ve likely already installed a Linux such as Ubuntu or Fedora. These “desktop” Linux systems are specifically designed to be as simple as possible to install. It’s important to do an actual partition-based install (as opposed to a “virtual” partition as done by Wubi) because this will ensure you understand the way the partitions are named and the importance of a swap partition.
linuxninja-lucidinstall

Step 2 – Learn the Filesystem

This is particularly important if you’re transitioning from Windows. Linux does not store programs the same way Windows does. On Windows, a program’s files are normally stored in (drumroll please) Program Files, and that usually includes just about everything the program needs. Linux, however, takes an approach that may seem a bit more complicated but has some advantages.
linuxninja-fs
A Linux package will normally place its executable files in a location like /usr/bin, its configuration files in /etc, and perhaps its log files in /var. Why the split? In short, because that allows a user or administrator to work with groups of related files. For example, if you wanted to reinstall your OS but a lot of your apps have custom configurations, you can just back up your /etc directory and all your configs are saved. You could put /var in its own partition so that log files have a hard limit on the space they can take up.
For detailed info on the Linux filesystem hierarchy, check out this great guide from the folks at The Linux Documentation Project.

Step 3 – Explore /proc

We’ve mentioned before how useful it can be to understand /proc, the special filesystem created by Linux to hold dynamic system information. Understanding proc is essential toward understanding Linux, because it gives you live feedback on the state of your hardware and software.

Step 4 – Compile a Kernel

This is where a lot of people step back, feeling as if they’re not ready. The honest truth is that compiling a custom kernel is not as complicated as it may sound. Most of the time, the process consists of a few shell commands and a few minutes of reading over checkboxes. Often, customizing a kernel build is literally as simple as browsing a long list of options and picking the ones that sound good. Many options come with a recommended setting to help guide choices you might not be familiar with.
linuxninja-xconfig
Ubuntu provides an excellent guide on this topic here.

Step 5 – Install Gentoo

There are a few source-based distributions out there, and Gentoo is probably the best known among them. Where your average Linux like Ubuntu and Fedora will fetch packages, Gentoo fetches only the source code, and compile that code into the actual program. There are a few advantages (and disadvantages) to this approach, namely speed and flexibility.
Gentoo users set certain flags for the system that specify, among other things, the CPU type of the machine. When a user requests a package, say for example Firefox, Gentoo’s package manager will search the Firefox source code pack and download the code. It will check the user’s flags to get information, and then build the package that’s specifically optimized for that CPU.
linuxninja-gentoo
The Gentoo install process is not easy. It’s done through the command line and almost everything is done manually, so Gentoo provides excellent install documentation to help get you through.

Step 6 – Learn a Scripting Language

While C is usually the language of choice for Linux system internals, many of the applications are tied together using higher level programming and scripting languages like Python and bash. Learning one or both of these can be IMMENSELY useful for managing and automating your system.
For example, just yesterday I spoke with a friend who was tasked with gathering the specs from hundreds of hard drives on a company network. Many people would let out a little sigh, grab a clipboard, and start opening machines. This friend, being a Linux geek, instead whipped up a 3-line bash script which scanned the hard drive data for the whole network and printed the results in seconds.
If you’re looking for a place to start learning, MTE has a Basic Introduction to Python 3.

Step 7 – Install Linux From Scratch

You may have noticed in the section above when I mentioned that a Gentoo install involves doing nearly everything manually. Take out the word “nearly”, and you’re beginning to envision a LFS install. LFS is not a distribution exactly. In fact, it’s not a distribution at all. It’s a series of instructions, a way to build every… single… piece… of your Linux install directly from source code tarballs. There is no package manager, no installer, no helpful utilities. You just follow the steps to put each and every piece in place to make a bootable system.
The first time I did LFS, it took me a solid week to get it bootable. With some practice and a fast machine, you may be able to trim that down to a few hours. LFS is not for those lacking in serenity and patience, but if you’re willing to put in the time and effort, it’s one of the most rewarding experiences you can have on a PC.

Pidgin SSL Certificate Error? Here’s The Fix


Pidgin SSL Certificate Error? Here’s The Fix

pidgin-ssl-error

Update: The latest version of Pidgin (2.7.7) has fixed this issue. For Windows users, uninstall your current version, download and install the latest version. For Ubuntu users, add the following PPA and update your system:
sudo add-apt-repository ppa:pidgin-developers/ppa
sudo apt-get update && sudo apt-get upgrade
If you are using Pidgin to connect to your MSN messenger, you will probably receive the SSL certificate error message. it’s kinda irritating and prevents you from connecting to your MSN account. Here’s the fix.

1. Go to https://omega.contacts.msn.com/
2. On the URL bar, click on the security lock (usually just in front of the URL). Click on the certificate information.
pidgin-certificate-information
3. Go to the Detail tab and click the “Export” button. Save the file as “omega.contacts.msn.com” (without the quotes).
pidgin-export-certificate
4. Copy and paste this file to
“/home/your-username/.purple/certificates/x509/tls_peers/omega.contacts.msn.com”. When prompted, select “Replace” to replace the existing file.
That’s it. Open your Pidgin and the SSL certificate error will be gone.

Install Photoshop CS5 in Ubuntu Maverick 10.10

Install Photoshop CS5

in Ubuntu Maverick

10.10


photoshop-main
If you are running Ubuntu 10.10 Maverick and own a copy of the Photoshop CS 5 installer, you will find that you won’t be able to install it under wine. Photoshop CS5 on Ubuntu 10.4 works fine, but not 10.10. Here’s what I did to get it running on my Ubuntu Maverick machine.
What you’ll need:
  • A computer running Ubuntu Maverick
  • A computer running Windows (it doesn’t have to be a computer. It can be a virtual machine running Windows in Virtualbox)
  • A copy of Photoshop CS5 installer. You can get the trial version at Adobe website

Let’s get started

In your Windows machine, download (if you don’t own a copy) and install the Photoshop CS5.
Once the installation is completed, go the Start menu and type “regedit” on the search bar. The registry window will appear. Navigate to “HKEY_LOCAL_MACHINE -> Software -> Adobe“, right click the Adobe folder and select “Export”. When prompted, name the file “adobe.reg”.
photoshop-reg
photoshop-reg-export
Back to your Ubuntu Maverick machine, we will need to install wine and the Microsoft true type fonts
1sudo apt-get install wine ttf-mscorefonts-installer
This will create the “.wine” folder and prepare wine for usage.
Next, we are going to perform some hacks
1wget http://www.kegel.com/wine/winetricks
2sh winetricks msxml6 gdiplus gecko vcrun2005sp1 vcrun2008 msxml3 atmlib

Copying Photoshop files from Windows

Since we can’t get the installer to work in Ubuntu 10.10, we have to copy the core files from Windows to the Ubuntu machine. Folders/files you need to copy/paste are listed down below:
Copy the following folders/files from WindowsandPaste to Ubuntu
C:\Program Files\Adobe\->$HOME/.wine/drive_c/Program Files/Adobe
C:\Program Files\Common Files\Adobe->$HOME/.wine/drive_c/Program Files/Common Files/Adobe
C:\Documents and Settings\$USER\Application Data\Adobe->$HOME/.wine/drive_c/users/$USER/Applications Data/Adobe
C:\windows\system32\odbcint.dll->$HOME/.wine/drive_c/windows/system32/odbcint.dll
Lastly, save the “adobe.reg” file to the Home folder. In your terminal, type:
1wine regedit adobe.reg
This will import the “adobe.reg” into the wine registry.
That’s it. Now go to “Home -> .wine -> drive_c -> Program Files -> Adobe ->Adobe Photoshop CS5“, right click on the Photoshop.exe file and select “Open with Wine Windows Program Loader”.
photoshop-open-with-wine
Photoshop CS5 should load. You can also add a shortcut to the Application Menu for quick access.
Note:
1. Some people have mentioned that Photoshop CS5 in Ubuntu crashed with the text function. This has been fixed with the addition of atmlib.dll file.
2. Complex PSD file should load without problem.
3. The above mods were done with wine version 1.2.1. and Photoshop CS5 trial version. If you are using other version of wine or Photoshop, there is no guarantee that the above method will work.

Alternative to Photoshop CS5

For those who can’t get Photoshop CS5 to work, or find it too heavy for your daily usage, you can try out PhotoShop CS5 Portable. This is the unofficial portable version of Photoshop CS5 (not released by Adobe) and the installer work fine with wine. You will still need the atmlib.dll file for the text function to work.
:).

Fix for GPG error UBUNTU

Fix for GPG error UBUNTU 


When you try to access ubuntu extras you might see following GPG error
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used.
GPG error: http://extras.ubuntu.com maverick Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192

W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/maverick/Release
Solution
Open the terminal and run the following commands
gpg –keyserver keyserver.ubuntu.com –recv 3E5C1192
gpg –export –armor 3E5C1192 | sudo apt-key add -
sudo apt-get update

finish
If yaou got more error leave coment or send email to me thanks :).

21/12/10

30 Black Hat SEO Techniques

30 Black Hat SEO Techniques 
Wicked by xlorddashx.
Black hat SEO is both a myth and a reality we have to face sooner or later as SEO practicioners. While I abide by probably one of the strictest SEO codes of ethics around and SEOptimise is a clean white hat SEO company company itself we still can’t deny that there is black hat SEO.
The sheer existence of black hat SEO techniques must be acknowledged for several reasons.
As Rishi Lakhani noted on his new SEO blog: You need it at least to know what to avoid or to know how competitors who perform worse than you still manage to outrank your site.

The good news is: Most black hat SEO techniques can be used in a clean, ethical white hat way as well.
They are like knives: You can slice bread with a knife but you can kill with it as well. It’s your decision how you use the knife. Also consider the problem with overall perception of the SEO industry. Your hat can be whiter than snow and still people will treat you as the guy with the virtual knife.
Personally I think black hat SEO is for the weak.
The black hat logic goes: When you can’t win the game you have to cheat. It’s the same dilemma as in sports though: When everybody cheats how are you going to win? That’s why reputable and successful SEO experts don’t have to use it.
OK, long story short, here are the 30 black hat techniques you can use ethically as well. Take note how I am explaining only the positive way of using each technique. I do not advocate the use of it in it’s original black hat context. Use these knives as kitchen knives:

black hat by googlisti
http://crazyflx.com/dap/a/?a=79&p=www.crazyflx.com/softwarebots/ultimate-google-suggest-scraper-over-300-to-have-made-yours-for-24-99/
  1. Hidden text – Create modern CSS based websites with JQuery effects. They often hide large portions of text in layers to display them on click or mouse over for usability reasons. Example: CSS pagination.
  2. IP delivery – Offer the proper localized content to those coming from a country specific IP address. Offer the user a choice though. Shopping.com does a great job here.
  3. 301 redirects – Redirect outdated pages to the newer versions or your homepage. When moving to a new domain use them of course as well.
  4. Throw Away Domains – Create exact match micro sites for short term popular keywords and abandon them when the trend subsides. Something like tigerwoodssexrehab.com
  5. Cloaking – Hide the heavy Flash animations from Google, show the text-only version optimized for accessibility and findability.
  6. Paid links – Donate for charity, software developers etc. Many of them display links to those who donate.
  7. Keyword stuffing – Tags and folksonomy. Keyword stuff but adding several tags or let your users do the dirty work via UGC tagging (folksonomy) every major social site does that.
  8. Automatically generated keyword pages – Some shopping search engines create pages from each Google search query and assign the appropriate products to each query. You can do that as well if you have enough content.
  9. Mispsellings – Define, correct the misspelled term and/or redirect to the correct version.
  10. Scraping – Create mirrors for popular sites. Offer them to the respective webmasters. Most will be glad to pay less.
  11. Ad only pages – Create all page ads (interstitials) and show them before users see content like many old media do.
  12. Blog spam – Don’t spam yourself! Get spammed! Install a WordPress blog without Akismet spam protection. Then create a few posts about Mesothelioma for example, a very profitable keyword. Then let spammers comment spam it or even add posts (via TDO Mini Forms). Last but not least parse the comments for your keyword and outgoing links. If they contain the keyword publish them and remove the outgoing links of course. Bot user generated content so to say.
  13. Duplicate content on multiple domains – Offer your content under a creative Commons License with attribution.
  14. Domain grabbing – Buy old authority domains that failed and revive them instead of putting them on sale.
  15. Fake newsCreate real news on official looking sites for real events. You can even do it in print. Works great for all kinds of activism related topics.
  16. Link farm – Create a legit blog network of flagship blogs. A full time pro blogger can manage 3 to 5 high quality blogs by her or himself.
  17. New exploits – Find them and report them, blog about them. You break story and thus you get all the attention and links. Dave Naylor is excellent at it.
  18. Brand jacking – Write a bad review for a brand that has disappointed you or destroys the planet or set up a brand x sucks page and let consumers voice their concerns.
  19. Rogue bots – Spider websites and make their webmasters aware of broken links and other issues. Some people may be thankful enough to link to you.
  20. Hidden affiliate links – In fact hiding affiliate links is good for usability and can be even more ethical than showing them. example.com/ref?id=87233683 is far worse than than just example.com. Also unsuspecting Web users will copy your ad to forums etc. which might break their TOS. The only thing you have to do is disclose the affiliate as such. I prefer to use [ad] (on Twitter for example) or [partner-link] elsewhere. This way you can strip the annoying “ref” ids and achieve full disclosure at the same time.
  21. Doorway pages – Effectively doorway pages could also be called landing pages. The only difference is that doorway pages are worthless crap while landing pages are streamlined to suffice on their own. Common for both is that they are highly optimized for organic search traffic. So instead of making your doorway pages just a place to get skipped optimize them as landing pages and make the users convert right there.
  22. Multiple subdomains – Multiple subdomains for one domain can serve an ethical purpose. Just think blogspot.co or wordpress.com – they create multiple subdomains by UGC. This way they can rank several times for a query. You can offer subdomains to your users as well.
  23. Twitter automation – There is nothing wrong with Twitter automation as long as you don’t overdo it. Scheduling and repeating tweets, even automatically tweeting RSS feeds from your or other blogs is perfectly OK as long as the Twitter account has a real person attending it who tweets “manually” as well. Bot accounts can be ethical as well in case they are useful no only for yourself. A bot collecting news about Haiti in the aftermath of the earthquake would be perfectly legit if you ask me.
  24. Deceptive headlines – Tabloids use them all the time, black hat SEO also do. There are ethical use cases for deceptive headlines though. Satire is one of course and humor simply as well. For instance I could end this list with 24 items and declare this post to a list of 30 items anyways. That would be a good laugh. I’ve done that in the past but in a more humorous post.
  25. Google Bowling – The bad thing about Google bowling is that you hurt sites you don’t like. You could reverse that: Reverse Google bowling would mean that you push sites of competitors you like to make those you dislike disappear below. In a way we do that all the time linking out to the competition, the good guys of SEO who then outrank the ugly sites we like a lot less.
  26. Invisible links – You’d never used invisible links on your sites did you? You liar! You have. Most free web counters and statistic tools use them. Statcounter is a good example. So when you embed them on your site you use invisible links.
  27. Different content for search engines than users – Do you use WordPress? Then you have the nofollow attribute added to your comment links. this way the search engine gets different content than the user. He sees and clicks a link. A search bot sees a no trespass sign instead. In white hat SEO it’s often called PageRank sculpting. Most social media add ons do that by default.
  28. Hacking sites – While crackers hack sites security experts warn site owners that they vulnerabilities. Both discover the same issues. Recently I got an email by someone who warned me to update my WordPress installation. That was a grand idea I thought.
  29. Slander linkbait – Pulling a Calacanis like “SEO is bullshit” is quite common these days. Why don’t do it the other way around? The anti SEO thing doesn’t work that good anymore unless you are as famous as Robert Scoble. In contrast a post dealing with “100 Reasons to Love SEO Experts” might strike a chord by now.
  30. Map spam – Instead of faking multiple addresses all over the place just to appear on Google Maps and Local why don’t you simply create an affiliate network of real life small business owners with shops and offices who, for a small amount of money, are your representatives there? All they need to do is to collect your mail from Google and potential clients.