gdb backtrace for a chromium hangup

(gdb) bt
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007f9d69721343 in base::ConditionVariable::TimedWait (this=0x7fffdb12b308, max_time=...)
    at ../../base/synchronization/condition_variable_posix.cc:102
#2  0x00007f9d696fde2c in base::WaitableEvent::TimedWait (this=0x7f9d705c0540, max_time=...)
    at ../../base/synchronization/waitable_event_posix.cc:214
#3  0x00007f9d696dcc16 in base::MessagePumpDefault::Run (this=0x7f9d705c0530, delegate=0x7fffdb12b570)
    at ../../base/message_loop/message_pump_default.cc:56
#4  0x00007f9d696edc51 in base::RunLoop::Run (this=0x7fffdb12b3e0) at ../../base/run_loop.cc:49
#5  0x00007f9d696da157 in base::MessageLoop::Run (this=) at ../../base/message_loop/message_loop.cc:308
#6  0x00007f9d6c310ffc in content::RendererMain (parameters=...) at ../../content/renderer/renderer_main.cc:227
#7  0x00007f9d696a31de in content::RunZygote (main_function_params=..., delegate=)
    at ../../content/app/content_main_runner.cc:339
#8  0x00007f9d696a4071 in content::ContentMainRunnerImpl::Run (this=0x7f9d7059a270)
    at ../../content/app/content_main_runner.cc:764
#9  0x00007f9d696a2db0 in content::ContentMain (params=...) at ../../content/app/content_main.cc:19
#10 0x00007f9d69101ec8 in ChromeMain (argc=4, argv=0x7fffdb12bbd8) at ../../chrome/app/chrome_main.cc:57
#11 0x00007f9d60e91b45 in __libc_start_main (main=0x7f9d69101e70 , argc=4, argv=0x7fffdb12bbd8, 
    init=, fini=, rtld_fini=, stack_end=0x7fffdb12bbc8) at libc-start.c:287
#12 0x00007f9d69101d6f in _start ()
(gdb) 

How to manipulate packages with dpkg (Enabling Muilti-Arch in Multi-Arch support) ?

$dpkg --print-architecture
amd64
$dpkg --print-foreign-architectures
$dpkg --add-architecture i386
dpkg: error: unable to create new file '/var/lib/dpkg/arch-new': Permission denied
$sudo dpkg --add-architecture i386
[sudo] password for jeffrin: 
$dpkg --print-foreign-architectures
i386
$sudo dpkg --add-architecture itest386
$dpkg --print-foreign-architectures
i386
itest386
$dpkg --remove-architecture itest386
dpkg: error: unable to create new file '/var/lib/dpkg/arch-new': Permission denied
$sudo dpkg --remove-architecture itest386
$dpkg --print-foreign-architectures
i386
$sudo dpkg --remove-architecture i386
$dpkg --print-foreign-architectures
$

How to write a program to solve project Euler problem 4

'''
This file is worked on from http://www.s-anand.net/euler.html , Solution of Problem 4 

A palindromic number reads the same both ways. The largest palindrome made from the product 
of two 2-digit numbers is 9009 = 91 x 99.

Find the largest palindrome made from the product of two 3-digit numbers.

'''

n = 0

for a in xrange(999,100,-1):
    for b in xrange(a,100,-1):
        x = a * b
        if ( x > n ):
            s = str( a * b )
            if s == s[::-1]:
                n = a * b
print n
Hacking with runit and sv ( sv – control and manage services monitored by runsv(8) ) commands

$pwd
/etc/service
$ls
hello.sh
$mkdir new
mkdir: cannot create directory ‘new’: Permission denied
$sudo mkdir new
$mv hello.sh new/run
mv: cannot move ‘hello.sh’ to ‘new/run’: Permission denied
$sudo mv hello.sh new/run
$ls
new
$cd new/
$ls
run  supervise
$ls -l
total 8
-rw-r--r-- 1 root root   11 Oct 24 18:55 run
drwx------ 2 root root 4096 Oct 24 18:57 supervise
$cd supervise/
bash: cd: supervise/: Permission denied
$sudo cd supervise/
sudo: cd: command not found
$sudo sv start /etc/service/new
timeout: down: /etc/service/new: 1s, normally up, want up
$sudo sv status /etc/service/new
down: /etc/service/new: 0s, normally up, want up
$sudo sv restart /etc/service/new
timeout: down: /etc/service/new: 0s, normally up, want up
$sudo emacs /etc/service/new/run 
$sudo sv restart /etc/service/new
timeout: down: /etc/service/new: 0s, normally up, want up
$sudo sv stop /etc/service/new
ok: down: /etc/service/new: 0s, normally up, want up
$sudo chmod +x /etc/service/new/run
$sudo sv start /etc/service/new
timeout: down: /etc/service/new: 0s, normally up, want up
$sudo sv start /etc/service/new/
timeout: down: /etc/service/new/: 1s, normally up, want up
$su
Password: 
root>sv start /etc/service/new/
run        run~       supervise/ 
root>sv start /etc/service/new/run
fail: /etc/service/new/run: unable to change to service directory: not a directory
root>sv start /etc/service/new/
timeout: down: /etc/service/new/: 1s, normally up, want up
root>exit
$echo $?
1
$sudo sv stop /etc/service/new/
ok: down: /etc/service/new/: 1s, normally up, want up
$echo $?
0
$sudo runit
- runit: fatal: must be run as process no 1.
$sudo runit enable
- runit: fatal: must be run as process no 1.
$

Project Euler Problem 2, solution internals related using ruby debugger

$ruby -rdebug euler-two.rb 
Debug.rb
Emacs support available.

/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:57:        RUBYGEMS_ACTIVATION_MONITOR.enter
(rdb:1) r
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:57:        RUBYGEMS_ACTIVATION_MONITOR.enter
(rdb:1) 
r
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:57:        RUBYGEMS_ACTIVATION_MONITOR.enter
(rdb:1) next
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:143:    RUBYGEMS_ACTIVATION_MONITOR.exit
(rdb:1) next
euler-two.rb:3:n1, n2 = 1, 2
(rdb:1) next
euler-two.rb:4:sum = 0
(rdb:1) print n1
1nil
(rdb:1) print n2
2nil
(rdb:1) next
euler-two.rb:6:while n2 < 4000000
(rdb:1) print n2
2nil
(rdb:1) next
euler-two.rb:7:sum += (n2 % 2 == 0) ? n2 : 0
(rdb:1) next
euler-two.rb:7:sum += (n2 % 2 == 0) ? n2 : 0
(rdb:1) print sum
0nil
(rdb:1) next
euler-two.rb:8:n1, n2 = n2, (n1 + n2) # iterate through fibonacci seq
(rdb:1) print sum
2nil
(rdb:1) next
euler-two.rb:8:n1, n2 = n2, (n1 + n2) # iterate through fibonacci seq
(rdb:1) next
euler-two.rb:7:sum += (n2 % 2 == 0) ? n2 : 0
(rdb:1) next
euler-two.rb:7:sum += (n2 % 2 == 0) ? n2 : 0
(rdb:1) print sum
2nil
(rdb:1) next
euler-two.rb:8:n1, n2 = n2, (n1 + n2) # iterate through fibonacci seq
(rdb:1) print sum
2nil
(rdb:1) continue
/usr/lib/ruby/2.1.0/debug.rb:290:in `eval':undefined local variable or method `continue' for main:Object
	from /usr/lib/ruby/2.1.0/debug.rb:290:in `rescue in debug_eval'
	from /usr/lib/ruby/2.1.0/debug.rb:287:in `debug_eval'
	from /usr/lib/ruby/2.1.0/debug.rb:661:in `block in debug_command'
	from /usr/lib/ruby/2.1.0/debug.rb:400:in `catch'
	from /usr/lib/ruby/2.1.0/debug.rb:400:in `debug_command'
	from /usr/lib/ruby/2.1.0/debug.rb:859:in `trace_func'
	from /usr/lib/ruby/2.1.0/debug.rb:1085:in `block in '
	from euler-two.rb:8:in `
' (rdb:1) puts nil (rdb:1) puts sum 2 nil (rdb:1) puts n1 2 nil (rdb:1) puts n2 3 nil (rdb:1) quit Really quit? (y/n) y $
Project Euler Problem 3, solution internals using python debugger

$python -m pdb euler-three.py 
> /home/jeffrin/beautifulwork/lib/euler-three.py(7)()
-> '''
(Pdb) r
6857
--Return--
> /home/jeffrin/beautifulwork/lib/euler-three.py(17)()->None
-> print n
(Pdb) next
--Return--
> (1)()->None
(Pdb) next
The program finished and will be restarted
> /home/jeffrin/beautifulwork/lib/euler-three.py(7)()
-> '''
(Pdb) next
> /home/jeffrin/beautifulwork/lib/euler-three.py(9)()
-> n = 600851475143
(Pdb) next
> /home/jeffrin/beautifulwork/lib/euler-three.py(11)()
-> i = 2
(Pdb) next
> /home/jeffrin/beautifulwork/lib/euler-three.py(12)()
-> while i * i < n:
(Pdb) print i
2
(Pdb) next
> /home/jeffrin/beautifulwork/lib/euler-three.py(13)()
-> while n % i == 0:
(Pdb) print n
600851475143
(Pdb) print n % i
1
(Pdb) next
> /home/jeffrin/beautifulwork/lib/euler-three.py(15)()
-> i = i + 1
(Pdb) print i
2
(Pdb) next
> /home/jeffrin/beautifulwork/lib/euler-three.py(12)()
-> while i * i < n:
(Pdb) next
> /home/jeffrin/beautifulwork/lib/euler-three.py(13)()
-> while n % i == 0:
(Pdb) print n % i
2
(Pdb) next
> /home/jeffrin/beautifulwork/lib/euler-three.py(15)()
-> i = i + 1
(Pdb) continue
6857
The program finished and will be restarted
> /home/jeffrin/beautifulwork/lib/euler-three.py(7)()
-> '''
(Pdb) 




Copyright © 2009,  2010,  2011,  2012,  2013, 2014     BeautifulWork Project    e-mail:  ahiliation@yahoo.co.in
BeautifulWork Project comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.