<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>LinuxQuestions.org - Blogs</title>
		<link>http://www.linuxquestions.org/questions/blog.php</link>
		<description>LinuxQuestions.org offers a free Linux forum where Linux newbies can ask questions and Linux experts can offer advice. Topics include security, installation, networking and much more.</description>
		<language>en</language>
		<lastBuildDate>Fri, 10 Feb 2012 07:58:23 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://lqcdn.thequestionsnetwork.net/questions/images/misc/rss.jpg</url>
			<title>LinuxQuestions.org - Blogs</title>
			<link>http://www.linuxquestions.org/questions/blog.php</link>
		</image>
		<item>
			<title>Kate and Phil</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34455</link>
			<pubDate>Thu, 09 Feb 2012 22:51:02 GMT</pubDate>
			<description><![CDATA[I use KDE's Kate (http://kate-editor.org/) editor a lot. Recently, it has complained about opening some of my messy HTML files, giving the following...]]></description>
			<content:encoded><![CDATA[<div>I use KDE's <a href="http://kate-editor.org/" target="_blank">Kate</a> editor a lot. Recently, it has complained about opening some of my messy HTML files, giving the following slightly opaque error message:<br />
<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				The file [whatever] was opened and contained too long lines (more than 1,024 characters). Too long lines were wrapped and the document is set to read-only mode, as saving will modify its content.
			
		</td>
	</tr>
	</table>
</div>I searched for a portion of this text using <a href="http://startpage.com/" target="_blank">Startpage</a> and found just one result, in <a href="http://osdir.com/ml/kde-commits/2011-06/msg07612.html" target="_blank">a post to the kde-commits list</a>, pertaining to <a href="http://bugs.kde.org/show_bug.cgi?id=234475" target="_blank">bug 234475</a>.<br />
<br />
Well, I've not yet experienced such hangs when opening files, so I threw caution to the wind and, in Configure Kate &gt;  Open/Save, I increased the Line Limit Length from 1024 to 2048.<br />
<br />
Now my file opens and is writeable.<br />
<br />
For some reason this brought to mind the time a few years ago when the estimable Phil Hands decided he was selling himself short and doubled his day rate from £512 to £1024. Let me see what he's charging nowadays...<br />
<br />
Well, <a href="http://hands.com" target="_blank">Phil</a>'s a reasonable guy. In these straitened times, he has held his price, more or less. He now charges in guineas (maybe he always did and I forgot). So that's 1024 times 21 shillings (or £1.05 in the new money), making £1075 and four shillings (£1075.20). Plus VAT.<br />
<br />
As far as I know, no 'hang opening file' bug has yet been filed on Phil, which is good, because we want the co-sponsor and maintainer of the UK Debian mirror to be reasonably stable.</div>

]]></content:encoded>
			<dc:creator>trevorparsons</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34455</guid>
		</item>
		<item>
			<title>Monitoring sound over time for long periods to see trends using a microphone</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34454</link>
			<pubDate>Thu, 09 Feb 2012 21:54:39 GMT</pubDate>
			<description>Recently a post was made requesting a solution to detecting sound in a studio to see if it is populated with lots of noise (lots of...</description>
			<content:encoded><![CDATA[<div>Recently a post was made requesting a solution to detecting sound in a studio to see if it is populated with lots of noise (lots of noise=people/bands playing) this way the person monitoring it wouldn't have to go through the trouble of hulking all their stuff to the studio.<br />
<br />
I posted an interesting solution so I'm sharing it here and a little more on this blog.  See <a href="http://www.linuxquestions.org/questions/linux-newbie-8/wall-wart-linux-to-allow-audio-monitoring-via-wifi-network-928205/#post4597495">post #9 of this thread</a>.<br />
<br />
I'm going to expand upon that munin plugin and make it a little more robust and informative.  I'll rewrite the munin plugin a bit to include more information on the same graph and be a little better.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 450px;
		text-align: left;
		overflow: auto">#!/bin/sh

case $1 in
   config)
           cat &lt;&lt;EOM
graph_title Sound Amplitude
graph_args -l -1 --upper-limit 1
graph_vlabel Amplitude
graph_info Shows the sound amplitude values during the 1 second interval recorded discretely every minute.
mxamp.label max_ampl
mxamp.info Maximum amplitude
mnamp.label min_ampl
mnamp.info Minimum amplitude
mdamp.label mid_ampl
mdamp.info Midline amplitude
EOM
           exit 0;; 
esac

arecord -d 1 -f cd -t wav /tmp/foo.wav &amp;&gt; /dev/null
echo -n &quot;mxamp.value &quot; 
sox /tmp/foo.wav -n stat 2&gt;&amp;1 | grep 'Maximum amplitude' | awk '{print $3}'
echo -n &quot;mnamp.value &quot;
sox /tmp/foo.wav -n stat 2&gt;&amp;1 | grep 'Minimum amplitude' | awk '{print $3}'
echo -n &quot;mdamp.value &quot;
sox /tmp/foo.wav -n stat 2&gt;&amp;1 | grep 'Midline amplitude' | awk '{print $3}'
rm -f /tmp/foo.wav</pre>
</div>Of course, that plugin can be further improved by writing an awk script which parses out all of the values and displays all three values at once that way the sox command is only run once and it uses less CPU.  Though power savings will be almost negligible by doing that.  I kept it this way for readability mostly.<br />
<br />
The new munin plugin improves upon the last one by providing more information which is a little more useful than just knowing the maximum amplitude of the 1 second sample recorded at the time of running the plugin.  At any rate I thought that was a cool little project I got myself into so I documented it here.<br />
<br />
SAM</div>

]]></content:encoded>
			<dc:creator>sag47</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34454</guid>
		</item>
		<item>
			<title>How to Block website in RHEL 6 using squid proxy server</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34453</link>
			<pubDate>Thu, 09 Feb 2012 11:39:41 GMT</pubDate>
			<description>i m using squid proxy server.... 
now i want to block some websites using squid.conf file.. 
in this case, i write some entery for blocking.. 
 
acl...</description>
			<content:encoded><![CDATA[<div>i m using squid proxy server....<br />
now i want to block some websites using squid.conf file..<br />
in this case, i write some entery for blocking..<br />
<br />
acl mynet src 192.168.10.0/24<br />
http_access allow mynet<br />
http_port 3128<br />
<br />
Now, In window Pc,IP:192.168.10.2/255.255.255.0/DG:192.168.10.1,and Tools,Internetoptions,connetion,lan seting , address:192.168.17.5 port:3128<br />
now internet is working fine...<br />
<br />
after that, i want to block some websites:<br />
I make some entry:<br />
#vim /etc/squid/block_list.txt<br />
<a href="http://www.gmail.com" target="_blank">www.gmail.com</a><br />
<a href="http://www.sex.com" target="_blank">www.sex.com</a><br />
<a href="http://www.orkut.com" target="_blank">www.orkut.com</a><br />
:wq!<br />
#vim /etc/squid/squid.com<br />
acl block_list url_regex -i &quot;/etc/squid/block_list.txt&quot;<br />
http_access deny block_list<br />
:wq<br />
#service squid restart<br />
#chkconfig squid on<br />
<br />
now i access any website at window clint pc..<br />
like <a href="http://www.sex.com" target="_blank">www.sex.com</a><br />
this web site is open.....<br />
<br />
so plz guide me , how to block webseits at</div>

]]></content:encoded>
			<dc:creator>nandunay</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34453</guid>
		</item>
		<item>
			<title>ns2.34 in ubuntu11.04</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34452</link>
			<pubDate>Thu, 09 Feb 2012 07:27:03 GMT</pubDate>
			<description>To install ns2.34 in ubuntu11.04 
This method , pls, read carefully...! 
 
Step 1 : Download the ns-allinone-2.34 from this site:...</description>
			<content:encoded><![CDATA[<div>To install ns2.34 in ubuntu11.04<br />
This method , pls, read carefully...!<br />
<br />
Step 1 : Download the ns-allinone-2.34 from this site:<br />
<a href="http://bit.ly/downloadns" target="_blank">http://bit.ly/downloadns</a><br />
<br />
Step 2 : Place the ns-allinone-2.34.tar.gz package in your home folder(/home/micman in my case). Right click the package and extract the contents in the same folder.<br />
<br />
Step 3: Next, open the Terminal (Applications --&gt; Accessories --&gt; Terminal)<br />
<br />
Step 4: Change to ns-allinone2.34 directory<br />
$ cd /home/kuldip/ns-allinone-2.34<br />
<br />
Step 5: First install all the dependencies<br />
<br />
$ sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.4<br />
<br />
<br />
<br />
Edit Makefile.in found at this location ns-allinone-2.34/otcl-1.13/Makefile.in as follows: <br />
<br />
Find the line that says:<br />
CC= @CC@<br />
and change it to:<br />
CC= gcc-4.4<br />
<br />
Concerning ns-2, Ubuntu and other stuff.<br />
Installing ns-2.34 on Ubuntu 11.04<br />
<br />
<br />
Install the development files for X Windows plus the g++ compiler:<br />
$ sudo apt-get install xorg-dev g++ xgraph<br />
<br />
Fix the error in the linking of otcl by editing line 6304 of otcl-1.13/configure so that it reads<br />
SHLIB_LD=&quot;gcc -shared&quot;<br />
instead of<br />
SHLIB_LD=&quot;ld -shared&quot;<br />
<br />
Change the line 270 in tcl8.4.18/unix/Makefile.in that reads<br />
CC = @CC@<br />
so it appends the version parameter for version 4.4:<br />
CC = @CC@ -V 4.4<br />
Make sure it is a capital V.<br />
<br />
Then, edit the file ns-2.34/tools/ranvar.cc and change the line 219 from<br />
return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);<br />
to<br />
return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);<br />
<br />
Next, change the lines 183 and 185 in file ns-2.34/mobile/nakagami.cc to read<br />
resultPower = ErlangRandomVariable(Pr/m, int_m).value();<br />
and<br />
resultPower = GammaRandomVariable(m, Pr/m).value();<br />
<br />
Now the code will compile if you run ./install. However, you may not be able to run the ns executable. If you get an error stating that there has been a buffer overflow *** buffer overflow detected ***: ./ns terminated including a backtrace, you need to do the following to make it work:<br />
<br />
$ sudo apt-get install gcc-4.4 g++-4.4<br />
<br />
Change the line 270 in tcl8.4.18/unix/Makefile.in that reads<br />
CC = @CC@<br />
so it appends the version parameter for version 4.4:<br />
CC = @CC@ -V 4.4<br />
Make sure it is a capital V.<br />
<br />
Finally, run ./install from the ns-allinone-2.34 top folder again.<br />
<br />
Step 6 : Begin ns2.34 installation<br />
$ sudo su<br />
# ./install<br />
<br />
step7: Once the installation is successful i.e without any errors, we need to add the path information to the file /home/micman/.bashrc<br />
<br />
$ sudo gedit /home/kuldip/.bashrc<br />
<br />
$ sudo gedit /home/kuldip/.bashrc<br />
Append the following lines to the file /home/micman/.bashrc (after replacing the instances where you find micman with your username)<br />
<br />
# LD_LIBRARY_PATH<br />
OTCL_LIB=/home/kuldip/ns-allinone-2.34/otcl-1.13<br />
NS2_LIB=/home/kuldip/ns-allinone-2.34/lib<br />
X11_LIB=/usr/X11R6/lib<br />
USR_LOCAL_LIB=/usr/local/lib<br />
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB<br />
<br />
# TCL_LIBRARY<br />
TCL_LIB=/home/kuldip/ns-allinone-2.34/tcl8.4.18/library<br />
USR_LIB=/usr/lib<br />
export TCL_LIBRARY=$TCL_LIB:$USR_LIB<br />
<br />
# PATH<br />
XGRAPH=/home/kuldip/ns-allinone-2.34/bin:/home/kuldip/ns-allinone-2.34/tcl8.4.18/unix:/home/kuldip/ns-allinone-2.34/tk8.4.18/unix<br />
<br />
#the above two lines beginning from xgraph and ending with unix should come on the same line<br />
<br />
NS=/home/kuldip/ns-allinone-2.34/ns-2.34/<br />
NAM=/home/kuldip/ns-allinone-2.34/nam-1.14/<br />
PATH=$PATH:$XGRAPH:$NS:$NAM<br />
<br />
For the changes to take effect immediately, do the following:<br />
<br />
$ sudo su<br />
# source /home/kuldip/.bashrc<br />
<br />
$ ns<br />
$ %<br />
means mission complete<br />
for tcl file testing<br />
$ ns example.tcl<br />
$ nam<br />
<br />
<br />
<br />
OTHER PACKAGES IF Missing U CAN USE :<br />
<br />
<br />
$ sudo gedit /home/kuldip/.bashrc<br />
$ sudo gedit ns-2.34/tools/ranvar.cc<br />
$ sudo gedit ns-2.34/mobile/nakagami.cc<br />
$ sudo apt-get install tcl-dev<br />
$ sudo apt-get update<br />
$ sudo apt-get install tcl-dev<br />
$ sudo apt-get install libx11-dev<br />
$ sudo apt-get install x-dev<br />
$ sudo apt-get install gcc-4.4 g++-4.4<br />
$ sudo apt-get install libxt-dev<br />
$ sudo apt-get install nam<br />
$ sudo apt-get install xorg-dev g++ xgraph<br />
$ export CC=gcc-4.4 CXX=g++-4.4 &amp;&amp; ./install</div>

]]></content:encoded>
			<dc:creator>kuldip acharya 2012</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34452</guid>
		</item>
		<item>
			<title>High-availability middleware on Linux - Heartbeat and Apache Web server</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34451</link>
			<pubDate>Wed, 08 Feb 2012 23:27:25 GMT</pubDate>
			<description>_*Introduction*_ 
Using any software product in a business-critical or mission-critical environment requires that you consider availability, a...</description>
			<content:encoded><![CDATA[<div><u><b>Introduction</b></u><br />
Using any software product in a business-critical or mission-critical environment requires that you consider availability, a measure of the ability of a system to do what it is supposed to do, even in the presence of crashes, equipment failures, and environmental mishaps. As more and more critical commercial applications move onto the Internet, providing highly available services becomes increasingly important.<br />
This blog highlights implementation issues that we may encounter when implementing HA solutions. We'll review HA concepts, available HA software, hardware to use, and installation and configuration details about heartbeat (open source HA software for Linux) -- and I'll show you how a Web server can be made highly available using heartbeat.<br />
<br />
<u><b>Hardware Requirements</b></u><br />
The test scenarios described in this series require the following hardware:<br />
•	Four systems that support Linux, with Ethernet network adapters<br />
•	One shared external SCSI hard drive (twin tail disk)<br />
•	One IBM serial null modem cable<br />
In my setup, I used IBM eServer™ xSeries® 335 machines with 1 GB of RAM. For shared disk, I used one of these machines as an NFS server. The software requirements for the complete setup are as follows, although for this article you need only Red Hat Enterprise Linux and heartbeat:<br />
•	Red Hat Enterprise Linux 3.0 (2.4.21-15.EL)<br />
•	heartbeat 1.2.2<br />
•	IBM Java 2 SDK 1.4.2<br />
•	WebSphere MQ for Linux 5.3.0.2 with Fix Pack 7<br />
•	LoadLeveler for Linux 3.2<br />
•	WebSphere Base Edition 5.1.1 for Linux with Cumulative Fix 1<br />
•	WebSphere ND 5.1 for Linux with Fixpack 1<br />
•	DB2 Universal Database Enterprise Server Edition 8.1 Linux<br />
<br />
<u><b>High availability concepts</b></u><br />
High availability is the system management strategy of quickly restoring essential services in the event of system, component, or application failure. The goal is minimal service interruption rather than fault tolerance. The most common solution for a failure of a system performing critical business operations is to have another system waiting to assume the failed system's workload and continue business operations.<br />
The term &quot;cluster&quot; has different meanings within the computing industry. Throughout this blog, unless noted otherwise, cluster describes a heartbeat cluster, which is a collection of nodes and resources (such as disks and networks) that cooperate to provide high availability of services running within the cluster. If one of those machines should fail, the resources required to maintain business operations are transferred to another available machine in the cluster.<br />
The two main cluster configurations are:<br />
• <u>Standby configuration</u>: The most basic cluster configuration, in which one node performs work while the other node acts only as standby. The standby node does not perform work and is referred to as idle; this configuration is sometimes called cold standby. Such a configuration requires a high degree of hardware redundancy. This series of articles focuses on cold standby configuration.<br />
• <u>Takeover configuration</u>: A more advanced configuration in which all nodes perform some kind of work, and critical work can be taken over in the event of a node failure. In a one-sided takeover configuration, a standby node performs some additional, non-critical, non-movable work. In a mutual takeover configuration, all nodes are performing highly available (movable) work. This series of articles does not address takeover configuration.<br />
<br />
You must plan for several key items when setting up an HA cluster:<br />
• The disks used to store the data must be connected by a private interconnect (serial cable) or LAN to the servers that make up the cluster.<br />
• There must be a method for automatic detection of a failed resource. This is done by a software component referred to as a heartbeat monitor.<br />
• There must be automatic transfer of resource ownership to one or more surviving cluster members upon failure.<br />
<br />
<u><b>Cluster configuration</b></u><br />
The setup consists of a pair of clustered servers, <b>ha1(9.22.7.48)</b> and <b>ha2(9.22.7.49)</b>, both of which have access to a shared disk enclosure containing multiple physical disks; the servers are in cold standby mode. The application data needs to be on a shared device that both nodes can access. It can be a shared disk or a network file system. The device itself should be mirrored or have data protection to avoid data corruption. Such a configuration is frequently referred to as a shared disk cluster, but it is actually a shared-nothing architecture, as no disk is accessed by more than one node at a time.<br />
<br />
For the test setup, I use NFS as the shared disk mechanism. A null modem cable connected between the serial ports of the two systems<b>(i.e., ha1 &amp; ha2)</b> is used to transmit heartbeats between the two nodes.<br />
<br />
<u><b>Test cluster configuration</b></u><br />
<u>Role</u> <u>Hostname</u> <u>IP-Address</u><br />
Shared(cluster)IP ha.haw2.ibm.com	9.22.7.46<br />
Node1(master)	 ha1.haw2.ibm.com	9.22.7.48<br />
Node2(backup)	 ha2.haw2.ibm.com	9.22.7.49<br />
Node 3(not shown) ha3.haw2.ibm.com	9.23.7.50<br />
NFS Server	 hanfs.haw2.ibm.com	9.2.14.175<br />
<br />
<u><b>Set up the serial connection</b></u><br />
Use a null modem cable to connect the two nodes through their serial ports. Now test the serial connection, as follows:<br />
On ha1 (receiver), type:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># cat &lt; /dev/ttyS0</pre>
</div>On ha2 (sender) type:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># echo &quot;Serial Connection test&quot; &gt; /dev/ttyS0</pre>
</div>You should see the text on the receiver node (ha1). If it works, change their roles and try again.<br />
<br />
<br />
<u><b>Setting up NFS for a shared file system</b></u><br />
As mentioned, I used NFS for shared data between nodes for the test setup.<br />
• The node <b>nfsha.haw2.ibm.com</b> is used as an NFS server.<br />
• The file system <b>/ha</b> is shared.<br />
To get NFS up and running:<br />
1. Create a directory <b>/ha</b> on nfsha node.<br />
2. Edit the <b>/etc/exports</b> file. This file contains a list of entries; each entry indicates a volume that is shared and how it is shared. Listing 1 shows the relevant portion of the exports file for my setup. <br />
<br />
Listing 1. exports file<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				/ha 9.22.7.48(rw,no_root_squash)<br />
/ha 9.22.7.46(rw,no_root_squash)<br />
/ha 9.22.7.35(rw,no_root_squash)<br />
/ha 9.22.7.49(rw,no_root_squash)<br />
/ha 9.22.7.50(rw,no_root_squash)
			
		</td>
	</tr>
	</table>
</div>3. Start the NFS services. If NFS is already running, you should run the command <b>/usr/sbin/exportfs -ra</b> to force nfsd to re-read the <b>/etc/exports</b> file.<br />
4. Add the file system <b>/ha</b> to your <b>/etc/fstab</b> file, on both the HA nodes -- ha1 and ha2 -- the same way as local file systems. Listing 2 shows the relevant portion of the fstab file for my setup: <br />
<br />
Listing 2. fstab file<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				nfsha.haw2.ibm.com:/ha /ha nfs noauto,rw,hard 0 0
			
		</td>
	</tr>
	</table>
</div>Later on, I will configure heartbeat to mount this file system.<br />
<br />
5. Extract the code sample, hahbcode.tar.gz, on this file system using the commands shown in Listing 3. (First download the code sample from the <a href="http://www.ibm.com/developerworks/apps/download/index.jsp?contentid=23294&amp;filename=hahbcode.tar.gz&amp;method=http&amp;locale=worldwide" target="_blank">here</a>(just click on I accept the terms and conditions and download).)<br />
<br />
Listing 3. Extract sample code<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto"># cd /ha
# tar xvfz hahbcode.tar.gz</pre>
</div><br />
<u><b>Download and install heartbeat</b></u><br />
Download and install heartbeat:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto"># rpm -ivh heartbeat-pils-1.2.2-8.rh.el.3.0.i386.rpm
# rpm -ivh heartbeat-stonith-1.2.2-8.rh.el.3.0.i386.rpm
# rpm -ivh heartbeat-1.2.2-8.rh.el.3.0.i386.rpm</pre>
</div><u><b>Configure /etc/ha.d/authkeys</b></u><br />
This file determines your authentication keys for the cluster; the keys must be the same on both nodes. You can choose from three authentication schemes: crc, md5, or sha1. If your heartbeat runs over a secure network, such as the crossover cable in the example, you'll want to use crc. This is the cheapest method from a resources perspective. If the network is insecure, but you're either not very paranoid or concerned about minimizing CPU resources, use md5. Finally, if you want the best authentication without regard for CPU resources, use sha1, as it's the hardest to crack.<br />
<br />
The format of the file is as follows:<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				auth &lt;number&gt;<br />
&lt;number&gt; &lt;authmethod&gt; [&lt;authkey&gt;]
			
		</td>
	</tr>
	</table>
</div>For the test setup I chose the crc scheme. Listing 5 shows the <b>/etc/ha.d/authkeys</b> file. Make sure its permissions are safe, such as 600.<br />
<br />
Listing 5. authkeys file<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				auth 2<br />
2 crc
			
		</td>
	</tr>
	</table>
</div><br />
<u><b>Configure /etc/ha.d/ha.cf</b></u><br />
This file will be placed in the <b>/etc/ha.d</b> directory that is created after installation. It tells heartbeat what types of media paths to use and how to configure them. This file also defines the nodes in the cluster and the interfaces that heartbeat uses to verify whether or not a system is up. Listing 6 shows the relevant portion of the <b>/etc/ha.d/ha.cf</b> file for my setup<br />
<br />
Listing 6. ha.cf file<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				#	File to write debug messages to<br />
debugfile /var/log/ha-debug<br />
#<br />
#<br />
# File to write other messages to<br />
#<br />
logfile	/var/log/ha-log<br />
#<br />
#<br />
#	Facility to use for syslog()/logger<br />
#<br />
logfacility	local0<br />
#<br />
#<br />
#	keepalive: how long between heartbeats?<br />
#<br />
keepalive 2<br />
#<br />
#	deadtime: how long-to-declare-host-dead?<br />
#<br />
deadtime 60<br />
#<br />
#	warntime: how long before issuing &quot;late heartbeat&quot; warning?<br />
#<br />
warntime 10<br />
#<br />
#<br />
#	Very first dead time (initdead)<br />
#<br />
initdead 120<br />
#<br />
...<br />
#	Baud rate for serial ports...<br />
#<br />
baud	19200<br />
#<br />
#	serial	serialportname ...<br />
serial	/dev/ttyS0<br />
#	auto_failback: determines whether a resource will<br />
#	automatically fail back to its &quot;primary&quot; node, or remain<br />
#	on whatever node is serving it until that node fails, or<br />
#	an administrator intervenes.<br />
#<br />
auto_failback on<br />
#<br />
...<br />
#<br />
#	Tell what machines are in the cluster<br />
#	node	nodename ...	-- must match uname -n<br />
node	ha1.haw2.ibm.com<br />
node	ha2.haw2.ibm.com<br />
#<br />
#	Less common options...<br />
#<br />
#	Treats 10.10.10.254 as a pseudo-cluster-member<br />
#	Used together with ipfail below...<br />
#<br />
ping 9.22.7.1<br />
#	Processes started and stopped with heartbeat. Restarted unless<br />
#	 they exit with rc=100<br />
#<br />
respawn hacluster /usr/lib/heartbeat/ipfail
			
		</td>
	</tr>
	</table>
</div><br />
<u><b>Configure /etc/ha.d/haresources</b></u><br />
This file describes the resources that are managed by heartbeat. The resources are basically just start/stop scripts much like the ones used for starting and stopping resources in <b>/etc/rc.d/init.d</b>. Note that heartbeat will look in <b>/etc/rc.d/init.d</b> and <b>/etc/ha.d/resource.d</b> for scripts. The script file httpd comes with heartbeat. Listing 7 shows my <b>/etc/ha.d/haresources</b> file:<br />
<br />
Listing 7. haresources file<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				ha1.haw2.ibm.com 9.22.7.46 Filesystem::nfsha.haw2.ibm.com:/ha::/ha::nfs::rw,hard httpd
			
		</td>
	</tr>
	</table>
</div>This file must be the same on both the nodes.<br />
This line dictates that on startup:<br />
• Have ha1 serve the IP 9.22.7.46<br />
• Mount the NFS shared file system /ha<br />
• Start Apache Web server<br />
<br />
On shutdown, heartbeat will:<br />
<br />
• Stop the Apache server<br />
• Unmount the shared file system<br />
• Give up the IP<br />
<br />
This assumes that the command <b>uname -n</b> displays <b>ha1.haw2.ibm.com</b>; yours may well produce ha1, and if it does, use that instead.<br />
<br />
<br />
<u><b>Configure the Apache HTTP server for HA</b></u><br />
In this step I will make a few changes to the Apache Web server setup so that it will serve files from the shared system and from filesystems local to the two machines ha1 and ha2. The <b>index.html</b> file (included with the code samples) will be served from the shared disk, and the <b>hostname.html</b> file will be served from a local file system on each of the machines ha1 and ha2. To implement HA for the Apache Web server:<br />
1. Log in as root.<br />
<br />
2. Create the following directories on the shared disk <b>(/ha)</b>: <br />
<br />
<b>/ha/www <br />
/ha/www/html</b><br />
<br />
3. Set appropriate permissions on the shared directories using commands shown below on the node ha1:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto"># chmod 775 /ha/www
# chmod 775 /ha/www/html</pre>
</div>4. On both the primary and backup machines, rename the html directory of the Apache Web server:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># mv /var/www/html /var/www/htmllocal</pre>
</div>5. Create symbolic links to the shared directories using the following commands on both the machines:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># ln -s /ha/www/html /var/www/html</pre>
</div>6. Copy the <b>index.html</b> file to the <b>/ha/www/html</b> directory on the node ha1:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># cp /ha/hahbcode/www/index.html /var/www/html</pre>
</div>You will have to change the cluster name in this file.<br />
<br />
7. Copy the <b>hostname.html</b> file to the <b>/ha/www/htmllocal</b> directory on both the machines:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># cp /ha/hahbcode/www/hostname.html /var/www/html</pre>
</div>Change the cluster name and the node name in this file.<br />
<br />
8. Create symbolic links to the <b>hostname.html</b> file on both the machines:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># ln -s /var/www/htmllocal/hostname.html /ha/www/html/hostname.html</pre>
</div>Now you are ready to test the HA implementation.<br />
<br />
<u><b>Test HA for the Apache HTTP server</b></u><br />
<br />
To test the high availability of the Web server:<br />
<br />
1. Start the heartbeat service on the primary and then on the backup node using this command:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># /etc/rc.d/init.d/heartbeat start</pre>
</div>If it fails, look in <b>/var/log/messages</b> to determine the reason and then correct it. After heartbeat starts successfully, you should see a new network interface with the IP address that you configured in the ha.cf file. Once you've started heartbeat, take a peek at your log file (default is <b>/var/log/ha-log</b>) on the primary and make sure that it is doing the IP takeover and then starting the Apache Web server. Use the ps command to make sure the Web server daemons are running on the primary node. Heartbeat will not start any Web server processes on the backup. This happens only after the primary fails.<br />
<br />
2. Verify that the two Web pages are being served correctly on the ha1 node by pointing the browser at the following URLs (yours will differ if you use a different host name): <br />
<br />
<b><a href="http://ha.haw2.ibm.com/index.html" target="_blank">http://ha.haw2.ibm.com/index.html</a><br />
<a href="http://ha.haw2.ibm.com/hostname.html" target="_blank">http://ha.haw2.ibm.com/hostname.html</a></b><br />
<br />
Note that I am using the cluster address in the above URLs and not the address of the primary node.<br />
The browser should display the following text for the first URL:<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				Hello!!! I am being served from a High Availability Cluster ha.haw2.ibm.com
			
		</td>
	</tr>
	</table>
</div>The browser should display the following text for the second URL:<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				Hello!!! I am being served from a node ha1.haw2.ibm.com in a High Availability Cluster ha.haw2.ibm.com
			
		</td>
	</tr>
	</table>
</div>3. Simulate failover by simply stopping heartbeat on the primary system using the command shown below:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto"># /etc/rc.d/init.d/heartbeat stop</pre>
</div>You should see all the Web server processes come up on the second machine in under a minute. If you do not, look in /var/log/messages to determine the problem and correct it.<br />
<br />
4. Verify that the two Web pages are being served correctly on the ha2 node by pointing the browser at the following URLs: <br />
<br />
<b><a href="http://ha.haw2.ibm.com/index.html" target="_blank">http://ha.haw2.ibm.com/index.html</a><br />
<a href="http://ha.haw2.ibm.com/hostname.html" target="_blank">http://ha.haw2.ibm.com/hostname.html</a></b><br />
<br />
The browser should display the following text for the first URL:<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				Hello!!! I am being served from a High Availability Cluster ha.haw2.ibm.com
			
		</td>
	</tr>
	</table>
</div>The browser should display the following text for the second URL:<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				Hello!!! I am being served from a node ha2.haw2.ibm.com in a High Availability Cluster ha.haw2.ibm.com
			
		</td>
	</tr>
	</table>
</div>Note that the node serving this page now is ha2.<br />
<br />
5. Restart the heartbeat service back on the primary. This should stop the Apache server processes on the secondary and start them on the primary. The primary should also take over the cluster IP.<br />
<br />
Thus, by putting the Web pages on the shared disk, a secondary machine can serve them to a client in the event of failure of the primary machine. The failover is transparent to the client accessing the Web pages. This technique can be applied to serving CGI scripts as well.</div>

]]></content:encoded>
			<dc:creator>Satyaveer Arya</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34451</guid>
		</item>
		<item>
			<title>RHCE - a bit late, but almost done!</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34450</link>
			<pubDate>Wed, 08 Feb 2012 15:46:05 GMT</pubDate>
			<description>A little while ago (2007?) I joined LQ.org.  In one of my first posts I asked a question about the RedHat Certification courses and studying for...</description>
			<content:encoded><![CDATA[<div>A little while ago (2007?) I joined LQ.org.  In one of my first posts I asked a question about the RedHat Certification courses and studying for them.  I wanted to get my RHCE, but didn't have the knowledge needed to get it...so I wanted to know if studying CentOS was a good start.<br />
<br />
Fast forward 5 years.  I'm sitting in a week-long RHCE &quot;boot camp&quot; class.  We're supposed to be doing a lab for PAM configuration for the next few minutes, but I'm already done...so I'm blogging =)  (Due to a scheduling snafu, I'm not going to take my RHCSA until next month...but according to my employer this shouldn't be an issue heh).<br />
<br />
So is the RHCE as intensive as I thought it would be?  Maybe...I haven't taken the official test yet.  I will say this, however:  All indicators point to &quot;no&quot;.  To quote my instructor, &quot;The RHCE ocean is a mile wide, but only an inch deep.&quot;  <br />
<br />
To this I add &quot;No diving allowed.&quot;<br />
<br />
He's right.  The RHCE test (RHCE 6, I can't comment on earlier tests) is 2 hours of a massive whirlwind task list that focuses on configuration of a bazillion services.  You need to know how to get common system services configured...a LOT of them!  You need to know common RH security features.  You need to know common...&quot;RedHat-isms&quot;.<br />
<br />
The beauty is that everything I learned to work with RedHat, I learned from other distros.  Sounds funny, but the last time I used RedHat Linux was around 2004, before the great &quot;corporatization&quot; and the &quot;death&quot; of RH9.0.  The thing about &quot;RedHat-isms&quot; is that RedHat tends to put &quot;control scripts&quot; in that do a great deal many things at once.  In a test where you have 2 hours to take a completely stock install and achieve a massive list of objectives, scripts that handle a great deal of work in mere seconds sounds just right...<br />
<br />
I dunno...just my thoughts.  I'll post again in March when I find out how I did on the RHCE test =)</div>

]]></content:encoded>
			<dc:creator>rocket357</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34450</guid>
		</item>
		<item>
			<title>base station information</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34449</link>
			<pubDate>Wed, 08 Feb 2012 13:05:25 GMT</pubDate>
			<description>hey frds! i hav successfully finished installin d leach protocol..now cluster head formation got over! next base station information should be...</description>
			<content:encoded><![CDATA[<div>hey frds! i hav successfully finished installin d leach protocol..now cluster head formation got over! next base station information should be initialised.. like node id,node energy,random key etc! how to add these information to base station node! pls help out!</div>

]]></content:encoded>
			<dc:creator>Priyahari</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34449</guid>
		</item>
		<item>
			<title>Simple C: some ideas on how to find headers, names, and a name demangler tool</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34448</link>
			<pubDate>Wed, 08 Feb 2012 09:23:03 GMT</pubDate>
			<description>The simplest yet, I think.. at least the C program is. 
 
Features: 
*  tips on how to find C/C++ header paths and declarations 
*  tips on how to...</description>
			<content:encoded><![CDATA[<div>The simplest yet, I think.. at least the C program is.<br />
<br />
Features:<ul><li> tips on how to find C/C++ header paths and declarations</li>
<li> tips on how to find libs containing references and definitions</li>
<li> a super-simple program to demangle C++ names</li>
</ul><blockquote>----------------<br />
Note: With even a simple automatic makefile generator such as the one built from sources in this blog (<br />
<a href="http://www.linuxquestions.org/questions/blog/rainbowsally-615861/computer-mad-science-the-anatomy-of-a-makefile-part-2-34421/">http://www.linuxquestions.org/questi...-part-2-34421/</a>),<br />
you can edit the makefile with a text editor to compile libs (an example coming up very soon), static/dynamic, change from 32-bit to 64-bit executables, add and remove files, copy headers, and/or binaries for installation, with a single command (such as 'makefile-creator &lt;outputname&gt;'.<br />
<br />
So using makefiles is HIGHLY recommended especially if you are experimenting with C or C++ or developing applications where the files may change a lot.<br />
<br />
And if you want a more full-featured makefile generator, check out AutoBake -- new and improved but still obviously the work of a backyard mechanic. :-) <br />
<br />
<a href="http://rainbowsally.net/tkf/ftl/AutoBake3.1-Personal-2012-02-04.tar.gz" target="_blank">http://rainbowsally.net/tkf/ftl/Auto...2-02-04.tar.gz</a><br />
<br />
The makefile-creator posted here (the first link near the top) will do the job nicely for this and other simple apps.  And boy is this one SIMPLE!  :-)<br />
---------<br />
</blockquote>Now let's see what's up in today's Computer Mad Science or whatever. ;-)<br />
<br />
If you can't find a header or want to look at it in an editor...<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">find &lt;GUESS_BRANCH&gt; -name &lt;QUOTED_NAME&gt;</pre>
</div>where GUESS_BRANCH is something like '/usr/include/*' or <br />
'/usr/include/*/*' (low level system dependent headers).<br />
<br />
If you need to find a library where a certain function is defined it can be found a couple of ways.<br />
<br />
first check the development libs in /usr/lib<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">grep demangle /usr/lib/*.so 
grep demangle /usr/lib/*.a</pre>
</div>then the development libs in /lib<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">grep demangle /lib/*.so 
grep demangle /lib/*.a</pre>
</div>---------------<br />
Note: If you suspect there is no development lib, add a splat after the *.so name so you can also check dso's with numeric extensions but be aware that they can't be linked with the -l switch in the Makefile LDFLAGS.  They need to be listed by their full paths.<br />
---------------<br />
<br />
Here's what I get looking for 'demangle', for example, which we'll need for our demangling application that we create below.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 226px;
		text-align: left;
		overflow: auto">grep demangle /usr/lib/*.so
  Binary file /usr/lib/libstdc++.so matches

grep demangle /usr/lib/*.a
  Binary file /usr/lib/libiberty.a matches
  Binary file /usr/lib/libstdc++.a matches
  Binary file /usr/lib/libsupc++.a matches

grep demangle /lib/*.so
  no hits

grep demangle /lib/*.so
  no hits</pre>
</div>The best guess for a definition of this function would be libiberty.a for several reasons.  One is that all the others are similar types of libs and probably have a common set of functions defined from somewhere and the oddball is libiberty, so that's most likely the common set of definitions.<br />
<br />
We can verify this hunch rather than experimenting with the LDFLAGS in the makefile (easy enough to do but this is quicker) like this:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto"># Compare objdump of static and dynamic symbols:
  objdump -tT /usr/lib/libstdc++.so | sed '/demangle/!d'
  objdump -tT /usr/lib/libiberty.a | sed '/demangle/!d'</pre>
</div>Here's what some of the symbols mean in these dumps.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 162px;
		text-align: left;
		overflow: auto">Legend:
  g = 'global'
  F = 'function'
  O = 'object' (or data/struct, etc.)
  .text = executable code section, read only
  .data = initialized data, read-write
  .bss  = uninitialized data, 
  *UND* = undefined, requires definition from elsewhere
  [etc.]</pre>
</div>libiberty is where our function &quot;cplus_demangle_v3&quot; is defined so that is the   lib we'll link in a little program to demangle C++ names.<br />
<br />
Here's the program:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 370px;
		text-align: left;
		overflow: auto">// file: main.cpp 
// executable: demangle
#include &lt;stdio.h&gt;    // FILE stuff, printf(), sprintf(), etc.
#include &lt;malloc.h&gt;   // memory allocation
#include &lt;string.h&gt;   // strings and block comparisons and moves
#include &lt;demangle.h&gt; // the main function

int main(int argc, char** argv)
{
  // TODO: a more meaningful error handler
  if(argc &lt; 2)
    exit(1); 
    
  // extern char * cplus_demangle (const char *mangled, int options);
  int flags = DMGL_PARAMS | DMGL_VERBOSE | DMGL_TYPES;
  char* s = cplus_demangle_v3(argv[1], flags);
  if(s)
    printf(&quot;%s\n&quot;, s);
  else
    printf(&quot;%s(...)\n&quot;, argv[1]); // or write a &quot;can't demangle&quot; warning.
  return 0;
}</pre>
</div>If you use the makefile-creator utility from sources posted in this blog <a href="http://www.linuxquestions.org/questions/blog/rainbowsally-615861/computer-mad-science-the-anatomy-of-a-makefile-part-2-34421/">http://www.linuxquestions.org/questi...-part-2-34421/</a><br />
create the makefile with the C++ option [you have added your own code to remind you of the syntax and do some error checks by now, right? :-) ] and add '-liberty' to the LDFLAGS with a text editor<br />
<br />
Using this 'demangle' utility once it's built, here's what we get for a few of the mangled names in /usr/lib/libstdc++.so<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 146px;
		text-align: left;
		overflow: auto">  # objdump sees: 000d3db0  w   DO .data 00000008  CXXABI_1.3  _ZTIw
  $&gt; demangle _ZTIw
  typeinfo for wchar_t
  
  # And I have always wondered what a &quot;C1ERKSs&quot; was, haven't you?
  $&gt; demangle _ZNSt14overflow_errorC1ERKSs
  std::overflow_error::overflow_error(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)
  # and now I regret having asked. :-)</pre>
</div>Enjoy! :-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34448</guid>
		</item>
		<item>
			<title>Thanks, Sonny Bono</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34447</link>
			<pubDate>Tue, 07 Feb 2012 19:56:14 GMT</pubDate>
			<description><![CDATA[Interestingly,the Copyright Term Extension Act of 1998 (also termed the "Mickey Mouse Protection Act") which extended copyright by 20 years, was...]]></description>
			<content:encoded><![CDATA[<div>Interestingly,the Copyright Term Extension Act of 1998 (also termed the &quot;Mickey Mouse Protection Act&quot;) which extended copyright by 20 years, was named after Sonny Bono:<br />
<br />
<a href="https://en.wikipedia.org/wiki/Sonny_Bono_Copyright_Term_Extension_Act" target="_blank">Sonny Bono Copyright Term Extension Act</a><br />
<br />
He didn't actually get the bill passed, but it was named in memory of him. Reportedly, it was his opinion that copyright should last forever. But the CTEA bill compromised with a &quot;mere&quot; twenty year extension.<br />
<br />
Sigh... just imagine how many books (and perhaps software?) might be in the public domain by now if we had even stuck with the original duration of the 1790 Copyright Act, which provided a 14 year duration plus another 14 years if renewed. As things stand now, I'll be long dead and decomposed before the copyright expires for anything that was composed in my generation. Now we are up to &quot;120 years after creation or 95 years after publication, whichever endpoint is earlier.&quot; (Think that Walt Disney won't lobby to get that extended, once their 95 years is up...? If you think they won't, then you've been sniffing too much pixie dust.)</div>

]]></content:encoded>
			<dc:creator>hydraMax</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34447</guid>
		</item>
		<item>
			<title>Wireless Adaptor installation</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34446</link>
			<pubDate>Tue, 07 Feb 2012 06:40:01 GMT</pubDate>
			<description>I want to install a wireless PCI adaptor card in Ubuntu 10.04 
The hardware driver rt3563sta is displayed on systems which is properly worked.</description>
			<content:encoded><![CDATA[<div>I want to install a wireless PCI adaptor card in Ubuntu 10.04<br />
The hardware driver rt3563sta is displayed on systems which is properly worked.</div>

]]></content:encoded>
			<dc:creator>shyjumani</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34446</guid>
		</item>
		<item>
			<title>Graphics mode</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34444</link>
			<pubDate>Mon, 06 Feb 2012 12:14:07 GMT</pubDate>
			<description>Dear All, 
 
This question may look foolish. Still i want to ask why Linux does not start in graphical mode while accessing it through putty?  
 
I...</description>
			<content:encoded><![CDATA[<div>Dear All,<br />
<br />
This question may look foolish. Still i want to ask why Linux does not start in graphical mode while accessing it through putty? <br />
<br />
I googled and found xmanager is an option if we are accessing linux using putty. It can be kind of workaround to access the linux in GUI<br />
<br />
Please give your thoughts.<br />
<br />
Thanks in advance.</div>

]]></content:encoded>
			<dc:creator>mail2vivek1</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34444</guid>
		</item>
		<item>
			<title><![CDATA[Keep a "secret" file open]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34443</link>
			<pubDate>Mon, 06 Feb 2012 05:13:59 GMT</pubDate>
			<description><![CDATA[There is an interesting thing about the way file deletion works in POSIX systems like Linux: When you call a command like "rm" on a file, ultimately...]]></description>
			<content:encoded><![CDATA[<div>There is an interesting thing about the way file deletion works in POSIX systems like Linux: When you call a command like &quot;rm&quot; on a file, ultimately you are calling the unlink() function on that file. the unlink() function does indeed remove the file name from the file system; however, the actual file itself is not removed from the file system until the last open file descriptor to that file is closed. (see UNLINK(2))<br />
<br />
This means that, effectively, you can keep any file you wish alive, so long as you can keep an open file descriptor pointed at it. (Accessible, at least, to your own user.) For example, do the following:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">$ echo &quot;you'll never get me, coppa&quot; &gt;&gt; anonymous
$ tail -f anonymous
you'll never get me, coppa</pre>
</div>Now, in another shell (in the same directory):<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">$ rm anonymous 
$ ls anonymous
ls: cannot access anonymous: No such file or directory</pre>
</div>The file is gone, or so it seems...<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 242px;
		text-align: left;
		overflow: auto">$ ps -e | grep tail
 9868 pts/0    00:00:00 tail
$ cd /proc/9868/fd
$ ls -lh
total 0
lrwx------ 1 cmhoward cmhoward 64 Feb  5 19:57 0 -&gt; /dev/pts/0
lrwx------ 1 cmhoward cmhoward 64 Feb  5 19:57 1 -&gt; /dev/pts/0
lrwx------ 1 cmhoward cmhoward 64 Feb  5 19:56 2 -&gt; /dev/pts/0
lr-x------ 1 cmhoward cmhoward 64 Feb  5 19:57 3 -&gt; /scratch/cmhoward/anonymous (deleted)
lr-x------ 1 cmhoward cmhoward 64 Feb  5 19:57 4 -&gt; anon_inode:inotify
$ echo &quot;nobody knows the trouble I've seen...&quot; &gt;&gt; 3
$ tail -f 3
you'll never get me, coppa
nobody knows the trouble I've seen...</pre>
</div>(The actually process number will differ, of course.)<br />
<br />
If you go back to the first shell, you will see that our second line of text has been added to first. You can close the first &quot;tail&quot; process, but the file will continue to exist because the second one now has the file open.<br />
<br />
If you used C functions in a custom program (instead of tail) and named your processes intelligently, you might be able to keep a very large file open for quite some time, at least until the next system reboot, without anyone noticing. And it wouldn't show up as memory usage (in say, a top printout) which is an added bonus.<br />
<br />
That is common knowledge to people who are familiar with the unlink function, of course. But it was rather interesting anyway.</div>

]]></content:encoded>
			<dc:creator>hydraMax</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34443</guid>
		</item>
		<item>
			<title>Late xmas</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34442</link>
			<pubDate>Mon, 06 Feb 2012 03:46:10 GMT</pubDate>
			<description>Friend of mine she gave me an all in one printer, but it needs major repair. Found the scanner driver for it, but I did not want to install that...</description>
			<content:encoded><![CDATA[<div>Friend of mine she gave me an all in one printer, but it needs major repair. Found the scanner driver for it, but I did not want to install that mess. She alo gave me a fax/scanner/low duty printer. It was low on ink, but it makes a superb color scanner.  Remembered that I had some scanners that at one time did not work with linux. Two were usb. Tested one and it worked fine with B/W. Could not find the power block for the other one. I will look around. parallel port scanners are going into a robot and or a homemade cnc machine.</div>

]]></content:encoded>
			<dc:creator>peonuser</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34442</guid>
		</item>
		<item>
			<title>Fedora How to make a movie?</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34441</link>
			<pubDate>Mon, 06 Feb 2012 03:41:21 GMT</pubDate>
			<description>Hello, 
I have some tga image files, named: frame0551.tga frame0552.tga frame0553.tga ... 
how can I make these images to a video?</description>
			<content:encoded><![CDATA[<div>Hello,<br />
I have some tga image files, named: frame0551.tga frame0552.tga frame0553.tga ...<br />
how can I make these images to a video?</div>

]]></content:encoded>
			<dc:creator>ssunlinux</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34441</guid>
		</item>
		<item>
			<title>ASM: mixing assembler and C++</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34440</link>
			<pubDate>Sun, 05 Feb 2012 18:05:07 GMT</pubDate>
			<description>This is for intel 32 bit assembler.  For 64-bits the calling convention is a bit different.  See previous entries (specifically asm 64 bits) if you...</description>
			<content:encoded><![CDATA[<div>This is for intel 32 bit assembler.  For 64-bits the calling convention is a bit different.  See previous entries (specifically asm 64 bits) if you need a leg-up to break the 64 bit barrier.<br />
<br />
Features:<ul><li> Asm functions that can call class functions (using an object pointer) through jump vectors written in C.</li>
<li> Usage of extern &quot;C&quot; declarations to un-mangle names we need to keep simple for asm coding.</li>
</ul><br />
[If you really want to get down, you can use the mangled names as seen in an 'objdump -d' output but with some switches (mentioned below) you might find cutting corners using high level C is almost as much fun as hand coding this stuff in low down asm.]<br />
<br />
Here's the main file written in C++ to demonstrate and test the calls to and from C++ and asm which is written in a file (not inlined, it's written in a separate *.s file).<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// main.cpp -&gt; asm2cxx
// Interfacing asm with C++ example

#include &lt;stdio.h&gt;  // printf()
#include &lt;string.h&gt; // str*()
#include &lt;malloc.h&gt; // malloc(), free()
#include &lt;stdlib.h&gt; // system()

void dbg(){}

class Interp
{
  private:
    char* parsebuf;
    const char* command;
  public:
    Interp();
    ~Interp();
    char* get_parsebuf() { return parsebuf; }
    void read_command();
    void do_command();
};

// constructor/destructor
Interp::Interp() { parsebuf = (char*) malloc(4096); }
Interp::~Interp() { if(parsebuf) free(parsebuf); parsebuf = 0; }

// some class functions we can call from asm through jumps
// defined in C.
void Interp::read_command() { fgets(parsebuf, 4096, stdin); }

// does a system call, this will NOT do chdir though.  That 
// has to be handled by a direct call to chdir().
void Interp::do_command() { 
  if(!system(parsebuf))
    printf(&quot; [OK]\n&quot;);
  else
    printf(&quot; [???]\n&quot;);
}

extern &quot;C&quot;
{
  // Takes an object pointer on the stack,
  // returns 0 to exit, else loop
  void code_section();
  int asm2cxx(Interp* o);
  void print_prompt();
} // extern &quot;C&quot;

int main(int argc, char** argv)
{
  dbg();
  Interp* o = new Interp();
  
  while(1)
  {
    int more;
    print_prompt();
    more = asm2cxx(o);
    if(! more)
    {
      printf(&quot;Exiting asm2cxx demo\n&quot;);
      break;
    }
  }
  return 0;
}

static char exit_str[] = {&quot;exit&quot;};

extern &quot;C&quot;
{
  void c2cxx_read_command(Interp* o) { o-&gt;read_command(); }
  void c2cxx_do_command(Interp* o) { o-&gt;do_command(); }
  const char* c2cxx_get_parsebuf(Interp* o) { return o-&gt;get_parsebuf(); }
}</pre>
</div>Note the use of 'extern &quot;C&quot;' declarations to avoid having to use the C++ mangled names.  These 'wrapper' functions may be annoying to asm programmers but by putting them in separate files and compiling with --omit-frame-pointers flag, can generate simple callable single-opcode jumps.<br />
<br />
Here's the code to parse an input we get from a C++ class and either exit the loop or call the C++ again to execute a command through the shell.<br />
<br />
About the demo itself: When it runs you can't 'chdir' or assign variables in the environment in this version, because we only 'interpret' one command locally and that is the 'exit' command.<br />
<br />
The calls to C++ through the C intermediaries are marked in the sources below.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// asm.s - 32 bit intel assembler, ATT syntax

/* notes:
 *    
 * C and C++ style comments are OK anywhere except following 
 * a mnemonic unless the mnemonic is terminated with a semicolon.
 * Hashmark '#' comments ala sh comments can be put anywhere.
 *
 * As in C declarations can be separate from definitions for
 * .data and .text (code).  And no external lookups are done 
 * until link-time, so including headers is not necessary.
*/

//////////////////////////////////////
// data section
  .data
  .align 4;

promptstr:
  .string &quot;\nASM2CXX: &quot;
exitstr:
  .string &quot;exit&quot;

//////////////////////////////////////
// code declarations

  .text;
  .align 4;
  
// void print_prompt();
.globl print_prompt
.type print_prompt, @function

// int asm2cxx(Interp* o);
.globl asm2cxx
.type asm2cxx, @function

//////////////////////////////////////
// code definitions

print_prompt:
  push  $promptstr;
  call  printf;
  pop  %eax;          // clean up stack
  ret;

asm2cxx:
  // grab object ptr and save regs
  mov 4(%esp), %eax; 
  pushl %ebx;   pushl %edi;  pushl %esi;
  
  // ebx = o
  movl  %eax, %ebx

  // reserve enough stack area for up to 4 call params en bloc
  subl  $16, %esp
      
  // get the command pointer (ebx = obj ptr)
  // set param[0] = obj ptr
  movl  %ebx, (%esp)
  call  c2cxx_read_command    ### call C++ through C

  // eax = command string
  // skip whitespaces
  cmpb  $32, (%eax)
  jg  .L_end_skip_leading
.L_begin_skip_leading:
  addl  $1, %eax
  cmpb  $32, (%eax)
  jle .L_begin_skip_leading
.L_end_skip_leading:

  // if command = &quot;exit&quot;
  movl  $exitstr, %edi;  movl  $4, %ecx;   movl  %eax, %esi;  repz cmpsb
  jne .L_not_exit
      
  movzbl  4(%eax), %edx
  leal  4(%eax), %ecx; // step to end of &quot;exit&quot; if match
  testb %dl, %dl
  je .L_exit

  // and trailing whitespaces ok (ecx is our str ptr)
  jmp .L_chk_ws
.L_next_ws:
  addl  $1, %ecx
  movzbl  (%ecx), %edx
  testb %dl, %dl
  je  .L_exit
.L_chk_ws:
  cmpb  $32, %dl
  jle .L_next_ws

.L_exit:
  // return FALSE (don't loop again) if end of input
  xorl  %eax, %eax
  testb %dl, %dl
  je  .L_clean_stack

  // do the command and return TRUE (loop again)
.L_not_exit:
  // set param[0] = obj ptr
  movl  %ebx, (%esp)
  call  c2cxx_do_command  ### call C++ through C

  // return TRUE
  movl  $1, %eax

.L_clean_stack:
  addl  $16, %esp
  popl  %esi;  popl  %edi;  popl  %ebx  
  ret</pre>
</div>If you want to create your makefile with our makefile-creator temporarily name asm.s asm.cpp in order to allow the makefile-creator to generate compile/link rules.<br />
<br />
Then type makefile-creator c++ asm2cxx to generate a C++ output file named asm2cxx.<br />
<br />
Finally change the name of the file back to asm.s and do a global find/replace to change asm.cpp to asm.s several places in the Makefile and you're good to go.<br />
<br />
If you want a tool that does this automatically, you might be interested in AutoBake (updated for use by &quot;normals&quot; at last).  ;-)<br />
<a href="http://rainbowsally.net/tkf/ftl/AutoBake3.1-Personal-2012-02-04.tar.gz" target="_blank">http://rainbowsally.net/tkf/ftl/Auto...2-02-04.tar.gz</a><br />
<br />
<br />
If you'd like a much simpler utility we made in this blog, you can try building this from sources here at the blog.<br />
<br />
<a href="http://www.linuxquestions.org/questions/blog/rainbowsally-615861/computer-mad-science-the-anatomy-of-a-makefile-part-2-34421/">http://www.linuxquestions.org/questi...-part-2-34421/</a></div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34440</guid>
		</item>
		<item>
			<title>Errata in makefile-creator</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34439</link>
			<pubDate>Sun, 05 Feb 2012 17:36:50 GMT</pubDate>
			<description><![CDATA[I had reversed the parameters in the strstr() call.  It's updated in the blog, but if you had wondered why the C++ option didn't work right all the...]]></description>
			<content:encoded><![CDATA[<div>I had reversed the parameters in the strstr() call.  It's updated in the blog, but if you had wondered why the C++ option didn't work right all the time (when creating classes), this is why.<br />
<br />
The correct args order is this.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">  if(argc &gt; 2)
  {
    if(strstr(argv[1], &quot;++&quot;)) // CHANGED THIS -rs</pre>
</div>The code for the app (with a couple of TODOs left up to newbies as they start gaining a bit of confidence) is here.<br />
<br />
<a href="http://www.linuxquestions.org/questions/blog/rainbowsally-615861/computer-mad-science-the-anatomy-of-a-makefile-part-2-34421/">http://www.linuxquestions.org/questi...-part-2-34421/</a></div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34439</guid>
		</item>
		<item>
			<title>Slackware-13.37-Hacks-Hardening Tips</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34438</link>
			<pubDate>Sun, 05 Feb 2012 03:17:34 GMT</pubDate>
			<description>These suggestions are based on advice from the SlackWiki Basic Security Fixes, The Center For Internet Security Slackware Benchmarks and on the...</description>
			<content:encoded><![CDATA[<div>These suggestions are based on advice from the SlackWiki Basic Security Fixes, The Center For Internet Security Slackware Benchmarks and on the General Hardening Tips for Red Hat Enterprise Linux. I condensed and categorized as many of the suggestions as I could glean, however, it is your choice as to how many of them apply in your case.<br />
<br />
PHYSICAL SECURITY<br />
<br />
Create a BIOS Password to keep others from changing your BIOS settings. After you have installed Slackware, you can disable booting from CD/DVD and USB so that your computer will be forced to boot from the Hard Drive. You can still use the CD/DVD and USB once the machine is running. The BIOS Password keeps others from changing the settings. Since the BIOS can be reset to default setting by removing the watch battery on the motherboard, you should consider adding tamper-resistant computer case screws. The two I have seen are the Torx Security Screws which require a special screwdriver bit to install/remove and the CPU Security Lock, which replaces one of the computer case screws and uses a special barrel-shaped key to install/remove. Setting a lilo password will keep someone else from booting to single-user mode (runlevel 1) or from changing the settings at boot-time.<br />
<br />
SEPARATE PARTITIONS<br />
<br />
When you first install Slackware, keep the /home, /tmp, /usr and /var on separate partitions so that you can change mount options in /etc/fstab to limit what files on those partitions can do. If you look at your /etc/fstab file and see the 4th column (mount options) as &quot;defaults&quot;, this means that the file system being mounted is using the default values for the file system in question. In the case of ext4 (see man mount) these are: rw, suid, dev, exec, auto, nouser, and async. Here are some suggested defaults from the RHEL Hardening Manual.<br />
<br />
/home  defaults,nodev<br />
/tmp   defaults,nodev,nosuid,noexec<br />
/usr   defaults,nodev<br />
/var   defaults,nodev<br />
tmpfs  defaults,nodev,nosuid,noexec<br />
<br />
ENCRYPTION<br />
<br />
Setting up encryption is fairly easy with Slackware. The README_CRYPT.TXT has all the details on how to do this. You can setup swap space encryption during or after installation and it uses a random key on every boot. You do not need to enter a password to have swap space encryption. To have /home encryption, you will need to do this when you first install the system. With swap and /home encryption, you only need to remember one password to decrypt. Of course you will also need your login password.<br />
<br />
USE STRONG PASSWORDS<br />
<br />
Weak passwords make your system vulnerable. You can use John The Ripper (current version 1.7.9 available from SlackBuilds) to check your /etc/passwd file and see if the application can crack your password. If it can, you might consider strengthening it up a bit by adding capital letters, numbers, characters, etc.<br />
<br />
TURN OFF SERVICES<br />
<br />
Turning off services not only saves you resources and RAM, it also makes your computer more secure since it is one less application running that can be hacked or compromised. There is a tutorial for turning off services on Linux Questions.<br />
<br />
REMOVE UNUSED SOFTWARE<br />
<br />
Normally, I do a Full Installation to have all the tools and compilers available to me since I like compiling everything I need and personalizing my system. However, from a security standpoint, the more unused software you remove, the less chance you have of being affected by a vulnerability in any one piece of software. Here are potential candidates for removal: 1. Games (bsd-games) 2. Extra Shells (ksh93, tcsh, zsh) 3. Server Applications (apache, bluetooth, cups, nfs, samba, sendmail) 4. Window Managers (fluxbox, fvwm, windowmaker, xfce) 5. Misc Applications (emacs) 6. Compilers (gcc-gnat, gcc-objc, others from the &quot;D&quot; Series). With regard to the Compilers and Developer Tools, the reasoning being that if someone were to break-in to your machine, they would try to compile/install a rootkit with kernel modules. If the tools to compile are not there, then you are making it harder for someone to root your box. If you compile your packages on another machine and use the patches provided by Slackware, then you don't need to compile software on your box.<br />
<br />
KEEP YOUR SYSTEM UPDATED<br />
<br />
You can go to the Slackware website and download the patches to your machine, then use the command &quot;upgradepkg&quot; to install the patches. The automated way to do updates is by using the slackpkg tool included with the Full Installation of Slackware. This will check the packages and perform the update using an ncurses menu. There is a tutorial for installing/configuring slackpkg on Linux Questions.<br />
<br />
USE SECURITY-ENHANCING SOFTWARE AND TOOLS<br />
<br />
Aide - Available from SlackBuilds. Aide monitors for file system changes. It does this by creating a database with MD5SUM's and SHA1SUM's of your files and binaries. When you run aide later on, if the checksum's don't match, it will let you know. It may mean you have upgraded a package or it could mean you have been hacked.<br />
<br />
Chkrootkit - Available from SlackBuilds. Chkrootkit checks your system for known rootkits.<br />
<br />
FireHOL - Available from SlackBuilds. FireHOL is a tool for configuring a firewall. There is a tutorial for installing/configuring FireHOL on Linux Questions.<br />
<br />
UFW - Available from SlackBuilds. UFW is a tool for configuring a firewall. It is called the Uncomplicated Firewall and comes from the Ubuntu Project. There is a tutorial for installing/configuring UFW on Linux Questions.<br />
<br />
LOGIN HARDENING<br />
<br />
If you choose to have automatic login, anyone can turn on your machine and get to your files, etc. Configure the Login Manager (KDM, GDM, XDM, SLiM) so that the Login Name is BLANK. If you let the Login Manager display the Login Name, you have just given away half of the information required to login to your machine. Increasing the login delay to 10 seconds in case the wrong password is entered makes a cracker have to take more time guessing at the login password since it creates a time delay.<br />
<br />
CONFIGURE SU/SUDO<br />
<br />
This will restrict who is able to su to root and use sudo so that if you have multiple users on the computer, they will not be able to do too much damage to the box. Hopefully.</div>

]]></content:encoded>
			<dc:creator>arniekat</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34438</guid>
		</item>
		<item>
			<title>Slackware-13.37-Hacks-Vim Tutorial</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34437</link>
			<pubDate>Sat, 04 Feb 2012 01:46:08 GMT</pubDate>
			<description>SOURCE - The Vimbook Tutorial Version 5.7 and Vim Manpages and vim.org 
 
Elvis is a clone of the ex/vi text editor. 
/usr/bin/vi is a symlink to...</description>
			<content:encoded><![CDATA[<div>SOURCE - The Vimbook Tutorial Version 5.7 and Vim Manpages and vim.org<br />
<br />
Elvis is a clone of the ex/vi text editor.<br />
/usr/bin/vi is a symlink to elvis<br />
Elvis is part of the package elvis-2.2_0<br />
<br />
This tutorial, however will use Vim.<br />
Vim is part of the package vim-7.3.154<br />
Main Website: <a href="http://www.vim.org/" target="_blank">http://www.vim.org/</a><br />
NOTE - vipw is an editor for the file /etc/passwd<br />
       vigr is an editor for the file /etc/group<br />
       visudo is an editor for the file /etc/sudoers<br />
These special versions of vi are configured to lock the file being edited so there cannot be multiple simultaneous edits and they provide basic syntax checks.<br />
<br />
BASIC 10 VIM COMMANDS<br />
<br />
The Vimbook from the website has a tutorial for the 10 Basic Commands, which are all you really need to basically edit files in Slackware. I show below some of the information from that tutorial which should take care of your editing needs. If you ever get into trouble, hit the &lt;Esc&gt; key twice and you will be in command mode.<br />
<br />
1. The four basic movement commands<br />
<br />
When you are in command mode, you can move around by using these keys:<br />
<br />
h (left) or ARROW-LEFT<br />
j (down) or ARROW-DOWN<br />
k (up) or ARROW-UP<br />
l (right) or ARROW-RIGHT<br />
<br />
I usually use the arrow keys, however it is a good idea to learn the other keys in case you get a keyboard with no arrow keys or arrow keys in a strange location.<br />
<br />
2. Insert And Delete Text<br />
<br />
Inserting Text<br />
<br />
To enter text, you need to be in insert mode. Type i, and notice that the lower left of the screen changes to --INSERT-- (meaning that you are in insert mode). Now type your text.<br />
<br />
After you have finished inserting, press the &lt;Esc&gt; key. The --INSERT-- indicator goes away and you return to command mode.<br />
<br />
Deleting Text<br />
<br />
If you want to delete text, just move the cursor over the it and type x. Continue typing x to delete individual characters. To delete a whole line,  place the cursor on the line you want to delete. Type dd to delete the line and vim will delete the line and take up the empty space.<br />
<br />
3. Undo and Re-Do<br />
<br />
The u command undoes the last edit and CTRL-R undoes the undo.<br />
<br />
4. How to get Help<br />
<br />
In command mode type :help &lt;ENTER&gt; to get help.<br />
To get out of help type :q! &lt;ENTER&gt; and you will be back at your document.<br />
<br />
5. Exiting the editor<br />
<br />
To exit the editor without saving your changes type :q! &lt;ENTER&gt; (A colon, the letter q, and an exclamation point)<br />
To write the changes to the file and exit type :wq &lt;ENTER&gt; (A colon, the letter w, and the letter q)<br />
<br />
ENCRYPTING TEXT<br />
<br />
When you wish to create an encrypted file, you will enter the command shown below on the Terminal. The -n flag suppresses the swap file so recovery after a crash will be impossible. The -x flag tells vim to use encryption when writing files. You will be prompted for the password.<br />
<br />
$ vim -nx /home/&lt;user&gt;/file.txt<br />
Enter encryption key: &lt;Password&gt; ENTER<br />
Enter same key again: &lt;Password&gt; ENTER<br />
<br />
If you use a Hex Editor to open up the encrypted file, it will have this as a header:<br />
<br />
VimCrypt~01!<br />
<br />
and then garbage.</div>

]]></content:encoded>
			<dc:creator>arniekat</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34437</guid>
		</item>
		<item>
			<title>ASM: Intercepting (and using) Errors (like segfaults) in asm (aka SEH)</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34436</link>
			<pubDate>Fri, 03 Feb 2012 22:10:50 GMT</pubDate>
			<description>This is for i86 and x86_64 types but with a bit of poking around you can probably find a similar way to do this with other CPUs.   
 
Note: This asm...</description>
			<content:encoded><![CDATA[<div>This is for i86 and x86_64 types but with a bit of poking around you can probably find a similar way to do this with other CPUs.  <br />
<br />
Note: This asm requires 'sigaction'.  (See the test code.  And bear in mind that this is not an attempt to create a full-blown system of signal handlers.  Check the libc docs for 'sigaction' for ideas on how you can use something like this for a seed for a more extensive application.)<br />
<br />
There used to be a lot of cool little programs for the terminal that did all kinds of fun stuff.  There were BASICs, FORTHs, etc., but nowadays it seems we have confused the GUI with the nuts and bolts of the underlying programs.  A 'fast' GUI does nothing more than typing faster than a slow one (in essence).  And though the simple programs would have looked nicer with a nice GUI, choosing which GUI to use is one problem that may have caused them to disappear, and not having a great system for catching errors (structured error handling) may have been another.<br />
<br />
Let's look at the structured error handling (seh) problem in asm and C since the GUI issue will continue to be one of preferences and a tendency toward idiosyncracy in Linux programs at any level above the kernel.<br />
<br />
SEH.<br />
<br />
First of all, we need to know where the internal data of a CPU is stored (called the &quot;context&quot; in Windows) when we catch a signal like &quot;SIGSEGV&quot; (11) which is the example we'll use here.<br />
<br />
If you've ever tried to find that in 32- or 64- bit asm, this is probably all you need.<br />
<br />
That struct pointer is located on the stack and is located like this (and this might also be where the context is for other CPUs but I haven't tried <br />
it):<br />
<br />
For 32 bits.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 242px;
		text-align: left;
		overflow: auto">    //  int* pi = &amp;signum;
    //  int z = pi[2]; 
    //  z += 20;
    //  sig_context* ps = (void*)z;

    // translation: get parameter 3.
    // set sig_context pointer to param3 + 5 stack_cells

    asm(
        &quot;   lea    8(%ebp),%eax;&quot;         // int *eax = &amp;signum
        &quot;   mov    8(%eax),%eax;&quot;         // signum, p2, pointers
        &quot;   lea    20(%eax),%eax;&quot;        // pointers+20 -&gt; psig_context
        &quot;   mov    %eax,psig_context;&quot;    // and now we're set to go...
       );</pre>
</div><br />
For 64 bits.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 354px;
		text-align: left;
		overflow: auto">
  // Since the first 6 parameters are held in registers in an ix_64 cpu
  // getting the first pointer address can't be done.
    //  int* pi = &amp;signum; &lt;-- will not work in 64 bits
    //  int z = pi[2];     &lt;-- can't be done because of prob above
    //  z += 20; // 5 cells
    //  sig_context* ps = (void*)z;
  
    // translation: get parameter 3.
    // set sig_context pointer to param3 + 5 stack_cells
    // For 64 bits we do it this way...
  
  // so we need another way to get the third parameter, and for this 
  // we'll use a C-callable asm rountine called get_rdx() which just
  // returns rdx is rax.
  
    void**p;
    
    p = (void**)get_rdx();
    p+=5;
    psig_context = (sig_context*)p;</pre>
</div>The above are written in C but shouldn't be too hard to adapt to your prefered dialect of asm and from here your code should start working.<br />
<br />
But if you also need the 'picture' of the data for the cpu, here are the 32 and 64 bit versions of what we're calling the sig_context.<br />
<br />
<br />
For 32 bits (longs here are dword size)<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 450px;
		text-align: left;
		overflow: auto">typedef struct _sig_context {
    // this comes in on the stack during an exception
    unsigned short gs, __gsh;
    unsigned short fs, __fsh;
    unsigned short es, __esh;
    unsigned short ds, __dsh;
    unsigned long edi;
    unsigned long esi;
    unsigned long ebp;
    unsigned long esp;
    unsigned long ebx;
    unsigned long edx;
    unsigned long ecx;
    unsigned long eax;
    unsigned long trapno;
    unsigned long err;
    unsigned long eip;
    unsigned short cs, __csh;
    unsigned long eflags;
    unsigned long esp_at_signal;
    unsigned short ss, __ssh;
    void* fpstate; // n/u for now
    unsigned long oldmask;
    unsigned long cr2;
    // theres more if you need it but you will have to find the header 
    // in the kernel dev stuff if you want it
}sig_context;</pre>
</div>For 64 bits (longs here are qword size).<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 466px;
		text-align: left;
		overflow: auto">typedef struct _sig_context {
  // this comes in on the stack during an exception
  unsigned long r8;
  unsigned long r9;
  unsigned long r10;
  unsigned long r11;
  unsigned long r12;
  unsigned long r13;
  unsigned long r14;
  unsigned long r15;
  unsigned long rdi;
  unsigned long rsi;
  unsigned long rbp;
  unsigned long rbx;
  unsigned long rdx;
  unsigned long rax;
  unsigned long rcx;
  unsigned long rsp;
  unsigned long rip;
  unsigned long efl;
  unsigned long csgsfs;   /* actually short cs, gs, fs, __pad0.  */
  unsigned long err;
  unsigned long trapno;
  unsigned long oldmask;
  unsigned long cr2;
  // theres more if you need it but you will have to find the header 
  // in the kernel dev stuff if you want it
}sig_context;</pre>
</div>Now for the fun part.  Some test code.<br />
<br />
Let's write a simple function to catch segment violations and return a flag indicating whether a memory location is read only or read-write or neither.  And we'll use the 32 bit sig_context so it will work on either CPU type.<br />
<br />
Note that the call will always return, so we don't crash or get the glib dump.  In fact the test itself will catch two crashes in order to give us the three printouts, only one of which is the result of a mem_test() call that doesn't crash.<br />
<br />
No jumpbuf.  Nothing up my sleave.<br />
file: src/main.c<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// main.c for seh-test

#include &lt;stdio.h&gt;  // printf() 
#include &lt;signal.h&gt; // signal()

void dbg(){}

void exception_dispatcher(int signum);

static int mem_test_var;

static struct sigaction new_action;

void init_sighandler(void (*fn)(int))
{
  new_action.sa_handler = fn;
  sigemptyset (&amp;new_action.sa_mask);
  new_action.sa_flags = SA_SIGINFO;
  // we only need to catch segfault, but let's anticipate
  // playing with any signal between 1 and 16.
  int i;
  for( i = 1; i &lt; 16; i++ )
  {
    sigaction(i, &amp;new_action, 0);
  }    
}


// sets mem_test_var = 1 if no access, 2 if read only, 3 if read-write.
void mem_test(void* address);
void print_result(const char* name);

int main(int argc, char** argv)
{
  dbg();
  init_sighandler(exception_dispatcher);
  
  const char* ro_test = &quot;some text&quot;;   // read only
  char rw_test[4];                     // readwrite
  char* none_test = 0;                 // inaccessable
  
  mem_test((void*)ro_test);
  print_result(&quot;ro_test&quot;);
  
  mem_test((void*) rw_test);
  print_result(&quot;rw_test&quot;);
  
  mem_test((void*) none_test);
  print_result(&quot;none_test&quot;);
  
  return 0;
}

typedef struct _sig_context {
    // this comes in on the stack during an exception
  unsigned short gs, __gsh;
  unsigned short fs, __fsh;
  unsigned short es, __esh;
  unsigned short ds, __dsh;
  unsigned long edi;
  unsigned long esi;
  unsigned long ebp;
  unsigned long esp;
  unsigned long ebx;
  unsigned long edx;
  unsigned long ecx;
  unsigned long eax;
  unsigned long trapno;
  unsigned long err;
  unsigned long eip;
  unsigned short cs, __csh;
  unsigned long eflags;
  unsigned long esp_at_signal;
  unsigned short ss, __ssh;
  void* fpstate; // n/u for now
  unsigned long oldmask;
  unsigned long cr2;
    // theres more if you need it but you will have to find the header 
    // in the kernel dev stuff if you want it
}sig_context;


static sig_context* psig_context; // a pointer we can get at in asm

void asm_section() // creates a place for asm function(s) in a C file
{
  asm(
      // the asm declaration, code section, local (static)
      &quot;.text;\n&quot;
      &quot;.align 4;\n&quot;
      &quot;.local mem_test;\n&quot;
      &quot;.type mem_test, @function;\n&quot;
      &quot;mem_test:\n&quot;                 // (that's a colon)
      &quot;movl $0, %eax;\n&quot;            // clear and get const 0
      &quot;movl %eax, mem_test_var;\n&quot;  // init test type = 0
      &quot;movl 4(%esp), %edx;\n&quot;       // get address
      &quot;incl mem_test_var;\n&quot;        // crash on read = 1
      &quot;movb (%edx), %al;\n&quot;         // read one byte
      &quot;incl mem_test_var;\n&quot;        // crash on write = 2
      &quot;movb %al, (%edx);\n&quot;         // write it back 
      &quot;incl mem_test_var;\n&quot;        // read/write ok = 3
      &quot;ret;\n&quot;
     );
}

void exception_dispatcher(int signum)
{
  // TODO: filter and handle signals by signum.
  
  // This function will always have the stack frame 
  // so if it's written in asm, include that in your
  // code.
  
  asm(
      &quot;   lea    8(%ebp),%eax;&quot;         // int *eax = &amp;signum
      &quot;   mov    8(%eax),%eax;&quot;         // signum, p2, pointers
      &quot;   lea    20(%eax),%eax;&quot;        // pointers+20 -&gt; psig_context
      &quot;   mov    %eax,psig_context;&quot;    // and now we're set to go...
     );
  
  // Model the cpu doing a 'ret' opcode in C.  
  // See the disassembly if you aren't familiar with 
  // how C deals with operand sizes.
  
  void** esp = (void**)psig_context-&gt;esp; // stack ptr
  void* eip = *esp++;                     // pop eip
  
  // and update the context from our modeled registers
  psig_context-&gt;esp = (long)esp;
  psig_context-&gt;eip = (long)eip;  
}

void print_result(const char* name)
{
  const char* result;
  switch(mem_test_var)
  {
    case 1:
      result = &quot;inaccessible&quot;;
      break;
    case 2:
      result = &quot;read only&quot;;
      break;
    case 3:
      result = &quot;read write&quot;;
      break;
    default:
      result = &quot;unknown&quot;;
  }
  printf(&quot;%s:\tmemory is %s\n&quot;, name, result);
}</pre>
</div>To test this with a makefile generated by our makefile-creator make sure the source file is in a subdirectory named src.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">makefile-creator seh-test # straight C, output name is seh-test
make clean; make          # generate the app
seh-test                  # and run it</pre>
</div>To add debug info change the '-O2' flag to '-g3' in the Makefile and repeat with a debugger.<br />
<br />
Here's the printout from when I did this.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto">$&gt; seh-test
ro_test:        memory is read only
rw_test:        memory is read write
none_test:      memory is inaccessible</pre>
</div>Obviously the first and last tests segfaulted but all three ran and the main() function returns normally.<br />
<br />
And there you have it.  At least part of it.  How you actually implement structured error handling in nested calls save and restore sigaction structs or implement priorities, or handle code where these things may go into a loop is up to you.<br />
<br />
And yes, of course it can be used in GUI apps.  But I don't know of many asm coders writing GUI apps.  (yet.)<br />
<br />
:-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34436</guid>
		</item>
		<item>
			<title>ASM: 64 bit intel asm in linux</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34435</link>
			<pubDate>Fri, 03 Feb 2012 22:01:31 GMT</pubDate>
			<description><![CDATA[If you're used to 32 bit asm in gcc, the 64 bit asm might throw you for a loop initially.  That's because part of the stack is passed around in...]]></description>
			<content:encoded><![CDATA[<div>If you're used to 32 bit asm in gcc, the 64 bit asm might throw you for a loop initially.  That's because part of the stack is passed around in registers.<br />
<br />
Let's compile a bit of test code and see what's going on.<br />
<br />
If you're using our makefile-creator put this in a subdirectory named &quot;src&quot;  or use whatever method you prefer if not.<br />
<br />
file: src/main.c<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// main.c
#include &lt;stdio.h&gt;

void  dbg(){}

// macros to define an asm function
#define __L(name) \
  &quot;.text;\n&quot; \
  &quot;.globl &quot;#name&quot;;\n&quot; \
  &quot;.type &quot; #name&quot;, @function;\n&quot; \
  &quot;&quot;#name&quot;:&quot;

#define FUNCTION(name) \
  asm( \
  &quot;.text;\n&quot; \
  &quot;.align 4\n&quot; \
  __L(name) \
  ); \
  asm

// iterative tester, first test (long a), then (long a, long b) and so forth
// to see the pattern using a debugger or using 'objdump -d asm64-test'.
long c_test(long a, long b, long c, long d, long e, long f, long g, long h)
{
  return g;  // offset 0x10 from ebp = offset 8 in asm code below
}


long rval;

long asm_test(long a, long b, long c, long d, long e, long f, long g, long h);

void asm_section()
{
  FUNCTION(asm_test)
  (
      &quot;movq 8(%rsp), %rax;\n&quot; // get first item above the return address off the stack
      &quot;movq %rax, rval(%rip)\n;&quot;
      &quot;ret;\n&quot;
  );
}
 
int main(int argc, char** argv)
{
  dbg();
  //  test code -------&gt;
  // rdi = 1, rsi = 2,  rdx = 3, rcx = 4, r8 = 5, r9 = 6, 
  
  long n1 = c_test(1, 2, 3, 4, 5, 6, 7, 8);
  printf(&quot;C test  : first item on machine stack is #%d in (1,2,3,4,5,6,7,8)\n&quot;, n1);
  
  long n2 = asm_test(1,2,3,4,5,6,7, 8);
  printf(&quot;ASM test: first item on machine stack is #%d in (1,2,3,4,5,6,7,8)\n&quot;, n2);
  // &lt;------- test code
  return 0;
}</pre>
</div>To name the output file 'asm64-test' using our makefile generator:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">makefile-creator asm64-test
edit Makefile # and change the -m32 switches to -m64
make</pre>
</div>Whatever way you do this, with or without debug symbols, or optimization, run the test code as<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">asm64-test</pre>
</div>And verify that both test outputs are the same verifying that that the 7th parameter is the first one actually pushed onto the machine stack.<br />
<br />
By iteratively* adding parameters to a standard C call we can determine that the parameters that are not on the machine stack are in registers in the <br />
following order:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">rdi = 1, rsi = 2,  rdx = 3, rcx = 4, r8 = 5, r9 = 6</pre>
</div>so that the first item on the stack is in rdi, the second is in rsi, and so forth up to 6 stacked values before the actual machine stack is involved at all.<br />
<br />
Other than that 64 bit asm pretty much follows the same conventions as 32 bit asm except for the 'q' suffix for quads replacing the 'l' suffix for dwords when needed and variables (like rval above) being addressed relativeto rip).<br />
<br />
If you need more clues it's easy to write a simple C file and add the '--save-temps' flag to the CFLAGS line to get the intermediate asm file (*.s) from the compiler.<br />
<br />
Note: if you need the intel syntax, take a quick peek at earlier asm blog entries.<br />
<br />
--------<br />
* Iteratively adding parameters to the list is easier than trying to save registers to variables and picking them up in C for display.  At least it is for me.  :-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34435</guid>
		</item>
		<item>
			<title>Interesting facts about ASCII</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34434</link>
			<pubDate>Fri, 03 Feb 2012 10:59:08 GMT</pubDate>
			<description>Some interesting about ASCII, when it is represented as bytes in a binary system: (taken from Art of Assembly Language...</description>
			<content:encoded><![CDATA[<div>Some interesting about ASCII, when it is represented as bytes in a binary system: (taken from <a href="http://maven.smith.edu/~thiebaut/ArtOfAssembly/CH01/CH01-3.html" target="_blank">Art of Assembly Language</a>):<br />
<br />
1) All alphabetic characters in standard ASCII can be converted to lowercase or uppercase simply by toggling the fifth bit (the first bit is bit zero). E.g.:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">E = 01000101
e = 01100101</pre>
</div>2) you can obtain the numeric equivalent of any of the numeric characters by subtracting 0x30 from the ASCII value.<br />
<br />
3) Bits five and six will tell you which of the four ASCII groups your character is in:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 98px;
		text-align: left;
		overflow: auto">Bit 6	Bit 5	Group
0	0	Control Characters
0	1	Digits &amp; Punctuation
1	0	Upper Case &amp; Special
1	1	Lower Case &amp; Special</pre>
</div></div>

]]></content:encoded>
			<dc:creator>hydraMax</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34434</guid>
		</item>
		<item>
			<title><![CDATA[Advanced C: UsR2usr Part 2 - Dummy install into /UsR and 'rpath' mods etc.]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34432</link>
			<pubDate>Thu, 02 Feb 2012 22:24:33 GMT</pubDate>
			<description><![CDATA[[See part 1 for info links to slist files and an automatic makefile generator you can compile for yourself.  Thanks] 
 
file src/usage_str.dat 
...]]></description>
			<content:encoded><![CDATA[<div>[See part 1 for info links to slist files and an automatic makefile generator you can compile for yourself.  Thanks]<br />
<br />
file src/usage_str.dat<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">const char* usage_str =
    &quot;Usage: %s [switches] dir\n&quot;
    &quot;\n&quot;
    &quot;  For use with 'configure' based installations to install into\n&quot;
    &quot;  prefix=/UsR and then converted to a binary installation into the\n&quot;
    &quot;  real /usr folder.\n&quot;
    &quot;\n&quot;
    &quot;  How: \n&quot;
    &quot;  This application scans and replaces the path UsR found in elf\n&quot;
    &quot;  binaries and other files allowing installation into /UsR and\n&quot;
    &quot;  then changing the path to a real system directory.\n&quot;
    &quot;\n&quot;
    &quot;  Several checks are performed on the text before committing to\n&quot;
    &quot;  a change and it can be first (without the --armed switch( which \n&quot;
    &quot;  you can verify in a hex viewers before creating the binary \n&quot;
    &quot;  installation.  \n&quot;
    &quot;\n&quot;
    &quot;  Is it fool proof?  Pretty close, but some caution is advised.\n&quot;
    &quot;  Keeping a backup of folders and doing a test installation on\n&quot;
    &quot;  your own system to see what changes is just good sense and as\n&quot;
    &quot;  usual, no warantees at this end.  Just best wishes and a bit\n&quot;
    &quot;  of optimism considering the alternatives which you might want\n&quot;
    &quot;  to check out if there are any.\n&quot;
    &quot;\n&quot;
    &quot;  Switches:\n&quot;
    &quot;    [none]          - prints file names and offsets where /UsR is\n&quot;
    &quot;                      found and set to be changed in an armed run.\n&quot;
    &quot;                      Shows a bit of context (hex/ascii dump) and\n&quot;
    &quot;                      can also be used to view in a hex editor.\n&quot;
    &quot;\n&quot;
    &quot;                      Includes text files and other other binaries\n&quot;
    &quot;                      in the scan in addition to elf binaries (the\n&quot;
    &quot;                      default).\n&quot;
    &quot;\n&quot;
    &quot;    --armed         - commit to changes reported in dry run (default).\n&quot;
    &quot;\n&quot;
    &quot;    --elf | --elf-only\n&quot;
    &quot;                    - Only change rpaths and other occurrances of \n&quot;
    &quot;                      UsR in a path context in elf binaries (libs\n&quot;
    &quot;                      and executables).\n&quot;
    &quot;\n&quot;
    &quot;  Tips: \n&quot;
    &quot;    * After intalling into prefix=/UsR, tar up the /UsR directory\n&quot;
    &quot;    where it is before moving the files to where you will build\n&quot;
    &quot;    your package to avoid broken links and missing files, etc.\n&quot;
    &quot;\n&quot;
    &quot;    * If after running with no switches and none of the non-elf files\n&quot;
    &quot;      need to be modified, you can add the '--elf' switch for the \n&quot;
    &quot;      armed run.\n&quot;
    &quot;\n&quot;
    &quot;    * For use as a non-root user, any directory tree is assumed to \n&quot;
    &quot;      have come from and is intended to be installed at root.  You \n&quot;
    &quot;      may run this before or after having moved the files.  Don't\n&quot;
    &quot;      run it in the source though. :-)\n&quot;
    &quot;\n&quot;
    &quot;  Note: The /UsR (prefix) folder you install into using the initial\n&quot;
    &quot;  compilation and installation must be located at the root of the\n&quot;
    &quot;  file system.  The number of letters in the path is critical to\n&quot;
    &quot;  this application's ability to accurately modify 'rpath' and other\n&quot;
    &quot;  text after you have installed into the /UsR dummy directory.\n&quot;
    &quot;\n&quot;
    &quot;    Copyright (C) 2012, Rainbow Sally\n&quot;
    &quot;\n&quot;
    &quot;    Released under the GPL license.\n&quot;
    &quot;\n&quot;
    ;</pre>
</div>file src/version.h<br />
purpose: More than one version exists, the last digit is yours to play with.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">// uses slist functions
#define VERSION &quot;1.3.0&quot;</pre>
</div>file: Usr2usr.cpp<br />
purpose: enable development on the system being developed<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// UsR2usr.cpp

#include &lt;stdio.h&gt;    // printf, sprintf, etc.
#include &lt;stdlib.h&gt;   // exit()
#include &lt;unistd.h&gt;   // tons of stuff
#include &lt;malloc.h&gt;   // memory allocation
#include &lt;string.h&gt;   // strings and block comparisons and moves
#include &lt;ctype.h&gt;
#include &quot;version.h&quot;
#include &quot;slist.h&quot;

void dbg(){}          // a breakpoint for kdbg.exec

// simplified syntax for comparing and moving str/mem
// case insensitive
#define streq(a, b) (strcasecmp(a, b) == 0)

// case sensitive
#define memeq(buf, str) \
  (memcmp(buf, str, strlen(str)) == 0)

// move a string minus terminator
#define memstrcpy(buf, str) \
  memcpy(buf, str, strlen(str))

enum
{
  FILETYPE_ELF = 101,
  FILETYPE_TEXT,
  // others...
  FILETYPE_BINARY
};

static char errmsg[256];
typedef struct
{
  char* buf;
  size_t buflen;
  bool armed_flag; // = 0;
  bool elf_only_flag; // = 0;
  bool pass_filter;
  int filetype; // elf, text, other binary..
  int scan_number; // = 0; // true if first file in scan
  const char* filename;
}VARS;

VARS* global_vars;
// #define obj (*global_vars)

VARS* vars_new()
{
  VARS* vars = (VARS*)malloc(sizeof(VARS));
  memset(vars, 0, sizeof(VARS));
}

void vars_delete(VARS**po)
{
  // destructor
  if(*po)
    free(*po);
  *po = 0;
}

void obj_setPassFilter(VARS* o);
void obj_setFiletype(VARS* o);

// returns count of replacements proposed
int obj_scanAndReplace(VARS* o);

// returns 0 on success, else fatal
int obj_processFile(VARS* o, const char* filename);


const char* appname;

int usage(int errcode);
int show_version(int errcode);
int do_errmsg(int errcode, const char* msgfmt, const char* errvar);
int reorder_args(int argc, char** argv);

int main(int argc, char** argv)
{
  dbg();
    
  appname = basename(argv[0]);
  int arg_offset = reorder_args(argc, argv);
  
  if(argc == 1)
    return usage(1);
  
  if(streq(argv[1], &quot;--help&quot;))
    return usage(0);

  VARS* o = vars_new();
  
  for(int i = 1; i &lt;= arg_offset; i++)
  {  
    if(streq(argv[i], &quot;--armed&quot;))
      o-&gt;armed_flag = 1;
    else if(memeq(argv[i], &quot;--elf&quot;)) // --elf | --elf-only
      o-&gt;elf_only_flag = 1;
    else if(streq(argv[i], &quot;-v&quot;) || streq(argv[i], &quot;--version&quot;))
      return show_version(0);
    else
    {
      fprintf(stderr, &quot;Unknown switch '%s'\n&quot;, argv[i]);
      exit(1);
    }
  }

  const char* dirname = argv[1 + arg_offset];
  
  // get list of files in dirname
  char tmpbuf[4096];
  char** filelist = slist_new();
  int numfiles;
  
  sprintf(tmpbuf, &quot;find %s -type f&quot;, dirname);
  slist_readPipe(&amp;filelist, tmpbuf);
  
  numfiles = slist_count(filelist);  
  
  // tell type of scan
  if(numfiles &gt; 0)
  {
    printf(&quot;\n&quot;);
    sprintf(tmpbuf, &quot;Scan type selected = [%s, %s]&quot;,
         o-&gt;armed_flag ? &quot;ARMED&quot; : &quot;check&quot;,
         o-&gt;elf_only_flag ? &quot;ELF only&quot; : &quot;all&quot;);
    printf(&quot;%s\n&quot;, tmpbuf);
    for(int i = 0; i &lt; strlen(tmpbuf); i++)
      printf(&quot;-&quot;);
    printf(&quot;\n&quot;);
  }
  else
  {
    printf(&quot;%s: No files!\n&quot;, appname);
    return 1;
  }
  
  for(int i = 0; i &lt; numfiles; i++)
  {
    const char* filename = filelist[i];
    int fatal = obj_processFile(o, filename);
    if(fatal)
      return 1;
    
  }
  vars_delete(&amp;o);
  return 0;
}

int show_version(int errcode)
{
  printf(&quot;UsR2usr version %s&quot;, VERSION);
  return errcode;
}


int do_errmsg(int errcode, const char* msgfmt, const char* errvar)
{
  if(errvar == 0)
    errvar = (char*)&quot;&quot;;
  sprintf(errmsg, msgfmt, errvar);
  perror(errmsg);
  return errcode;
}


int usage(int errcode)
{
#include &quot;usage_str.dat&quot; // has one %s format for appname
             
  // test for presence of kdialog for the usage message
  char syscmd[4096];
  sprintf(syscmd, &quot;kdialog -v &gt;/dev/null 2&gt;&amp;1&quot;);
  int err = system(syscmd);

  if(err)
    printf(usage_str, appname);
  else
  {
    char msg[4096];
    sprintf(msg, usage_str, appname);
    sprintf(syscmd, &quot;kdialog -msgbox \&quot;%s\&quot; -title \&quot;Usage     \&quot;&quot; , msg);
    err = system(syscmd);

    if(err)
      printf(usage_str, appname);
  }
  return errcode;
}

int reorder_args(int argc, char** argv)
{
  // make literal copy of argv in temporary list
  char** tmp_args = (char**)malloc(argc * sizeof(char**));
  memcpy(tmp_args, argv, argc * sizeof(char**));
  
  int cnt = 1; // current copy back number, app path is at [0] still
  int nswitches = 0; // the value to return
  
  // copy switches back first
  for(int i = 1; i &lt; argc; i++)
    if(tmp_args[i][0] == '-')
      argv[cnt++] = tmp_args[i];
  
  nswitches = cnt - 1; // number of actual switches
  
  // copy non-switches back next
  for(int i = 1; i &lt; argc; i++)
    if(tmp_args[i][0] != '-')
      argv[cnt++] = tmp_args[i];
  
  free(tmp_args);
  return nswitches;
}


void obj_setFiletype(VARS* o)
{
  do
  {
    if(memeq(o-&gt;buf+1, &quot;ELF&quot;))
       printf(&quot;&quot;);
    if(memeq(o-&gt;buf, &quot;\177ELF&quot;))
      printf(&quot;&quot;);
    if(o-&gt;buflen &gt;= 4)
    {
      if(memeq(o-&gt;buf, &quot;\177ELF&quot;))
      {
        o-&gt;filetype = FILETYPE_ELF;
        break;
      }
    }
    int testlen = 32;
    int ascii_flag = 1;
    if(o-&gt;buflen &lt; testlen)
      testlen = o-&gt;buflen;
    for(int i = 0; i &lt; testlen; i++)
    {
      if(!isascii(o-&gt;buf[i]))
      {
        ascii_flag = 0;
        break;
      }
    }
    if(ascii_flag &amp;&amp; (testlen &gt; 0))
    {
      o-&gt;filetype = FILETYPE_TEXT;
      break;
    }
    // other checks..
    // default
    o-&gt;filetype = FILETYPE_BINARY;       
  }while(0);
}

// returns 0 on success, else fatal
int obj_processFile(VARS* o, const char* filename)
{
  o-&gt;filename = filename;
  FILE* fp = fopen(filename, &quot;rb+&quot;);
  if(! fp)
    return do_errmsg(1, &quot;Can't open file '%s'&quot;, o-&gt;filename);
        
  fseek(fp, 0, SEEK_END);
  o-&gt;buflen = ftell(fp);
  fseek(fp, 0, SEEK_SET);    
    
  o-&gt;buf=(char*)malloc(o-&gt;buflen);
  if(! o-&gt;buf)
    return do_errmsg(1, &quot;Can't allocate memory&quot;, 0);
      
  fread(o-&gt;buf, 1, o-&gt;buflen, fp);
    
  // check file type and set accessible flag to indicate 
  // whether this is selected to be modified or not.
  obj_setFiletype(o);  
  obj_setPassFilter(o);
      
  // scan for text /UsR or UsR/ and replace with 
  // /usr or usr/
    // save file only if not just checking and
    // filetype matches user selection
  if(o-&gt;pass_filter)
  {
    int count = obj_scanAndReplace(o);
    if(count &lt; 0)
      return do_errmsg(1, &quot;Can't scan file '%s'&quot;, o-&gt;filename);
    
    int nbytes; // for debugger
    if(o-&gt;armed_flag)
    {
      //fseek(fp, 0, SEEK_SET);
      fseek(fp, 0, SEEK_SET);    
      nbytes = fwrite(o-&gt;buf, 1, o-&gt;buflen, fp);
    }
  }
  fclose(fp);
  free(o-&gt;buf);
  return 0;
}

void obj_dumpContext(VARS* o, char* bufptr, bool change)
{
  if(! o-&gt;scan_number)
    printf(&quot;\n&quot;);
  
  o-&gt;scan_number += 1;

  // hex dump 16 bytes of context
  
  unsigned char* cptr;
  int dumplen = 16;
  
  cptr = (unsigned char*)bufptr - 6;
  if((char*)cptr &lt; o-&gt;buf)
    cptr = (unsigned char*)o-&gt;buf;
  
  char* bufend = o-&gt;buf + o-&gt;buflen;
  if(cptr &gt; (unsigned char*)bufend)
    dumplen = (unsigned char*)bufend - cptr;
  
  if(!change)
    printf(&quot;NOT &quot;);
  
  printf(&quot;To change in '%s' at offset 0x%0X:\n&quot;, o-&gt;filename, bufptr - o-&gt;buf);
  for(int i = 0; i &lt; dumplen; i++)
  {
    printf(&quot;%0.2X &quot;, cptr[i]);
  }
  printf(&quot; %s\&quot;...&quot;, change ? &quot;CHG: \x1b[1;31m&quot; : &quot;---- \x1b[37m&quot;);
  for(int i = 0; i &lt; dumplen; i++)
  {
    if(isprint(cptr[i]))
      printf(&quot;%c&quot;, cptr[i]);
    else
      printf(&quot;.&quot;);
  }
  printf(&quot;...\&quot;\x1b[0;30m\n\n&quot;);
}


void obj_showStatus(VARS* o, char* bufptr, bool change)
{
  if(o-&gt;armed_flag)
  {
    printf(&quot;Found 'UsR' in '%s' at 0x%X %s\n&quot;, o-&gt;filename, bufptr - o-&gt;buf, change ? &quot;(CONVERTED)&quot; : &quot;(No Change)&quot;);
  }
  else
  { 
    obj_dumpContext(o, bufptr, change);
  }
}


// returns number of changes made.
int obj_scanAndReplace(VARS* o)
{
  int count = 0;
  char* ptr = o-&gt;buf;
  char* bufend = ptr + o-&gt;buflen;

  int found;
  found = 0;
  while(ptr &lt; bufend)
  {
    found = 0;            // flag found in context
    const char* replstr = 0;   // flag and string to skip
    do{
      // UsR in correct context
      ///
      // check for any all at once
      if(strchr(&quot;/U\'\&quot;&quot;, *ptr))
      {
        if(*ptr == 'U')
        {
          static const char* this_str = &quot;UsR/&quot;;
          if(memeq(ptr, this_str))
          {
            found++;
            replstr = &quot;usr/&quot;;
          }
          else if(memeq(ptr, &quot;UsR&quot;))
          {
            replstr = &quot;UsR&quot;;            
          }
        }
        else if(*ptr == '/')
        {
          static const char* this_str = &quot;/UsR&quot;;
          if(memeq(ptr, this_str))
          {
            found++;
            replstr = &quot;/usr&quot;;
          }
        }          
        else if(*ptr == '\'')
        {
          static const char* this_str = &quot;\'UsR\'&quot;;
          if(memeq(ptr, this_str))
          {
            found++;
            replstr = &quot;\'usr\'&quot;;
          }
        }          
        else if(*ptr == '\&quot;')
        {
          static const char* this_str = &quot;\&quot;UsR\&quot;&quot;;
          if(memeq(ptr, this_str))
          {
            found++;
            replstr = &quot;\&quot;usr\&quot;&quot;;
          }
        }
      } // if(strchr
      
      //  found &amp; show copy count steps
      //        | (replstr &amp; steps | 1step)
      if(found)
      {
        obj_showStatus(o, ptr, true); // and show 'change'
        memstrcpy(ptr, replstr);
        ptr += strlen(replstr);
        count++;
      }
      else // not found
      {
        if(replstr)
        {
          obj_showStatus(o, ptr, false); // show 'no change'
          ptr += strlen(replstr);
        }
        else 
          ptr++; // step 1
      }      
      
    }while(0); // do
  } // while(bufptr...)
  return count;
}

void obj_setPassFilter(VARS* o)
{
  // if filetype = elf or --all then true else false
  o-&gt;pass_filter = false;
  if(o-&gt;filetype == FILETYPE_ELF)
    o-&gt;pass_filter = true;
  else if(!o-&gt;elf_only_flag)
    o-&gt;pass_filter = true;
}</pre>
</div>To create the Makefile: <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">makefile-creator c++ UsR2usr</pre>
</div>or the equivalent.<br />
<br />
[If you forget the output name using makefile-creator you may get strange looking syntax errors when you 'make' it.  If you don't like that, it's yours now.  Fix it!  Find TODO in the sources.  :-) ]<br />
<br />
To build: <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">make</pre>
</div>This has been built with the files linked in part 1 and using the makeifle-creator with a test fileset consisting of the src folder copied to 'test' and the o/ dir also copied into it.<br />
<br />
The test sequence for a build using makefile-creator was as follows.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 194px;
		text-align: left;
		overflow: auto">[elf files only]
UsR2usr test --elf-only
UsR2usr test --elf-only --armed
UsR2usr test --elf-only
[verified all changes made and other strings untouched]

[all files]
UsR2usr test
UsR2usr test --armed
UsR2usr test
[verified]</pre>
</div>All tests passed.<br />
Compiled and linked with gcc version 4.5.1 20101208. <br />
<br />
The executable file size was 20436.  (Yours should at least be close to that size even if compiled with a different version unless you use a different Makefile generator.)<br />
<br />
Thank you. -rs</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34432</guid>
		</item>
		<item>
			<title><![CDATA[Advanced C: UsR2usr Part 1 - Dummy install into /UsR and 'rpath' mods etc.]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34431</link>
			<pubDate>Thu, 02 Feb 2012 22:17:46 GMT</pubDate>
			<description><![CDATA[[This application may be used by non-kde users though the help display is nicer in kde.  As an openSUSE user trying to build from alleged source...]]></description>
			<content:encoded><![CDATA[<div>[This application may be used by non-kde users though the help display is nicer in kde.  As an openSUSE user trying to build from alleged source packages, I realized that we NEED something like this for developers and advanced users alike in order to make &quot;open&quot; source less &quot;opaque&quot;]<br />
<br />
Purposes:<ul><li> Re-enables user verification of opaque binary packages and re-opens the &quot;open&quot; part of open source.</li>
<li> Create retro packages.</li>
<li> Make custom packages with files missing from standard packages.</li>
</ul><br />
Features:<ul><li> A way to install into a dummy image of the /usr directory and modify rpaths and other strings resembling the real /usr path after compilation and installation by normal methods. (Usually './configure --prefix=UsR..., make, and make install, but possible with cmake as well.)</li>
</ul><br />
Requires:<ul><li> An automatic makefile generator (see makefile-creator if you need one).</li>
<li> Files from previous blog posts (see links below).</li>
<li> make, and gcc/g++ (about 60 megs and well worth the download).</li>
<li> A little common sense for the final installation of your packages, or a sense of curiosity if you only want to see what it does in the check mode (default) which doesn't require root privileges at any point.</li>
</ul><br />
An armed run and installation of the resulting re-pointed binaries is by nature quite risky whether or not the app we build is bug infested.  Keep backups.  Do responsible testing on small file sets to make sure this is right for your needs.  Save about a thousand bucks on something commercial that might not work as well.  :-)<br />
<br />
<b>A bit of context</b><br />
<br />
We notice on the internet that Solaris has addressed the issue of relocating binary installations by changing the 'rpath' which is now in the string table for their operating system so that it can be changed. That allows developing and/or installing files for the currently running system, which is otherwise incredibly risky!!<br />
  <br />
But what about HTML links?<br />
<br />
Their solution is still incomplete and appears to have the same reliability issues as this new approach I propose here, and may in fact be less reliable from what I've seen posted on the net.<br />
<br />
This application is named UsR2usr and does what it the name implies.<br />
<br />
It's a utility to allow configuring your installation to go into a directory named /UsR instead of the usual /usr folder, and modify all occurrances of that path in all files (or explicitly just binary executables, at the user's preference) in quoted strings or in strings with path separators, with a short hex dump allowing you to see what will be changed in an 'armed' run and make necessary manual changes if any are required.  <br />
  <br />
So far I have never seen this tool make a parsing error, even in horrendously large installations (all of QT4), but again, common sense requires the additional margin of safety and you may be glad we don't just brute-force the modifications someday.<br />
<br />
Caveats:<br />
<br />
We can accept no liability for what happens when the binaries are put into packages and actually installed.  Problems can creep in during the &quot;configure&quot; stage with incorrectly &quot;configure&quot;-ed paths, etc.  Probs can be caused by inadvertently installing obsolete 'development' files (headers or *.so - minus numeric extension) as well.  And due to the parsing algorithm used here, there's the statistical possibility that a string &quot;UsR&quot; might be found in a binary file (usually compressed or an image file) getting converted that shouldn't have and the proposed change (or non-change) could be missed by the user in a large dump.<br />
<br />
NO changes are performed that aren't in the hex dump.  The only difference between an armed run and a test run (the default) is that in the armed run the data is written back to file.  Even in a check run, the data listed is converted but only in memory.<br />
<br />
Once this tool is built, run it with no args or with the --help switch for usage details.<br />
<br />
Dependencies:<br />
  <br />
The file dependencies for this application are in the blog entry: beyond bash part 2.  Grab slist.h and slist.cpp<br />
<a href="http://www.linuxquestions.org/questions/blog/rainbowsally-615861/simple-c-beyond-bash-part-1-string-lists-and-pipes-34413/">http://www.linuxquestions.org/questi...d-pipes-34413/</a><br />
<br />
Got makefile-creator yet?  If you need a simple, fast and efficient automatic makefile generator you might enjoy it even if you already have more advanced tools already.<br />
<a href="http://www.linuxquestions.org/questions/blog/rainbowsally-615861/computer-mad-science-the-anatomy-of-a-makefile-part-2-34421/">http://www.linuxquestions.org/questi...-part-2-34421/</a><br />
<br />
This application is Copyright (C) 2012, Rainbow Sally, released under the GPL license <br />
<br />
It may NEVER be locked up, stolen, or made a proprietary secret, so there is <b>no excuse</b> for &quot;open source&quot; installations to require a can opener, a crow bar or a secret combination to &quot;open&quot;, install, debug, or simply to verify by non-developers.<br />
<br />
[Case in point: Find the source rpm for libffi45.  Standard openSUSE 11.4, they say.  But libffi should be 330K, not 60 megs.]<br />
<br />
So... Copy/paste absolutely anonymously and off you go...  <br />
<br />
And whether you use it or not, let the people who make these opaque binaries from sources that don't match what's on our systems worry that you MIGHT!  :-)<br />
<br />
[As creators of binary installations they have root access to your system by way of the installation process and if the files run as root, by way of the executable as well.]<br />
<br />
UsR2usr implementation code coming soon...<br />
<br />
:-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34431</guid>
		</item>
		<item>
			<title>film photography</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34430</link>
			<pubDate>Thu, 02 Feb 2012 19:32:37 GMT</pubDate>
			<description><![CDATA[This year I'm moving back to film photography and will learn processing myself, since no real lab in our forsaken town. 
Anyway, time to get my hands...]]></description>
			<content:encoded><![CDATA[<div>This year I'm moving back to film photography and will learn processing myself, since no real lab in our forsaken town.<br />
Anyway, time to get my hands busy with some art ;D<br />
Enough writing shit-code!</div>

]]></content:encoded>
			<dc:creator>Web31337</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34430</guid>
		</item>
		<item>
			<title>incremental backup on tape drive</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34429</link>
			<pubDate>Thu, 02 Feb 2012 13:24:50 GMT</pubDate>
			<description>Dear Sir, 
 
  I want to take backup on LTO4 for Linux partition (mounted as user home ). How can I take incremental backup . I have 8 partition...</description>
			<content:encoded><![CDATA[<div>Dear Sir,<br />
<br />
  I want to take backup on LTO4 for Linux partition (mounted as user home ). How can I take incremental backup . I have 8 partition belongs to 8 home (including numbers of home on each partition ) in my NIS server and eight LTO4 tape drive. How can I take incremental data backup? Is there any GUI third party software there or any kind of script have to be run. Please help in this regards. I am totally stuck on it.<br />
<br />
 Regards<br />
  Nayan</div>

]]></content:encoded>
			<dc:creator>nayan123</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34429</guid>
		</item>
		<item>
			<title>Really tiny executable</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34427</link>
			<pubDate>Wed, 01 Feb 2012 21:23:37 GMT</pubDate>
			<description>Thought this was neat: 
 
A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux...</description>
			<content:encoded><![CDATA[<div>Thought this was neat:<br />
<br />
<a href="http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html" target="_blank">A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux</a> <br />
<br />
The author uses assembly and ELF-hacking to make a binary as small as possible while still doing something useful (returning a value). Goes step-by-step through each hack.</div>

]]></content:encoded>
			<dc:creator>hydraMax</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34427</guid>
		</item>
		<item>
			<title>How to reverse a linked list? - C</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34426</link>
			<pubDate>Wed, 01 Feb 2012 11:49:24 GMT</pubDate>
			<description><![CDATA[[IMG]http://i1238.photobucket.com/albums/ff492/anishakaul/DataStructures/Diagram1.jpg[/IMG] 
 
 
Code: 
--------- 
*void* reverseLinkedList () 
{...]]></description>
			<content:encoded><![CDATA[<div><img src="http://i1238.photobucket.com/albums/ff492/anishakaul/DataStructures/Diagram1.jpg" border="0" alt="" /><br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto"><b><i>void</i></b> reverseLinkedList ()
{
	linkedList *pointer1;
	linkedList *pointer2;
	
	pointer1 = NULL;
	pointer2 = head-&gt;next;
	
	<b><i>while</i></b> (pointer2 != NULL)
	{
		head-&gt;next = pointer1;
		
		pointer1     = head;
		head         = pointer2;
		pointer2     = pointer2-&gt;next;
	}
	
	<i><font color="YellowGreen">/*
             <b>When
		`pointer1` reaches the last but one node,
		`head` reaches the last node,
		`pointer2` reaches the null,
		
		the direction change of the head node's next pointer is still pending, so</b>
	*/</font></i>
	head-&gt;next = pointer1;

	<i><font color="YellowGreen">/* 
             <b>To include the direction change of the head node's next pointer (when it 
	        reaches the end of the list) in the while loop itself, simply store the head 
        	pointer in another temporary pointer i.e pointerX. The condition in the while 
	        loop then will be <b>`while (pointerX != NULL)`</b> and you'll have to check the value
        	of the <b>`pointer2`</b> before moving it again, like 
	        <b>`if (pointer2 != NULL) pointer2 = pointer2-&gt;next;`</b></b></font></i><font color="YellowGreen">
        */</font>
}</pre>
</div></div>


<!-- attachments -->
	<div style="margin-top:10px">

		
		
		
		
			<fieldset class="fieldset">
				<legend>Attached Files</legend>
				<table cellpadding="0" cellspacing="3" border="0">
				<tr>
	<td><img class="inlineimg" src="http://lqcdn.thequestionsnetwork.net/questions/images/attach/txt.gif" alt="File Type: txt" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
	<td><a href="http://www.linuxquestions.org/questions/blog_attachment.php?attachmentid=78&amp;d=1328096899">reverseLinkedList.txt</a> (1.8 KB, 2 views)</td>
</tr>
				</table>
			</fieldset>
		

	</div>
<!-- / attachments -->
]]></content:encoded>
			<dc:creator>Anisha Kaul</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34426</guid>
		</item>
		<item>
			<title>mount error 13 permission denied</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34425</link>
			<pubDate>Wed, 01 Feb 2012 10:48:48 GMT</pubDate>
			<description><![CDATA[Dear All, 
 
When I tried to mount a folder in windows to Linux using  
mount -t cifs //ipaddr/foldername /home/folder -o username=<username>  and...]]></description>
			<content:encoded><![CDATA[<div>Dear All,<br />
<br />
When I tried to mount a folder in windows to Linux using <br />
mount -t cifs //ipaddr/foldername /home/folder -o username=&lt;username&gt;  and hit enter it asks for password after giving the password it shows &quot;mount error 13:permission denied&quot;<br />
<br />
I have share the folder with full control to everyone in windows pc.<br />
<br />
Please let me know how to solve this issue</div>

]]></content:encoded>
			<dc:creator>linuxpandi</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34425</guid>
		</item>
		<item>
			<title>Fix: browser downloads PHP file instead of running it (Debian Squeeze)</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34424</link>
			<pubDate>Tue, 31 Jan 2012 08:39:45 GMT</pubDate>
			<description><![CDATA[This problem took nearly a day to solve so here's the solution. 
 
The problem symptom was with nagios3.  After browsing http://<server>/nagios3 and...]]></description>
			<content:encoded><![CDATA[<div>This problem took nearly a day to solve so here's the solution.<br />
<br />
The problem symptom was with nagios3.  After browsing http://&lt;server&gt;/nagios3 and logging on, Firefox opened a download dialog with said &quot;<i>You have chosen to open &lt;blank line&gt; which is a: application/x-httpd-php</i>&quot;.  <br />
<br />
Looking for nagios-specific solutions was not fruitful.  It was only when I searched for solutions to the browser downloading PHP files instead of running them I found solutions such as <a href="http://serverfault.com/questions/337873/php-is-not-executed-on-apache2" target="_blank">this one</a>.<br />
<br />
It turned out I had broken the libapache2-mod-php5 installation when re-installing apache2 to get a baselined installation.<br />
<br />
The libapache2-mod-php5 installation was fixed by purging libapache2-mod-php5 which also removed (purged?) nagios3 and its many dependencies.  After re-installing libapache2-mod-php5 and then nagios3, the same problem occurred until Firefox's &quot;Recent History&quot; (including cookies and cache) was cleared.</div>

]]></content:encoded>
			<dc:creator>catkin</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34424</guid>
		</item>
		<item>
			<title>Slackware-13.37-Hacks-Turning Off Services</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34423</link>
			<pubDate>Tue, 31 Jan 2012 01:18:39 GMT</pubDate>
			<description>These are all of the Services that are available upon Installation. It is better to deactivate them upon the initial Slackware 13.37 installation,...</description>
			<content:encoded><![CDATA[<div>These are all of the Services that are available upon Installation. It is better to deactivate them upon the initial Slackware 13.37 installation, however in this tutorial will go through deactivating services as an exercise.<br />
<br />
Confirm startup services to run<br />
<br />
[ ] rc.atalk<br />
[ ] rc.bind<br />
[ ] rc.cups<br />
[ ] rc.dnsmasq<br />
[X] rc.fuse<br />
[X] rc.hald<br />
[ ] rc.httpd<br />
[ ] rc.inetd<br />
[ ] rc.ip_forward<br />
[X] rc.messagebus<br />
[ ] rc.mysqld<br />
[ ] rc.ntpd<br />
[ ] rc.pcmcia<br />
[ ] rc.rpc<br />
[ ] rc.samba<br />
[ ] rc.saslauthd<br />
[ ] rc.sendmail<br />
[ ] rc.snmpd<br />
[X] rc.syslog<br />
[X] rc.sshd<br />
<br />
After turning ON all Services with KDE Desktop running, there were 183 tasks consuming approx 421MB of RAM. After disabling/turning off the unneeded services, there were 167 tasks consuming approx 345MB of RAM.<br />
<br />
The tools you can use to check for listening ports are the (1) CLI nmap or (2) CLI netstat or (3) Zenmap Application which is just a Graphical Front-End for nmap located at KDE Menu &gt; Internet &gt; Zenmap (as root) (GUI Port Scanner)<br />
<br />
In this example, my local machine has a Static IP of 192.168.0.13<br />
<br />
# nmap -T4 -A -v &lt;IP Address of Your Machine&gt;<br />
# nmap -T4 -A -v 192.168.0.13<br />
<br />
bash-4.1# netstat -lundt   <br />
Active Internet connections (only servers)<br />
Proto Recv-Q Send-Q Local Address           Foreign Address         State      <br />
tcp        0      0 0.0.0.0:113             0.0.0.0:*               LISTEN     <br />
tcp        0      0 192.168.0.13:53         0.0.0.0:*               LISTEN     <br />
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN     <br />
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     <br />
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     <br />
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN     <br />
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN     <br />
tcp        0      0 0.0.0.0:548             0.0.0.0:*               LISTEN     <br />
tcp        0      0 0.0.0.0:37              0.0.0.0:*               LISTEN     <br />
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN     <br />
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN     <br />
tcp6       0      0 :::80                   :::*                    LISTEN     <br />
tcp6       0      0 :::22                   :::*                    LISTEN     <br />
tcp6       0      0 ::1:631                 :::*                    LISTEN     <br />
tcp6       0      0 ::1:953                 :::*                    LISTEN     <br />
<br />
All the above with a State of &quot;LISTEN&quot; are Server Programs running on your computer. The ports opened are shown at the end of the quad notation on the section &quot;Local Address&quot;.<br />
<br />
You can find the name of the Service by using the following command.<br />
<br />
$ cat /etc/services | grep 113<br />
auth		113/tcp	   ident tap	#Authentication Service<br />
auth		113/udp	   ident tap	#Authentication Service<br />
<br />
Port 22 SSH Server (sshd)<br />
Port 25 Sendmail Mail Server (smtp)<br />
Port 37 Time Server (timserver)<br />
Port 53 Domain Name Server (bind)<br />
Port 80 Apache Web Server (httpd)<br />
Port 111 Sun Remote Procedure Bind (rpcbind)<br />
Port 113 Authentication Service (ident tap)<br />
Port 548 AFP over TCP (netatalk)<br />
Port 587 Submission Sendmail Mail Server (smtp)<br />
Port 631 CUPS Print Server (cups)<br />
Port 953 Named's rndc control socket (bind)<br />
<br />
To turn off services:<br />
<br />
ETC/INETD.CONF<br />
<br />
# vi /etc/inetd.conf<br />
Comment-out the following sections<br />
<br />
time            stream  tcp     nowait  root    internal<br />
time            dgram   udp     wait    root    internal<br />
<br />
# Ident service is used for net authentication<br />
auth    stream  tcp     wait    root    /usr/sbin/in.identd     in.identd<br />
<br />
Save the file and exit.<br />
This will turn off Ports 37 (time) and 113 (ident tap)<br />
<br />
RC.ATALK<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start netatalk. (a file/print server for Macs using Appletalk)<br />
if [ -x /etc/rc.d/rc.atalk ]; then<br />
  /etc/rc.d/rc.atalk<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.atalk<br />
# chmod -x /etc/rc.d/rc.atalk<br />
This will turn off Port 548<br />
<br />
RC.BIND<br />
<br />
# vi /etc/rc.d/rc.inet2<br />
Comment-out the following section<br />
<br />
# Start the BIND name server daemon:<br />
if [ -x /etc/rc.d/rc.bind ]; then<br />
  /etc/rc.d/rc.bind start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.bind<br />
# chmod -x /etc/rc.d/rc.bind<br />
This will turn off Ports 53 and 953<br />
<br />
RC.BLUETOOTH<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start Bluetooth:<br />
if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
  sh /etc/rc.d/rc.bluetooth start<br />
fi<br />
<br />
Save the file and exit.<br />
This service is not turned on by default, but is shown for completeness.<br />
<br />
RC.CUPS<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start the print spooling system.  This will usually be LPRng (lpd) or CUPS.<br />
if [ -x /etc/rc.d/rc.cups ]; then<br />
  # Start CUPS:<br />
  /etc/rc.d/rc.cups start<br />
elif [ -x /etc/rc.d/rc.lprng ]; then<br />
  # Start LPRng (lpd):<br />
  . /etc/rc.d/rc.lprng start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.cups<br />
# chmod -x /etc/rc.d/rc.cups<br />
This will turn off Port 631<br />
<br />
RC.DNSMASQ<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start dnsmasq, a simple DHCP/DNS server:<br />
if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
  /etc/rc.d/rc.dnsmasq start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.dnsmasq<br />
# chmod -x /etc/rc.d/rc.dnsmasq<br />
<br />
RC.HTTPD<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start Apache web server:<br />
if [ -x /etc/rc.d/rc.httpd ]; then<br />
  . /etc/rc.d/rc.httpd start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.httpd<br />
# chmod -x /etc/rc.d/rc.httpd<br />
This will turn off Port 80 (You can still browse the Web. This just turns off the Apache Web Server)<br />
<br />
RC.IP_FORWARD<br />
<br />
# vi /etc/rc.d/rc.inet2<br />
Comment-out the following section<br />
<br />
# Turn on IPv4 packet forwarding support.<br />
if [ -x /etc/rc.d/rc.ip_forward ]; then<br />
  . /etc/rc.d/rc.ip_forward start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.ip_forward<br />
# chmod -x /etc/rc.d/rc.ip_forward<br />
<br />
RC.MYSQLD<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start the MySQL database:<br />
if [ -x /etc/rc.d/rc.mysqld ]; then<br />
  . /etc/rc.d/rc.mysqld start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.mysqld<br />
# chmod -x /etc/rc.d/rc.mysqld<br />
<br />
RC.NFSD<br />
<br />
# vi /etc/rc.d/rc.inet2<br />
Comment-out the following section<br />
<br />
# Start the NFS server.  Note that for this to work correctly, you'll<br />
# need nfsd support in the kernel (the startup script will try to load<br />
# the module for you).<br />
# You'll also need to set up some shares in /etc/exports.<br />
# Starting the NFS server:<br />
if [ -x /etc/rc.d/rc.nfsd ]; then<br />
  /etc/rc.d/rc.nfsd start<br />
fi<br />
<br />
Save the file and exit.<br />
This service is not turned on by default, but is shown for completeness.<br />
<br />
RC.NTPD<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
  sh /etc/rc.d/rc.ntpd start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.ntpd<br />
# chmod -x /etc/rc.d/rc.ntpd<br />
<br />
RC.OPENLDAP<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start OpenLDAP:<br />
if [ -x /etc/rc.d/rc.openldap ]; then<br />
  . /etc/rc.d/rc.openldap start<br />
fi<br />
<br />
Save the file and exit.<br />
This service is not turned on by default, but is shown for completeness.<br />
<br />
RC.PCMCIA<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
  . /etc/rc.d/rc.pcmcia start<br />
  # The cards might need a little extra time here to initialize.<br />
  sleep 5<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.pcmcia<br />
# chmod -x /etc/rc.d/rc.pcmcia<br />
<br />
RC.RPC<br />
<br />
# vi /etc/rc.d/rc.inet2<br />
Comment-out the following sections<br />
<br />
# Mount remote (NFS) filesystems:<br />
if cat /etc/fstab | grep -v '^#' | grep -w nfs 1&gt; /dev/null 2&gt; /dev/null ; then<br />
  # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
  # volumes defined in /etc/fstab since these will need to be running in order<br />
  # to mount them.  If they are not running, attempting to mount an NFS<br />
  # partition will cause mount to hang, or at least result in unreliable<br />
  # operation.  Keep this in mind if you plan to mount unlisted NFS<br />
  # partitions... <br />
  # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
  # whether it is set as executable or not.  If you don't want to run it,<br />
  # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
  if [ -r /etc/rc.d/rc.rpc ]; then<br />
    sh /etc/rc.d/rc.rpc start<br />
  fi<br />
  echo &quot;Mounting remote (NFS) file systems:  /sbin/mount -a -t nfs&quot;<br />
  /sbin/mount -a -t nfs          # This may be our /usr runtime!<br />
  # Show the mounted volumes:<br />
  /sbin/mount -v -t nfs<br />
fi<br />
<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd.  This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab.  Starting this twice won't hurt as the script will<br />
# check if things are already running before trying to start them.<br />
if [ -x /etc/rc.d/rc.rpc ]; then<br />
  sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.rpc<br />
# chmod -x /etc/rc.d/rc.rpc<br />
This will turn off Port 111<br />
<br />
RC.SAMBA<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start Samba (a file/print server for Win95/NT machines).<br />
# Samba can be started in /etc/inetd.conf instead.<br />
if [ -x /etc/rc.d/rc.samba ]; then<br />
  . /etc/rc.d/rc.samba start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.samba<br />
# chmod -x /etc/rc.d/rc.samba<br />
<br />
This will turn off Ports 137, 138 and 139<br />
<br />
RC.SASLAUTHD<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start the SASL authentication server.  This provides SASL<br />
# authentication services for sendmail:<br />
if [ -x /etc/rc.d/rc.saslauthd ]; then<br />
  . /etc/rc.d/rc.saslauthd start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.saslauthd<br />
# chmod -x /etc/rc.d/rc.saslauthd<br />
<br />
RC.SENDMAIL<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start the sendmail daemon:<br />
if [ -x /etc/rc.d/rc.sendmail ]; then<br />
  . /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.sendmail<br />
# chmod -x /etc/rc.d/rc.sendmail<br />
This will turn off Ports 25 and 587<br />
<br />
RC.SSHD<br />
<br />
# vi /etc/rc.d/rc.inet2<br />
Comment-out the following section<br />
<br />
# Start the OpenSSH SSH daemon:<br />
if [ -x /etc/rc.d/rc.sshd ]; then<br />
  echo &quot;Starting OpenSSH SSH daemon:  /usr/sbin/sshd&quot;<br />
  /etc/rc.d/rc.sshd start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.sshd<br />
# chmod -x /etc/rc.d/rc.sshd<br />
This will turn off Port 22<br />
<br />
RC.SNMPD<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
  /etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.snmpd<br />
# chmod -x /etc/rc.d/rc.snmpd<br />
<br />
RC.WICD<br />
<br />
# vi /etc/rc.d/rc.M<br />
Comment-out the following section<br />
<br />
# Start wicd:<br />
if [ -x /etc/rc.d/rc.wicd ]; then<br />
  sh /etc/rc.d/rc.wicd start<br />
fi<br />
<br />
Save the file and exit.<br />
This service is not turned on by default, but is shown for completeness.<br />
<br />
RC.YP<br />
<br />
# vi /etc/rc.d/rc.inet2<br />
Comment-out the following section<br />
<br />
# Start NIS (the Network Information Service):<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
  . /etc/rc.d/rc.yp start<br />
fi<br />
<br />
Save the file and exit.<br />
Remove the executable bit from the script /etc/rc.d/rc.yp<br />
# chmod -x /etc/rc.d/rc.yp<br />
This service is not turned on by default, but is shown for completeness.<br />
<br />
REMOVING EXECUTABLE BIT<br />
<br />
Since this is a desktop machine hooked up with a Network Cable, I go ahead and remove the executable bit from scripts that I don't want to run at boot-time.<br />
<br />
# chmod -x /etc/rc.d/rc.gpm<br />
# chmod -x /etc/rc.d/rc.sysvinit<br />
# chmod -x /etc/rc.d/rc.wireless<br />
<br />
COMMENTING-OUT RC.M<br />
<br />
# vi /etc/rc.d/rc.M<br />
<br />
Comment-out the following sections if you don't use these Services:<br />
<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
  . /etc/rc.d/rc.font<br />
fi<br />
<br />
# Load a custom keymap if the user has an rc.keymap script.<br />
if [ -x /etc/rc.d/rc.keymap ]; then<br />
  . /etc/rc.d/rc.keymap<br />
fi<br />
<br />
# Start the GPM mouse server:<br />
if [ -x /etc/rc.d/rc.gpm ]; then<br />
  . /etc/rc.d/rc.gpm start<br />
fi<br />
<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
  . /etc/rc.d/rc.sysvinit<br />
fi<br />
<br />
Save the file and exit.<br />
<br />
COMMENTING-OUT RC.INET2<br />
<br />
# vi /etc/rc.d/rc.inet2<br />
<br />
Comment-out the following sections if you don't use these Services:<br />
<br />
# Mount remote CIFS filesystems.  Note that where possible, using CIFS is<br />
# preferred over SMBFS.  SMBFS is no longer actively maintained.<br />
if cat /etc/fstab | grep -v '^#' | grep -w cifs 1&gt; /dev/null 2&gt; /dev/null ; then<br />
  echo &quot;Mounting remote CIFS file systems:  /sbin/mount -a -t cifs&quot;<br />
  /sbin/mount -a -t cifs<br />
  # Show the mounted volumes:<br />
  /sbin/mount -v -t cifs<br />
fi<br />
<br />
# Mount remote SMB filesystems:<br />
if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1&gt; /dev/null 2&gt; /dev/null ; then<br />
  echo &quot;Mounting remote SMBFS file systems:  /sbin/mount -a -t smbfs&quot;<br />
  /sbin/mount -a -t smbfs<br />
  # Show the mounted volumes:<br />
  /sbin/mount -v -t smbfs<br />
fi<br />
<br />
Save the file and exit.</div>

]]></content:encoded>
			<dc:creator>arniekat</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34423</guid>
		</item>
		<item>
			<title>Bash scripts and keyboard input</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34422</link>
			<pubDate>Sun, 29 Jan 2012 20:43:18 GMT</pubDate>
			<description>You can use Bash to read individual keypresses. Here is an example: 
 
Code: 
--------- 
#!/bin/bash 
 
# Reset terminal to current state when we...</description>
			<content:encoded><![CDATA[<div>You can use Bash to read individual keypresses. Here is an example:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">#!/bin/bash

# Reset terminal to current state when we exit.
trap &quot;stty $(stty -g)&quot; EXIT

# Disable echo and special characters, set input timeout to 0.2 seconds.
stty -echo -icanon time 2 || exit $?

# String containing all keypresses.
KEYS=&quot;&quot;

# Set field separator to BEL (should not occur in keypresses)
IFS=$'\a'

# Remind user to press ESC to quit.
echo &quot;Press Esc to quit.&quot; &gt;&amp;2

# Input loop.
while [ 1 ]; do

    # Read more input from keyboard when necessary.
    while read -t 0 ; do
        read -s -r -d &quot;&quot; -N 1 -t 0.2 CHAR &amp;&amp; KEYS=&quot;$KEYS$CHAR&quot; || break
    done

    # If no keys to process, wait 0.05 seconds and retry.
    if [ -z &quot;$KEYS&quot; ]; then
        sleep 0.05
        continue
    fi

    # Check the first (next) keypress in the buffer.
    case &quot;$KEYS&quot; in
      $'\x1B\x5B\x41'*) # Up
        KEYS=&quot;${KEYS##???}&quot;
        echo &quot;Up&quot;
        ;;
      $'\x1B\x5B\x42'*) # Down
        KEYS=&quot;${KEYS##???}&quot;
        echo &quot;Down&quot;
        ;;
      $'\x1B\x5B\x44'*) # Down
        KEYS=&quot;${KEYS##???}&quot;
        echo &quot;Left&quot;
        ;;
      $'\x1B\x5B\x43'*) # Down
        KEYS=&quot;${KEYS##???}&quot;
        echo &quot;Right&quot;
        ;;
      $'\x1B\x4F\x48'*) # Home
        KEYS=&quot;${KEYS##???}&quot;
        echo &quot;Home&quot;
        ;;
      $'\x1B\x5B\x31\x7E'*) # Home (Numpad)
        KEYS=&quot;${KEYS##????}&quot;
        echo &quot;Home (Numpad)&quot;
        ;;
      $'\x1B\x4F\x46'*) # End
        KEYS=&quot;${KEYS##???}&quot;
        echo &quot;End&quot;
        ;;
      $'\x1B\x5B\x34\x7E'*) # End (Numpad)
        KEYS=&quot;${KEYS##????}&quot;
        echo &quot;End (Numpad)&quot;
        ;;
      $'\x1B\x5B\x45'*) # 5 (Numpad)
        KEYS=&quot;${KEYS#???}&quot;
        echo &quot;Center (Numpad)&quot;
        ;;
      $'\x1B\x5B\x35\x7e'*) # PageUp
        KEYS=&quot;${KEYS##????}&quot;
        echo &quot;PageUp&quot;
        ;;
      $'\x1B\x5B\x36\x7e'*) # PageDown
        KEYS=&quot;${KEYS##????}&quot;
        echo &quot;PageDown&quot;
        ;;
      $'\x1B\x5B\x32\x7e'*) # Insert
        KEYS=&quot;${KEYS##????}&quot;
        echo &quot;Insert&quot;
        ;;
      $'\x1B\x5B\x33\x7e'*) # Delete
        KEYS=&quot;${KEYS##????}&quot;
        echo &quot;Delete&quot;
        ;;
      $'\n'*|$'\r'*) # Enter/Return
        KEYS=&quot;${KEYS##?}&quot;
        echo &quot;Enter or Return&quot;
        ;;
      $'\t'*) # Tab
        KEYS=&quot;${KEYS##?}&quot;
        echo &quot;Tab&quot;
        ;;
      $'\x1B') # Esc (without anything following!)
        KEYS=&quot;${KEYS##?}&quot;
        echo &quot;Esc - Quitting&quot;
        exit 0
        ;;
      $'\x1B'*) # Unknown escape sequences
        echo -n &quot;Unknown escape sequence (${#KEYS} chars): \$'&quot;
        echo -n &quot;$KEYS&quot; | od --width=256 -t x1 | sed -e '2,99 d; s|^[0-9A-Fa-f]* ||; s| |\\x|g; s|$|'&quot;'|&quot;
        KEYS=&quot;&quot;
        ;;
      [$'\x01'-$'\x1F'$'\x7F']*) # Consume control characters
        KEYS=&quot;${KEYS##?}&quot;
        ;;
      *) # Printable characters.
        KEY=&quot;${KEYS:0:1}&quot;
        KEYS=&quot;${KEYS#?}&quot;
        echo &quot;'$KEY'&quot;
        ;;
    esac
done</pre>
</div>The crucial lines to get individual characters and not just complete input lines are the two lines<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">trap &quot;stty $(stty -g)&quot; EXIT
stty -echo -icanon time 2 || exit $?</pre>
</div>The first one sets an exit trap, so that the terminal is restored to current mode whenever the script exits. The second one disables input echoing, special character parsing, and sets the input timeout to 2 deciseconds = 0.2 seconds.<br />
<br />
One decisecond may be too short for some keyboards or machines; I've seen &quot;partial&quot; keypresses read when using 1. When using 2, the loop seems to catch all keypresses intact.<br />
<br />
(Technically,<font face="Monospace"> read </font>should just attempt a large read, but return whatever it receives from the first attempt, and only do one attempt. Unfortunately, Bash does not support that for its<font face="Monospace"> read </font>built-in, so we need this loopy whing as a workaround. Fortunately, the above seems to be rock solid on all machines I've tried it on.)<br />
<br />
You'll also need to set the field separator,<font face="Monospace"> IFS</font>, to a value that does not interfere with your character comparisons. I used the <i>beep</i>, ASCII BEL,<font face="Monospace"> \a</font>, as it should never occur in input. If you do not, you will have issues in trying to match the keypresses in a case..esac statement.<br />
<br />
When reading keyboard input, the special keys are provided as multi-character strings. (The above script will tell you what they look like to the script.) To handle that, we need a simple loop:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto">    # Read more input from keyboard when necessary.
    while read -t 0 ; do
        read -s -r -d &quot;&quot; -N 1 -t 0.2 CHAR &amp;&amp; KEYS=&quot;$KEYS$CHAR&quot; || break
    done</pre>
</div>The while loop will continue for as long as Bash thinks it has input to read. <font face="Monospace">read -t 0</font> does not actually read anything, it will just return success if there is input available right now, and failure otherwise.<br />
<br />
The<font face="Monospace"> read -s -r -d &quot;&quot; -N 1 -t 0.2 <i>CHAR</i> </font>command tells Bash to read one character, storing it into the <i>CHAR</i> variable. The flags tell Bash to not echo it, to not consider backslashes special, to consider ASCII NUL (empty string) as the line separator, only read one character, and not wait more than 0.2 seconds for input.<br />
<br />
If the read succeeds, we add it to the key buffer, and see if there is more. If it fails, we should have a full keypress, and we can break out from the keyboard loop.<br />
<br />
In most cases, this loop should work without any delays. The timeouts are there to stop it from &quot;hanging&quot; in the corner cases. At worst, it might drop a character -- but I don't think it will, it's pretty carefully designed to avoid that.<br />
<br />
Because the keyboard input is essentially delayless, and I don't want to waste CPU, I delay for 1/20th of a second before re-checking for input. It should be short enough to make it feel snappy to the user, but long enough to not waste CPU. If you disagree, just change the<font face="Monospace"> sleep 0.05 </font>to suit your preference!<br />
<br />
When keyboard input is received, it is easiest to use a case..esac statement in Bash to determine which one it is. I've included most of the interesting keypresses in the statement above, but it'll also display the ones it does not recognize, so you should not have problems in supporting any keypress in your own programs. (Just try to match the longest ones first, and you should have no problems.)<br />
<br />
It is also important that you note that the keyboard input buffer may contain more than one character. You cannot compare the input exactly, you need to check if the start of the buffer matches, and if so, remove those from the string. You can use either<font face="Monospace"> KEYS=&quot;${KEYS##?}&quot; </font>to remove the matching prefix (with as many ? as there are chars in the keypress).<font face="Monospace"> KEYS=&quot;${KEYS:1}&quot; </font>would work exactly the same (with 1 being the number of chars to remove).<br />
<br />
Because of the exit trap, you can let Ctrl+C interrupt the script, or exit using<font face="Monospace"> exit</font>, and the trap will return the terminal to its previous working state.</div>

]]></content:encoded>
			<dc:creator>Nominal Animal</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34422</guid>
		</item>
		<item>
			<title>Computer Mad Science: The Anatomy Of A Makefile Part 2</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34421</link>
			<pubDate>Sat, 28 Jan 2012 19:24:36 GMT</pubDate>
			<description>Features:  
*  Example: building an editable makefile creator. 
 
 
CHANGELOG: 
*  Feb 5, 2012, corrected reversed params in strstr() call. 
*  Feb...</description>
			<content:encoded><![CDATA[<div>Features: <ul><li> Example: building an editable makefile creator.</li>
</ul><br />
CHANGELOG:<ul><li> Feb 5, 2012, corrected reversed params in strstr() call.</li>
<li> Feb 9, 2012, added a newline between stuff in the write_rules code so the makeifle easier to read.  The &quot;TODO&quot; is still there for the user to fancy up (add help and version switches, etc.) but this one I'll do.</li>
</ul><br />
So you thought you loved cmake, qmake, automake.  Heh heh... okay.<br />
<br />
But you might be surprised at how easily we can create our own makefiles with just a handful of restrictions.  And with an editor those restrictions are replaced by new capabilities you probably never imagined possible.<br />
<br />
As we saw in Part 1, makefiles create files as needed by the rules section.<br />
<br />
Let us create a simple makefile generator.  It's a simple generator.  I didn't say the makefiles would be simple.  :-)  And though it's fairly trivial to adapt this to making static or dynamic libs and comping for 64 or 32 bits, we'll  just let gcc/g++ do what they do with a minimum of interferance.<br />
<br />
[On the subject of 64 or 32 bits, if you are 64 bit user and don't want the 32 bit libs change the '-m32' switch to '-m64' in the source code or edit the output makefile to chage it.  32 bit apps are easier to share, but if you don't want to add more commandline switches and you really don't want the 32 bit build, you have the power now.]<br />
<br />
Basically, we want a list of input files.  Those will come from a directory named 'src'.  And we want to create a list of object files which we'll place in a directory named 'o'.<br />
<br />
And after all the sources are compiled to objects we'll link them.<br />
<br />
That's three steps, not counting whatever I forgot.  :-)<br />
<br />
And we'll do it in C++ for speed and strong type safety (to eliminate most of the coding errors we're likely to make) and convert it to straight C later if you like.  In other words we aren't going to create any &quot;classes&quot; or anything.<br />
<br />
Once this is built it can create it's own makefile so you can recompile it typing only 'make clean' and 'make'.<br />
<br />
Ready?<br />
<br />
Create a project directory and a subdirectory named 'src'.  Place in src the slist.cpp and slist.h files from &quot;beyond bash part 1&quot; back a couple of blog entries  and add this file along with them.<br />
<br />
[Don't worry about TABs for this, the creator handles all that unless you edit the output Makefile.]<br />
<br />
file: src/makefile-creator.cpp<br />
purpose: make makefiles so we can study how they work and who knows, maybe even use 'em.  ;-)<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// makefile-creator, generates editable, makefile for single binary 
// executables written in C or C++.

#include &lt;stdio.h&gt;    // printf, sprintf, etc.
#include &lt;stdlib.h&gt;   // exit()
#include &lt;unistd.h&gt;   // tons of stuff
#include &lt;malloc.h&gt;   // memory allocation
#include &lt;string.h&gt;   // strings and block comparisons and moves

#include &quot;slist.h&quot;

void dbg(){}          // a breakpoint for kdbg.exec

// returns error code
int usage(int errcode);

// these return 0 on success else error
int create_dirs(const char* srcdir, const char* objdir, const char* bindir);
int read_srclist(char*** psrclist, const char* srcdir);
int read_hdrlist(char*** phdrlist, const char* srcdir);
void create_objlist(char*** pobjlist, char** srclist);
int write_makefile(
  const char* bindir, const char* out_name, 
  const char* compiler_name,	
  const char* srcdir, char** srclist, char** hdrlist,
  const char* objdir, char** objlist);


const char* appname;
const char* HERE; // initial dir

int main(int argc, char** argv)
{
  dbg();
  
  int offset = 0;
  int chk;
  // TODO: handle this error flag when true
  int err = 0;
  appname = basename(argv[0]);
  HERE = getenv(&quot;PWD&quot;);
  
  const char* compiler_name;
  
  // syntax check
  if(argc &lt; 2)
  	return usage(1);
  
  // switch check, only allows optional switch as first param
  if(argc &gt; 2)
  {
// CORRECTED THIS -rs
//   if(strstr(&quot;++&quot;, argv[1])) 
    if(strstr(argv[1], &quot;++&quot;))
       compiler_name = &quot;g++&quot;;
    else
       compiler_name = &quot;gcc&quot;;
    offset++;
  }	
  
  // list of sources, headers and objects, names only,
  // paths will be added later to simplify string stuff
  char** srclist = slist_new();
  char** hdrlist = slist_new();
  char** objlist = slist_new();
  
  // output file name
  const char* out_name = argv[1 + offset];
  
  // other vars for the makefile: SRCDIR, OBJDIR, BINDIR
  const char* srcdir = &quot;src&quot;;
  const char* objdir = &quot;o&quot;;
  const char* bindir = &quot;.&quot;;
  
  // init dirs if they don't exist yet.
  err = create_dirs(srcdir, objdir, bindir);
  
  err = read_srclist(&amp;srclist, srcdir);
chk = slist_count(srclist);
  err = read_hdrlist(&amp;hdrlist, srcdir);
chk = slist_count(hdrlist);
  create_objlist(&amp;objlist, srclist);
  
  err = write_makefile(bindir, out_name, compiler_name,	srcdir, srclist, hdrlist, objdir, objlist);
  	
  return err;
}


int usage(int errcode)
{
  /* usage_str.txt converted with txt2cstr */
  const char* usage_str =
  &quot;\n&quot;
  &quot;Usage: %s [c|c++] &lt;filename&gt;\n&quot;
  &quot;  where filename is the name of the output file.\n&quot;
  &quot;\n&quot;
  &quot;  Place all your sources in a directory named 'src' and choose\n&quot;
  &quot;  a c or c++ type of build (default = c) and your makefile will \n&quot;
  &quot;  be created, ready to 'make' or edit.\n&quot;
  &quot;\n&quot;
  ;
  
  printf(usage_str, appname);
  return errcode;

}

// let's cheat and use a shell command for this so we don't have
// to mess with mode bits.
int create_dirs(const char* srcdir, const char* objdir, const char* bindir)
{
  int err;
  char buf[256];
  sprintf(buf, &quot;mkdir -p %s&quot;, srcdir);
  err = system(buf);
  sprintf(buf, &quot;mkdir -p %s&quot;, objdir);
  err |= system(buf);
  sprintf(buf, &quot;mkdir -p %s&quot;, bindir);
  err |= system(buf);
  return err;
}

// let's cheat and use 'find' to get the file names.
int read_srclist(char*** psrclist, const char* srcdir)
{
  int err = 0;
  
  if(chdir(srcdir)) return 1;
  // find src -type f -name *.c -o -name *.cxx -o -name *.cpp 
  char syscmd[256];
  sprintf(syscmd, &quot;find * -maxdepth 0 -type f -name '*.c' -o -name '*.cxx' -o -name '*.cpp'&quot;);
  err = slist_readPipe(psrclist, syscmd);
  chdir(HERE);
  return err;
}

int read_hdrlist(char*** phdrlist, const char* srcdir)
{
  int err = 0;
  if(chdir(srcdir)) return 1;
  // find src -type f -name *.c -o -name *.cxx -o -name *.cpp 
  char syscmd[256];
  sprintf(syscmd, &quot;find * -maxdepth 0 -type f -name '*.h' -o -name '*.hxx' -o -name '*.hpp'&quot;);
  err = slist_readPipe(phdrlist, syscmd);
  chdir(HERE);
  return err;
}

void create_objlist(char*** pobjlist, char** srclist)
{
  int i; // loop counter
  char tmp[256]; // temp string
  char* p;       // scrath pointer
  char* filename;
  for(i = 0; i &lt; slist_count(srclist); i++)
  {
  	filename = srclist[i];
  	// change ext from .* to .o
  	strcpy(tmp, filename);
  	p = strrchr(tmp, '.');
  	strcpy(p, &quot;.o&quot;);
  	
  	// tmp now = objdir/filename.o
  	slist_append(pobjlist, tmp);
  }	
}

void write_makehdr(FILE* fp) {
fprintf(fp, 
&quot;## Makefile created with 'makefile-creator'\n\n&quot;);
}

void assign_outname(FILE* fp, const char* outname) {
fprintf(fp, 
&quot;## The outputf file name not including path\n&quot;
&quot;OUTNAME = %s\n\n&quot;, outname);
}

void assign_dirs(FILE* fp, const char* bindir, const char* srcdir, const char* objdir) {
fprintf(fp, 
&quot;## The directories for sources, (temp) objects, and binary output(s)\n&quot;
&quot;BINDIR = %s\n&quot;
&quot;SRCDIR = %s\n&quot;
&quot;OBJDIR = %s\n\n&quot;, bindir, srcdir, objdir);
}


void assign_compiler(FILE* fp, const char* compiler_name) {
fprintf(fp, 
&quot;## What COMPILE should do.\n&quot;
&quot;COMPILE = %s -m32 -c -o\n&quot;
&quot;CFLAGS = # -O2 or -g3\n&quot;
&quot;INCLUDE = -I/usr/include -I./$(SRCDIR)\n\n&quot;, compiler_name);
}

// compiler name = linker name here.
void assign_linker(FILE* fp, const char* linker_name) {
fprintf(fp,
&quot;## What LINK should do.\n&quot;
&quot;LINK = %s -m32 -o\n&quot;
&quot;LDFLAGS = # -lc\n&quot;
&quot;LIB = -L/usr/lib\n\n&quot;, linker_name);
}

void write_list(FILE* fp, const char* dir, char** list) {
  int i;
  for(i = 0; i &lt; slist_count(list); i++) {
  	fprintf(fp, &quot;  %s/%s \\\n&quot;, dir, list[i]);
  }
}

void assign_lists(FILE* fp, const char* srcdir, char** srclist, char** hdrlist, const char* objdir, char** objlist) {
fprintf(fp, 
&quot;## The full path to the output file\n&quot;
&quot;MAIN = $(BINDIR)/$(OUTNAME)\n&quot;
&quot;\n&quot;
&quot;# MODIFY BELOW THIS LINE WITH GREAT CARE!\n&quot;
&quot;# ---------------------------------------\n&quot;
&quot;\n&quot;);

  const char* endlist = &quot;  #############\n\n&quot;;
  
  fprintf(fp,&quot;SRC = \\\n&quot;);
  write_list(fp, srcdir, srclist);
  fprintf(fp, endlist);	
  
  fprintf(fp,&quot;HDR = \\\n&quot;);
  write_list(fp, srcdir, hdrlist);
  fprintf(fp, endlist);	
  
  fprintf(fp,&quot;OBJ = \\\n&quot;);
  write_list(fp, objdir, objlist);
  fprintf(fp, endlist);
}

void write_rules(FILE* fp, char** srclist, char** objlist)
{
int i; // loop counter
fprintf(fp, &quot;################################## Rules Section\n&quot;);
fprintf(fp, &quot;\n&quot;);
fprintf(fp, &quot;all: $(MAIN) $(HDR) $(OBJ) $(SRC)\n&quot;);
fprintf(fp, &quot;\n&quot;);
fprintf(fp, &quot;$(MAIN): $(OBJ) $(HDR) $(SRC)\n&quot;);
fprintf(fp, &quot;\t@echo\n&quot;);
fprintf(fp, &quot;\t@echo \&quot;Linking $(OUTNAME)\&quot;\n&quot;);
fprintf(fp, &quot;\t$(LINK) $(MAIN) $(OBJ) $(LDFLAGS) $(LIB)\n&quot;);
fprintf(fp, &quot;\t$(POST)\n&quot;);
fprintf(fp, &quot;\n&quot;);

  for(i = 0; i &lt; slist_count(srclist); i++)
  {
  fprintf(fp, &quot;$(OBJDIR)/%s: $(SRCDIR)/%s $(HDR)\n&quot;, objlist[i], srclist[i]);
  fprintf(fp, &quot;\t@echo\n&quot;);
  fprintf(fp, &quot;\t@echo \&quot;Compiling %s\&quot;\n&quot;, objlist[i]);

  // fprintf(fp, &quot;\t$(COMPILE) $(OBJDIR)/%s $(SRCDIR)/%s $(CFLAGS) $(INCLUDE)\n&quot;,	objlist[i], srclist[i]);
  // Added an extra newline at the end of this line -rs
  fprintf(fp, &quot;\t$(COMPILE) $(OBJDIR)/%s $(SRCDIR)/%s $(CFLAGS) $(INCLUDE)\n\n&quot;,	objlist[i], srclist[i]);

  }
}

void write_userdef(FILE* fp)
{
fprintf(fp, &quot;################################## User Defined\n&quot;);
fprintf(fp, &quot;\n&quot;);
fprintf(fp, &quot;clean:\n&quot;);
fprintf(fp, &quot;\t@rm -f $(MAIN)\n&quot;);
fprintf(fp, &quot;\t@rm -f $(OBJ)\n&quot;);
fprintf(fp, &quot;\t@rm -f *~ */*~ */*/*~ */*/*/*~\n&quot;);
}

int write_makefile(
const char* bindir, const char* out_name, 
const char* compiler_name,	
const char* srcdir, char** srclist, char** hdrlist,
const char* objdir, char** objlist)
{
  FILE* fp = fopen(&quot;Makefile&quot;, &quot;r&quot;);
	if(fp) { system(&quot;cp -f Makefile Makefile-backup&quot;); fclose(fp); }
	fp = fopen(&quot;Makefile&quot;, &quot;w&quot;);
  if(! fp) {
		fprintf(stderr, &quot;Can't create Makefile\n&quot;);
  	return 1;
  }
  write_makehdr(fp);
  assign_outname(fp, out_name);
  assign_dirs(fp, bindir, srcdir, objdir);
  assign_compiler(fp, compiler_name);
  assign_linker(fp, compiler_name);
  assign_lists(fp, srcdir, srclist, hdrlist, objdir, objlist);
  write_rules(fp, srclist, objlist);	
  write_userdef(fp);
  fclose(fp);
}</pre>
</div>First time around we have to make it by hand.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto">mkdir -p o
g++ -c src/makefile-creator.cpp -o o/makefile-creator.o
g++ -c src/slist.cpp -o o/slist.o
g++ o/* -o makefile-creator</pre>
</div>And that's so easy you might thing we don't even need a makefile creator.<br />
<br />
Yes but... what if you add or remove files?<br />
<br />
To make a new makefile with new sources just type &quot;makefile-creator [c++] outputname&quot;.<br />
<br />
And 'make clean' and 'make'.<br />
<br />
Go ahead and build it, then let it write it's own makefile and see for yourself how easily you can write c and c++ applications with huge file sets you can split or combine as you see fit, and the makefile can super-easily keep up with your changes.<br />
<br />
Or...<br />
<br />
Want to rename the app?  'makefile-creator c++ NewName'.  That's all.  No need to change the names of any sources.<br />
<br />
Open the output Makefile in an editor and notice how the dependencies are listed.<br />
<br />
That's so if you change one source file only the associated object file will get recompiled.  It's quite fast, especially noticible in large projects.<br />
<br />
Any change to any header, on the other hand forces a full recompile of all the files as we previously mentioned in Part 1.<br />
<br />
Copyright (C) 2012, Rainbow Sally, released under GPL.<br />
<br />
No... that's not the &quot;Computer Rocket Mad Science&quot;.  We haven't gotten to that yet, but now we can write the makefile.<br />
<br />
:-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34421</guid>
		</item>
		<item>
			<title>Computer Mad Science: The Anatomy Of A Makefile Part 1</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34420</link>
			<pubDate>Sat, 28 Jan 2012 19:17:59 GMT</pubDate>
			<description><![CDATA[Features: 
*  Anatomy of a Makefile 
 
 
Requires: 
*  an editor that can produce real TABs 
*  make 
*  And bash (with a 'B')... Not DASH, the...]]></description>
			<content:encoded><![CDATA[<div>Features:<ul><li> Anatomy of a Makefile</li>
</ul><br />
Requires:<ul><li> an editor that can produce real TABs</li>
<li> make</li>
<li> And bash (with a 'B')... Not DASH, the Debian default shell, which can cause problems with some makefiles, especially on KDE sytems when trying to link <br />
libpthreads.</li>
</ul><br />
This might be interesting for even non-programmers, just to see how makefiles efficiently work through their dependencies.<br />
<br />
[If you're already up to speed on what make does, skip to Part 2 and we'll create a makefile creator that you might just find is perfect for smallish projects that you'd rather not clutter up with a bazillion unnecessary files and sluggish, redundant &quot;configure&quot; runs.]<br />
<br />
First let's create an empty makefile named Makefile.  It's just a text file.<br />
<br />
And run 'make' in that folder with the Makefile.<br />
<br />
Here's what we get.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">$&gt; make
make: *** No targets.  Stop.</pre>
</div>No big surprises there, but we see that 'make' expects some &quot;targets&quot;.<br />
<br />
Let's now add &quot;all:&quot; to the makefile and see what happens.  (Don't miss that colon after the name.)<br />
<br />
[If you get any &quot;missing separator&quot; errors in any of these things, it's almost certainly a missing colon or a missing TAB.  In the rules section, which we'll talk about in a sec, the spaces before the commands must be real TAB characters.]<br />
<br />
And...<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">$&gt; make
make: Nothing to be done for `all'.</pre>
</div>We've seen that before in 'make' builds, especially when make is descending into directories containing non-code stuff in a system of files created with &quot;automake&quot;.<br />
<br />
And again, this is not too surprising.  But we notice that apparently &quot;all:&quot; is in fact a &quot;target&quot;.<br />
<br />
Change the name of &quot;all&quot; to &quot;target&quot; (don't delete the trailing colon) and we get the same notice for the new name, though 'all' is by convention used for the first target which is the start of the 'rules' section and below this first line assignments such as we see at the top of normal makefiles are not allowed.<br />
<br />
And what we see if we look at a typical makefile is that there are tons of assignments (this equals that) and that environment variable names are enclosed in parens.  So $HOME as written in bash needs to be written $(HOME) in a makefile.<br />
<br />
Other than that all the stuff above the rules section appears to be somewhat more forgiving than bash.  For example spaces between names and &quot;=&quot; signs and we don't need to quote strings composed of several words.<br />
<br />
So there are two 'sections' in the makefiles.  The assignments section and the rules section.<br />
<br />
So now let's start assigning and creating the &quot;rules&quot; section.  And by 'rules' we mean simply that we have to perform a target's &quot;depenecies&quot; before we perform the function defined in the target's commands (if it has any).<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 130px;
		text-align: left;
		overflow: auto">
string = Im   doing something  .

all: target

target:
	echo $(string)</pre>
</div>And here's what we get.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">$&gt; make
echo Im   doing something  .
Im doing something .</pre>
</div>Notice that in addition to echoing the line it also shows the command itself. Since the string contains unusual spaces in it, we can see that anything in the assignments section of the makefile is taken literally as if in quotes.<br />
<br />
If you add the apostrophe in &quot;I'm&quot;, however, you will indeed have to put it in quotes because make also recognizes quoted string with single and double quotes.<br />
<br />
Now let's add some dependencies for our target and see what happens.<br />
<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 306px;
		text-align: left;
		overflow: auto">
string = &quot;I'm doing something!&quot;

all: target

target: dep1 dep2 dep3
	echo $(string)
	@echo &quot;That's all I can tell you right now.&quot;

dep1:
	@echo &quot;My name is 'echo'&quot;

dep2:
	@printf &quot;What are you doing? &quot;

dep3:
	@echo &quot;if you don't mind my asking.&quot;
	@echo</pre>
</div>I know you can't stand the suspense, but what that does, you'll have to find out by doing it.  :-)<br />
<br />
What do you think is going on here?<br />
  What do the &quot;@&quot; signs do?<br />
  How did 'target' know echo's name?  :-)<br />
  In what order were the various commands executed.<br />
<br />
What would happen if you re-organized that so that target's only dependency was dep3 and dep3's only dependency was dep2, and dep2's only dependency was dep1?<br />
<br />
Here's that makefile and we'll use a &quot;#&quot; comment which works the same as a bash comment in either section, to tell what we're doing for people who want to do development on this project.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 338px;
		text-align: left;
		overflow: auto">
string = &quot;I'm doing something!&quot;

all: target

target: dep3
	echo $(string)
	@echo &quot;That's all I can tell you right now.&quot;

# and let's mix 'em up a bit...

dep1:
	@echo &quot;My name is 'echo'&quot;

dep3:dep2
	@echo &quot;if you don't mind my asking.&quot;
	@echo

dep2:dep1
	@printf &quot;What are you doing? &quot;</pre>
</div>Now let's get serious.  A real makefile usually (always?) works with files.<br />
<br />
Let's write the above dialog to a file.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 450px;
		text-align: left;
		overflow: auto">
string = &quot;I'm doing something!&quot;

all: temp.txt

temp.txt: target
	@echo &quot;temp.txt has been created.&quot;

target: dep3
	echo $(string)                       &gt;&gt; temp.txt
	@echo &quot;That's all I can tell you right now.&quot; &gt;&gt; temp.txt

# and let's mix 'em up a bit...

dep1:
	@echo &quot;My name is 'echo'&quot; &gt;&gt; temp.txt

dep3:dep2
	@echo &quot;if you don't mind my asking.&quot;  &gt;&gt; temp.txt
	@echo                                 &gt;&gt; temp.txt

dep2:dep1
	@printf &quot;What are you doing? &quot;  &gt;&gt; temp.txt

# this tag/target will run when we type 'make clean'
clean:
	@rm temp.txt</pre>
</div>Type 'make' several times and take a look at temp.txt (How many times did the same text get written to the file?  Lots.)<br />
<br />
Type 'make clean' to delete the file.<br />
<br />
Now change the make file to this and run it several times and then look at temp.txt<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 274px;
		text-align: left;
		overflow: auto">
string = &quot;I'm doing something!&quot;

all: temp.txt
	@echo &quot;temp.txt has been created.&quot;

temp.txt:
	@echo &quot;My name is 'echo'&quot; &gt;&gt; temp.txt
	@printf &quot;What are you doing? &quot;  &gt;&gt; temp.txt
	@echo &quot;if you don't mind my asking.&quot;  &gt;&gt; temp.txt
	@echo                                 &gt;&gt; temp.txt
	@echo $(string)                       &gt;&gt; temp.txt
	@echo &quot;That's all I can tell you right now.&quot; &gt;&gt; temp.txt

clean:
	@rm temp.txt</pre>
</div>What do you think is going on this time?<br />
  Where did the dependecy name &quot;temp.txt&quot; come from?<br />
  [It's the file name itself.  The name could have included the path as well.]<br />
<br />
  Why didn't the make file keep writing strings into the file this time?<br />
<br />
  [Once the file existed there was nothing more that needed to be done for the <br />
  'rule' governing temp.txt.]<br />
<br />
And that's the basic anatomy of a makefile.  <br />
<br />
We'll look at how and when a file may be re-created depending on its own dependencies (other files) a bit later.  But before we sign off for this session let's try one more experiment.<br />
<br />
Keep the line with &quot;all&quot; on it but remove the &quot;echo&quot; line below that.<br />
<br />
Type 'make clean' <br />
<br />
And then 'make'<br />
<br />
No surprises there.  Okay, now what do you think will happen if you type 'make' a secondor third time after you 'make clean'?<br />
<br />
Starting to look familiar?  <br />
<br />
Any number of files can be listed on the 'all' line and any tag/target can have any number of dependecies.  If they end up recursing, make will warn you.<br />
<br />
Generally, *ALL* headers should be considered dependencies of *ANY* C/C++ file in a buildbecause changes in one header can change how a C/C++ file has to deal with other C/C++ files.<br />
<br />
The principle of conditional compilation (similar to that last experiment) will allow us to conditionally compile only sources that change unless ANY header does, in which case the only reliable way to rebuild is to rebuild the whole thing.  <br />
<br />
Conditional or 'incremental' building leads to very fast edit-compile-test cycles which is extremely nice for large projects.<br />
<br />
Are you tooled up for C/C++ yet?<br />
<br />
We might just do some Computer Rocket Mad Science soon.  The cutting edge, after all, is attached to a preferably blunt-ish handle.<br />
<br />
:-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34420</guid>
		</item>
		<item>
			<title>To boot a broken openSUSE 11.4 (also dual-linux bootloader issues)</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34419</link>
			<pubDate>Sat, 28 Jan 2012 09:31:25 GMT</pubDate>
			<description><![CDATA[*To boot a broken openSUSE system:* 
 
Use the DVD. (I am not online when I do this but it should work either way.) 
 
1. Select "install" at the...]]></description>
			<content:encoded><![CDATA[<div><b>To boot a broken openSUSE system:</b><br />
<br />
Use the DVD. (I am not online when I do this but it should work either way.)<br />
<br />
1. Select &quot;install&quot; at the main menu, then when you get to the menu,<br />
<br />
2. Select &quot;update&quot; <b>&lt;- IMPORTANT!</b> If you don't click on 'update' it will destroy your home folders at the last step.  Reboot (reset is fine here) if there's any question and run the installer again.  <br />
  <br />
Evaluating the root partition is ok.  It only reads it and mounts it.  (Don't freak out.)<br />
<br />
3. Don't select any packages. The updater should only show a couple of packages (possibly none at all) when you get to the point where it tells you it's ready to 'install' those packages.  A few packages to install is ok, even if you selected none.  They may be configs, and I think usually are in the range of about a hundred K or a bit more.<br />
<br />
You can stop the process at any point before the actual installation begins to verify that YOU have control.  Proceed at a pace you're comfortable with.  Confidence comes slowly, and sometimes at great pain.  But when the choices are between losing everything and a chance to get it back, the element of &quot;fear&quot; diminishes significantly.<br />
<br />
ENJOY! :-)  <br />
<br />
[And I think you will.  This has only failed on me once that I recall.  I accidentlly hit the wrong key and fsck-ed a mounted root partition.  Woops.]<br />
<br />
----------------------------<br />
<b>For dual linux users:</b><br />
<br />
If you have an older linux installed along with your newer openSUSE do NOT use the update trick above if it wipes out your old bootloader unless you've saved significantly more than 512 bytes of mbr.  (More on this below).<br />
<br />
How can you tell if it will clobber your other linux?  If the old linux saves 512 bytes or less of the mbr data, openSUSE 11.X (and almost certainly 12.x) will clobber it if it ever installs the bootloader twice.  The second time it writes the bootloader will be fatal to the older linux.  (Other distros have the same problem -- I wish they would be as nice to linux as they are to Windows.)<br />
<br />
You may need a rescue CD to get back into your older linux and you probably want to make a copy of 17 or 18 sectors of /dev/sda at a point in time when both linuxes are bootable.  Your guess as to the correct number of sectors is as good as mine.<br />
<br />
See this file: /var/log/YaST2/y2log_bootloader<br />
<br />
17?  18?  Place your bets.  The older bootloaders use &quot;1&quot;, and &quot;1+17&quot; (see the file) = 18, so I have placed my bet on 18.<br />
<br />
I use this script to load and run my mbr save/restore functions.  No guarantees it will work on any other system.  I won't even guarantee it will work on other openSUSE 11.4 which is what I have.<br />
<br />
file: mbrfun.sub<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 354px;
		text-align: left;
		overflow: auto"># type 'source mbrfun.sub' to load
function mbr_backup # mbr_file
{
  dd of=$1 if=/dev/sda count=1
}

function mbr_write # mbr_file
{
  dd if=$1 of=/dev/sda count=1
}

function mbr_help
{
echo &quot;
  Commands:
    mbr_backup # to_filename
    mbr_write  # from_filename
 &quot;
}

mbr_help # show now</pre>
</div>I keep this in my /boot folder of my older linux which I can boot by way of... the old suse 10.0 &quot;boot installed system&quot; button in the installation DVD.  (A rescue CD also works.)<br />
<br />
This is a desperate measure for desperate times.  Works for me.  That's all I can assure you of.  If you need it, good luck.  Let us know what you did and how it worked out for you.<br />
<br />
----------------------------<br />
<b>For any openSUSE user:</b><br />
<br />
Remember when?<br />
<br />
Why did they remove the button to just &quot;boot installed system&quot;?<br />
<br />
Oh, I know.  I've heard it many times. &quot;Normal&quot; or &quot;most&quot; users don't need that, and &quot;normal&quot; or <br />
&quot;most&quot; users don't DO that.<br />
<br />
Of course not!<br />
<a href="http://rainbowsally.net/rainbow/poli/images/madsci.png" target="_blank">http://rainbowsally.net/rainbow/poli/images/madsci.png</a><br />
<br />
And where are we Linux folk on the bell curve?  Don't you know that &quot;most users&quot; use Windows?<br />
<br />
PS. to boot other broken linuxes, a utility like ubcd &quot;ultimate boot CD&quot; with super grub2 can locate all bootable partitions and even boot into iso images.<br />
<br />
There are other rescue cd's around but I haven't tried 'em.  I have tried ubcd, though.<br />
<br />
Thank you for the blog LQ.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34419</guid>
		</item>
		<item>
			<title><![CDATA[KDE Utils: new.exec, shell-exec (for ENTER &amp; click on executables)]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34418</link>
			<pubDate>Sat, 28 Jan 2012 09:08:41 GMT</pubDate>
			<description><![CDATA[[This post includes some test data showing what's wrong in KDE and a peek into the configuration files for various file types.] 
 
Let's start with a...]]></description>
			<content:encoded><![CDATA[<div>[This post includes some test data showing what's wrong in KDE and a peek into the configuration files for various file types.]<br />
<br />
Let's start with a program that writes programs.  This is 'new.exec'.<br />
<br />
file: new.exec (executable)<br />
purpose: create a skeleton of a clickable shell program with an 'exec' extension.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 290px;
		text-align: left;
		overflow: auto">#!/bin/sh
# creates a new exec file named $1.exec that does $2

name_exec=&quot;$1.exec&quot;
cd_here='cd `dirname &quot;$0&quot;`'
shift
cmd=&quot;$@&quot;

echo '#!/bin/sh' &gt; $name_exec
echo &quot;$cd_here&quot; &gt;&gt; $name_exec
echo &quot;printf \&quot;\&quot; &gt;.msg&quot; &gt;&gt; $name_exec
echo &quot;$cmd 2&gt;&gt;.msg&quot; &gt;&gt; $name_exec
echo &quot;echo 'done.' &gt;&gt; .msg&quot; &gt;&gt; $name_exec
echo &quot;kdialog --msgbox \&quot;\$(&lt;.msg)\&quot;&quot; &gt;&gt; $name_exec
echo &quot;rm -f .msg&quot; &gt;&gt; $name_exec

chmod +x $name_exec</pre>
</div>Temporarily install it right where you are (see 'new.symlink' in previous KDE Utils) and to test it, type <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">new.exec test</pre>
</div>[That's an incorrect usage, but legal and adequate for a quick test.]<br />
<br />
It should create a program named test.exec.<br />
<br />
Click on test.exec and see if it does anything as-is.  If not, that is; if it opens in a text editor or tries to play in amarok (which hasn't happened on my system yet but I've seen others posting some pretty strange effects like opening binary executables as image files...) or something like that?  Then it's not working.  <br />
<br />
Also try highlighting it and press ENTER.  It should still run correctly.<br />
<br />
Open it with a text editor (on purpose) and see what it should do.<br />
<br />
When it runs, if it shows the &quot;done&quot; message, delete test.exec and you're alread good to go.  You can install it per other &quot;new.*&quot; functions and it will show in 'new.listall' with the others, if you want this utility.<br />
<br />
Alas.  It did NOT work on my KDE and it may not work on yours.  But all is not lost, my fellow Computer Mad Scientists.<br />
<br />
*** WARNING: EXPERIMENTAL.  You may want to test this on a throw-away user before using this procedure.  [On Kubuntu the process is similar but some extra steps may be required to get PATH and LD_LIBRARY_PATH full benefits of this feature.]<br />
<br />
The first programable half of the openSUSE (and other?) solution is this.<br />
  <br />
file: shell-exec (executable)<br />
purpose: iron out mime-type handling inconsistencies in newer KDE<br />
versions.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 226px;
		text-align: left;
		overflow: auto">#!/bin/sh
msg=&quot;
  PWD=  $PWD
  PATH= $PATH
  FILE= $1
  LD_LIBRARY_PATH = $LD_LIBRARY_PATH
 &quot;
kdialog -msgbox &quot;$msg&quot;

# Add code as req'd here, for example,
cd `dirname &quot;$0&quot;` # to go to the directory where the file was clicked on
&quot;$1&quot; 
# the line above runs the program. spaces in path = OK.</pre>
</div><i>Additional filtering and testing of file types and extenstions is up to you.  All we do here is unbreak old code and restore functionality lost in newer KDE systems.</i><br />
<br />
Leave the test code in it so you can tell when it's running and when it's not.  Also the diagnostics may give you some clues as to what's getting messed up if even this doesn't work for your system.<br />
<br />
Now if you haven't backed up your HOME/.kde4/share folder yet.  Do it now just for good measure (it's not affected by this experiment).  And there's another folder you might want to back up too.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">HOME/.local/share/applications</pre>
</div>Got browse yet?  Let's go take a look.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">browse ~/.local/share/applications</pre>
</div>You may see several *.deskop files, some of which may appear to be duplicates, some you may not want, etc.  Before you delete anything, though, let's look at the master file that uses these desktop files.<br />
<br />
Open <b>mimeapps.list</b> with a text editor.<br />
<br />
See anything you wanted to get rid of but couldn't?  You can do it there.  Also remove the named desktop files you may want to remove from your file associations but couldn't find to delete when we use filet association menus, and (at least on my system) the changes will take effect immediately.<br />
<br />
But take a look at a desktop file in an editor and see how they are written.<br />
<br />
Our problem with KDE is in regard to two types of files which are these:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">application/x-shellscript
application/x-executable</pre>
</div>And two methods of opening them which are these:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">Mouse click
ENTER key</pre>
</div>In your systemsettings (from the commandline or from the main menu it may be called &quot;Configure Desktop&quot; or &quot;Personal Settings&quot;) find type 'x-executable'.  It's in the &quot;applications&quot; node.<br />
<br />
Don't set a filename pattern for x-executable.  That entry field is probably clear already, but if it's not, remove the pattern string but add our new &quot;shell-exec&quot; as the application to open this type with in 'application preference'.<br />
<br />
Apply and close the settings manager.<br />
<br />
If you did this with a new user, the 'applications' folder under HOME/.local/share now exists and the shell-exec.destkip file and mimeapps.list files are in there.<br />
<br />
At this point, if your PATH and LD_LIBRARY_PATH are set in your HOME/.bashrc file even binary executables linked to libraries in your HOME folder should run.  (This is important for developers and testers.) If not set at least your path and logout and back in to make sure it's set at login time.<br />
<br />
Notice that executables now run with shell-exec when you highlight them and press ENTER, but they run when clicked by some other means.  We can tell because of the test code in shell-exec.  Also, for kubuntu, to run the executables you may need to right-click and select 'shell-exec' to open the binary with it.  I have not gotten it to work as the default in kubuntu yet.<br />
<br />
You can skip this 'testing' section if you like.  I just did it to PROVE that something is screwy here.<br />
<font color="Blue"><br />
[Note. your results may differ from mine below because... well...  KDE is haunted.  Didn't you know that?  Different things happen if stuff is set up in different orders, but the final setup, whether done automatically or by hand will finally get KDE to work as is should, as it used to, in a predictable user-controllable manner.]<br />
<br />
The important data here is.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 194px;
		text-align: left;
		overflow: auto">binaries | open with
  click [unknown]
  ENTER [shell-exec]

Repeat the test with test.exec (dolphin)
  click [unknown]
  ENTER [shell-exec]

Repeat the test with test.exec (konqueror) 
  click [unknown]
  ENTER [kwrite]</pre>
</div>This tells us that before we set up an association for shell scripts they DO run even before we explicitly set up an association to run them, at least when they are clicked.<br />
<br />
But what about the x-shellscript types?<br />
<br />
Will they run (behind our backs) by either method?  Copy test.exex to test.sh and it now matches the pattern for x-shellscript type in the file association menu.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 130px;
		text-align: left;
		overflow: auto">Repeat the test with test.sh (dolphin)
  click [unknown]
  ENTER [shell-exec]

Repeat the test with test.sh (konqueror)
  click [unknown]
  ENTER [kwrite]</pre>
</div>Here's what we have then.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 114px;
		text-align: left;
		overflow: auto">
        |  clicked  |   ENTER key (dolphin/konqueror)
          ----------------------
*.exec  |  GHOSTS?  |   shell-exec / kwrite
*.sh    |  GHOSTS?  |   shell-exec / kwrite
binary  |  GHOSTS?  |   shell-exec / (untested*)</pre>
</div>[A member of Linux Questions recently wrote about a problem he had which at one point included a problem like his binaries opening as image files.  Do you believe it? I sure do!]<br />
<br />
Using the linux xdg-mime program we can see what the system (? which system ?) thinks each file type is by using<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">xdg-mime query filetype &lt;filename&gt;</pre>
</div>It says my shell-exec program is: application/x-shellscript as are other *.sh files<br />
It says my test.exec program is: application/x-shellscript<br />
It says my find-deps program is: application/x-executable<br />
<br />
All of the above are correct.  So then what's wrong with KDE?<br />
<br />
-------------<br />
<br />
In order to get konqueror and dolphin in step we will also need to add shell-exec to open mime type x-shellscript (if it wasn't added automatically -- don't ask me, I just work here) Add it to the file associations list for type x-shellscript.<br />
<br />
Now everythiing is in sync between dolphin and konqueror, between click and ENTER, and between kde and kde.<br />
<br />
:-)<br />
</font><br />
If test.exec works now, you can remove it and also test.sh and install new.exec in your HOME/bin/src/misc pile with the other micro programs in there or wherever you keep your shell program sources.  And don't forget to 'new.symlink' it for it's new location.<br />
<br />
Same with the 'shell-exec' utility.  Remove the test code from the body of the script or add filters to prohibit certain file extensions from running (which may be what KDE was trying to do) when you're done playing with it.  <br />
<br />
The command 'edit ~/bin/shell-exec' should get you there no matter where you installed the program itself.  <br />
<br />
Or not.  It's up to you but these things are very easy to uninstall and do not require any special privileges to install/uninstall.  In fact we don't WANT special privileges here.  These are our own private 'executable' snippets collections.<br />
<br />
See previous KDE Utils posts for how and why we install/uninstall this way and to get a few gizmos you might find interesting.<br />
<br />
:-)<br />
<blockquote>If you think I should be writing to KDE about this, I don't agree to their privacy policy regarding my mailbox address but feel free to forward it to anyone you like. Furthermore, I don't think a bug report on this stuff should even be necessary.  Isn't anyone that's developing this stuff using the systems they are developing?  Many of these problems aren't exactly subtle.<br />
</blockquote>Note: I repeated the above for a brand new user.  Here are the files generated.<br />
<br />
file:HOME/.local/share/applications/mimeapps.list<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">[Added Associations]
application/x-executable=shell-exec.desktop;</pre>
</div>file: HOME/.local/share/applications/shell-exec.desktop<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 114px;
		text-align: left;
		overflow: auto">[Desktop Entry]
Exec=shell-exec
MimeType=application/x-executable;
Name=shell-exec
NoDisplay=true
Type=Application</pre>
</div>I did NOT set the file association for x-shellscript but those run properly for a brand new user while they did not run properly until the association was set manually for my old user.<br />
<br />
This is just plain screwy.<br />
<br />
But we're all Computer Mad Scientists around here, right?  So all's well that ends well.<br />
<br />
:-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34418</guid>
		</item>
		<item>
			<title>Simple C: Beyond Bash Part 2 - Dependency lister for dir branch (recursive)</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34417</link>
			<pubDate>Fri, 27 Jan 2012 12:09:18 GMT</pubDate>
			<description>Simple C: Beyond Bash Part 2 - Dependency lister for dir branch (recursive) 
 
Features: 
*  Read a pipe (uses slist functions from Part 1). 
* ...</description>
			<content:encoded><![CDATA[<div>Simple C: Beyond Bash Part 2 - Dependency lister for dir branch (recursive)<br />
<br />
Features:<ul><li> Read a pipe (uses slist functions from Part 1).</li>
<li> Commandline switch reordering (non-destructive).</li>
<li> Non-regex parsing &amp; translating in do{...}while(0) AND block (see 'elfpaths_only') ,</li>
<li> Unsorted 'uniq' example in C</li>
<li> -- A tool to read dependencies from all elf executables and libraries in a directory branch.</li>
<li> -- Can be used to check make-based[tm] :-) installations or rpm and deb packages before packing up.</li>
</ul>Build Requires:<ul><li> bash</li>
<li> make</li>
<li> g++</li>
</ul>Run Requires:<ul><li> ldd</li>
<li> find</li>
</ul>This is interesting, because I discovered that we can't run ldd in a pipe to read /usr/lib or /usr/bin (openSUSE 11.4).  Possibly due to security settings.  Try it with the --info flag.  It CAN, however read files in directories below /usr/lib (such as /usr/lib/dri on my system).<br />
<br />
Seems to work great when used &quot;normally&quot; (to read binary trees in package folders), and it's pretty fast.  Here's part of a dump of my /bin deps.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 162px;
		text-align: left;
		overflow: auto">[list of 45 unique deps deleted -rs]
---------------------------------------------------
binaries found : 125
ldd pipe errors: 0
external deps  : 45
---------------------------------------------------
real    0m1.667s -- less than two seconds (cmd: 'time find-deps /bin -i')
user    0m0.727s
sys     0m0.778s</pre>
</div>The &quot;external deps&quot; listed are libs loaded at run time that are not resolved in or below the prefix branch (i.e., /bin in this case).<br />
<br />
I have installed the code and executable in my sandbox so it's linked into my path and is easy to edit.  (see early blog entries re. new.symlink, etc.).  And I gave the folder a version number so I can easily see which one is current if this needs any changes later.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto">HOME
 \-- bin
      \-- src
           \-- find-deps-1.0 [everything goes here]</pre>
</div>The slib.cpp and slib.h files are in Part 1.  Put those in the same folder with the new ones. Don't worry, the compiler will tell you which are missing if you forget.  :-)<br />
<br />
There are three new files (five total).  Here's what's new.<ul><li> version.h       - version and changelog in one</li>
<li> usage_str.dat   - easier to edit a text file, this is the output, the non-C type file extension avoids potential linker errors with tools such as AutoBake (makefile creator).</li>
<li> find-deps.cpp   - the program</li>
</ul><br />
file: version.h<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">// initial app created
#define VERSION &quot;1.0&quot;</pre>
</div>file: usage_str.dat<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">/* usage.txt converted with txt2cstr */
const char* usage_str =
    &quot;\n&quot;
    &quot;Usage: find-deps &lt;branch&gt;\n&quot;
    &quot;\n&quot;
    &quot;  Primary usage is for discovering files needed by a binary package before\n&quot;
    &quot;  installation/building, etc.\n&quot;
    &quot;\n&quot;
    &quot;  Prints out a list of all libs used by executable files and libs \n&quot;
    &quot;  found in the directory &lt;branch&gt; (recursive). \n&quot;
    &quot;\n&quot;
    &quot;  Does not list files that are resolved by other files in the same \n&quot;
    &quot;  branch.\n&quot;
    &quot;\n&quot;
    &quot;  Does not look in any other branches for resolvers.\n&quot;
    &quot;\n&quot;
    &quot;Switches:\n&quot;
    &quot;  -i | --info         display info about files found\n&quot;
    &quot;  -v | --version      show version\n&quot;
    &quot;\n&quot;
    &quot;Notes: \n&quot;
    &quot;\n&quot;
    &quot;  1. Needs linux tools 'find' and 'ldd' to run.\n&quot;
    &quot;\n&quot;
    &quot;  2. If a symlink points to a non-existent file (as encountered in \n&quot;
    &quot;  development packages) this will be still be counted as a self-resolved \n&quot;
    &quot;  dependency.\n&quot;
    &quot;\n&quot;
    &quot;  3. The error message \&quot;No elf binaries found\&quot; sent to stderr could mean\n&quot;
    &quot;  that there really aren't any or just that the path doesn't exist.\n&quot;
    &quot;\n&quot;
    &quot;  4. May not work for system dirs (e.g. /usr/bin, /usr/lib, /lib) due to \n&quot;
    &quot;  ldd quirks but we can get 'info' on the number of elf files.\n&quot;
    &quot;\n&quot;
    ;</pre>
</div><br />
file: find-deps.cpp<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// find-deps.cpp

// shotgun load some commonly used headers
#include &lt;stdio.h&gt;    // printf, sprintf, etc.
#include &lt;stdlib.h&gt;   // exit()
#include &lt;unistd.h&gt;   // tons of stuff
#include &lt;malloc.h&gt;   // memory allocation
#include &lt;string.h&gt;   // strings and block comparisons and moves

// our own includes
#include &quot;slist.h&quot;
#include &quot;version.h&quot;

void dbg(){}          // a breakpoint for kdbg/gdb

//////////////////////////////////////////////////////
// prototypes section

// saved current directory path
extern char* HERE;

// true if we want to know how many files were processed
extern int infoflg;

// number of pipe to ldd errors
extern int ldderrs;

// name of currently running app
extern char* appname;

// reorder args so switches precede args and return
// # of switches.
int reorder_args(int argc, char** argv);

// find and store names of elf executables in elflist,
// returns 0 on success
int find_elf(char*** pelflist, const char* prefix);

// find and store dependency libs in depslist, not including files
// in elflist, returns 0 on success
int find_deps(char*** depslist, const char* prefix, char** elflist);

// process recognized switches and return errcode if bad switch
// value.
int handle_switches(int n, char** argv);

// usage note
int usage(int errcode);

//////////////////////////////////////////////////////
// the program

// saved current directory path
char* HERE;

// true if we want to know how many files were processed
int infoflg = 0;

// number of pipe to ldd errors
int ldderrs = 0;

// name of currently running app
char* appname;

int main(int argc, char** argv)
{
  dbg();
  
  appname = basename(argv[0]);
  
  int err = 0;
  char** elflist = slist_new();
  char** depslist = slist_new();  
  int offset = 0; // increases for each commandline switch
  
  // syntax checks, should return usage(1) if argc &lt; 2, but... whatever :-)
  if((argc &lt; 2) || (strcmp(argv[1], &quot;--help&quot;) == 0))
    return usage(0);
      
  // switches
  offset = reorder_args(argc, argv);
  err = handle_switches(offset, argv);
  if(err)
    return err;
  
  // setup
  const char* prefix = argv[1 + offset];
  HERE = getenv(&quot;PWD&quot;);
  
  // get list of all elf executables in prefix dir
  err = find_elf(&amp;elflist, prefix);
  
  int num_elf = slist_count(elflist);

  if(num_elf == 0)
  {
    fprintf(stderr, &quot;No elf binaries found.\n&quot;);
    return 1;
  }
  
  // get list of deps in all elf files that are not in the
  // list already in the prefix dir
  err = find_deps(&amp;depslist, prefix, elflist);
  
  int num_deps = slist_count(depslist);

  for(int i = 0; i &lt; slist_count(depslist); i++)
    printf(&quot;%s\n&quot;, depslist[i]);
  
  if(infoflg)
  {
    const char* hline =
       &quot;---------------------------------------------------&quot;;
    printf(&quot;%s\n&quot;, hline);
    printf(&quot;binaries found : %d\n&quot;
           &quot;ldd pipe errors: %d\n&quot;
           &quot;external deps  : %d\n&quot;,
           num_elf, ldderrs, num_deps);
    printf(&quot;%s\n&quot;, hline);
  }
  
  // cleanup and return
  slist_delete(depslist);
  slist_delete(elflist);
  return 0;
}

//////////////////////////////////////////////////////
// the library of functions and various utils

// utils - misc

// returns true (1) if filename is an elf file
int is_elf(const char* fname)
{
  FILE* fp = fopen(fname, &quot;r&quot;);
  if(! fp) return 0; // error, file not found
  
  // read the first few bytes of the file and look for the
  // signature of a valid elf binary.
  char buf[8] = {0};
  fread(buf, 1, 4, fp);
  if(memcmp(buf, &quot;\177ELF&quot;, 4) == 0)
    return 1; // true
  return 0;   // false
}

int reorder_args(int argc, char** argv)
{
  // make literal copy of argv list in temporary list
  char** tmp_args = (char**)malloc(argc * sizeof(char**));
  memcpy(tmp_args, argv, argc * sizeof(char**));
  
  int cnt = 1; // current copy back number, app path is at [0] (no change)
  int nswitches = 0; // the value to return
  
  // copy switches (anything starting with '-') back first
  for(int i = 1; i &lt; argc; i++)
    if(tmp_args[i][0] == '-')
      argv[cnt++] = tmp_args[i];
  
  nswitches = cnt - 1; // number of actual switches
  
  // copy non-switches back next
  for(int i = 1; i &lt; argc; i++)
    if(tmp_args[i][0] != '-')
      argv[cnt++] = tmp_args[i];
  
  free(tmp_args);
  return nswitches;
}

/////////////////////////////////////////////////////////

// find and store names of elf executables in elflist,
// returns 0 on success
int find_elf(char*** pelflist, const char* prefix)
{  
  // init the flag and the list which is an array of 
  // pointers terminated by a zero and save current
  // directory so we can always return to it.
  int err = 0;
  char pipcmd[512];
  char** elflist = *pelflist; /// remove after test
  char** tmp = slist_new();

  // Create a non-looping do-while block we can leave 
  // at the first error.  Functionally equivalent to a 
  // string of ORs using err as the flag.
  do
  {  
    char pipecmd[512];
    err = chdir(prefix);
    if(err) break;
  
    // get complete list of all executables, then
    // remove those not elf type.
    sprintf(pipecmd, &quot;find * -executable&quot;);
    err = slist_readPipe(&amp;elflist, pipecmd);
    if(err)
    {
      slist_clear(elflist);
      break;
    }
    
    // remove non-elf files
    for(int i = 0; i &lt; slist_count(elflist); i++)
    {
      if(is_elf(elflist[i]))
        slist_append(&amp;tmp, elflist[i]);
    }
  }while(0);
  if(err) return err;
  
  // elflist = tmp;
  slist_delete(elflist);
  //elflist = tmp-&gt;list();
  elflist = tmp;
  *pelflist = elflist;
  // delete tmp;
  chdir(HERE);
  return 0;
}

void elfpaths_only(char*** plist)
{
  int state = 0;
  char** list = *plist;
  char** tmp = slist_new();
  
  for(int i = 0; i &lt; slist_count(list); i++)
  {
    // THANK YOU :-) to the svanah non-gnu BNF project for this trick
    char buf[256];
    sprintf(buf, list[i]);
    char* ip = buf, *op = buf;
    do
    {
      // skip whitespaces
      while(*ip &lt;= ' ')
        ip++;
      
      // don't want blank lines
      if(!*ip)
        break;
      
      // want lines starting with slash
      if(*ip == '/')
        break;
      
      // don't want lines not pointing to lib path
      ip = strstr(ip, &quot; =&gt; &quot;);
      if(!ip)
        break;
      
      ip += 4; // move to file path, should start with '/'
      
      // don't want lines not having a lib path
      if(*ip != '/')
        break;
      
      // MATCHED - now copy to first non text and terminate string
      while(*ip &gt; ' ')
        *op++ = *ip++;
      *op = 0;
      
      state = 1; // signale that we got one
    }while(0);
      
    if(state)
      slist_append(&amp;tmp, buf);
  }
  
  // save new result and return
  slist_delete(list);
  *plist = tmp;
}

// find and store dependency libs in depslist, not including files
// in elflist, returns 0 on success
int find_deps(char*** pdepslist, const char* prefix, char** elflist)
{
  // init
  char** depslist = *pdepslist;
  int err = 0;
  char pipecmd[512];
  
  err = chdir(prefix);
  if(err) return 1;
  
  int len = slist_count(elflist);
  for(int i = 0; i &lt; len; i++)
  {
    // get list of ldd libs loaded by each elf file and add
    // to the depslist, temporarily before removing dups.
    
    char** sublist = slist_new();
    
    sprintf(pipecmd, &quot;/usr/bin/ldd %s&quot;, elflist[i]);
    err = slist_readPipe(&amp;sublist, pipecmd);
    
    // count ldd errors
    if(err)
      ldderrs++;
    
    elfpaths_only(&amp;sublist);
    
    // &quot;you will be assimilated&quot; said depslist to sublist....
    slist_addList(&amp;depslist, sublist);
    slist_delete(sublist);
  }while(0);
  
  int ip;
  int op;
  
  // remove duplicates if any items to copy
  ip = 0;  
  for(ip = 0; ip &lt; slist_count(depslist); ip++)
  {
    op = ip + 1;
    while(op &lt; slist_count(depslist))
    {
      // shrink list or advance pointer...
      if(strcmp(depslist[op], depslist[ip]) == 0)
        slist_remove(&amp;depslist, op);
      else
        op++;
    }
  }
  
  // remove self-resolved and hope the paths are right 
  // after installation because we won't (can't) check them at
  // this point without setting LD_LIBRARY_PATH and that can 
  // be as error prone as this, so... here we go.  If it 
  // exists at all in our branch, we count is as 'resolved'.
  for(int elf = 0; elf &lt; slist_count(elflist); elf++)
  {
    char* elffile = basename(elflist[elf]);
    for(int dep = 0; dep &lt; slist_count(depslist); dep++)
    {
      char* depfile = basename(depslist[dep]);
      if(strcmp(elffile, depfile) == 0)
        slist_remove(&amp;depslist, dep);
    }
  }

  *pdepslist = depslist;
  chdir(HERE);
  return 0;
}

int usage(int errcode)
{
#include &quot;usage_str.dat&quot;
  printf(usage_str); 
  return errcode;
}

// process recognized switches and return errcode if bad switch
// value.
int handle_switches(int n, char** argv)
{
  n++; // don't count argv[0] (app path)
  
  // we already know the first char is a '-' so we look for
  // substrings common to both long and short switches.
  
  for(int i = 1; i &lt; n; i++)
  {
    // -v or --version
    if(strstr(argv[i], &quot;-v&quot;))
    {
      printf(&quot;%s version %s\n&quot;, appname, VERSION);
      exit(0);
    }
    
    // -i or --info
    else if(strstr(argv[i], &quot;-i&quot;))
      infoflg = 1;
    
    else
    {
      fprintf(stderr, &quot;Unrecognized switch %s\n&quot;, argv[i]);
      return 1; // not a valid switch
    }
  }
  return 0; // ok
}

// if you must, here's a way to do this without linking explicitly. :-)
// #include &quot;slist.cpp&quot; // uncomment this line.
// COMPILE: g++ find-deps.cpp -o find-deps</pre>
</div>Compile as you did with the toy at the bottom of Part 1, or if you like we can cheat and simply <div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">#include &quot;slist.cpp&quot;</pre>
</div> in the deps-list.cpp file itself.  This trick works sometimes.  And it will this time.  <br />
<br />
But after this, having a bit of a taste of what's possible with C/C++, you might want to tool up and do it for real with <ol style="list-style-type: decimal"><li> a good debugger. I HIGHLY recommend kdbg version 5.0 or greater. (insight genre.)</li>
<li> a decent programming editor.  With macro keys if you can get em.  kdevelop3 is my pick.  (Haven't tried Jen's programming editor with Wine yet -- that's also a good one.)</li>
<li> and a way to create your own makefiles if you don't like the default.  I like AutoBake.</li>
</ol>That's so you don't have to live with anyone else's bad idea.<br />
<br />
And here's my own bad idea if you want to check it out.  It's easy to edit the templates, but I should have done that myself.  &quot;autobake new c-32&quot; is ok out-of-box tho.<br />
<br />
<a href="http://rainbowsally.net/tkf/ftl/AutoBake3.1-Personal-2011-12-29.tar.gz" target="_blank">http://rainbowsally.net/tkf/ftl/Auto...1-12-29.tar.gz</a><br />
<br />
Also needs a type lister like 'new.image' has and some other improvements/reorganizations.  It's easier to delete stuff than write stuff though, so this is on the back burner as far as my own needs are concerned.<br />
<br />
But that's one bad idea.  And it may give you some bad ideas of your own!<br />
<br />
:-)<br />
<br />
Now we have find-deps.<br />
<br />
We'll put it to good use a bit later, if all continues to go well here in blog-land.<br />
<br />
Some more interesting stuff you can do once you've got a way to compile this and run it.<ul><li> Compile the app and run 'strip find-deps' and check the file size after it's stripped.  Compare to the -s switch (sent to the linker).</li>
<li> Add the -g3 switch to the compile and run in a good debugger.  Find where the ldd pipe errors come from when checking /usr/lib if your system does the same thing as mine.  (Same whether you chdir to the folder or not.  You'll see what I mean.)</li>
<li> Create a TREE folder containing the directory image of an installation you might want to generate.  Probably in TREE/usr/local, for a somewhat safe place if you decide to actually install it later.  And 'find-deps TREE'. :-) </li>
</ul></div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34417</guid>
		</item>
		<item>
			<title>samba</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34416</link>
			<pubDate>Fri, 27 Jan 2012 08:10:33 GMT</pubDate>
			<description><![CDATA[Hi friends, 
 
i am using centos-5 for samba server. also i have created 3 samba user's for folder access 
i.e: 
user1 
user2 
user3 
 
folder path...]]></description>
			<content:encoded><![CDATA[<div>Hi friends,<br />
<br />
i am using centos-5 for samba server. also i have created 3 samba user's for folder access<br />
i.e:<br />
user1<br />
user2<br />
user3<br />
<br />
folder path<br />
path= /data<br />
<br />
now i want to view the /data folder <font color="Red">only for user1</font>. i tried many ways but it's not work.<br />
<br />
if you know, please give the solution for this same.</div>

]]></content:encoded>
			<dc:creator>unibox</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34416</guid>
		</item>
		<item>
			<title>Download of Centos DVD1 6.2 getting header error.</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34415</link>
			<pubDate>Thu, 26 Jan 2012 21:44:35 GMT</pubDate>
			<description>I am unable to download the Centos 6.2 DVD1 isos disk from any of the Centos Mirrors. I get a header error when I try to download to my hardrive. Any...</description>
			<content:encoded><![CDATA[<div>I am unable to download the Centos 6.2 DVD1 isos disk from any of the Centos Mirrors. I get a header error when I try to download to my hardrive. Any ideas ?</div>

]]></content:encoded>
			<dc:creator>cdrolet</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34415</guid>
		</item>
		<item>
			<title>Errata in Beyond Bash Part 1</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34414</link>
			<pubDate>Thu, 26 Jan 2012 16:32:53 GMT</pubDate>
			<description>I noticed we got a few hits since I posted so... 
 
Errata in Beyond Bash Part 1. 
 
Add near the end of function list_readPipe() in file slist.cpp 
...</description>
			<content:encoded><![CDATA[<div>I noticed we got a few hits since I posted so...<br />
<br />
Errata in Beyond Bash Part 1.<br />
<br />
Add near the end of function list_readPipe() in file slist.cpp<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 98px;
		text-align: left;
		overflow: auto">  // save the result and return ok
  free(buf);  // ADD THIS LINE
  *plist = list;
  return 0;
}</pre>
</div>I changed from a buffer on the stack and fgets() to a malloc-ed buffer and getline() for y'all and I forgot to free the buffer at the end.<br />
<br />
That's the only change, in case you already copped the file.  <br />
<br />
Will update the original post.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34414</guid>
		</item>
		<item>
			<title>Simple C: Beyond Bash Part 1 - String lists and pipes</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34413</link>
			<pubDate>Thu, 26 Jan 2012 14:03:24 GMT</pubDate>
			<description><![CDATA[Simple C: Beyond Bash Part 1 - String lists and pipes 
 
CHANGELOG: 
* Jan 26, 2012 - Added "free(buf)" in list_readPipe() 
 
 
Features: 
*  Simple...]]></description>
			<content:encoded><![CDATA[<div>Simple C: Beyond Bash Part 1 - String lists and pipes<br />
<br />
CHANGELOG:<br />
* Jan 26, 2012 - Added &quot;free(buf)&quot; in list_readPipe()<br />
<br />
<br />
Features:<ul><li> Simple sting list functions</li>
<li> Including a way to read and write lists to and from files</li>
<li> Using the increased type safety of C++ to avoid subtle errors, at least for the first cut.</li>
<li> Linking object files.</li>
<li> An application that can look up all dependencies in all files in a directory, for use with our make-based system, etc. (in part 2)</li>
</ul><br />
One of the main coolnesses of that crazy 'bash' interpreter is the way it works with &quot;pipes&quot;.  <br />
<br />
You thought I was going to say &quot;args lists&quot; or &quot;lists of strings&quot;?  Heck NO!  Bash is <b>horrible</b> for working with strings.  I don't care what they say about [R]TFM, making sense of bash is at times like making sense of nonsense, and so it's no wonder there are so many other programs like perl, tcl, python, etc., getting into the picture.<br />
<br />
But C.  That's where WE have the control, and almost as much freedom as assembler (and in fact even that if we need it).  And if you think you need a simplified syntax, or relaxed type safety, &quot;Go macros, young man, go macros.&quot;  There are some examples in the recent &quot;asm&quot; blog entry and more in the first &quot;simple c&quot; entry to show the kind of things that are possible.<br />
<br />
With a good debugger (kdbg is dynamite) and an [R]TFM that makes sense (again I say, bookmark the alphabetical list in &quot;Functions and Macros&quot; section of the libc docs), and once you get past the seemingly wild spew of error messages you will encounter as a newbie (they are cumulative, the first will trigger others so they do clear up as quickly as they appear), you may just find that the best thing about bash is that it can run C apps.  :-)<br />
<br />
Don't get me wrong.  Bash is good for what it's good for, BUT.  That's where it ends.<br />
<br />
So...<br />
<br />
There two main things we need in order to get some real power with lists (such as args lists and piped strings).  And that's what we will throw together today.  This will be a two part post.  The first part is the lists, a bit of compiling and linking, the second part is an application that may be useful for other things, but certainly useful for make-based install/uninstall functions, which can indeed work with other packages (rpm and deb) to do a much safer first run -- because it can roll back in case of an error or a dangerous overwrite. (see previous &quot;make-base&quot; posts).<br />
<br />
<i>A couple of notes here.  Skip this if you just want to get to the goodies.<br />
<br />
And while you're contemplating the warnings about the make-based setup, consider the fact that rpm and deb do not even warn you.  <br />
<br />
Ever got your entire kde and x11 wiped out by installing an file using apt-get or muon?  Well... I have.  <br />
<br />
Ever wondered how libffi45 got to be 60 megs instead of 280 K?  <br />
<br />
Who's checking up on those folks (openSUSE)?<br />
<br />
How about &quot;checkinstall&quot;.  What happens if it crashes you.  How are you supposed to use the alleged &quot;backup file&quot;?  (openSUSE and others.)<br />
<br />
So be forewarned.  It's nice to at least know what you're getting into.</i>  :-)<i><br />
<br />
<b>ALSO</b><br />
<br />
I'm using kdevelop3 (retro) and it just freakin' smokes.  <br />
<br />
kdevelop4 on the other hand is a shockingly unrestrained resource/disk hog, and apparently an amalgam of development philosophy paradoxes.  Got rid of regex and added VI mode?  OUCH!  Lot's of sense that makes.<br />
<br />
I really like kdevelop3 though.  It will open source files to the exact lines where I make mistakes so I can correct them and when parameters are out of order or something, it will even open the source header in the system files to show what I should have done.  And the grepper can't be beat.<br />
<br />
But the choice is yours.  Retro can be risky. But personally I think that it's well worth the risk, and I have never had a problem with kdevelop3.  <br />
<br />
Do check out the 'retro' blog entry about kdevelop if you need a leg up, trying it out tho.<br />
<br />
Or if anyone has a better way get kdevelop3 into their allegedly new and improved KDE system, please let us know!</i>  :-)<br />
<br />
Back on the ranch...<br />
<br />
Here's the header file, and I've included the pipe functions along with the string list functions.  <br />
<br />
[There's no plan (as of the time of this writing) to add plain text file read/write functionality but that might be a great project for newbies. :-) ]<br />
<br />
file: slist.h<br />
purpose: describes syntax and functionality of various string list calls.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// slist.h

#ifndef SLIST_H
#define SLIST_H

// TODO:
// slist_insert(char*** plist, s, idx)   -- insert new item at idx
// slist_moveList(plist1, idx, plist2, delete_flg)  -- overwrite and append,
//                                                 -- [empty or delete list2]
// slist_trim(plist, idx)                -- remove items from idx to end
// slist_shift(plist, n)                 -- remove first n items from list

// returns an initialized pointer to a list base
char** slist_new();

// removes item and deletes the base
void slist_delete(char** list);

// returns number of items in the list
int slist_count(char** list);

// removes items, does not resize or delete the base
void slist_clear(char** list);

// adds a new items at the end of the list
void slist_append(char*** plist, const char* s);

// removes (and frees) item at idx. Does not resize the list
void slist_remove(char*** plist, int idx);

// adds list list2 to list1, does not delete list that's added
void slist_addList(char*** plist1, char** list2);

// remove one trailing newline char from a string
// static void trim_newline(char* buf);

// Loads list with strings from a piped command,
// returns 0 on success
int slist_readPipe(char*** plist, const char* pipecmd);

// writes list through pipe, returns 0 on success.
int slist_writePipe(char*** list, const char* syscmd);

#endif // SLIST_H</pre>
</div>And here's the code.  It's in C++ but could probably be turned to a C file if compiled with the -std=c99 switch or the equivalent.<br />
file: slist.cpp<br />
purpose: functions to create and work with lists of string objects<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// slist.cpp -- lists of strings in the format of an args list, 0 terminated.

#include &lt;malloc.h&gt; // malloc and free
#include &lt;string.h&gt; // str*() funcs

#include &quot;slist.h&quot;

// returns an initialized pointer to a list base
char** slist_new()
{
  char** p = (char**)malloc(sizeof(char**));
  *p = 0;
  return p;
}


// removes item and deletes the base
void slist_delete(char** list)
{
  int i = 0;
  while(list[i])
    free(list[i++]);
  free(list);
}

// returns number of items in the list
int slist_count(char** list)
{
  int i = 0;
  while(list[i])
    i++;
  return i;
}

// removes items, does not resize or delete the base
void slist_clear(char** list)
{
  int i = 0;
  for(int i =  0; list[i] != 0; i++)
  {
    free(list[i]);
    list[i] = 0;
  }
}

// adds a new items at the end of the list
void slist_append(char*** plist, const char* s)
{
  int count;
  char** list = *plist;
  for(count = 0; list[count]; count++)
    ; // noop
  list = (char**)realloc(list, sizeof(char**) * (count + 2));
  list[count] = strdup(s);
  list[count + 1] = 0;
  *plist = list;
}

// removes (and frees) item at idx. Does not resize the list
void slist_remove(char*** plist, int idx)
{
  char** list = *plist;
  int len = slist_count(list);
  if((idx &lt; 0) || (idx &gt; len))
    return;
  free(list[idx]);
  for(int i = idx; i &lt; len; i++)
    list[i] = list[i+1];
  // *plist = list; -- already set since no resizing is done
}


// adds list list2 to list1, does not delete list that's added
void slist_addList(char*** plist1, char** list2)
{
  int len = slist_count(list2);
  for(int i = 0; i &lt; len; i++)
    slist_append(plist1, list2[i]);
}


// remove one trailing newline char from a string
static void trim_newline(char* buf)
{
  char* p = buf + strlen(buf) -1;
  if(*p == '\n')
    *p = 0;
}

// Loads list with strings from a piped command,
// returns 0 on success
int slist_readPipe(char*** plist, const char* pipecmd)
{
  size_t bufsize = 4096;
  char* buf = (char*) malloc(bufsize);
  char** list = *plist;
  FILE* fp = popen(pipecmd, &quot;r&quot;);
  if(! fp) return 1;
  while(! feof(fp))
  {
    *buf = 0;
    getline(&amp;buf, &amp;bufsize, fp);
    
    // done if nothing is read
    if(! *buf)
      break;
    
    trim_newline(buf);
    slist_append(&amp;list, buf);
  }
  fclose(fp);
  
  // save the result and return ok
  *plist = list;
  free(buf); // ADDED -rs
  return 0;
}

// writes list through pipe, returns 0 on success.
int slist_writePipe(char*** plist, const char* pipecmd)
{
  char** list = *plist;
  FILE* fp = popen(pipecmd, &quot;w&quot;);
  if(! fp) return 1;
  for(int i = 0; i &lt; slist_count(list); i++)
  {
    char* line = list[i]; // to see in debugger
    fprintf(fp, &quot;%s\n&quot;, line);    
  }
  fclose(fp);
  return 0;
}</pre>
</div>To test and start messing around with this, create a basic main.cpp template like so:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 338px;
		text-align: left;
		overflow: auto">
// some commonly used c headers, no harm in overkill
#include &lt;stdio.h&gt;    // printf, sprintf, etc.
#include &lt;stdlib.h&gt;   // exit()
#include &lt;unistd.h&gt;   // tons of stuff
#include &lt;malloc.h&gt;   // memory allocation
#include &lt;string.h&gt;   // strings and block comparisons and moves

#include &quot;slist.h&quot;    // all we need is the header

void dbg(){} // place a breakpoint here that won't move even if main() does.

int main(int argc, char** argv)
{
  dbg(); // best if viewed with kdbg.
  
  // add test code here
  
  return 0; // no errors
}</pre>
</div>While it's quite possible to also &quot;include&quot; the cpp file, let's get some experience linking object files.  Here's how to compile this with debug info so you can run the app in a debugger.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 162px;
		text-align: left;
		overflow: auto">COMPILE() # basename
{
  g++ -c $CFLAGS $1.cpp -o $1.o
}

LINK()
{
  g++ $LDFLAGS $OBJ -o $1
}</pre>
</div>Those two functions are now defined in the environment.  This is similar to what makefiles do.<br />
<br />
In the COMPILE funcion the -c switch tells gcc/g++ to only compile.  Do not link. The parameter &quot;basename' is the name of the file minus the &quot;cpp&quot; extension in order to simplify the definition.<br />
<br />
Now we have two simple commands to compile and link the program.<br />
<br />
Type <div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">COMPILE slist</pre>
</div>and make sure 'slist.o' is created.<br />
<br />
Type <div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">COMPILE main</pre>
</div>check for main.o too<br />
<br />
Now we have the object files and we can create the OJB definition like this.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">OBJ=`ls *.o` # Think about this.  :-)  Automatic object listing.
echo $OBJ # and verify that main.o and slist.o are both compiled.</pre>
</div>Ready to link?<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">LINK output</pre>
</div>Notice that the output file name will be &quot;output&quot;.  Change that to anything you like.<br />
<br />
And we notice that CFLAGS haven't been defined?<br />
<br />
If you want to compile with debug info in the files,<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">CFLAGS=&quot;-g3&quot;</pre>
</div>And repeat both compiles and link.<br />
<br />
Check the size of the output. ['du -cb &lt;filename&gt;' works from the commandline if you prefer not to have to switch windows (and press F5 to update the browser).]<br />
<br />
If you want an optimized output file, use '-O2' instead.<br />
<br />
Check the size.<br />
<br />
There are other g&lt;N&gt; levels for debug output and there are other O&lt;N&gt; levels for optimization but these two are the most useful.<br />
<br />
I can see that it's time to fire up Ye Olde 'hlp' app.  :-)<br />
<br />
See early blog entries on &quot;KDE Utils&quot; for a GREAT help doc viewer.<br />
<br />
Type<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">hlp gcc</pre>
</div>to get more ideas about what you can do.<br />
<br />
And again, even if you don't want kdevelop3, kdbg (version 5 or greater) will knock your socks off.  Check it out with the -g3 version of your executable.<br />
<br />
Note: You might be thinking, well, that's so easy, why not create a permanent subroutine file for COMPILE and LINK?  No, don't do that.  I mean, you could but, make and makefiles have some very interesting qualities that will quickly obsolete this simple tool.  Similar, but different.  :-)  Maybe we should peek into that subject soon too, even if it does look like this is becoming a C/C++ programming blog. ;-)<br />
<br />
Coming Up: Part 2.  <br />
<br />
Let's make a utility to scan a directory branch and find ALL dependencies in ALL the binary files.<br />
<br />
You can forget about bash here.  <br />
<br />
Warp 9...  Engage.<br />
<br />
:-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34413</guid>
		</item>
		<item>
			<title>Assembler Stuff: Asm and Inline Asm</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34412</link>
			<pubDate>Thu, 26 Jan 2012 01:15:08 GMT</pubDate>
			<description>Assembler Stuff: Asm and Inline Asm 
 
Features: 
*  Asm and inline asm examples 
*  Using C macros to create global function names 
*  Intel and ATT...</description>
			<content:encoded><![CDATA[<div>Assembler Stuff: Asm and Inline Asm<br />
<br />
Features:<ul><li> Asm and inline asm examples</li>
<li> Using C macros to create global function names</li>
<li> Intel and ATT syntax</li>
<li> Viewing disassembly in a *.s file and using objdump</li>
</ul><br />
Let's get right to the point...<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// main.c
// COMPILE: gcc main.c -o main --save-temps
// take a look at the C asm output file, 'main.s' afterwar

// 64 bit asm keeps part of the stack in registers in C, so let's
// keep this simple and compilt it for 32 bit intel x86.

#include &lt;stdio.h&gt;

// We can use C macros to hide ugly details such as giving 
// the function a global name we can use to call it.  We'll
// use backslashes to span lines to make it more readable.

#define LABEL(name) \
    &quot;.text;\n&quot; \
    &quot;.globl &quot;#name&quot;;\n&quot; \
    &quot;.type &quot; #name&quot;, @function;\n&quot; \
    &quot;&quot;#name&quot;:&quot;

#define FUNCTION(name) \
    asm( \
    &quot;.text;\n&quot; \
    &quot;.align 4\n&quot; \
    LABEL(name) \
    );

// returns char* as a long
long test_readvar(char* s);

// sets [addr] = s
void test_writevar(char** addr, const char* s);

// functionally identical to this
void c_writevar(char** addr, char* s)
{
  *addr = s;
}

char* watch; // copy a value here to see it in a debugger

// Let's create a stretch of throwaway code in C in which we 
// can compile some straight assembler routines.  This basically
// switches the assembler to compile in the .text section.

void code_section()
{
  // We are now in a code block created by C, i.e., the .text
  // section, so the following FUNCTION will be somewhat redundant
  // but certainly easier to read than the gory details of the full
  // declaration.
  
  // C pushes the params on the stack, right to left.  This is 
  // straight asm code so there is no frame pointer, esp points
  // to the return address, esp+4 points to first param in param
  // list.
  FUNCTION(test_readvar) // return contents of value on the stack
  asm(
      // This is the first opcode that executes in the call.
      &quot;mov 4(%esp), %eax;&quot;
      
      // Note that we don't need newlines after the semicolons
      // here, but if you have a syntax error there will be 
      // few usable clues about where it occurred.
      
      // And this is the last byte to execute in this code.
      &quot;ret;&quot;
  );
  // end function
  // Now let's try  intel syntax
  FUNCTION(test_writevar) // (var, val)
  asm(
      &quot;.intel_syntax noprefix;\n&quot;
      
      // C let's us play with eax and edx, but others need to be 
      // saved and restored.
      &quot;MOV    EAX, DWORD PTR [ESP+4];\n&quot;  // var
      &quot;MOV    EDX, DWORD PTR [ESP+8];\n&quot;  // val
      &quot;MOV    DWORD PTR [EAX], EDX;\n&quot;    // [var] = val
      &quot;RET;\n&quot;
      
      // if we don't switch back, C will choke on intel syntax
      &quot;.att_syntax\n&quot;
     );
}

void thats_all_folks() {printf(&quot;That's All Folks!\n\n&quot;);}

int main()
{
  char*x = &quot;testing&quot;;
  // first test
  long addr = test_readvar(x);
  printf(&quot;readvar -&gt; Addr: 0x%X\tValue: %s\n&quot;, addr, x);
  
  // second test, and also rerun first routine for printout
  test_writevar(&amp;x, &quot;finished&quot;);
  
  addr = test_readvar(x); // to get new value
  printf(&quot;readvar -&gt; Addr: 0x%X\tValue: %s\n&quot;, addr, x);
  
  // and we can inline asm with C as well
  asm( &quot;call thats_all_folks;&quot;);
  return 0;
}</pre>
</div>Also, here's the gcc equivalent for the stdcall call types if you want it.  Normally, in C, the caller cleans up the stack, though.  Tends to be <br />
faster.<br />
<br />
Pick the one you're most familiar with; __stdcall, _stdcall, or stdcall <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">#define __stdcall __attribute__((__stdcall__))
#define _stdcall __attribute__((__stdcall__))
#define stdcall __attribute__((__stdcall__))</pre>
</div>You only need those for the prototype declarations.  Asm is asm.<br />
<br />
To see the intel syntax disassembly (dest, src) type:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">objdump -d main -M intel_syntax</pre>
</div>or remove the &quot;-M ...&quot; part for ATT (src, dest) disassembly.<br />
<br />
Try the compile with adding the flag '--omit-frame-pointer' and look at the c_writevar code compared to test_writevar in objdump.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">tofile objdump -d -M intel_syntax main</pre>
</div>[If you don't have 'tofile', you can pipe it through 'more' or whatever...]<br />
<br />
Here's what I get...<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 194px;
		text-align: left;
		overflow: auto">08048454 &lt;c_writevar&gt;:
 8048454: 8b 44 24 04           mov    eax,DWORD PTR [esp+0x4]
 8048458: 8b 54 24 08           mov    edx,DWORD PTR [esp+0x8]
 804845c: 89 10                 mov    DWORD PTR [eax],edx
 804845e: c3                    ret    

08048468 &lt;test_writevar&gt;:
 8048468: 8b 44 24 04           mov    eax,DWORD PTR [esp+0x4]
 804846c: 8b 54 24 08           mov    edx,DWORD PTR [esp+0x8]
 8048470: 89 10                 mov    DWORD PTR [eax],edx
 8048472: c3                    ret</pre>
</div>:-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34412</guid>
		</item>
		<item>
			<title>update</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34411</link>
			<pubDate>Thu, 26 Jan 2012 00:42:18 GMT</pubDate>
			<description>I still use PCLinuxOS on one computer.  Version 11.06 I believe it is called.  It is very polished and I like it a lot.  However, it is 32 bit and...</description>
			<content:encoded><![CDATA[<div>I still use PCLinuxOS on one computer.  Version 11.06 I believe it is called.  It is very polished and I like it a lot.  However, it is 32 bit and the lack of a 64 bit version caused me to go looking for another distro.<br />
<br />
My other computer, the one I'm on now, has simply Mepis 64 bit on it and it runs nicely.  There are some minor issues such as a volume slider that doesn't change the volume.  I have to open the mixer and use the slider in it which works well enough.  Also, M11, as it is called, will not remember my screen resolution.  There is probably a solution but I just change it each time I boot.  Now, the Mepis fourms are great.  Some of the nicest people you'll find in a Linux distro forum.</div>

]]></content:encoded>
			<dc:creator>XenaneX</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34411</guid>
		</item>
		<item>
			<title>Holy Binary Blobs, Batman!</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34410</link>
			<pubDate>Wed, 25 Jan 2012 20:58:09 GMT</pubDate>
			<description><![CDATA[Just how many binary blobs are there in the kernel...!? I finally enabled "deblob" for my gentoo  kernel sources, and it took the build five minutes...]]></description>
			<content:encoded><![CDATA[<div>Just how many binary blobs are there in the kernel...!? I finally enabled &quot;deblob&quot; for my gentoo  kernel sources, and it took the build five minutes to remove all the kernel blobs! Must have been hundreds of them. I think I saw my Ethernet driver scroll by... hopefully I have networking in my next boot. (*gulp*)</div>

]]></content:encoded>
			<dc:creator>hydraMax</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34410</guid>
		</item>
		<item>
			<title>Flattened rice aka Poha (in Hindi)</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34340</link>
			<pubDate>Wed, 25 Jan 2012 12:17:06 GMT</pubDate>
			<description>*Ingredients*: 
 
* 1 table spoon *small* *yellow* Mustard seeds (Aka Sarson in Hindi) 
* 4 small Green chillies (Aka Hari mirch in Hindi) thinly...</description>
			<content:encoded><![CDATA[<div><b>Ingredients</b>:<br />
<ul><li>1 table spoon <b>small</b> <b>yellow</b> Mustard seeds <i>(Aka Sarson in Hindi)</i></li>
<li>4 small Green chillies <i>(Aka Hari mirch in Hindi)</i> <i>thinly</i> chopped.</li>
<li>1 <i>and</i> 1/2 table spoon fresh Ginger <i>(Aka Adrak in Hindi)</i> <i>finely</i> grated.</li>
<li>1/2 table spoon Salt.</li>
<li>2 medium Onions <i>thinly</i> chopped.</li>
<li>1/4 table spoon Turmeric powder <i>(Aka Haldi in Hindi)</i>.</li>
<li>4 cups Flattened rice.</li>
<li>Juice of half lemon.</li>
<li>Oil for frying.</li>
</ul><br />
<b>Directions</b>:<ul><li>Wash the Flattened Rice. Keep it wide spread in a <i><b>flat</b></i> dish. Drain the water, do NOT squeeze the Flattened Rice.</li>
<li>When the oil is hot enough put the yellow Mustard seeds in it and let them crackle.</li>
<li>Add grated Ginger and fry till it turns light brown.</li>
<li>Add salt.</li>
<li>Add thinly chopped Onions and fry till they turn golden brown.</li>
<li>Add turmeric.</li>
<li>Add the Flattened Rice, and mix well.</li>
<li>Turn off the gas, add lemon juice and mix well.</li>
</ul><b>Serves 2</b>.</div>

]]></content:encoded>
			<dc:creator>Anisha Kaul</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34340</guid>
		</item>
		<item>
			<title>New Printer: Brother HL-2270DW</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34409</link>
			<pubDate>Wed, 25 Jan 2012 09:39:13 GMT</pubDate>
			<description><![CDATA[Finally broke down and bought my first printer, a Brother HL-2270DW. It has only been a few days, but I'm pretty happy with my purchase. It's...]]></description>
			<content:encoded><![CDATA[<div>Finally broke down and bought my first printer, a Brother HL-2270DW. It has only been a few days, but I'm pretty happy with my purchase. It's everything I wanted: an inexpensive, Ethernet capable, Linux-compatible laser printer (I hate inkjet). It provides LPD/LPR service over the network, so you don't even have to download the proprietary drivers to use it: just use the CUPS Web interface to add an LPD printer (Generic PCL) and point it to the correct IP address.<br />
<br />
If it is plugged into the network, it will get an IP address through DHCP, which you can use to get to the Web control interface on port 80. Also, if you press the &quot;Go&quot; button on the printer three times rapidly, it will print a page telling you its IP Address, MAC, and other settings. I couldn't find a menu option in the Web interface for setting a static IP, but I didn't look very hard... I'll probably just set my router to always give it the same IP based on the MAC.<br />
<br />
Supposedly has Wireless support as well, but I haven't messed around with that.<br />
<br />
Now, off to print my tax forms. :|</div>

]]></content:encoded>
			<dc:creator>hydraMax</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34409</guid>
		</item>
		<item>
			<title><![CDATA[Quick Note = rpmerizor & retro dev files]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34408</link>
			<pubDate>Wed, 25 Jan 2012 09:31:10 GMT</pubDate>
			<description><![CDATA[I noticed that rpmerizor doesn't include so symlinks in the package.  (You have to add them to the spec as "%dir" types if you need them.) 
 
As a...]]></description>
			<content:encoded><![CDATA[<div>I noticed that rpmerizor doesn't include so symlinks in the package.  (You have to add them to the spec as &quot;%dir&quot; types if you need them.)<br />
<br />
As a result the current rpmerizor is pretty SAFE for retro development packages because it can't overwrite the default libs (*.so with no numeric extension).<br />
<br />
However, I've asked eric to consider adding a switch so that we can include the symlinks as per &quot;normal&quot; development packages which usually only contain the *.so symlinks, header files, and perhaps a pkgconfig entry in the lib folder and some docs.<br />
<br />
Again, retro development files can munch your system whereas the executables are much less likely to mess you up.<br />
<br />
Consider relocating the retro dev files if you actually do need them for some reason.<br />
<br />
[See &quot;make-based ...&quot;, first in the series in this blog.  <br />
<br />
We've got an upgrade in the pipes but it's not ready to post yet.]</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34408</guid>
		</item>
		<item>
			<title>Frankenstein (bash) Meets GodziRRa (C/C++).</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34407</link>
			<pubDate>Wed, 25 Jan 2012 08:57:41 GMT</pubDate>
			<description><![CDATA[Frankenstein (bash) Meets GodziRRa (C/C++). 
 
Features: 
* Simple C program embedded in a bash script. 
* Program that doesn't print a newline at...]]></description>
			<content:encoded><![CDATA[<div>Frankenstein (bash) Meets GodziRRa (C/C++).<br />
<br />
Features:<ul><li>Simple C program embedded in a bash script.</li>
<li>Program that doesn't print a newline at the end of a string.</li>
<li>Compiling without superuser privileges.</li>
<li>Ethical concerns.</li>
</ul><br />
Requires:<ul><li>bash</li>
<li>gcc</li>
</ul><br />
Bash is so screwy it feels like you have to hack it to get it to work at times. Once it works it always does the same thing every time so it's reliable once you have managed to crack the &quot;security system&quot; which consists of 'the docs' (aka TFM).<br />
<br />
So there's bash in one corner.<br />
<br />
In the other corner we have C.<br />
<br />
Who needs it?<br />
<br />
Well, &quot;bash may need it&quot;, is the answer.  And C can be used, even included as source, embedded in bash programs.<br />
<br />
Don't believe me.  Here...<br />
<br />
Let's read the first 4 bytes of a file and print it out in modified ascii (for unprintable characters) which bash cannot do on its own.<br />
<br />
Need proof that bash needs help?  :-)  Compare this... and plug your ears if it's a large binary file.<br />
<br />
'echo &quot;$(&lt;largebinaryfile)&quot;'<br />
<br />
But here's a sketch of a C program that can handle it easily.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 114px;
		text-align: left;
		overflow: auto">char buf[4];                // a place to hold the file data
FILE* fp;                   // a file pointer
fp = fopen(argv[1], &quot;r&quot;);   // open first arg for reading.
fread(buf, 1, 4, fp);       // datasize = byte, get 4 of 'em
fclose(fp);                 // done with the file
dump(buf, 4);               // print it out</pre>
</div>What the above is missing is only a <br />
1. check to see if the parameter is a valid file, which bash can do<br />
2. the code for the dump, which C can do<br />
3. an error code from C, which can be any number, meaning anything you like but only a zero return value always means &quot;OK&quot; or (paradoxically) &quot;true&quot; for a value returned to a shell.<br />
<br />
Let's fill out the code in a stand-alone C program then let's embed it in a bash script so it compiles on the fly and cleans up when done.<br />
<br />
[Mark this spot.  It's the text you need to copy/paste into the bash script in a moment.]<br />
<br />
file: file-sig.c (initial test version -- mostly useless except for ELF sigs.)<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 338px;
		text-align: left;
		overflow: auto">// file-sig.c
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;malloc.h&gt;
 
int main(int argc, char** argv)
{
  char buf[4];                // a place to hold the file data
  FILE* fp;                   // a file pointer
  fp = fopen(argv[1], &quot;r&quot;);   // open first arg for reading.
  fread(buf, 1, 4, fp);       // datasize = byte, get 4 of 'em
  fclose(fp);                 // done with the file
//  dump(buf, 4);
  // print it out
  int i;
  for(i = 0; i &lt; 4; i++)
    if(isprint(buf[i])) printf(&quot;%c&quot;, buf[i]);
    else printf(&quot;.&quot;);
  return 0;
}</pre>
</div>Here's what it does when it reads its own sig.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">$&gt; file-sig file-sig
.ELF</pre>
</div>The first &quot;file-sig&quot; above is to run the program the second is the name of the file to check which is itself.<br />
<br />
Now to embed this in a bash script all we need to do is write the C file, compile it, run it, and then delete both files.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 386px;
		text-align: left;
		overflow: auto">#!/bin/sh
# This prints out 4 bytes of a file sig

# write the C file
cat &lt;&lt; _EOF &gt; file-sig.c
[COPY AND PASTE THE C FILE VERBATIM HERE]
_EOF

# compile it.
gcc file-sig.c -o file-sig

# run it with a valid input param so it doesn't crash.
# we know file-sig will exist so let's do that again.
file-sig file-sig

echo &quot; &lt;- The ELF signature from an executable binary.
  ---------------------------------------------
  Eh?  Eh?? Well?  What do you think?
  Godzilla meets Frankenstein?  Kinda fun, no?.  :-)
 &quot;

# cleanup... Nah...  Let's leave the files hanging around
# this time.</pre>
</div>I know what you're thinking...<br />
<br />
Is this LEGAL?  Ethical?  Open a typical 'configure' script with an editor and find &quot;main&quot; in those files.  You can answer that question yourself.  <br />
<br />
WARNING: Minor rant ahead.<br />
<br />
[We're SUPPOSED to be able to do this.  Where's the ethics in dumbing down these systems to make it harder to actually get any work out of them?  So let's get back on track (you KDE distros!) so we don't have to have two different linuxes installed just to do anything interesting.  After all, who do you think is going to fix KDE so it can run an executable when you press ENTER on it?  Or when you click on a binary (even gui app)?  Obviously not you guys.  You broke it.  Want a bug report?  Here it is.  Use the systems you are developing and you won't need the bug reports.]<br />
<br />
End of rant.  It's safe again. :-)<br />
<br />
------------<br />
Notes:<br />
<br />
I used a utility to create a clickable IDE launcher and generate my makefile for the first cut. (How I made it clickable is a long story, but older KDE's do that without modification.)<br />
<br />
Here's how it was done.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 146px;
		text-align: left;
		overflow: auto">$&gt; autobake new c-32            # creates an intermediate makefile template, 32 bits.
$&gt; autobake edit                # changed the name of the output program from &quot;main&quot; to
$&gt; autobake create main         # write a simple main program for starters.
File extension for file-sig.&lt;ext&gt; ('c' or 'cpp'): c     
                                # I entered 'c' above.
$&gt; autobake create dirs         # create default source folder and place to put object files
$&gt; autobake create ide          # create the clickable kdevelop3 launcher
$&gt; autobake bake                # and finally generating the makefile from the sources</pre>
</div>At this point 'make' generates an executable but it doesn't do much because the C file is just enough to print a hello message or something.<br />
<br />
If that looks easier than using cmake or automake, I might have something you'd be interested in.  Hang tight for a while.  It's currently customized for my old suse 10.0 and a gui toolkit I wrote (well, it's in transition actually).<br />
<br />
But if you want to give an old version a spin, you can mess with it yourself and try to get it working for your system.  Hopefully the README is up to date.<br />
<a href="http://rainbowsally.net/tkf/ftl/" target="_blank">http://rainbowsally.net/tkf/ftl/</a>  about 75% down the page.<br />
<br />
Sold &quot;as-is&quot;.  No refunds.  ;-)<br />
<br />
PS. The above C program demo for this blog entry (not cleaned up) could be expanded to discover the sig of all kinds of files, png,jpeg, xpm, and even oddball binaries like deb packages which are &quot;&lt;arch&gt;&quot; (an 'ar' library archive, it's true).<br />
<br />
If you enjoy this kind of activity, tell KDE to put the brakes on.  Following Windows over a cliff may not be as smart as they think.<br />
<br />
.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34407</guid>
		</item>
		<item>
			<title>USB Linux Installitio</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34406</link>
			<pubDate>Tue, 24 Jan 2012 16:40:16 GMT</pubDate>
			<description><![CDATA[Hello . 
 I have intel p 4 processor and 2 GB Ram in my system. I don't have DVD r/w in my computer. so i want to make instillation by using usb...]]></description>
			<content:encoded><![CDATA[<div>Hello .<br />
 I have intel p 4 processor and 2 GB Ram in my system. I don't have DVD r/w in my computer. so i want to make instillation by using usb stick. i tried a lot by using bootable software like 'Unetbootin'. i tried with RHEL 6 Beta. it goes till selection of language and moniter gets off.<br />
Than i install xp in my system and in virtualbox i installed RHEL 6. then it install properlly.<br />
i don't to use linux in virtualbox. so will you guys please help me in selection of bootable software and installation step of RHEL 6 by using usb stick.<br />
<br />
<br />
Thanks and Regards<br />
Md Reza</div>

]]></content:encoded>
			<dc:creator>linuxreza</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34406</guid>
		</item>
		<item>
			<title>kernel upgradation or change in RHEL</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34405</link>
			<pubDate>Tue, 24 Jan 2012 10:46:12 GMT</pubDate>
			<description>chek your version of kernel 
 
Code: 
--------- 
#rpm -qa | grep kernel 
--------- 
go to your repository location as I have mine inside yum...</description>
			<content:encoded><![CDATA[<div>chek your version of kernel<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">#rpm -qa | grep kernel</pre>
</div>go to your repository location as I have mine inside yum directory<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">#rpm -ivh /yum/kernel-2.6.18-8.el5.i686.rpm</pre>
</div>you will find two entries in your grub.conf<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 258px;
		text-align: left;
		overflow: auto">#vi /boot/grub/grub.conf
<font color="Red">default=1</font>
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-8.el5xen)
        root (hd0,0)
        kernel /boot/xen.gz-2.6.18-8.el5
        module /boot/vmlinuz-2.6.18-8.el5xen ro root=LABEL=/ rhgb quiet
        module /boot/initrd-2.6.18-8.el5xen.img
<font color="Red">title Red Hat Enterprise Linux Server (2.6.18-8.el5)
        root (hd0,0)
        kernel /boot/.gz-2.6.18-8.el5
        module /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quiet
        module /boot/initrd-2.6.18-8.el5.img</font></pre>
</div>change the<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">default=1 ---&gt; default=0</pre>
</div>and boot your OS and if your machine boots up properly<br />
then remove the old kernel<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">#rpm -e kernel-2.x.x.xel5.rpm</pre>
</div></div>

]]></content:encoded>
			<dc:creator>deep27ak</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34405</guid>
		</item>
		<item>
			<title>Just a qiuckie.</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34404</link>
			<pubDate>Tue, 24 Jan 2012 05:21:42 GMT</pubDate>
			<description>Favorite new program for the command line is dvtm. It is sort of a command line desktop with text windows.</description>
			<content:encoded><![CDATA[<div>Favorite new program for the command line is dvtm. It is sort of a command line desktop with text windows.</div>

]]></content:encoded>
			<dc:creator>peonuser</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34404</guid>
		</item>
		<item>
			<title>Archive Diff</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34403</link>
			<pubDate>Tue, 24 Jan 2012 04:12:35 GMT</pubDate>
			<description>I have beta source code available for another small utility I coded, called Archive Diff. It is a convenient tool intended to let you quickly see the...</description>
			<content:encoded><![CDATA[<div>I have beta source code available for another small utility I coded, called Archive Diff. It is a convenient tool intended to let you quickly see the differences between the files in two archives, without going to the trouble of unwrapping the archives yourself or running the proper diff commands. The target users are those who like to install software from source code but also like to know exactly what source code has been changed between the two versions (i.e., without trusting the ChangeLog or downloading a git repository).<br />
<br />
If anyone would like to try it out, feel free to attach any suggestions, criticisms, insults, or snide remarks in the comments for this post.<br />
<br />
<a href="https://frigidcode.com/code/archdiff/" target="_blank">Archive Diff</a></div>

]]></content:encoded>
			<dc:creator>hydraMax</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34403</guid>
		</item>
		<item>
			<title><![CDATA[Let's Go Retro Now - A RPM Extractor w/ Scripts]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34402</link>
			<pubDate>Tue, 24 Jan 2012 02:10:53 GMT</pubDate>
			<description><![CDATA[[Note to myself: needs links to kubuntu forum re. deb extraction, rebuilding 2 places.  The page is ccurrently down for maintenance and one...]]></description>
			<content:encoded><![CDATA[<div>[Note to myself: needs links to kubuntu forum re. deb extraction, rebuilding 2 places.  The page is ccurrently down for maintenance and one check/edit.]<br />
<br />
Let's Go Retro Now - A RPM Extractor w/ Scripts<br />
<br />
Especially when building retro packages from binary packages, we need to look out for old development files overwriting newer ones.<br />
<br />
For deb packages, the process is a bit more complicated, but once you have a set of definitions for bash functions, it's not too hard to do this interactively in kubuntu too.  <br />
<br />
[To myself. Edit this.  May not be the early version?  Here's an early version of loadable definitions for kubuntu users. Needs kubuntu forum link.]<br />
<br />
We assume the shell has been changed to sh --&gt; bash instead of DASH. DASH causes all kinds of problems with makefiles and many other shell programs including cmake which can't find 'libpthreads' due to DASH anomalies (or bash's required anomalies).<br />
<br />
[Link to deb rebuild stuff here.]<br />
<br />
Here's the basic RPM extractor definitions.  (For now a subset of a set of dynamically linked shell definition libraries, a concept we may examine in detail a bit later.)  <br />
<br />
We load these with the command <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">source rpm.sub</pre>
</div>And these I have put in my HOME/bin/src/subs folder (where the dynamically linked shell libraries will live) and installed by the same method as the binaries and executable micro-programs that were in the &quot;KDE Utils&quot; posts in this blog, so they are immediately available for editing and/or loading.<br />
<br />
[remember the ~/bin prefix to edit, but for running no prefix is req'd.]<br />
<br />
file: rpm.sub (plain text, temp subset of real shell lib)<br />
purpose: load some rpm funcs into shell environment<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto"># type 'source rpm.sub' to load

_rpm_src_extract_one() # rpmFile [dir]
{
    local rpmdir=`echo &quot;$1&quot; | sed -r 's|\.rpm$||'`
    local destdir=$2
    if [ &quot;$destdir&quot; = &quot;&quot; ];then
        destdir=&quot;.&quot;
    fi
    mkdir -p &quot;$destdir/$rpmdir&quot; &gt;/dev/null 2&gt;&amp;1
    rpm2cpio &quot;$1&quot; | (cd $destdir/$rpmdir; cpio -i --make-directories )
    local scriptname=`echo $1 | sed 's|\.rpm|\.scripts|'`
# echo &quot;$destdir/$rpmdir/$scriptname&quot;; read key
    rpm -qp --scripts &quot;$1&quot; &gt; $destdir/$scriptname 2&gt;/dev/null
}


rpm.src_extract() # rpmfile [dir]
{
  local dir=&quot;.&quot;
    if [ &quot;$1&quot; = &quot;-d&quot; ]; then
        dir=$2
        shift 2
    fi
    mkdir -p &quot;$dir&quot; &gt;/dev/null 2&gt;&amp;1
    
    for file in $@
    do
        _rpm_src_extract_one &quot;$file&quot; $dir
    done
    
}

rpm.help()
{
  echo &quot;
  commands:
    help              -- this quick ref
    rpm.src_extract   -- file1 [file2 ...] extract rpm file(s) to a tree (splats ok)
  &quot;
}

rpm.help</pre>
</div>Remember the dot for rpm.help or you'll get bash help instead.<br />
<br />
This will create the directory containing all the files inside an rpm (old rpms = ok) and will generate a similarly named text file containing the configs and pre/post functions used by rpm during installation and uninstallation.<br />
<br />
If the top dir is renamed TREE this can be used as the basis of a make-based installer/uninstaller which may be used for testing before rebuiling as SAFE rpm package.  <br />
<br />
<b>The word &quot;SAFE' in this context means only that we have checked it to make sure it doesn't overwrite stuff in our main file system.  This can be verified by looking at the initial backup (number 01 in the backup folder).</b><br />
<br />
There is always some risk when installing retro packages in your system.  Approach this activity with respect, backups, and a rescue CD you can use in case your retro files overwrite sytem files required for normal booting.<br />
<br />
--------------------------------<br />
Notes:<br />
<br />
re. the 'rescue CD'.<br />
<br />
Usually if you can make it back into your folder where the make-based files are, you can copy and the backup to the correct destination and untar it there.  Copying and unpacking gives you two chances to catch errors in the destination path.<br />
<br />
'make restore' can't be used in this scenario because a different root is mounted.<br />
<br />
re. Rescue CD v. Older Linux.<br />
<br />
I don't use a rescue CD if I can avoid it.  I prefer a persistent 'older' linux installation to do the job so I don't have to mess around with mount points, fdisk, device ids, etc.  It's already set up when I go into it.  <br />
<br />
Knoppix could probably also do this (using a persistent image) but my older linux is still very usable and it boots faster -- if it boots at all!<br />
<br />
<br />
re. &quot;if it boots at all&quot;<br />
<br />
Some of the newer linuxes (including openSUSE and Kubuntu) clobber my older (single sector mbr) linux installation.<br />
<br />
<b>PLEASE STOP DOING THAT!!</b>  The work-arounds are quite inconvenient and my Windows installation is worthless for fixing a Linux that's temporarily in disarray.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34402</guid>
		</item>
		<item>
			<title>Apache configuration for Xapian Omega on Slackware 13.1</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34401</link>
			<pubDate>Mon, 23 Jan 2012 16:09:01 GMT</pubDate>
			<description><![CDATA[Here's an Apache configuration file for Xapian Omega on Slackware 13.1, to be saved as /etc/httpd/omega.conf 
 
It was developed and tested on...]]></description>
			<content:encoded><![CDATA[<div>Here's an Apache configuration file for Xapian Omega on Slackware 13.1, to be saved as /etc/httpd/omega.conf<br />
<br />
It was developed and tested on Slackware64 13.1 with Xapian Omega 1.2.8 installed by SlackBuild. <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 322px;
		text-align: left;
		overflow: auto"># Apache configuration file for Xapian Omega

&lt;Directory /srv/httpd/htdocs/omega&gt;
    Allow          from all
    DirectorySlash On
    Options        FollowSymlinks
    Order          Deny,Allow

    RewriteEngine  On
    RewriteBase    /
    RewriteRule    ^/*$ /cgi-bin/omega/omega?DB=default&amp;FMT=query [L]
&lt;/Directory&gt;

&lt;Directory /srv/httpd/cgi-bin&gt;
    Allow          from all
    DirectorySlash On
    Options        FollowSymlinks
    Order          Deny,Allow
&lt;/Directory&gt;</pre>
</div>It can be used with the default /etc/httpd/httpd.conf by adding the following line at the end of /etc/httpd/httpd.conf<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">Include /etc/httpd/omega.conf</pre>
</div>The Xapian Omega omega CGI executable must be available in the default cgi-bin directory which can be done by smlinking<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">ln -s /usr/lib64/xapian-omega/bin/omega /srv/httpd/cgi-bin/omega</pre>
</div>Change lib64 to lib on 32-bit systems.<br />
<br />
After Apache (httpd) has been restarted and Xapian Omega's omindex has been run to create a default text search database, the GUI can be accessed at http://&lt;server ID&gt;/omega</div>

]]></content:encoded>
			<dc:creator>catkin</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34401</guid>
		</item>
		<item>
			<title>A turn for the worse....</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34400</link>
			<pubDate>Mon, 23 Jan 2012 13:48:57 GMT</pubDate>
			<description><![CDATA[So I'm now currently a high profile "target," so to speak. I started having "mini" seizures in my sleep every so often, and the pain and pressure has...]]></description>
			<content:encoded><![CDATA[<div>So I'm now currently a high profile &quot;target,&quot; so to speak. I started having &quot;mini&quot; seizures in my sleep every so often, and the pain and pressure has been gradually increasing. I'm starting to see a lot more doctors, and about to see a new neurologist, so hopefully something can be done soon. Will be posting back soon once I find out more information.<br />
<br />
Over and out,<br />
<br />
 -- Josh</div>

]]></content:encoded>
			<dc:creator>corp769</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34400</guid>
		</item>
		<item>
			<title>Simple C: Filling in the blanks - A simple memory allocator/reallocator.</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34399</link>
			<pubDate>Mon, 23 Jan 2012 13:32:16 GMT</pubDate>
			<description><![CDATA[No memdup()?  No memcat()?  No prob. 
 
Today's Features: 
* Simple C/C++ program and new memdup() and memcat() functions. 
* C macros (spanning...]]></description>
			<content:encoded><![CDATA[<div>No memdup()?  No memcat()?  No prob.<br />
<br />
Today's Features:<ul><li>Simple C/C++ program and new memdup() and memcat() functions.</li>
<li>C macros (spanning lines with backslash) to create 'lenient' aliases.</li>
<li>Type casting in C/C++ to override sometimes overly strict syntax checks.</li>
</ul>Anyone that has used strdup() or strcat() knows how convenient those are.  But when it comes to memory allocation and reallocation for other kinds of data the lack of simple standard mechanisms for this often leads to duplicated code.<br />
<br />
Here's a couple of simple C/C++ routines you can add to your snippets library if you are tired of complicated memory allocation and reallocation schemes.<br />
<br />
[Don't have gcc/g++ yet?  The gnu compiler and its dependencies is about 67 megs of the best download time ever spent.  I'm talking to newbies and to you assembler guys too. ;-) The libc docs is also very handy.  Bookmark the &quot;Function and Macro&quot; index (an alphabetical listing) to get to the goodies fast.]<br />
<br />
There are only two short routines of importance below.  The main() function is just the tester.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">// main.c

/*
 * Simple memory allocation, reallocation using built-in
 * libc calls.  Based on strdup() and strcat() concepts.
 */

// use gnu99 so we can declare loop index inside for(...) block in tester
// COMPILE: gcc -std=gnu99 main.c -o main

#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;malloc.h&gt;
void dbg(){}  // Try kdbg if you haven't yet.  It's dynamite.  
              // Add -g3 to the compile line if you want to enable it.

/////////////////////////////////////////////////////////////////////////
// The calling function is responsible for free-ing the memory after use.

// use xmalloc() and xrealloc() if you need safety over simplicity and speed.
void _memcat(void** dest, int* destsize, const void* src, int srcsize)
{
  int dsz = *destsize;
  *destsize += srcsize;
  *dest = realloc(*dest, dsz + srcsize);
  memcpy((char*)*dest + dsz, src, srcsize); 
  // the call at the end eliminates an unnecessary call/return pair.
  // Asm coders, see note at the bottom.
}

void _memdup(void** dest, int* destsize, const void* src, int srcsize)
{
  *dest = malloc(srcsize);
  *destsize = srcsize;
  memcpy(*dest, src, srcsize);  
}

// NOTE:
// Since C++ syntax is so strict we can create aliases that will cast the
// input params to the type needed by the functions.  This is a little risky 
// because even 'longs' can be case to char**, and crazy stuff like that so 
// consider deleting these and renaming the above without the underscore prefix 
// to renenable the more comprehensive error checks.  But this CAN be done 
// and may make breaking the ice a little more palletable for folks coming 
// from other programming languages that aren't so strict.

#define memcat(dest, destsize, src, srcsize) \
  _memcat((void**)dest, destsize, (const void*)src, srcsize)

#define memdup(dest, destsize, src, srcsize) \
  _memdup((void**)dest, destsize, (const void*)src, srcsize)


///////////////////////////////////////////////////////////////////////
// Example: 
int main(int argc, char** argv)
{
  dbg();
  const char* a = &quot;this is a&quot;;
  const char* b = &quot;this is b&quot;;
  
  // the memory descriptor is a base pointer and a length variable.
  // they could have been in a single object but we'll keep them 
  // separate here so the parameter lists make clear what's going on,
  // especially for those new to C/C++.
  void* pa;
  int palen;
  
  
  int paptr; // a temp for test
  
  // here we go... duplicate string a plus its terminator using memory
  // blocks instead of strings, per se.
  memdup(&amp;pa, &amp;palen, a, strlen(a) + 1);
  printf(&quot;memdup()\n0x%0X: %s\n&quot;, pa, pa);

  // you can lie about the buffer length to truncate the block as far
  // as the descriptor is concerned.  Don't truncate to &lt; 0 though and
  // don't increase the length or the end of the block may be in 
  // non-existent memory.
  palen--; // remove terminator (the lie)
  
  // add a five-byte string to the memory block
  memcat(&amp;pa, &amp;palen, &quot; and &quot;, 5); 
  
  // add string b and it's null char terminator.
  memcat(&amp;pa, &amp;palen, b, strlen(b) + 1);
  
  // Let's have a look...
  printf(&quot;memcat()\n0x%0X: %s\n&quot;, pa, pa);

  free(pa);
  return 0;
}</pre>
</div>BEGINNERS:<br />
<br />
How would you write a function named (let's say) <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">stradd(char** s, const char* newstr);</pre>
</div>that would do both reallocation of the string's base pointer and grow the memory for the expanded string?<br />
<br />
Hint: All you'd need to pass as parameters is a pointer to the string, ala &quot;&amp;&lt;string&gt;&quot; and the string to add.  Lengths can be calculated using strlen().  (Note: The ampersand in &quot;&amp;&lt;sting&gt;&quot; means &quot;AddressOf&quot;.)<br />
<br />
Gotchas: The initial string must be &quot;char*&quot; not &quot;const char*&quot; or it will segfault.  Strings  like <u>'this'</u> (type: const char*, aka &quot;string constant&quot;) are read-only.  Strings like <u>'strdup(&quot;this&quot;)'</u> (type: char* aka &quot;string variable&quot;) are not.  <br />
<br />
:-)<br />
<br />
<br />
ASM CODERS:<br />
<br />
The tail code can be eliminated by setting the code up to do calls at the end of the code block.  Use the -O2 optimization flag.<br />
<br />
Type 'tofile objdump -d main -M intel-mnemonic' (remove &quot;-M ...&quot; if you prefer AT&amp;T syntax) and find _memcat in the dump.<br />
<br />
[tofile is a simple 'more'-ish alternative that views the dump with a kde-based editor.  See the link near the top of the previous blog entry if you want it.]<br />
<br />
You can further reduce overhead using the '--omit-frame-pointer' flag, which eliminates pushing and popping the frame pointer in each subroutine.  You lose debug info but you gain what you gain in hand-written asm.  GCL uses this flag, BTW, to expose the machine stack for pushing an popping lists.<br />
<br />
Give gcc a chance.  I think you'll be very impressed.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34399</guid>
		</item>
		<item>
			<title>KDE Utils: cleanup, hlp</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34398</link>
			<pubDate>Mon, 23 Jan 2012 13:16:07 GMT</pubDate>
			<description><![CDATA[Features: 
* Cleanup old backup files quickly with feedback on operations being done. 
* Outstanding doc viewer that doesn't tie up your terminal. 
...]]></description>
			<content:encoded><![CDATA[<div>Features:<ul><li>Cleanup old backup files quickly with feedback on operations being done.</li>
<li>Outstanding doc viewer that doesn't tie up your terminal.</li>
</ul>--------------------<br />
See the link below for the &quot;how and why&quot; to install these as symlinks in your HOME/bin folder.  Need functions for 'browse', 'launch', 'tofile'?  It's all here.<br />
<a href="http://www.linuxquestions.org/questions/blog/rainbowsally-615861/kde-utils-new-symlink-launch-edit-browse-tofile-34376/">http://www.linuxquestions.org/questi...-tofile-34376/</a><br />
--------------------<br />
<br />
Often we end up with lots of files with tilde suffixes (~) after editing files. Here's a utility to descend several directory levels to quickly 'cleanup' these backups starting with the current directory.<br />
<br />
file: cleanup<br />
purpose: remove old backup files<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">#!/bin/sh

exists()  # not just a link
{
    if test -f &quot;$1&quot;;then
    return 0    # ok
    else    return 1    # error
    fi
}

do_cleanup()
{
    for i in $1/*~
    do
        if exists &quot;$i&quot;; then
            echo &quot;$i&quot;
            rm -f &quot;$i&quot; &gt;/dev/null
        fi
    done
    for i in $1/*.bak
    do
        if exists &quot;$i&quot;; then
            echo &quot;$i&quot;
            rm -f &quot;$i&quot; &gt;/dev/null
        fi
    done

}


do_cleanup .
for i in * 
do 
    do_cleanup $i
done

for i in */*
do 
    do_cleanup $i
done

for i in */*/*
do 
    do_cleanup $i
done

for i in */*/*/*
do 
    do_cleanup $i
done

for i in */*/*/*/*
do 
    do_cleanup $i
done

# also remove the typical hidden backups
rm -f \.*~
rm -f */\.*~
rm -f */*/\.*~
rm -f */*/*/\.*~
rm -f */*/*/*/\.*~
rm -f */*/*/*/*/\.*~

echo
echo &quot;done...&quot;
echo</pre>
</div>Here's a help display function similar to the 'browse' function but that opens info and man docs, beautifully formatted, for any linux command you need to look up.<br />
<br />
file: hlp<br />
purpose: view nice docs without tying up the terminal<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 450px;
		text-align: left;
		overflow: auto">#!/bin/sh

browser=konqueror
opt=&quot;info&quot;

if [ &quot;$1&quot; = &quot;-m&quot; ];then
    opt=&quot;man&quot;
    shift
else
if [ &quot;$1&quot; = &quot;-i&quot; ];then
    opt=&quot;info&quot;
    shift
fi ;fi

if [ &quot;$1&quot; = &quot;&quot; ];then
  #update and view ~/bin docs
  echo &quot;
  Please wait... updating ~/bin docs
  if this isn't what you wanted to do, add the subject
  you wanted help on on the command line
  &quot;
  
  cd ~/bin
  ./update-docs.exec 2&gt;/dev/null # suppress errors
else
  launch &quot;$browser '$opt:$1' &gt;/dev/null 2&gt;&amp;1&quot; 
fi</pre>
</div>Optimizations welcome.  These are by now quite old but they work so I haven't felt much inspiration to rework them.<br />
<br />
:-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34398</guid>
		</item>
		<item>
			<title>Errata (in the make-based fileset) (#1 in the make-based series)</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34397</link>
			<pubDate>Sun, 22 Jan 2012 11:42:55 GMT</pubDate>
			<description><![CDATA[Correction:  
Add './' before 'mk_backup' in the Makefile around line 10. 
 
I'll go back and edit that post where the fileset is, but if you got a...]]></description>
			<content:encoded><![CDATA[<div>Correction: <br />
Add './' before 'mk_backup' in the Makefile around line 10.<br />
<br />
I'll go back and edit that post where the fileset is, but if you got a copy already, that's how to get it working right.<br />
<br />
It only affects the Makefile.  The rest are unchanged.<br />
<br />
Explanation: I have '.' (dot) in my path so it worked on my system and I uploaded an older version that didn't have the correction.<br />
<br />
Sorry about that.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34397</guid>
		</item>
		<item>
			<title>A make-based #2 (alpha) install/uninstall -- in HOME folder.</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34396</link>
			<pubDate>Sun, 22 Jan 2012 07:42:25 GMT</pubDate>
			<description><![CDATA[See Features and Misfeatures in "A make-based #1..." 
 
For this, we'll unpack the fileset and... 
 
1. Create folder named TREE in the directory...]]></description>
			<content:encoded><![CDATA[<div>See Features and Misfeatures in &quot;A make-based #1...&quot;<br />
<br />
For this, we'll unpack the fileset and...<br />
<br />
1. Create folder named TREE in the directory with the Makefile.<br />
<br />
2. Create a directory name 'bin' under TREE.<br />
<br />
3. Create a text file named 'new.listall' containing the following. <br />
<br />
file: new.listall<br />
purpose: display all &quot;new.*&quot; functions that are available.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 306px;
		text-align: left;
		overflow: auto">#!/bin/sh 

cd `dirname &quot;$0&quot;`
b=`ls new.*`

a=`printf &quot;%s&quot; &quot;new.&lt;name&gt; creates a new set of project files.
Currently available functions are:
&quot;`

c=&quot;$a
 
$b&quot;

# create msgBox using gtk, qt, or kdialog if you want a nicer
# display. -rs
if ! msgBox &quot;$c&quot;  2&gt;/dev/null; then
xmessage -center &quot;$c&quot; -default &quot;okay&quot;
fi</pre>
</div>And set the permissions for 'executable'<br />
<br />
At this point we have the directory image we want to place in our HOME directory.  The Makefile will create the ~/bin folder if it doesn't exist.<br />
<br />
[You may need to download the package containing 'make'.  It's used for all kinds of stuff, well worth having.  If you don't have a decent 'edit' function for your user yet, see earlier posts in this blog.]<br />
<br />
If we type 'make' at this point the output will look like this.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 98px;
		text-align: left;
		overflow: auto">$&gt; make

Error: Prefix not set in Makefile yet

make: *** [prefix-check] Error 1</pre>
</div>Since a terminal is already open at this point, type<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">edit Makefile</pre>
</div>And set the prefix to point to your HOME directory using the syntax required by 'make' or if you prefer, with the full path to your HOME folder.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">export PREFIX=$(HOME)</pre>
</div>The installation is thus 'relocatable', which works fine for things that don't have hard-coded paths such as 'rpath' in some libraries.<br />
<br />
Now if we type 'make' we get the following message.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 114px;
		text-align: left;
		overflow: auto">$&gt; make

ERROR: Missing dat files.
Use 'make init' to create a default set

make: *** [init-check] Error 1</pre>
</div>The dat files will be used for various things, such as importing from the file system or anything else a sorted (by attributes) file list might be used for.<br />
<br />
type<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">make init</pre>
</div>to create the files, links, and dirs lists<br />
<br />
Now if we type make we see the following message.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">make

Binary package, already built. Ready to install.</pre>
</div>IN OUR HOME FOLDER WE DO NOT NEED, NOR DO WE WANT SUPERUSER PRIVILEGES.<br />
<br />
If you are an old hand at using make, you may be in the habit of using su or sudo su for this.  Don't.  :-)  It's unnecessary and we are doing this to get familiar with the tool in a relatively safe 'sandbox'.  <br />
<blockquote><i>If your kde system can't do any of this, let your distro developers know that KDE is going the WRONG WAY with locking their systems up so even users can't use them.  In particular we need accurate mime types, that can execute executable files and kwrapper aliases (kdesu and kshell) when clicked on or opened with the ENTER key and that don't lose our PATH and LD_LIBRARY_PATH when running tests in a sandbox (such as this).  The distro developers might be able to make the point -- if they get the point themselves.  But so far, the &quot;one size fits all&quot; philosopy and the linux-suicidal policy of being a windows-liked dumbed down turkey rules the day.<br />
</i></blockquote>Now let's install and uninstall the app and test it.<br />
<br />
To install, type 'make install' (again, with NO ROOT PRIVS).  Then type 'new.listall'.<br />
<br />
You should see all files in the ~/bin folder that have the prefix &quot;new.&quot;.<br />
<br />
Then type 'make uninstall' and 'new.listall' and see what happens.  It should now generate an error message because the app is no longer installed.<br />
<br />
The new.listall file probably didn't exist in your ~/bin folder, but if it did, it would have been saved in the 'backups' folder.  <br />
<br />
<i>Take a look in that folder.  Unpack the tarball or enter the way you'd enter a directory, which works if you have konqueror.<br />
</i><br />
As a result, since there are no files in the backup, if you use 'make restore' nothing would be restored.<br />
<br />
We could have installed 'new.listall' as we did the others, but since it uses its own path to determine the directory for the listing, a symlink here would read the wrong folder.  <br />
<br />
While it's true that using the HOME env var to get the path to where the bin folder is, when you are su-ing or sudo-ing, that folder would be the wrong one.  This way, by adding your user's bin folder to any other user's PATH (including or perhaps especially root's) these tools can be accessed gobally by any user -- very similar to a global installation but with none of the dangers involved in writing files into the main system.<br />
<br />
But this is not a replacement for the symlink-ed installers used in the beginning of this blog.<br />
<br />
For most of the tools, especially stuff you are likely to modify from time to time, the 'new.symlink' installatin is better.  Especially when we get into compiled applications.<br />
<br />
[See recommended src paths in first blog post or thereabouts.]<br />
<br />
<b>Let's not assume we understand this tool after simply running a demo.  Here's a challenge to encourage you to do some of your own experimenting in a 'sandbox'.</b><br />
<br />
How would you create makefile functions to duplicate the installation of some of the other tools, with sources in folders below ~/bin and the executables symlinked into the ~/bin folder.<br />
<br />
Hint: rpm uses scripts 'pre' and 'postun', and debian uses triggers, and pre/post funcs for both installation and uninstallation.  This make-based installer/uninstaller system has neither (yet) ;-).<br />
<br />
Happy installing.  And remember the TABs must be real TABs in the body of a makefile or you'll get 'seperator' error messages.  Also env var names must be enclosed in parens in makefiles.  And '@' signs before shell commands suppress echoing the output to the terminal.  <br />
<br />
And that should be enough to get started.<br />
  <br />
:-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34396</guid>
		</item>
		<item>
			<title>A make-based #1 (alpha) install/uninstall system for binary packages with rollback.</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34395</link>
			<pubDate>Sat, 21 Jan 2012 10:41:23 GMT</pubDate>
			<description>A make-based #1 (alpha) install/uninstall system for binary packages with rollback. 
 
Features: 
* Generates lists of dirs, files, and links. 
*...</description>
			<content:encoded><![CDATA[<div>A make-based #1 (alpha) install/uninstall system for binary packages with rollback.<br />
<br />
Features:<ul><li>Generates lists of dirs, files, and links.</li>
<li>Capable of rolling back files overwritten by the installation after test/uninstall.</li>
<li>Creates a base TREE of files that can be used to create RPM slackware, or DEB packages.</li>
</ul>Misfeatures:<ul><li>Still under development.  There may be a bug hiding in it somewhere (see below).</li>
</ul><blockquote><b>WARNING: EXPERIMENTAL</b><br />
<br />
Approach some of these experiments (especially those involving root privileges) as a mountain climber approaches a steep incline.  <br />
<br />
Always have a fallback position.  Never get over confident.  Make at least one backup you can live with.<br />
<br />
I have used this utility very extensively (probably at least 50-60 times) and it's only messed up on me twice.<br />
<br />
But boy did it mess up one of those times.<br />
<br />
One time it messed up, but not due to the utility itself.  I created a desktop file with a bad &quot;Categories&quot; line that caused very unexpected errors in other gui apps, from ConsoleKit and symptoms like being unable to read a file to being unable mount non-removable drives (?) which worked itself out through a couple of reboots somehow, to a crash in a 3d-cad program I was playing with (kde3 kgraphics-3d) which finally gave me the clues when I ran it from a commandline.<br />
<br />
It said: &quot;missing '=' in Categories&quot;<br />
<br />
Aha!  One of my own make-based creations, no doubt.  ;-)  [And it was.]<br />
<br />
I created it with this utility, corrected the file in the TREE (you'll see what I mean), reinstalled, and the problem went away.<br />
<br />
It's also the utility that fixed it very easily because the files are not packed up and inaccessible here.<br />
<br />
But what good is a warning with no &quot;examples&quot;?  So we'll count that as one of the times it messed up.<br />
<br />
The other time it messed up and with no redeeming qualities is when I compiled ALL of qt4 with missing demos and examples and tried to install it on kubuntu with this utility.  This, I fear was a real bug.  I know a couple of places to check out but haven't had an opportunity (nor the need) to yet.<br />
<br />
It should be noted that the qt4 installation was more than 17,000 files, took 4 hours to compile, had to be installed into a dummy folder &quot;UsR' (later corrected so rpaths were right, etc.) and the default directories (in the download from nokia) do NOT match those needed by kubuntu.  Also kubuntu uses symlinks for certain folders that I might not have copied correctly.  All of this adding to the likelihood of an error occurring somewhere along the line.  <br />
<br />
Moreover, qt4 was running while I was installing/uninstalling.  That is, I was modifying files and libs that were currently in use.<br />
<br />
But since it didn't &quot;roll back&quot; properly, this bug we truly do own.<br />
<br />
And so for this reason this utility comes with a great big warning. :-)<br />
<br />
But for simple apps and libs and quick testing it is very handy and appears to be quite safe, but you are advised that this is not an application for the novice or the timid.  If you get in trouble you'll need to learn how to get back out of it on your own, my fellow mountain climbers.<br />
</blockquote>Ready?<br />
<br />
This is actually kind of cool.<br />
<br />
There's one README, 5 executables (4 called from the makefile) and a Makefile.<br />
<br />
file: README (plain text)<br />
purpose: info<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">Precompiled binary installer/uninstaller using make.

See the WARNING at the bottom.

* The hard part:

Create a directory named TREE and load it with the files you want to make into a binary package.

Use 'make init' to make the data files.

Edit dirs.dat to remove dirs not created by the installer.  No harm 
done if you don't edit it most times, but if for example you install
into /usr/local/bin and there is nothing there when you uninstall then
the bin folder will be removed by the uninstaller and some configured
compile jobs (not this utility) don't actually recreate that folder 
first so be aware of that possibility.  

If the dirs are not empty (for any reason) they won't be uninstalled.

Make sure the prefix is set correctly for installing the files.  
That if your TREE of files is for in TREE/usr/local your prefix is 
/ (root).  If it's TREE/local, your prefix is /usr, and so forth.

The installer will attempt to back up any existing files before 
installing but you can backup manually as well. See TO BACKUP below.
If you don't want to back anything up, create an empty folder named
bak/00 and tar it up as bak/00.tar.gz.  If no files with the same
names as the newly installed ones exist, that is what the install
will do as well.

Only the first backup is set to be restored on uninstallation and 
if there is nothing in the bak/00.tar.gz file nothing will be 
restored.


* The easy part:

TO BACKUP: 
  command: make backup

  Once you have the dat files, you can make incremental backups from
  the system using 'make backup'.  If there are no files in the system
  yet, no harm done.  But if there are, the first backup may be used
  to restore the original state.

  [This is normally done automatically the first time you install in
  order to allow rolling back to the initial state.]

  Requires superuser for system backups.


TO IMPORT:
  command: make import

  If you have a file list and a list of symlinks you can put those
  lists into files.dat and links.dat and run 'make import' to get
  copies of those files from the system folders.  Do not list dirs 
  in those files or loaded dirs will get copied into the tree.

  This can be useful, for example, if you make edits in the source 
  code and and install from a configured 'make' and want to update 
  the TREE those files.  

  NOTE: if you ADD any files this way, they must be added to the dat 
  files as well or they won't get imported into the TREE.

  May superuser for system imports.


TO RESTORE:
  command: make restore

  This attempts to copy restored files (if any existed) back to their 
  original locations.  It does not remove new files, so in general,
  this would follow an 'uninstall'.

  Requires superuser for system files.
  

TO RELOCATE:  
  This is risky.

  Change PREFIX in the Makefile if you can't recompile with the new
  prefix. (and cross your fingers).  

  WARNING: Relocation WILL change the files necessary for restoring 
  so that the initial backup, if it exists, may no longer be valid.

  command: make install (after manual changes set as per above)

-------------------------------------------------------------------


Tips:

  IMPORTING CMAKE-ed INSTALLATIONS:
 
  To create a binary installer from a CMake-ed installation copy
  the files list from the cmake-generated 'install_manifest.txt' 
  into links.dat and create or empty the 'dirs.dat' and 'files.dat'
  files and run 'make import' as superuser.

  [The reason for using links.dat for the files list instead of 
  files.dat is because it will import copying attributes, including 
  symlinks whereas files.dat may cause linked files to copy over as 
  full sized files.  Other than that, the imports from both files.dat
  and links.dat are identical.  But again, do NOT include dirs in those
  files or the entire directory will be imported, even if it's loaded
  with previously existing files.]

  Then regenerate the dat files with 'make init'.

WARNING:

  In general, don't set prefix to root unless you're confident that your
  installation doesn't mess up any global configuration files.

  Keep backups.  The restore function works but if something goes wrong, 
  make sure you have a fallback you can live with.

  License = GPL.  No warrantees.  Be very careful when installing into
  root, and things should go reasonably well.  :-)</pre>
</div>file: bak-tgz.exec (executable, clickable)<br />
purpose: Brute force full numbered backups of current folder and TREE for keeping 'versions' while testing/debugging.  Not part of make backup/restore<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">#!/bin/sh
cd `dirname &quot;$0&quot;`

CURDIR=`pwd`

#echo $CURDIR
#read key

NENTRIES=01

mkdir bak 2&gt;/dev/null

if ! ls bak/* 2&gt;/dev/null 
then
   NENTRIES=00
fi


for i in bak/*
do
    let NENTRIES=NENTRIES+1
done

#echo $NENTRIES
#read key

if [ $NENTRIES -lt 10 ]
then
echo &quot;doing...&quot;
    NENTRIES=0$NENTRIES
fi

NEWDIR=bak/$NENTRIES

#echo $NEWDIR
#read key

rm *~
rm */*~
rm */*/*~
rm */*/*/*~
rm */*/*/*/*~


mkdir $NEWDIR

cp -f -t $NEWDIR *
cp -r -t $NEWDIR TREE/

DIRLIST=`ls $NEWDIR`
cd bak

MSG=&quot;Creating backup '$NEWDIR.tgz'
---------------------------------------
$DIRLIST&quot;

#if ! msgBox &quot;$MSG&quot;;then
#    kdialog --msgbox &quot;$MSG&quot;
#fi
xmessage -default &quot;okay&quot; -center &quot;$MSG&quot;

# old code, feel free to fix it. -rs
pack_tgz()
{
  for i in $1
  do
    # remove if has trailing slash
    local name=`echo $i | sed 's|\/$||'` 
    if ! tar -c &quot;$name&quot; | gzip &gt; $name.tgz ;then
      return 1
    fi
    if test -e $name.tgz; then
        rm -r &quot;$name&quot;
    else
        return 1
    fi
    exit ## only do first match if wildcard used
  done
}

pack_tgz $NENTRIES</pre>
</div>file: mk_backup (executable disabled for direct use)<br />
purpose: called automatically for first rollback fileset<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">#!/bin/sh
cd `dirname &quot;$0&quot;`

if [ &quot;$1&quot; == &quot;initial&quot; ];then
  if [ -e backup/01.tar.gz ];then
    echo &quot;  
  [Initial backup (backup/01.tar.gz) exists.]
  Continuing installation, please wait...
  &quot;
    exit
  fi
  echo &quot;
  Creating initial backup of any files that would be overwritten by
  the installation (if any).
  &quot;
  mk_backup working
  echo &quot;
  Continuing installation, please wait...
  &quot;
  exit
fi


if [ &quot;$1&quot; != &quot;working&quot; ];then
  echo &quot;
  Only run this from the makefile as 'make &lt;app&gt;' where &lt;app&gt;
  is the name of the function minus the 'mk_' prefix

  Press ENTER to abort now.
  &quot;
  read key; exit
  
fi

echo &quot;Please wait...&quot;


bp()
{
  echo $1
  read key
}

CURDIR=`pwd`

NENTRIES=01

mkdir backup 2&gt;/dev/null

#bp 1

if ! ls backup/* &gt;/dev/null 2&gt;&amp;1
then
   NENTRIES=00
fi

for i in backup/*
do
    let NENTRIES=NENTRIES+1
done

if [ $NENTRIES -lt 10 ]
then
#echo &quot;doing...&quot;
    NENTRIES=0$NENTRIES
fi

#bp 2

NEWDIR=backup/$NENTRIES

mkdir $NEWDIR

#bp 3

for i in $(&lt;files.dat); do
  cp -f --parents $PREFIX/$i $NEWDIR/ 2&gt;/dev/null
done

#bp 4

for i in $(&lt;links.dat); do
  cp -f --no-dereference --parents $PREFIX/$i $NEWDIR/ 2&gt;/dev/null
done

#bp 5

DIRLIST=`ls $NEWDIR`
cd backup

MSG=&quot;Creating backup '$NEWDIR.tgz'
---------------------------------------
$DIRLIST&quot;

#if ! msgBox &quot;$MSG&quot;;then
#    kdialog --msgbox &quot;$MSG&quot;
#fi
xmessage -default &quot;okay&quot; -center &quot;$MSG&quot;

#bp 6

#pack-tgz $NENTRIES
tar czf $NENTRIES.tar.gz $NENTRIES

# in case being run as su, only change owner, not group
chown -R $USER $NENTRIES 

#bp 7

rm -r $NENTRIES
cd ..
chown $USER:users -R backup

echo &quot;Done.
 &quot;</pre>
</div>file: mk_import (executable disabled for direct use)<br />
purpose: loads TREE from files currently in the system (See tips in README)<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">#!/bin/sh
cd `dirname &quot;$0&quot;`
HERE=$PWD

if [ &quot;$1&quot; != &quot;working&quot; ];then
  echo &quot;
  Only run this from the makefile as 'make &lt;app&gt;' where &lt;app&gt;
  is the name of the function minus the 'mk_' prefix

  Press ENTER to abort now.
  &quot;
  read key; exit
  
fi

if ls -d TREE/* &gt;/dev/null 2&gt;&amp;1; then
  echo &quot;
  Move or remove the existing TREE files before importing new
  ones.
  Aborting now.
  &quot;
  exit
fi

echo &quot;Please wait...&quot;

bp()
{
  echo $1
  read key
}


# bp 1

mkdir -p TREE 

# only copy non-dirs
for i in $(&lt;files.dat); do
  d=`find $i -type d`
  if [ &quot;$d&quot; == &quot;&quot; ]; then
  cp -r --parents $PREFIX/$i TREE/ &gt;/dev/null 2&gt;&amp;1
  fi
done

# bp 2

# only copy non-dirs
for i in $(&lt;links.dat); do 
  d=`find $i -type d`
  if [ &quot;$d&quot; == &quot;&quot; ]; then
  cp -r --no-dereference --parents $PREFIX/$i TREE/ &gt;/dev/null 2&gt;&amp;1
  fi
done

# bp 3

for i in $(&lt;remove.dat); do
remove_path=`dirname $i`
mkdir -p $PREFIX/$remove_path
echo &quot;removed&quot; &gt; TREE/$PREFIX/$i
done

# in case being run as su, change owner, not the group

echo &quot;Done.

  Move imported files relative to TREE=PREFIX in your Makefile
 &quot;</pre>
</div>file: mk_init (executable disabled for direct use)<br />
purpose: Create dirs, links, and files (*.dat) used for install/uninstall, etc.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">#!/bin/sh
cd `dirname &quot;$0&quot;`
HERE=$PWD

if [ &quot;$1&quot; != &quot;working&quot; ];then
  echo &quot;
  Only run this from the makefile as 'make &lt;app&gt;' where &lt;app&gt;
  is the name of the function minus the 'mk_' part of the name.

  Press ENTER to abort now.
  &quot;
  read key; exit
  
fi

init_dat()
{
  local SELF_DIR=$PWD
  # running as root is ok, but not necessary here unless your
  # permissions on /usr/sbin are too restrictive

  if ! find TREE/* -type d &gt;/dev/null 2&gt;&amp;1; then
    echo &quot;
  Need at least one populated directory TREE folder in order init.
  Press ENTER to abort.
    &quot;
    mkdir -p $SELF_DIR/TREE
    printf &quot;&quot; &gt;&gt; files.dat
    printf &quot;&quot; &gt;&gt; links.dat
    printf &quot;&quot; &gt;&gt; dirs.dat
    printf &quot;&quot; &gt;&gt; remove.dat
    chown $USER:users TREE 
    read key
    return 
  fi

  cd TREE
  
  find * -type f &gt; ../files.dat 2&gt;/dev/null || true
  find * -type l &gt; ../links.dat 2&gt;/dev/null || true

  # we want the list of dirs in reverse order so a simple rmdir
  # on empty dirs will work up the chain removing the more distant
  # ones first.
  find * -type d | sort -r &gt; ../dirs.dat

  # in case we need to remove any old files when installing
  echo &gt; ../remove.dat

  chown -R $USER:users ../*.dat
  cd $SELF_DIR
}

init_dat 

echo &quot;Done.
 &quot;</pre>
</div>file: mk_restore (executable disabled for direct use)<br />
purpose: roll back to original fileset (#01) in 'backups' folder<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">#!/bin/sh
cd `dirname &quot;$0&quot;`
HERE=$PWD

if [ &quot;$1&quot; != &quot;working&quot; ];then
  echo &quot;
  Only run this from the makefile as 'make &lt;app&gt;' where &lt;app&gt;
  is the name of the function minus the 'mk_' part of the name.

  Press ENTER to abort now.
  &quot;
  read key; exit
  
fi

if [ ! -e backup/01.tar.gz ];then
  echo &quot;
  Can't find backup # 01.tar.gz in 'backup' folder, can't restore.
  Not restoring old files.  Press ENTER to continue  
  &quot;
  read key
  exit
fi

echo &quot;Please wait...&quot;


bp()
{
  echo $1
  read key
}


cd backup
tar -xzf 01.tar.gz
if [ ! -e 01 ];then
  echo &quot;ERROR: Can't extract backup/01.tar.gz -&gt; 01 initial backup files&quot;
  read key
  exit
fi


if ls 01/* &gt;/dev/null 2&gt;&amp;1; then
  cp -rf 01/* /
  rm -r 01
fi
 
echo &quot;Done.
 &quot;</pre>
</div><br />
file: Makefile<br />
purpose: Install, uninstall, and rollback (restore).<br />
<br />
<b>NOTICE: If your editor doesn't reproduce the TABs correctly, you'll need to recreate them as TABS.  Every leading space below the &quot;all:&quot; line should be a real, honest to goodness TAB or 'make' will complain about missing 'separator's.</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto"># PREFIX must be 'export'ed for subfunctions executed in scripts

export PREFIX=NOPREFIX

all: prefix-check tree-check init-check
	@printf &quot;\nBinary package, already built. Ready to install.\n\n&quot;

install: prefix-check
	@mkdir -p $(PREFIX)
	@mk_backup initial
	@cd TREE &amp;&amp; for i in $$(&lt;../files.dat); do cp --parents $$i $(PREFIX); done
	@cd TREE &amp;&amp; for i in $$(&lt;../links.dat); do cp  --parents --no-dereference $$i $(PREFIX); done
	@for i in $$(&lt;remove.dat); do rm $(PREFIX)/$$i; done
	@echo &quot;Install done&quot;
	@echo

uninstall: prefix-check force
	@for i in $$(&lt;files.dat); do rm -f $(PREFIX)/$$i ; done
	@for i in $$(&lt;links.dat); do rm -f $(PREFIX)/$$i ; done
	@for i in $$(&lt;dirs.dat); do rmdir --ignore-fail-on-non-empty  $(PREFIX)/$$i &gt;/dev/null 2&gt;&amp;1; done
	@echo
	@echo &quot;*******************************************************&quot;
	@echo &quot;*** Run 'make restore' if you have backups you need ***&quot;
	@echo &quot;*** to restore at this time                         ***&quot;
	@echo &quot;*******************************************************&quot;
	@echo

clean:
	@rm -f *~ */*~ */*/*~ */*/*/*~ */*/*/*/*~

prefix-check: force
	@if [ &quot;_&quot;$(PREFIX) == &quot;_NOPREFIX&quot; ] || [ &quot;_&quot;$(PREFIX) == &quot;_&quot; ] ; then \
	printf &quot;\nError: Prefix not set in Makefile yet\n\n&quot;; false; else true; \
	fi


tree-check:
	@if ! ls TREE/* &gt;/dev/null 2&gt;&amp;1; then printf &quot;\nError: No files in TREE yet.\n\n&quot;; false; else true; fi

init-check:
	@if [ ! -e dirs.dat ] || [ ! -e files.dat ] || [ ! -e links.dat ]; then \
	echo; \
	echo &quot;ERROR: Missing dat files.&quot;; \
	echo &quot;Use 'make init' to create a default set&quot;; \
	echo; \
	false; else true ; \
	fi

distclean: clean

import: files.dat links.dat dirs.dat prefix-check
	./mk_import working

backup: files.dat links.dat dirs.dat prefix-check force
	./mk_backup working

restore: prefix-check force
	./mk_restore working

files.dat links.dat dirs.dat:
	@echo
	@echo &quot;Can't find dat files.  See README&quot;
	@echo

init:
	@echo
	@echo &quot;Creating default set of dat files&quot;
	@echo &quot;Recommend editing dirs.dat to remove system dirs, just in case.&quot;
	@echo &quot;See README&quot;
	@echo
	./mk_init working &gt;/dev/null

force:</pre>
</div>Copy the files, set the appropriate perms and tar those files up for now so the 'virgin' set can be used until we have a smart 'new.make' utility to do this for us (without overwriting existing files).<br />
<br />
Next let's take it on a test flight in our own HOME folder.<br />
<br />
Then let's try to make a new menu icon we can install and uninstall out there in the &quot;real world&quot; where things can sometimes get quite hairy.<br />
<br />
Stay tuned!  :-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34395</guid>
		</item>
		<item>
			<title>Enable X sharing on ubuntu</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34394</link>
			<pubDate>Sat, 21 Jan 2012 05:21:12 GMT</pubDate>
			<description><![CDATA[Normally Ubuntu doesn't allow X server to listen on any port.To enable X server listen on port 6000 edit /etc/gdm/custom.conf 
and add  
 
Code:...]]></description>
			<content:encoded><![CDATA[<div>Normally Ubuntu doesn't allow X server to listen on any port.To enable X server listen on port 6000 edit /etc/gdm/custom.conf<br />
and add <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">[security]
DisallowTCP=false</pre>
</div>finally restart.Still you can't user X server from outside because it has kind of firewall on it.To disable fire wall run <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">xhost +</pre>
</div>in terminal.Now the X server is available for outside access.The above command xhost + will disable entire firewall so there is a security risk if your machine is in a network.read xhost man for more accurate configurations.</div>

]]></content:encoded>
			<dc:creator>kavinga</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34394</guid>
		</item>
		<item>
			<title>More Mad Computer Science? (Simple multi-threading in a shell script)</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34393</link>
			<pubDate>Fri, 20 Jan 2012 15:02:52 GMT</pubDate>
			<description><![CDATA[Just dropping by?  Here's an easy one.  And it's kind of fun. 
 
We've already created a launch utility in this blog, but let's create one that works...]]></description>
			<content:encoded><![CDATA[<div>Just dropping by?  Here's an easy one.  And it's kind of fun.<br />
<br />
We've already created a launch utility in this blog, but let's create one that works on other folks systems so they don't need to &quot;install&quot; (so to speak) anything to get the benefits of the functionality.<br />
<br />
<b>First let's look at the principles involved</b><br />
<br />
Let's read fstab as a normal user.  Don't 'su' or 'sudo su' here, because we don't actually want to be able to write to it.  Just picking on that file because everyone has it.<br />
<br />
Compare <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">kshell4 kwrite /etc/fstab</pre>
</div>to<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">nohup kwrite /etc/fstab &gt;/dev/null 2&gt;&amp;1 &amp;</pre>
</div>[Use 'kate -n' instead of kwrite if you like.  For goodness sakes even use gedit.  :-) ]<br />
<br />
The advantage in using the second version is that it will work for other window managers besides kde.  It's straight Linux and the effect is identical for all practical purposes.<br />
<br />
The disadvantage is that it's a bit more code to write.  And for that alone the kde version is worth being aware of.  The 14K (file size) has already been committed and if you KNOW your recipients have kde, you can easily use that instead.<br />
<br />
And either one can be incorporated in a newly created launcher for an application which will, in essence, run another application in a new thread, disconnected from the app that launched it.<br />
<blockquote><i>WARNING: This CAN be dangerous in that if you have an endless loop in the &quot;launched&quot; application, especially if that application was set off as superuser and you have closed the terminal or you run it from a clickable app) because in a single-core system, that loop can hog so much cpu time that you probably won't be able to close it any time real soon.  Time for Ye Olde Reset Button, know what I mean?<br />
<br />
This can happen in any app, of course, but with a terminal and with the usual stdio connections you can hit Ctrl-C to stop the madness.  In this arrangement Ctrl-C has no effect.<br />
<br />
So make sure you test your code before sharing it with your friends.<br />
</i></blockquote>That should suffice for the common sense and the warning.  :-)<br />
<br />
Now...<br />
<br />
Let's say we want to create an application that shows a popup for a few seconds but that doesn't hang around doing nothing while it's showing.<br />
<br />
That program can easily write a NEW program (the launcher) to run the popup and clean up (remove the new program) when it's done.<br />
<br />
Sounds difficult?<br />
<br />
You might be surprised.<br />
<br />
file: test.exec (set permissions += executable)<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">#!/bin/sh
# Click on this file to run it

# Copy the text that follows to the launcher file
cat &lt;&lt; _EOF &gt; ~/.launcher
#!/bin/sh
# this is a temporary launcher for a test. -rainbow sally
nohup &quot;\$@&quot; &gt;/dev/null 2&gt;&amp;1 &amp;
_EOF

# change perms to make it executable
chmod +x ~/.launcher

# run it to show a popup for three seconds and start a timeout for
# 4 seconds.  The four second timeout is to simulate actually doing 
# some task that takes a bit longer than the popup shows.

msg=&quot;
  Hang on, we're pretending to do 
  some work around here... 
  &quot;

~/.launcher kdialog -passivepopup &quot;$msg&quot; 3

# now while that's running we timeout for 4 seconds.
sleep 4

# and report the good news... done at long-last.
kdialog -msgbox &quot;
  All done!
  That will be 55 dollars and 35 cents, please.
  &quot;

# this cleanup can be done at any time after the launcher has been called.
rm ~/.launcher</pre>
</div>A more practical application might be to use the popup to display something like &quot;&lt;AppName&gt;: Working... Please wait&quot; while the main thread is aleady busy doing whatever it needs to do behind the scenes.<br />
<br />
ALSO: Consider xmessage for the popup messages too.  Xmessage is common to all X systems, which include everything from WindowMaker to LXDE, fluxbox, xfce, iceWM, Gnome, to who knows what all.<br />
<br />
.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34393</guid>
		</item>
		<item>
			<title>Computer Mad Science: Classic Style KDE Menu (Shows That We CAN...)</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34392</link>
			<pubDate>Fri, 20 Jan 2012 09:35:44 GMT</pubDate>
			<description><![CDATA[Computer Mad Science: Classic Style KDE Menu (Shows That We CAN...) 
 
I don't necessarily think the old menu style is better than the new one, but...]]></description>
			<content:encoded><![CDATA[<div>Computer Mad Science: Classic Style KDE Menu (Shows That We CAN...)<br />
<br />
I don't necessarily think the old menu style is better than the new one, but what if I wanted a screen shot that showed that we can create retro apps and &quot;reto&quot;fit them into the KDE menus, with a proper (and perhaps new) heirarchy so we can run them from either style menu.<br />
<br />
First let's take a look at the Science/Mathematics/XMaxima menu as it appears  in the old-style menus.<br />
<br />
<a href="http://rainbowsally.net/pub/old-menu.jpeg" target="_blank">http://rainbowsally.net/pub/old-menu.jpeg</a><br />
<br />
This clearly shows the menu heirarchy which is not so visible in the new KDE menus.<br />
<br />
XMaxima is NOT a KDE application.  If anything it's an X or a tcl/tk application.<br />
<br />
It's compiled from scratch and the icons and menus are all added for KDE by creating icons and desktop files that contain all the info KDE needs to construct the menus.<br />
<br />
But for our present purposes...<br />
<br />
Let's take a peek at how to switch to the &quot;Classic Menu&quot; style if you have no right-click selection on your main menu to do that for you.  (On my current system, only root has this ability.)<br />
<br />
What's Going On Under The Hood<br />
<br />
Understand that most or all of your KDE settings are stored in the /var folders until the session closes, as which time the items in your folder are updated.  (On Kubuntu, at least at times, it seems that a full reboot is required, not just a logout/login.)<br />
<br />
And we don't want to do ANY &quot;superuser&quot; stuff yet.  Not until we get our feet wet with some relatively safe experiments.  So let's see how we can manually change an item in the hidden folders in our HOME which is analogous to the Windows Registry, but is MUCH less dangerous to mess with!  <br />
<br />
[For one, even if you bolixed up your whole HOME folder, the system would still boot, other users could still login and run and they'd never notice your HOME was haywire. Not so with the Windows registry, but...  <b>FOR THIS REASON, TURNING *OFF* AUTOMATIC LOGIN IS HIGHLE RECOMMENDED</b>, for the intrepid experimenter.  ...And maybe even any-old-body.  If you auto-login to a busted HOME, you're pretty much stuck in an endless dysfunctional loop until you find a way in that won't try to go into that HOME folder with the busted window manager(s) settings.  This can really bite you in openSUSE. fpr example, if you use LXDE to change certain desktop settings and then login with kde. You MIGHT have to reinstall. (Clue: &quot;compiz&quot; is the <b>WRONG</b> window manager for kde.)]<br />
<br />
The file we want to modify for our experiment in &quot;Computer Mad Science&quot; is in this folder.<br />
<br />
~/.kde4/share<br />
<br />
With the utilities created so far in this blog we could type <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">browse ~/.kde4</pre>
</div>to open the folder in konqueror (or???) and then copy the entire 'share' folder to 'share-bak'.<br />
<br />
The exact file we want to modify is in<br />
~/.kde4/share/config<br />
<br />
The name of the file is<br />
plasma-desktop-appletsrc<br />
<br />
Browse into the config folder and look around to get your bearings and then open that file and look for this line:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">plugin=launcher</pre>
</div>We'll change that to<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">plugin=simplelauncher</pre>
</div>&quot;Simple&quot;, no?  :-)<br />
<br />
There are several ways to set this as the current config, but for now let's try changing that and then logging in in a second session (to use the new setting) and the close the previous session, to &quot;set&quot; the new one.<br />
<br />
Here's the steps involved.<br />
<blockquote>Lock the Screen.<br />
Switch user.<br />
Login as the same user again.<br />
Verify that the menu is now the &quot;Classic Style&quot;.<br />
</blockquote>You can switch back and forth between these two sessions with the Alt-Ctrl-F7 and Alt-Ctrl-F8 keys.<br />
<br />
[Careful here!  Pay attention to what these keys do so you don't try this with a non-existent session and get stuck in a terminal you can't get out of without rebooting or playing complicated games with various runlevels.]<br />
<br />
If you want to keep the Classic Style menu, switch to the first session and log out of it.<br />
<br />
If you want to revert, log out of the new session instead, and undo the changes to that file (if that's even necessary).<br />
<br />
-----------------------<br />
Note: There was a way to force kde to reparse and load the system configs in kde3 using dcop <br />
calls but I haven't tried this or looked into it yet for kde4.<br />
<br />
Does kde4 even have 'dcop' calls anymore?<br />
<br />
If anyone knows the magical incantation for kde4, feel free to post it here.  <br />
<br />
:-)</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34392</guid>
		</item>
		<item>
			<title><![CDATA[KDE Utils: new.image <format>]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34391</link>
			<pubDate>Fri, 20 Jan 2012 04:21:28 GMT</pubDate>
			<description><![CDATA[More 'new' funcs for KDE.  Most of these will work with other Window managers but some rely on KDE gui apps so we'll call these KDE utilities. 
...]]></description>
			<content:encoded><![CDATA[<div>More 'new' funcs for KDE.  Most of these will work with other Window managers but some rely on KDE gui apps so we'll call these KDE utilities.<br />
<br />
<div align="center">--------------------</div><blockquote>These posts may also be of interest or may fill in some blanks if any of this post seems to be missing some pieces.<br />
<br />
Personal HOME/bin installer/uninstaller, no superuser req'd here and reason for 'new(dot)' file (or file set) creation:<br />
<a href="http://www.linuxquestions.org/questions/blog/rainbowsally-615861/kde-utils-new-symlink-launch-edit-browse-tofile-34376/">http://www.linuxquestions.org/questi...-tofile-34376/</a><br />
<br />
Desktop terminal here:<br />
<a href="http://www.linuxquestions.org/questions/linux-software-2/need-to-regain-lost-functionality-re-new-kdes-923826-post4575942/?highlight=konsole.exec#post4575942">http://www.linuxquestions.org/questi...ec#post4575942</a><br />
<br />
Possibly also &quot;Let's Go Retro Now&quot; (better kolourpaint if you need it) here:<br />
<a href="http://www.linuxquestions.org/questions/blog/rainbowsally-615861/lets-go-retro-now-everybodys-learning-how-34378/">http://www.linuxquestions.org/questi...ing-how-34378/</a><br />
</blockquote><div align="center">--------------------</div><br />
How do we create a new image in the current directory?  We don't have a right-click menu item for generating these, so let's make a next best, or better option.<br />
<br />
I'll put this utility here for reasons explained in previous posts.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto">HOME/bin/src/new-image
                +-- new.image (executable)
                +-- img-formats (formats we will be able to list &amp; generate)
                      +-- template files</pre>
</div>Here's the help/usage text.<br />
<br />
file: &lt;path&gt;/new-image/new-image.txt<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 194px;
		text-align: left;
		overflow: auto">Usage:
  new.image [ &lt;name.ext&gt; | --help ]
  
  Creates a new 32x32 image file named &lt;name.ext&gt; of a type determined by
  &lt;ext&gt;.  
  
  To see a list of file types available type 
    new.image --types
  
  To see this help type
    new.image --help</pre>
</div>The advantage of doing the help/usage display this way (as a regular text file) is that what you see is what is displayed when the --help switch is invoked.  The disadvantage is that you can't use env vars to pass string variables around such as the app name, version, paths, etc.<br />
<br />
Here's the application.<br />
file: &lt;path&gt;/new-image/new.image (that's a dot in the filename)<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">#!/bin/sh

HERE=$PWD

APPPATH=`readlink &quot;$0&quot;`
if [ &quot;$APPPATH&quot; = &quot;&quot; ]; then
  APPPATH=&quot;$0&quot;
fi

THERE=`dirname &quot;$APPPATH&quot;`

FMTLIST=

cd $THERE
for i in `ls img-formats/a.*`; do
  FMTLIST=`printf &quot;%s\n%s&quot; &quot;$FMTLIST&quot; &quot;$i&quot; | sed '/^$/d; s|^.*/a\.||;'&quot;  &quot;`
done
cd $HERE

print_types()
{
echo &quot;
Available image formats:

$FMT
&quot;
}

print_usage()
{
echo &quot;
Usage:
  new.image [ &lt;name.ext&gt; | --help ]
  
  Creates a new 32x32 image file named &lt;name.ext&gt; of a type determined by
  &lt;ext&gt;.  
  
  To see a list of file types available type 
    new.image --types
  
  To see this help type
    new.image --help   
&quot;
}

if [ &quot;$1&quot; = &quot;&quot; ]; then
  print_usage
elif [ &quot;$1&quot; = &quot;--help&quot; ]; then
  print_usage
elif [ &quot;$1&quot; = &quot;--types&quot; ]; then
  print_types
else
  EXT=`echo &quot;$1&quot; | sed 's|^.*\.||'`
  cp $THERE/img-formats/a.$EXT $HERE/$1
fi</pre>
</div>I use the generic /bin/sh to call my shell.  If you use kubuntu, this shell is DASH by default, but that will cause you all kinds of problems, especially if you ever try to compile anything, so we assume that sh --&gt; bash in these posts.  <br />
<br />
Or if you insist you can change the /bin/sh line to /bin/bash.<br />
<br />
Whatever works.<br />
<br />
The file above needs to be made executable and symlinked into your path.  See 'new.symlink' in previous posts and notes on installation/uninstallation if this seems odd to you.  ;-)<br />
<br />
To install it cd to the directory containing the executable and type.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">new.symlink new.image ~/bin</pre>
</div>as per the other utilities.<br />
<br />
Now we need the first image.  Let's make it a blank 32x32 pixel image such as might be used in a menu, or just for a seed to begin creating a new image with a spraycan or whatever your favorite art tools may be.<br />
<br />
Create the 'img-formats' directory under the containing folder and add this.<br />
<br />
file: &lt;path&gt;/new-image/img-formats/a.xpm<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">/* XPM */
static char *dummy[]={
&quot;32 32 1 1&quot;,
&quot;. c #ffffff&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;,
&quot;................................&quot;};</pre>
</div>Once created, you can open the file with an image editor such as kolourpaint (see &quot;Let's Go Retro Now&quot; post if you need a kolourpaint that works better than what you may have) and 'save as' any format you wish to be able to generate.<br />
<br />
To test, open a terminal on your Desktop (such as the one shown in the links at the top which WILL open on your Desktop) and type<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">new.image --types</pre>
</div>Each format you've created should be listed.  Let's assume you have made yourself a 'png' template using 'save as' and selecting 'png'.<br />
<br />
Type <br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">new.image png</pre>
</div>And the png file names 'a.png' should appear on your desktop.<br />
<br />
The svg format used by inkscape is a bit trickeir because it may be a collection of images that are linked into the svg file with absolute paths so it needs a bit of processing to make the svg file and files it references relocatable.<br />
<br />
We'll do that &quot;tricky&quot; svg format a bit later.<br />
<br />
[Note: This HOME/bin repository of scripts and programs we are building can be viewed in your 'edit'or and, as a set of tested/working snippets, may save you a lot of time when creating other applications.]<br />
<br />
.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34391</guid>
		</item>
		<item>
			<title>Creating special devices to solve problems</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34390</link>
			<pubDate>Thu, 19 Jan 2012 21:53:49 GMT</pubDate>
			<description><![CDATA[With tax season coming up I have been asked to set up a certain centralized tax service for a company.  I won't mention the company nor the well...]]></description>
			<content:encoded><![CDATA[<div>With tax season coming up I have been asked to set up a certain centralized tax service for a company.  I won't mention the company nor the well known tax program involved as this post isn't about flaming a product but just to show you how cool commands in Linux can be used to solve, what would originally seem like, complicated problems.<br />
<br />
Here's the scenario.  The software runs on JBoss (a java app server) and it has log output.  During client testing with fake social security numbers I noticed that they were getting output into the log.  For security purposes this is unacceptable.  After thinking for a while the solution I came up with was this... I want to output the log into /dev/null.  But how?  How indeed, and here's what I did.<br />
<br />
I remember that the mknod command is used for special devices so I looked at the man documentation.<br />
<br />
The relevant portions of the man page are...<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 146px;
		text-align: left;
		overflow: auto">--- *snip* ---
SYNOPSIS
       mknod [OPTION]... NAME TYPE [MAJOR MINOR]

DESCRIPTION
--- *snip* ---
       c, u   create a character (unbuffered) special file
--- *snip* ---</pre>
</div>Now let's look at the file listing for /dev/null.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">$ ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 2012-01-12 10:12 /dev/null</pre>
</div>The first character in the permissions is the filetype.  Normally you see d for directory, - for file, or l for a symbolic link as an example.  Here specifically it is a character special file.<br />
<br />
Also notice the &quot;1, 3&quot; in the file listing.  Those are the device special major and minor numbers.  I'm not sure where there's a list of all of the different types of numbers but if you know please post in the comments.  Here though we basically know how we want the file to behave and had a file we could analyze to get the major and minor numbers so that mknod knows what kind of special device we're creating.<br />
<br />
So now I just go to where the log file is outputting and create a null special device in the file name where the log name would normally be.  Let's say, hypothetically, that our offending log output file is located at /opt/jboss/log/program.log.  Here's the commands to create the special device and match it be the same type as /dev/null.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto">cd /opt/jboss/log/
rm program.log
mknod program.log c 1 3
chmod 666 program.log</pre>
</div>My jboss instance runs under user jboss but my program.log special device is owned by root with permissions 666.  That's because I don't want jboss or the app to be able to rename or move the special device.<br />
<br />
Now when log output is written to the log file it will simply be going into a null-like file which isn't recorded.  Of course if you ever need to troubleshoot you'll have to remove this special file so that it can write to a log file again for output.  But for normal usage of the app I'd say this is a pretty good solution to a closed source proprietary program which was simple for the problem at hand.<br />
<br />
SAM</div>

]]></content:encoded>
			<dc:creator>sag47</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34390</guid>
		</item>
		<item>
			<title>NFS problem</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34389</link>
			<pubDate>Thu, 19 Jan 2012 10:03:42 GMT</pubDate>
			<description>In running nfs server is this possible to edit a /etc/exports file without stop nfs</description>
			<content:encoded><![CDATA[<div>In running nfs server is this possible to edit a /etc/exports file without stop nfs</div>

]]></content:encoded>
			<dc:creator>manishs</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34389</guid>
		</item>
		<item>
			<title>Slackware-13.37-Hacks-Thunderbird/Enigmail</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34388</link>
			<pubDate>Wed, 18 Jan 2012 17:03:16 GMT</pubDate>
			<description>Mozilla Thunderbird/Enigmail Setup 
 
Mozilla Thunderbird 3.1.16 is the current package available from the Patches Directory. See the Claws...</description>
			<content:encoded><![CDATA[<div>Mozilla Thunderbird/Enigmail Setup<br />
<br />
Mozilla Thunderbird 3.1.16 is the current package available from the Patches Directory. See the Claws Mail/GnuPG Tutorial for Slackware 13.37 with regards to creating your GnuPG Public-Private Keypair. This tutorial will focus on setting up Mozilla Thunderbird as your email client for a Google GMail account and incorporating GnuPG encryption via the Enigmail encryption Plugin.<br />
<br />
When you first start Thunderbird, the Import Wizard runs which asks you if you would like to &quot;Import Preferences, Account Settings, Address Books, Filters and Other Data from Netscape 6, 7, Mozilla 1.X or Seamonkey.&quot; I select “Don't Import Anything”, then Next<br />
<br />
You will now see a Mail Account Setup Dialog Box.<br />
Enter Your Name, which will be shown to others when you send them mail.<br />
Enter your Email address, ie &lt;something&gt;&lt;at&gt;&lt;gmail&gt;&lt;dot&gt;&lt;com&gt;<br />
Enter your Password to access your email account<br />
NOTE - Be sure the &quot;Remember Password&quot; box is checked<br />
Click Continue<br />
<br />
Thunderbird selected IMAP - Access folders and messages from multiple computers (recommended)<br />
Incoming: imap.googlemail.com IMAP 993 SSL/TLS<br />
Outgoing: smtp.googlemail.com SMTP 465 SSL/TLS<br />
<br />
but you can select POP - Download all messages onto this computer, folders are local only.<br />
Incoming: pop.googlemail.com POP 995 SSL/TLS<br />
Outgoing: smtp.googlemail.com SMTP 465 SSL/TLS<br />
<br />
Thunderbird queries the Mozilla ISP Database to get the Settings for the Gmail account.<br />
I left it as IMAP since I use multiple computers to access mail.<br />
Click Create Account<br />
<br />
You will see Thunderbird checking your password and if it is OK, you are good to go.<br />
<br />
Download the Enigmail Plugin from (be sure of your version of Thunderbird):<br />
<a href="http://enigmail.mozdev.org/download/download-static.php.html" target="_blank">http://enigmail.mozdev.org/download/...tatic.php.html</a><br />
The correct Enigmail Plugin for Mozilla Thunderbird 3.1.16 64-Bit is<br />
enigmail-1.1.2-linux-x86_64-gcc4.5.0.xpi<br />
<br />
Go to the Thunderbird Tools--Add-Ons and select the &quot;Install&quot; button on the Add-On dialog box. Navigate to the directory containing the enigmail plugin and select it to install it. You will get a warning regarding installing malicious software. Click &quot;Install Now&quot; and restart Thunderbird.<br />
<br />
You will now have a new menu entry entitled &quot;OpenPGP&quot;. Go to OpenPGP--Setup Wizard.<br />
Click &quot;Next&quot; to start using the Enigmail Setup Wizard.<br />
Would you like to digitally sign your emails? Yes or No (I select No)<br />
Click &quot;Next&quot;<br />
Would you like to encrypt all your outgoing mail by default? Yes or No (I select No)<br />
Click &quot;Next&quot;<br />
Would you like to change your email settings to make OpenPGP work more reliably? Yes or No (I select Yes)<br />
Click &quot;Next&quot;<br />
Create a key to sign and encrypt email. You can select a pre-existing key or create a new one.<br />
Click &quot;Next&quot;<br />
Confirm what the Wizard will do for you and if you are happy with the settings, click &quot;Next&quot;<br />
Click &quot;Finish&quot;<br />
<br />
DIGITAL SIGNATURE<br />
<br />
NOTE - In order for the recipient to verify your signature, they must have your Public Key imported into GnuPG by means of KGPG, Seahorse, Gnu Privacy Assistant (GPA) or by CLI Importation using GnuPG. Thunderbird has an option to attach your Public Key to the email recipient. It is at the &quot;Write&quot; dialog box under the OpenPGP--Attach my Public Key.<br />
<br />
Compose your message by selecting the &quot;Write&quot; button which will bring up a new dailog box. Create the email. Go to OpenPGP--Sign Message or hit the key combination CTRL+SHIFT+S. This will put a checkmark on the menu choice and when you hit &quot;Send&quot; the signature will be added. When you hit &quot;Send&quot; you will be asked for the Passphrase/Password of your GnuPG Key. Enter it and hit &quot;OK&quot;. Your Private Key is used to Digitally Sign the message, which then gets verified at the receiving end by your Public Key.<br />
<br />
ENCRYPTING EMAIL<br />
<br />
NOTE - In order for the recipient of your encrypted email to decrypt the email, You must encrypt the email with the recipient's Public Key, which needs to be in your Keyring before you send the message. Thunderbird will know which key to use since the Public/Private Keypair is created with an email address attached as part of the Key. If you try to send an encypted email without the recipient's Public Key, Thunderbird will give you an error message &quot;Recipients not valid, not trusted or not found.&quot; You then have several options to obtain the missing key. The recipient uses their Private Key to decrypt the email.<br />
<br />
Compose your message by selecting the &quot;Write&quot; button which will bring up a new dailog box. Create the email. Go to OpenPGP--Encrypt Message or hit the key combination CTRL+SHIFT+E. This will put a checkmark on the menu choice and when you hit &quot;Send&quot; the message will be encrypted. Note that the Subject line is not encrypted. When you hit &quot;Send&quot; if you have no errors, the message gets encrypted and sent.</div>

]]></content:encoded>
			<dc:creator>arniekat</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34388</guid>
		</item>
		<item>
			<title>Be a geek with linux</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34387</link>
			<pubDate>Wed, 18 Jan 2012 15:23:01 GMT</pubDate>
			<description>Hi, 
 
this blog is going to be the first one to appear on this forum. 
 
In this introductory blog, I would like to share my experience with those...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
this blog is going to be the first one to appear on this forum.<br />
<br />
In this introductory blog, I would like to share my experience with those who are new to Linux.<br />
<br />
What I have really learnt is that in order to have a good understanding of the concepts and principles present in Linux, one needs to put aside the easy ways one usually finds in Windows operating system. Beginners should ensure that most of the operations performed by them should be through the terminal window and not through the in-built functionality(in the form of softwares and programs that are there inherent to Linux). To put in a nutshell, they should avoid mouse clicks as far as possible and should rely on the commands which make Linux quiet different from Windows.<br />
<br />
In this way, they are not only going to think something different from Windows GUI, but will also understand the usage of the commands in Linux(under various situations). This will greatly boost their confidence with this platform and will also help them to appreciate the features of Linux which(actually are far better than those offered in Windows).</div>

]]></content:encoded>
			<dc:creator>Upendra Pratap Singh</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34387</guid>
		</item>
		<item>
			<title>Security issues in opening an archive</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34386</link>
			<pubDate>Wed, 18 Jan 2012 04:21:09 GMT</pubDate>
			<description><![CDATA[I've personally opened hundreds (thousands?) of compressed archives -- tar, zip, and otherwise -- without even thinking of the possibility security...]]></description>
			<content:encoded><![CDATA[<div>I've personally opened hundreds (thousands?) of compressed archives -- tar, zip, and otherwise -- without even thinking of the possibility security ramifications of this action. However, extracting files (insecurely) from any archive has potentially two very dangerous effects:<br />
<br />
1. overwriting a file that should not be overwritten<br />
2. placing a file in a location you did not expect<br />
<br />
These of course are most deadly in combination. The bsdtar manual page has a helpful section on security:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 482px;
		text-align: left;
		overflow: auto">SECURITY
     Certain security issues are common to many archiving programs, including tar.  In particular,
     carefully-crafted archives can request that tar extract files to locations outside of the target
     directory.  This can potentially be used to cause unwitting users to overwrite files they did
     not intend to overwrite.  If the archive is being extracted by the superuser, any file on the
     system can potentially be overwritten.  There are three ways this can happen.  Although tar has
     mechanisms to protect against each one, savvy users should be aware of the implications:

     ·       Archive entries can have absolute pathnames.  By default, tar removes the leading /
             character from filenames before restoring them to guard against this problem.

     ·       Archive entries can have pathnames that include .. components.  By default, tar will not
             extract files containing .. components in their pathname.

     ·       Archive entries can exploit symbolic links to restore files to other directories.  An
             archive can restore a symbolic link to another directory, then use that link to restore
             a file into that directory.  To guard against this, tar checks each extracted path for
             symlinks.  If the final path element is a symlink, it will be removed and replaced with
             the archive entry.  If -U is specified, any intermediate symlink will also be uncondi&#8208;
             tionally removed.  If neither -U nor -P is specified, tar will refuse to extract the
             entry.
     To protect yourself, you should be wary of any archives that come from untrusted sources.  You
     should examine the contents of an archive with
           tar -tf filename
     before extraction.  You should use the -k option to ensure that tar will not overwrite any
     existing files or the -U option to remove any pre-existing files.  You should generally not
     extract archives while running with super-user privileges.  Note that the -P option to tar dis&#8208;
     ables the security checks above and allows you to extract an archive while preserving any abso&#8208;
     lute pathnames, .. components, or symlinks to other directories.</pre>
</div>Interestingly enough, there is no SECURITY discussion section in the manual page for GNU Tar (the default tar option for Linux). However, there is a section in the info document on untrusted sources:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 306px;
		text-align: left;
		overflow: auto">2.8.4 Extracting Archives from Untrusted Sources
------------------------------------------------

Extracting files from archives can overwrite files that already exist.
If you receive an archive from an untrusted source, you should make a
new directory and extract into that directory, so that you don't have
to worry about the extraction overwriting one of your existing files.
For example, if `untrusted.tar' came from somewhere else on the
Internet, and you don't necessarily trust its contents, you can extract
it as follows:

     $ mkdir newdir
     $ cd newdir
     $ tar -xvf ../untrusted.tar

   It is also a good practice to examine contents of the archive before
extracting it, using `--list' (`-t') option, possibly combined with
`--verbose' (`-v').</pre>
</div>Furthermore, the info document indicates that<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 146px;
		text-align: left;
		overflow: auto">By default, GNU `tar' drops a leading `/' on input or output, and
complains about file names containing a `..' component.  There is an
option that turns off this behavior:

`--absolute-names'
`-P'
     Do not strip leading slashes from file names, and permit file names
     containing a `..' file name component.</pre>
</div>It is not clear to me exactly what kind of protections GNU Tar uses when extracting entries that are or contain symbolic links, though symbolic links can be dereferenced during archive <i>creation</i>. (Which is not relevant to our discussion.) The GNU Tar manual has this paragraph:<br />
<br />
<div style="margin:20px; margin-top:5px; ">
	<div class="smallfont" style="margin-bottom:2px">Quote:</div>
	<table cellpadding="3" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="bbcodeblock" style="border:1px inset">
			
				Some people argue that GNU tar should not hesitate to overwrite files with other files when extracting. When extracting a tar archive, they expect to see a faithful copy of the state of the file system when the archive was created. It is debatable that this would always be a proper behavior. For example, suppose one has an archive in which ‘usr/local’ is a link to ‘usr/local2’. Since then, maybe the site removed the link and renamed the whole hierarchy from ‘/usr/local2’ to ‘/usr/local’. Such things happen all the time. I guess it would not be welcome at all that GNU tar removes the whole hierarchy just to make room for the link to be reinstated (unless it also simultaneously restores the full ‘/usr/local2’, of course!) GNU tar is indeed able to remove a whole hierarchy to reestablish a symbolic link, for example, but only if ‘--recursive-unlink’ is specified to allow this behavior. In any case, single files are silently removed.
			
		</td>
	</tr>
	</table>
</div>Both GNU Tar and BSD Tar have a <b>-k</b> option to prevent files from being overwritten.<br />
<br />
Anyway, now I have a few more thing to think about next time I open a tarball or a ZIP package.</div>

]]></content:encoded>
			<dc:creator>hydraMax</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34386</guid>
		</item>
		<item>
			<title>Test</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34385</link>
			<pubDate>Tue, 17 Jan 2012 17:49:48 GMT</pubDate>
			<description>Test</description>
			<content:encoded><![CDATA[<div>Test</div>

]]></content:encoded>
			<dc:creator>skimeer</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34385</guid>
		</item>
		<item>
			<title>simple script for creating 100 users in linux</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34384</link>
			<pubDate>Tue, 17 Jan 2012 13:35:42 GMT</pubDate>
			<description><![CDATA[#!/bin/bash 
a=1 
while [ $a -le 101 ] 
do 
{ 
useradd    user$a 
a=`expr $a + 1` 
} 
done]]></description>
			<content:encoded><![CDATA[<div>#!/bin/bash<br />
a=1<br />
while [ $a -le 101 ]<br />
do<br />
{<br />
useradd    user$a<br />
a=`expr $a + 1`<br />
}<br />
done</div>

]]></content:encoded>
			<dc:creator>dinakumar12</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34384</guid>
		</item>
		<item>
			<title>With every change a new challenge</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34383</link>
			<pubDate>Tue, 17 Jan 2012 13:28:20 GMT</pubDate>
			<description>Since my last blog entry I have improved my Linux OS skills dramatically. I am happy to say: I am comfortable with Linux now.  
 
My Programming...</description>
			<content:encoded><![CDATA[<div>Since my last blog entry I have improved my Linux OS skills dramatically. I am happy to say: I am comfortable with Linux now. <br />
<br />
<i>My Programming efforts:</i><br />
I discovered a serious lack of support and documentation for ORB (any ORB), and its implementation in a GUI Linux/Windows/Mac environment. On console applications them ORBS thrive well, but writing a X-Window Application with a toolkit (e.g. QT4) is a true disaster - them ORBs turn into ORCs! <br />
<br />
<i>Trolltech Qt4 dev. toolkit:</i><br />
So for my multi-tier X-Window program I dropped the whole &gt;2 'tier' ORB based idea, and I fell back to standard Client-Server technology. Being a security ant picker, I discovered a serious lack in support (by Trolltech) regarding defined x509 certificates. openSSL (x509) works fine on Linux with for example MySQL, so you'd expect that something simple as: allowing a certificate to be defined for an x-Window client - developed with the Qt Toolkit, and/or the C MySql API with the Qt Toolkit, would automatically be supported? Wrong! <br />
<br />
I implemented AES Rijndael for storing sensitive data, over SSL - that went smooth, and I wrote an installer with registration, activation and verification of program license - all for the Linux platform. The latter was a brain teaser. Now I am focussing on implementing Internet search technologies into my application. Yay more headaches!<br />
<br />
I am impressed - at least, to say how stable Linux is and how smooth it works.</div>

]]></content:encoded>
			<dc:creator>m3rl1n</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34383</guid>
		</item>
		<item>
			<title>ipc in kernel space</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34382</link>
			<pubDate>Tue, 17 Jan 2012 12:02:27 GMT</pubDate>
			<description>HI 
 
can i have shared memory ipc between netfilter and some other kernel process ? 
 
Thank you</description>
			<content:encoded><![CDATA[<div>HI<br />
<br />
can i have shared memory ipc between netfilter and some other kernel process ?<br />
<br />
Thank you</div>

]]></content:encoded>
			<dc:creator>muttanna2972</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34382</guid>
		</item>
		<item>
			<title><![CDATA[one time changing of default user's home directory while adding  newuser]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34381</link>
			<pubDate>Tue, 17 Jan 2012 11:28:43 GMT</pubDate>
			<description>vim /etc/default/useradd 
 
Look for this line 
 
 HOME=/home 
 
change /home to your own directory 
 
save the file and try adding new user by...</description>
			<content:encoded><![CDATA[<div>vim /etc/default/useradd<br />
<br />
Look for this line<br />
<br />
 HOME=/home<br />
<br />
change /home to your own directory<br />
<br />
save the file and try adding new user by useradd username<br />
<br />
Now the new user should be created with your own preferred directory.</div>

]]></content:encoded>
			<dc:creator>dinakumar12</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34381</guid>
		</item>
		<item>
			<title>How to insert a string at the top of a file using sed</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34380</link>
			<pubDate>Tue, 17 Jan 2012 11:22:40 GMT</pubDate>
			<description>sed -i 1i\string  filename</description>
			<content:encoded><![CDATA[<div>sed -i 1i\string  filename</div>

]]></content:encoded>
			<dc:creator>dinakumar12</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34380</guid>
		</item>
		<item>
			<title>Hi all</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34379</link>
			<pubDate>Tue, 17 Jan 2012 07:47:32 GMT</pubDate>
			<description>Hi this is suresh working as a Linux system administrator, 
Looking for a friend who have experience in Linux system admin.</description>
			<content:encoded><![CDATA[<div>Hi this is suresh working as a Linux system administrator,<br />
Looking for a friend who have experience in Linux system admin.</div>

]]></content:encoded>
			<dc:creator>suresh.k</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34379</guid>
		</item>
		<item>
			<title><![CDATA[Let's Go Retro Now, Everybody's Learning How...]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34378</link>
			<pubDate>Tue, 17 Jan 2012 06:01:26 GMT</pubDate>
			<description><![CDATA[Living on the "Trailing Edge" of computer development sometimes makes a LOT of sense. 
 
1. Kdevelop 3 vs. 4. 
 
The kde4 version of this...]]></description>
			<content:encoded><![CDATA[<div>Living on the &quot;Trailing Edge&quot; of computer development sometimes makes a LOT of sense.<br />
<br />
1. Kdevelop 3 vs. 4.<br />
<br />
The kde4 version of this ide/programming editor became a bit too ambitious, I think.  Spitting out one perfect plasma widgets at the click of a button.  But it's unrealistic to think that an automatic plasmoid creator will lead to programming prowess and many of the old features that were in kdevelop3 are sorely missed.<br />
<br />
I'd take the graphical regex editor over the VI mode any day.  I'd take an editor that can work efficiently with simple C programs over a plasmoid template (that installs the widget in the wrong folders too.  (Wrong folders for openSUSE, I dropped investigation in kubuntu when uninstalling kdevelop4 stripped my kubuntu down to bare bones due to mismatches in my installation and the DVD archives).<br />
<br />
That new kdevelop application generates 50 megs (I kid you not) of useless junk for every &quot;hello world&quot; C program you write.  This junk pile is in a hidden folder in your home folder and is &quot;per session&quot; data, meaning that these junk piles are duplicated and persistant wastes of your hard drive even when they serve no useful purpose.<br />
<br />
Kdevelop3 was much better, despite the lack of luster.  It is, in my opinion, the best ide/programming editor around to date.  But it seems to no longer compile on modern systems (due to tons of minor issues that cmake-ed builds are unforgiving about) and therefor needs to be installed as a binary.<br />
<br />
Kdevelop3 will pretty much install with only the qt3 support and kdelibs3 stuff.<br />
<br />
Missing development files aren't critical (in fact they are to be avoided, see below) for using it as a programming editor, so you may force the installation using yast overrides or dpkg commandline switches.<br />
<br />
Here.<br />
<br />
This is kdevelop3 running with the regex helper menu showing.  <br />
<br />
<a href="http://rainbowsally.net/pub/kdev3-regex.jpeg" target="_blank">http://rainbowsally.net/pub/kdev3-regex.jpeg</a><br />
<br />
[the image may appear oversized on a 800x600 screen.  the shot was taken on a 1024x768 screen.]<br />
<br />
The 'find in files' function is also incredibly powerful.  (alt-ctrl-F)<br />
<br />
The shot above is of a C++ parser generator application.  It writes C++ code to parse text based on a bnf-like syntax the user defines.  The total size of the entire package including the binary, docs, 7 demos, 15 tutorials, an optimizer, a static/dynamic linkage option and a 32-bit and a 64-bit &quot;panic&quot; executable (it metacompiles itself) is<br />
<br />
3,159,282 total<br />
<br />
Oh.  And there's a makefile.  :-)<br />
<br />
That's 3 megs of actual source code, nothing hidden, not 50 megs of hidden nonsense for &quot;hello world&quot; in C.<br />
<br />
It doesn't have macro key (recording and playback).  Neither does the kde4 version. But nedit is small and can be used for stuff the regex can't handle easily.<br />
<br />
Here's the clickable/relocatable script that launches the ide.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 242px;
		text-align: left;
		overflow: auto">#!/bin/sh
# The newer kdevelop is bulky and has bad shortcut keys.  We use
# the kde3 version.

CURDIR=`dirname &quot;$0&quot;`
cd &quot;$CURDIR&quot;
#this is buggy, let's get rid of it.
rm -f &quot;$HOME&quot;/.kde/share/config/kdevfileselectorrc
if kdevlite -v
  then 
    kdevlite &quot;$CURDIR&quot;/buffalo.kdevelop
  else
    kdevelop &quot;$CURDIR&quot;/buffalo.kdevelop
fi</pre>
</div>[Note: kdevlite (see above) was the version I created for developer evaluation.  Nobody did. Forward ho!  Ho ho ho!]<br />
<br />
<br />
2. kolourpaint kde3 v. 4.<br />
<br />
Dunno about you but my intel i915 driver sure doesn't like scaling images in the new kolourpaint, if that's even the problem.<br />
<br />
The older kolourpaint is in the kde package 'kdegraphics3-imaging-3' (rpm, not sure which deb).<br />
<br />
These retro packages from kde3 will also likely be needed.  Exact version matches are probably not necessary. Binary compatible should do it.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 114px;
		text-align: left;
		overflow: auto">  imlib2
  imlib2-loaders-1.4.4
  fribidi-0.10.9
  kdegraphics3-3.4.2
  expat-1.95.8
  kdegraphics3-imaging-3.4.2</pre>
</div>These packages are organized somewhat oddly in kubuntu, so you're on your own there.<br />
<br />
But...<br />
<br />
There are several ways to force installation of an app that the package managers think won't work. (I may upload a toolkit that can generate makefiles with 'revert' functionality a bit later.)<br />
<br />
For example it's possible to extract the package to a directory tree and copy the files manually into the system as long as there's no special configuration to be done.  That, after all, is what makefiles do after the files are compiled.  <br />
<br />
The most likely snags are configuration issues, which are usually solveable by installing other retro packages or libs as long as the packages you are installing are for your linux genre. And sometimes even the genre doesn't matter (but paths may be different and may require some tweeks).<br />
<br />
Some dependencies will show up at runtime, especially if the dependency is an interpreter like perl or tcl/tk.<br />
<br />
Others can be discovered before copying into the system by running ldd &lt;libname&gt; or ldd &lt;executable&gt; in the folder where you extracted the lib or executable.  Ignore those dependencies that are included in the package, of course.<br />
<br />
Retro *development* packages should be avoided, however, because these often include the libs with a plain un-numbered *.so name which are symlinks to the assumed default lib version such as *.so.&lt;N&gt; with the highest version numbered lib being the latest/default.  <br />
<br />
For example, you can have libreadline.so.5 and libreadline.so.6 both in the /lib folder as long as the librealine.so points to the so.6 version.<br />
<br />
*** Let's say th9is again.  By installing retro *develepment* packages you risk compiling and linking against the older libs which will make the newer one invisible due to the incorrect symlink.  (See above.)<br />
  <br />
Here.<br />
<br />
The newer kolourpaint would not blow up images without losing the colors and at times even the image.<br />
<br />
This is the older one forced, as per the methods above, into openSUSE 11.4 blowing up an icon by 800 percent with colors and image still quite recognizable.<br />
<br />
<a href="http://rainbowsally.net/pub/kolourpaint-800-times.png" target="_blank">http://rainbowsally.net/pub/kolourpaint-800-times.png</a><br />
<br />
[The image may appear oversized on 800x600 screens.]<br />
<br />
Is life on the trailing edge risky?  <br />
<br />
Of course it is.  Make tarball backups of anything that might change before you experiment unless you have a better way to restore a broken system using file lists, preferably with attributes.  As root your tarballs will retain perms, symlinks as symlinks, etc. And have a rescue CD you can use to boot into a broken linux installation.  <br />
<br />
**Never assume all is lost** until you know for absolutely sure that it is.<br />
<br />
You can almost always recover from terrible problems and you'll learn a lot as you discover how. <br />
<br />
But there are times when even the best tools and utmost effort will not replace lost or corrupted system files so backups and a bit of familiarity with the linux terminal are the most important part of having a good experience...<br />
<br />
Living On The Trailing Edge of computer technology.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34378</guid>
		</item>
		<item>
			<title>Phones...</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34377</link>
			<pubDate>Mon, 16 Jan 2012 20:47:31 GMT</pubDate>
			<description><![CDATA[Last week, I semi retired my N900 replacing it with a Samsung Galaxy SII.  Initial impressions are that the SGS2 is very nice and all but it doesn't...]]></description>
			<content:encoded><![CDATA[<div>Last week, I semi retired my N900 replacing it with a Samsung Galaxy SII.  Initial impressions are that the SGS2 is very nice and all but it doesn't have the same 'feel' as the Nokia.  My N900  is without doubt a small computer with phone functionality.  The SGSII is a smartphone.  There is a subtle but distinct difference.<br />
<br />
So, the N900 will live on at home with the sim removed but connected to my wireless network.  I see it fulfilling various roles, one of which will be as a device I can play about with.  It's already been overclocked to 900mhz.  Standard is 600mhz...<br />
<br />
As for the Galaxy SII, it will serve as my day to day phone/device.  I think it'll work out fine!  I haven't 'rooted' it yet and I'm not sure I will in the short term.  For the moment, I'm happy to make it suit my needs by installing a few carefully chosen apps.  Here's a list of the more useful ones I've installed so far:<br />
3G Watchdog<br />
AndFTP<br />
Barcode Scanner<br />
Battery Graph Widget<br />
Connectbot<br />
Firefox<br />
Hacker's keyboard<br />
Jota Text Edotor (Which I used to type this  post up with.)<br />
Wifi Analyser<br />
<br />
There are a couple of others like Facebook and a couple of games but to my mind they don't really add much that a web browser couldn't do.<br />
<br />
So for anyone contemplating replacing their N900, don't replace it.  Rather complement it with an Android device and get on with all the stuff you'd wanted to do with it but couldn't because it was your primary phone.</div>

]]></content:encoded>
			<dc:creator>rich_c</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34377</guid>
		</item>
		<item>
			<title>KDE Utils: new.symlink, launch, edit, browse, tofile</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34376</link>
			<pubDate>Mon, 16 Jan 2012 19:43:56 GMT</pubDate>
			<description><![CDATA[[Recommended: Kate (Advanced Text Editor).] 
 
In my setup I have HOME/bin with a subdirectory named src where I put my private  stockpile of...]]></description>
			<content:encoded><![CDATA[<div>[Recommended: Kate (Advanced Text Editor).]<br />
<br />
In my setup I have HOME/bin with a subdirectory named src where I put my private  stockpile of micro-programs and where I can uninstall them easily by simply deleting the files or the directories containing them.<br />
<br />
Under HOME/bin/src I have the directories named for the apps they contain, in some cases being collections of apps with additional subdirectories.<br />
<br />
In order to put the apps in the path all that is necessary is to symlink the executable in my HOME/bin folder.<br />
<br />
You may do this any way you like, but that is my preference and it should pretty much work on any KDE system around, though you may have to logout and back in to set the bin folder in your path (e.g., kubuntu.)<br />
<br />
This MIGHT require adding your bin folder to your path as well.  (This should be dealt with in the (dot).profile file in kubuntu, but I'm not sure it works right.)<br />
<br />
In general (assuming bash is your shell), the following can be added to your (dot).bashrc file to set the path.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">PATH=.:~/bin:$PATH</pre>
</div>That adds dot to your path first, which will allow you to run apps in the current directory without the usual dot-slash prefix and it also adds the HOME/bin folder, which are then scanned in a first-to-last order of preference.<br />
<br />
Also works for WindowMaker, LXDE, Gnome, and so forth, but for our purposes here we assume that KDE is at least accessible, even if it's not the current desktop manager.<br />
<br />
------------------------------------------------<br />
File: new.symlink (executable)<br />
Path: HOME/bin/src/misc<br />
Purpose: easily create a symlink with simple syntax and usage note.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 210px;
		text-align: left;
		overflow: auto">#!/bin/sh
#new.symlink &lt;FileInCurrentDir&gt; &lt;NewLinkLocation&gt;

if [ $# != 2 ];then
    echo &quot;Usage: new.symlink &lt;FileInCurrentDir&gt; &lt;NewLinkLocation&gt;&quot;
    exit
fi

file=&quot;$PWD/$1&quot;
dir=&quot;$2&quot;

(cd $dir &amp;&amp; ln -sf $file .)</pre>
</div>[There may be several apps with the name &quot;new&quot;(dot)&lt;func&gt; that create other files or sets of  files that we can look up easily as '~/bi /new.*', so let's go with the dot in the name here.]<br />
<br />
Place the file where it will be when it runs and then cd into that folder and link it into your ~/bin folder, using the file itself to generate the link.<br />
<br />
Type<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">new.symlink new.symlink ~/bin</pre>
</div>Note that with dot in your path you do not need to prefix the first name (the command) with &quot;./&quot;.<br />
<br />
Now it will run (immediately) since it's in your path.<br />
<br />
Type 'which new.symlink' to verify.  You should see the full path to the symlink in your ~/bin folder.<br />
<br />
<br />
------------------------------------------------<br />
File: launch (executable)<br />
Path: HOME/bin/src/misc<br />
Purpose: Execute programs noiselessly returning control to the terminal immediately.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">#!/bin/sh
nohup $@ &gt; /dev/null 2&gt;&amp;1 &amp;
exit 0</pre>
</div>In the folder containing the file type 'new.symlink launch ~/bin' to install.<br />
<br />
Remove the symlink and the file to uninstall.  NO SUPERUSER NEEDED.  None wanted for these apps.<br />
<br />
------------------------------------------------<br />
File: edit (executable)<br />
Path: HOME/bin/src/misc<br />
Purpose: Supercede that SCREWY vim 'edit' app with one that can go to exact lines.<br />
<br />
This can take &quot;grep -in &lt;text&gt; &lt;path&gt;&quot; output to go to the exact line in a file where the text is found.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto">#!/bin/sh

args=`echo $@ | sed 's|[:]| --line |; s|[:].*| |g;'`
launch &quot;kate -n $args&quot; ### we'll activate 'launch' later</pre>
</div>Install and uninstall as per the 'launch' utility above.<br />
<br />
When installed type 'edit ~/bin/edit' and verify.  This will show the source code for the app.  And now the default 'edit' will be superceded by a nicer gui version that can go to exact line numbers.<br />
<br />
Try this:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">grep -in fileincurrentdir ~/bin/*</pre>
</div>Highlight a chunk of, or even a whole line and copy/past behind the command 'edit', like so:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">edit &lt;pasted text&gt;</pre>
</div>Hit ENTER.<br />
<br />
You should end up with the cursor on the exact line containing the text.  (Not perfect, but nearly always works.)<br />
<br />
------------------------------------------------<br />
File: browse (executable)<br />
Path: HOME/bin/src/browse (folder name same as executable name within)<br />
Purpose: Use a KDE gui app to browse files or directories<br />
<br />
I put this in a separate directory because we MIGHT want to include a config file for changing the app that we use.  For now let's hard-code it (no config).<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">#!/bin/sh

BROWSER=konqueror

###############################################################
# read url and if first char is @, read the file instead of url

url=&quot;$1&quot;
shift

has_splat()
{
    local tmp=`echo &quot;$url&quot; | sed &quot;/@/! D&quot;`
    if [ &quot;$tmp&quot; = &quot;&quot; ];then
        return 1; #err=no
    else
        return 0; #ok=yes
    fi
}


if has_splat ;then
    # check if first arg is @ alone
    if [ &quot;$url&quot; = &quot;@&quot; ];then
        url=$(&lt;&quot;$1&quot;)
        shift
    else # splat is prefixed to url
        url=`echo &quot;$url&quot; | sed &quot;s/^@//&quot;`
        url=$(&lt;$url)
        shift
    fi

fi # has_splat


# compose a command line from url and other args, removing trailing
# spaces if any, so konqueror and other apps don't choke on a bum
# url.  That is a space at the end CAN be part of a valie url.

cmdln=`echo &quot;$url $@&quot; | sed 's/ *$//'`

# fork a system call (returns immediatly after creating new proc)
# and suppress error messages which would otherwise show in the 
# console.  (They could go directly to a log file, but stderr is
# the default for the console and the errors are usually non-fatal
# if they are anything more than warnings in the first place.)

launch &quot;$BROWSER '$cmdln'&quot;</pre>
</div>This could probably use a bit of revision, it's an ancient version, but roll with it for now and later we'll see how we could have included a config file to set the browser easily enough without tampering with the executable at all.<br />
<br />
Install and uninstall as per above.<br />
<br />
To test it, type &quot;browse ~/bin&quot;<br />
<br />
Also try &quot;browse ~/bin/browse&quot; and see what happens.<br />
<br />
[In konqueror it will prompt you for whether or not to execute it.  (Using openSUSE 11.4).  No guarantees what other filemanagers or other versions of kde will do.  Check and see.]<br />
<br />
If you want to you can set your environment to use these apps instead of the crazy defaults, but be aware that as superuser, unless these apps are in root's path the defaults will still run instead of the replacements.<br />
<br />
If you prefer the crazy defaults, however, uninstallation is even easier than installation.  Just remove the file first and then the broken and easily visible symlink in your ~/bin folder.<br />
<br />
Coming Up!  A C/C++ program to replace &quot;more&quot; with a gui-based text viewer that allows you to work in the terminal as you view docs or for just about any text produced by linux commandline programs.<br />
<br />
[Continued in comment below.]</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34376</guid>
		</item>
		<item>
			<title>Setting watchpoint for watching writes on a variable in C++ - GDB</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34375</link>
			<pubDate>Mon, 16 Jan 2012 12:14:30 GMT</pubDate>
			<description>*Watchpoint basics*: 
* Watchpoints are set on the variables, not on the functions or on the lines of code. 
* When the watched variables are read or...</description>
			<content:encoded><![CDATA[<div><b>Watchpoint basics</b>:<ul><li><i>Watchpoint</i>s are set on the variables, not on the functions or on the lines of code.</li>
<li>When the watched variables are read or written, the <i>watchpoint</i> gets triggered and the program's execution stops.</li>
</ul><br />
<b>Watchpoints on non-global variables</b>:<ul><li>To set a <i>watchpoint</i> on a <i>non-global variable</i>, we must first set a <i>breakpoint</i> that will stop the program in the scope of the variable to be watched.</li>
<li>The <i>watchpoint</i> can be set after the program stops at the above set <i>breakpoint</i>.</li>
<li>To get notified about the '<i>writes</i>' on a variable, we need to use the GDB's command '<i>watch</i>'.<br />
<br />
<b>watchpoint.cpp</b><br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 434px;
		text-align: left;
		overflow: auto">#include &lt;iostream&gt;
using namespace std;

<b>class</b> dummyA
{
   <b>int</b> x;
	
   <b>public</b>:
      dummyA ()
      {
         x = 0;
      }
		
      <b>void</b> test ()
      {
         x++;
      }
};

<b>int</b> <b>main</b> ()
{
	<b>cout</b> &lt;&lt; &quot;\nG'Morning&quot;;
	dummyA obj;
	obj.test ();
	<b>return</b> 0;
}</pre>
</div></li>
<li>In the above shown code, we intend to watch the <b>non-static class variable 'x'</b>.</li>
<li>The non-static class variable <i>x</i> can be accessed by an object of its respective class, which in the current case is declared in the function <i>main()</i>.<br /></li>
<li>Setting the <i>breakpoint</i> on the function <i>main()</i> where the class object <i>obj</i> is declared.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">(gdb) <b>b</b> main
Breakpoint 1 at 0x40074c: file watchpoint.cpp, line 22.</pre>
</div></li>
<li>Since, GDB hasn't yet reached the variable declaration point of the class object '<i>obj</i>' through which we intend to call the class variable '<i>x</i>', it is not able to find the class object '<i>obj</i>' in the file '<i>watchpoint.cpp</i>'.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">(gdb) <b>watch</b> obj.x
<b>No symbol &quot;obj&quot; in current context.</b></pre>
</div></li>
<li>We need to <i>run</i> the program till it reaches the above set <i>breakpoint</i>.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">(gdb) <b>r</b>
Breakpoint 1, main () at watchpoint.cpp:22
22              cout &lt;&lt; &quot;\nG'Morning&quot;;</pre>
</div></li>
<li>Now since GDB has reached the scope of the variable we intend to watch, we can safely set the <i>watchpoint</i>.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">(gdb) <b>watch</b> obj.x
Hardware watchpoint 2: obj.x</pre>
</div></li>
<li>Instead of traversing line by line, we can simply issue the <b>continue command 'c'</b>. The continue command continues the code execution silently till the <i>watchpoint</i> gets triggered by the constructor call (through the statement <i>dummyA obj;</i>) which changes the value of the class variable <i>x</i>.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 146px;
		text-align: left;
		overflow: auto">(gdb) <b>c</b>
Continuing.
Hardware watchpoint 2: obj.x

<b>Old value = -8912
New value = 0</b>
dummyA::dummyA (this=0x7fffffffdc40) at watchpoint.cpp:12
12                      }</pre>
</div></li>
<li>The continue command again continues the code execution silently till the watchpoint gets triggered by the test function call (through the statement <i>obj.test ();</i>) which increments the value of the class variable <i>x</i>.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 146px;
		text-align: left;
		overflow: auto">(gdb) <b>c</b>
Continuing.
Hardware watchpoint 2: obj.x

<b>Old value = 0
New value = 1</b>
dummyA::test (this=0x7fffffffdc40) at watchpoint.cpp:17
17                      }</pre>
</div></li>
<li>The continue command again continues the code execution silently, reaches the end of the main function and finds that the watchpoint variable is out of scope and hence it deletes the watchpoint.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 82px;
		text-align: left;
		overflow: auto">(gdb) <b>c</b>
Continuing.

<b>Watchpoint 2 deleted because the program has left the block in which its expression is valid.</b> 0x00007ffff7325b7d in __libc_start_main () from /lib64/libc.so.6</pre>
</div></li>
</ul></div>

]]></content:encoded>
			<dc:creator>Anisha Kaul</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34375</guid>
		</item>
		<item>
			<title>See source code intermixed with assembly</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34374</link>
			<pubDate>Mon, 16 Jan 2012 09:25:56 GMT</pubDate>
			<description>Maybe everybody else already knows this, but I thought it was pretty neat anyway: 
 
If you compile some C code with -g option (to include debugging...</description>
			<content:encoded><![CDATA[<div>Maybe everybody else already knows this, but I thought it was pretty neat anyway:<br />
<br />
If you compile some C code with -g option (to include debugging symbols), you can then use <b>objdump</b> on the binary, with the <b>-S</b> switch, to get source code intermixed with assembly. For example, here is a snippet from one of my binaries:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 402px;
		text-align: left;
		overflow: auto">int main() {
  401163:       55                      push   %rbp
  401164:       48 89 e5                mov    %rsp,%rbp
  401167:       53                      push   %rbx
  401168:       48 83 ec 58             sub    $0x58,%rsp
  struct archive * a = archive_read_new();
  40116c:       e8 1f fc ff ff          callq  400d90 &lt;archive_read_new@plt&gt;
  401171:       48 89 45 d8             mov    %rax,-0x28(%rbp)
  if(archive_read_support_compression_all(a) == ARCHIVE_WARN) {
  401175:       48 8b 45 d8             mov    -0x28(%rbp),%rax
  401179:       48 89 c7                mov    %rax,%rdi
  40117c:       e8 2f fb ff ff          callq  400cb0 &lt;archive_read_support_compression_all@plt&gt;
  401181:       83 f8 ec                cmp    $0xffffffffffffffec,%eax
  401184:       75 24                   jne    4011aa &lt;main+0x47&gt;
    fprintf(stderr, &quot;warning: external compression support detected&quot;);
  401186:       48 8b 05 63 0f 20 00    mov    0x200f63(%rip),%rax        # 6020f0 &lt;__bss_start&gt;
  40118d:       48 89 c2                mov    %rax,%rdx
  401190:       b8 b0 15 40 00          mov    $0x4015b0,%eax
  401195:       48 89 d1                mov    %rdx,%rcx
  401198:       ba 2e 00 00 00          mov    $0x2e,%edx
  40119d:       be 01 00 00 00          mov    $0x1,%esi
  4011a2:       48 89 c7                mov    %rax,%rdi
  4011a5:       e8 16 fc ff ff          callq  400dc0 &lt;fwrite@plt&gt;
  }</pre>
</div>It's rather educational, I would say. The only thing to remember is that the results can be very different (and harder to understand) if you use optimization flags (e.g., <b>-O2</b>) because a lot of code will be removed or condensed. Includes comments as well!</div>

]]></content:encoded>
			<dc:creator>hydraMax</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34374</guid>
		</item>
		<item>
			<title>Stragest BugZ Part 2</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34373</link>
			<pubDate>Mon, 16 Jan 2012 04:57:45 GMT</pubDate>
			<description><![CDATA[[Edited: Corrected md5sum generator, Jan 15, 2012.] 
 
Before I forget, I want to jot some notes on the screwiest bugs I've seen. 
 
Kubuntu next. 
...]]></description>
			<content:encoded><![CDATA[<div>[Edited: Corrected md5sum generator, Jan 15, 2012.]<br />
<br />
Before I forget, I want to jot some notes on the screwiest bugs I've seen.<br />
<br />
Kubuntu next.<br />
<br />
I initially got the Live CD, version 11.10, but I have dialup.  After playing with it a while I got 12.4 on the DVD and currently my Kubuntu is on mothballs but I do want to jot down a few things I noticed.<br />
<br />
First of all, Kubuntu is so biased toward those with a high speed internet connection that I discovered some things most people will never notice.  I have dialup and none of the modern linuxes work with my modem(s).<br />
<br />
If you don't have an internet connection, first time you install you will probably succeed.  But if you attempt to reinstall over an existing installation without reformatting, you could end up hanging like for hours.<br />
<br />
Installing without reformatting is an option that can be VERY useful, by the way.<br />
<br />
In Kubuntu, if you have a home folder you want to save, you can change its name temporarily, reinstall, and then change the name back to restore your settings, files, everything.  <br />
<br />
Very cool.  But there are a couple of 'gotchas' to look out for.<br />
<br />
Dialup Users: When you reinstall without reformatting, you MUST delete your /var folder and, if it exists, anything that looks like a dpkg cache in the root folder.  If Kubuntu sees those directories it will try to go online and your installation will hang.<br />
<br />
To be sure, you should also remove /etc and /usr I would think, just to make sure what's in your system after reinstalling is reflected in the package info.<br />
<br />
<b>THE WOOPS I THOUGHT I HAD KDE BUG.</b><br />
<br />
This even happened when I had the 12.4 DVD installation.  Later I reverted to 11.10, as I mentioned above, and so the discrepancies between what was installed and what was in the archives was more understandable.  The installed files did not all match those in the archive.<br />
<br />
This bug consists of the following:<br />
<br />
If you set up your /etc/apt/sources.list file to point to your offline archives or your DVD (pools and dist) folder, and you type apt-get install &lt;such and such&gt; or if you use muon to install something, and it tells you it needs to uninstall some files.<br />
<br />
YOU'D BETTER BELIEVE IT!<br />
<br />
More than once, sometimes when installing, other times when uninstalling, muon or apt-get would strip my system down to bare bones, kde and even x11 gone with the wind.<br />
<br />
The cause.<br />
<br />
What causes this is the extreme pickiness of the version requirements.  There may be an archive that is binary compatible, right down to the md5sums but with a  couple of changes in the docs and thus a different &lt;VV&gt;ubuntu&lt;VR&gt; identifier, and these software managers (muon and apt-get) will decide to shoot first, ask questions later.  <br />
<br />
I.e., if an exact version match can't be found, the files will be removed from your system and there's no way to restore them short of a full reinstall.<br />
<br />
Unless...<br />
<br />
This is where I got to, and unfortunately I didn't have time to test it more than once before I took a break from Kubuntu.<br />
<br />
The EXACT files in your system can be rebuilt as packages and you can recreate an archive that you can list in /etc/apt/sources.list.<br />
<br />
Use dpkg-repack on every package in your system.  <br />
<br />
---------------------------<br />
<br />
And you can discover which they are by listing them.  <br />
<br />
<b>WARNING: EXPERIMENTAL</b><br />
<br />
I don't want to leave you hanging but at the same time, don't count on this script being exactly right because I can't check it at this time.<br />
<br />
Get a list of all installed packages.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 194px;
		text-align: left;
		overflow: auto">df.installed() # find all installed or filter with substr
{ 
  # split into names and status lines
  local a=`dpkg --get-selections | sed 's|\t|\n|; /install/!d'`
  # delete status lines
  a=`echo &quot;$a&quot; | sed '/install$/d'`
  if [ &quot;$1&quot; != &quot;&quot; ];then
    a=`echo &quot;$a&quot; | sed '/'&quot;$1&quot;'/!d'`
  fi
  echo &quot;$a&quot;
}</pre>
</div>And I THINK, if that works, then to recreate all the installed packages, you can do this in a temporary directory to catch the output files.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 66px;
		text-align: left;
		overflow: auto">for i in `df.installed`; do
  dpkg-repack $i
done</pre>
</div>[Any corrections or alternate methods are more than welcome.]<br />
<br />
Once the collection of packages exist, they can be moved to an archive.<br />
<br />
Now we need the Package file that lists the files and contains various checks to verify an exact match.<br />
<br />
It will be horrendously large and very sensitive<br />
as to the tags that are required, so we'll try to create a program to generate it.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto">
BUILD_TYPE=&quot;binary-i386&quot;

show_params()
{
  echo &quot;
  Examples.
    pkgtype pkgpath   distname  poolname
    .....................................................
    deb   file:///&lt;path&gt;  oneiric   main
    deb   file:///&lt;path&gt;  precise   test
    &quot;
}

usage()
{
    echo
    echo &quot;Need distname and poolname (params 3 and 4 in /etc/apt/sources.list)&quot;
    show_params
}


create_package_files() # pkgpath poolname
{
  local pkgpath=$1
  local poolaname=$2
  local fsize
  local sum
  
  # echo $pkgpath/$poolname/pool; read key; cd pkgpath; return
  
  for i in `find $pkgpath/$poolname/pool/* -name *.deb`; do
  {
    # extract the control info
    ar -x $i control.tar.gz || return 1
    tar -xaf control.tar.gz ./control || return 1

    # add to ../Packages file removing null lines as we go.
    cat control | sed '/^$/d' &gt;&gt; Packages

    # need filename tag, relative path 
    echo &quot;Filename: $i&quot; | sed 's|.*\/pool\/|pool\/|' &gt;&gt; Packages
    
    # need exact file size, use disk usage (du) to get total for one file
    fsize=`du -cb $i | sed '/total/!d; s| *total||'`
    echo &quot;Size: $fsize&quot;
    
    # need at least md5sum, sha1sum and sha256sum appear to be optional
#    sum=`md5sum $i`
# remove filename from md5sum output -rs
    sum=`md5sum $i | cut -d' ' -f1`
    echo &quot;MD5sum: $sum&quot;

  }
  done
  
  # move up to where the Packages.gz and/or bz2 will be
  cd ..
  mv tmp/Packages .
  
  # cleanup
  rm -f tmp/*
  rmdir tmp
}


# mk_Package() # distname poolname
mk_pool()
{
  local pkgpath=&quot;$PWD&quot;
  local distname=$1
  local poolname=$2
  local indexpath
  
  # syntax and error checks
  if [ &quot;&quot; == &quot;$distname&quot; ]; then 
    usage
    return 1
  fi

  if [ &quot;&quot; == &quot;$poolname&quot; ]; then 
    usage
    return 1
  fi
  if [ ! -x $poolname/pool ]; then 
    echo &quot;Can't find '$poolname/pool' (deb files) folder&quot;
    return 1
  fi
  indexpath=dists/$distname/$poolname/$BUILD_TYPE
  mkdir -p $indexpath/tmp
  rm -f $indexpath/tmp/*
  
  # copy all the control files into the tmp dir
  # operating from that directory temporarily
  
  cd $indexpath/tmp 
  create_package_files $pkgpath $poolname
  cd $pkgpath
  
}</pre>
</div>Run it as 'mk_pool' and see the help/usage notes.  After testing in a dummy location, repeat as superuser in the real location for your archive if it looks like it's working.  And...<br />
<br />
If this all works, great.  If not... let me know so I can start running.  :-)<br />
<br />
No dangerous globbed deletions or anything (other than in the tmp folder), so the worst any of this is likely to do is put files all over the place.  <br />
<br />
Still... no warrantees.  Fair enough? :-)<br />
<br />
I'll try to remember to update this if necessary when I get back into kubuntu.<br />
<br />
--------------<br />
<br />
If anyone knows of a utility that already exists that creates debian archives with Package lists, go ahead and post it here and I'll remove my own somewhat experimental inventions.<br />
<br />
PS. if you think I should just post a bug report, let me ask you how much good that's done so far?<br />
<br />
Besides.  Here it is.  If you think it's a valid observation, feel free to forward it anywhere you like.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34373</guid>
		</item>
		<item>
			<title>Slackware-13.37-Hacks-TrueCrypt</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34372</link>
			<pubDate>Mon, 16 Jan 2012 01:40:04 GMT</pubDate>
			<description>You need to compile and install in the following order from SlackBuilds: 
 
cryptoki-2.20 
wxGTK-2.8.12 
truecrypt-7.1 
 
CREATING AN ENCRYPTED...</description>
			<content:encoded><![CDATA[<div>You need to compile and install in the following order from SlackBuilds:<br />
<br />
cryptoki-2.20<br />
wxGTK-2.8.12<br />
truecrypt-7.1<br />
<br />
CREATING AN ENCRYPTED FILE-BASED CONTAINER<br />
<br />
At the TrueCrypt dialog box, select &quot;Create Volume&quot;.<br />
Select &quot;Create an encrypted file container&quot; and click Next.<br />
Select &quot;Standard TrueCrypt Volume&quot; and click Next.<br />
At the Volume Location dialog box, click Select File.<br />
Navigate to any directory you wish and type a name in the File Name section of the dialog box and click Save.<br />
You will now see the complete filename and path. If it is OK, click Next.<br />
The default Encryption algorithm is AES 256-Bit with a default Hash algorithm of RIPEMD-160, which you can change. If it is OK, click Next.<br />
At the Volume Size dialog box, enter the size of the encrypted file container. Then click Next.<br />
At the Volume Password dialog box, enter the password for the encrypted volume twice and click Next.<br />
The recommended length of container passwords is 20 characters, so you will get a warning if it is shorter. If you want to use the short password anyway, click YES.<br />
At the Format Options dialog box, you can select a File System Type. The available choices are: FAT, Linux Ext2, Linux Ext3 and Linux Ext4.<br />
At the Volume Format dialog box, there is a message to move your mouse as randomly as possible within the window and when ready to format, click Format.<br />
After the Volume is created, you will get a confirmation message.<br />
If you wish to create another Volume, click Next. Otherwise click Exit.<br />
<br />
MOUNTING THE VOLUME<br />
<br />
At the main TrueCrypt dialog box, click the Select File button and find the container you just created. Select Mount.<br />
Select and highlight a free slot. They are numbered 1 through 64.<br />
Enter the container password. Hit OK.<br />
Enter your user password (NOT the root password). Hit OK.<br />
The truecrypt file containers mount on /media/truecryptX<br />
Where X is the slot number you chose from the truecrypt dialog box.</div>

]]></content:encoded>
			<dc:creator>arniekat</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34372</guid>
		</item>
		<item>
			<title><![CDATA[It's alive.]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34371</link>
			<pubDate>Sun, 15 Jan 2012 17:54:24 GMT</pubDate>
			<description>Replaced several apps on the web server. Sugarcrm is gone now. But by and large the server is running again. Still have to finish setting up the...</description>
			<content:encoded><![CDATA[<div>Replaced several apps on the web server. Sugarcrm is gone now. But by and large the server is running again. Still have to finish setting up the email server. <br />
<br />
Solved my problem with qb64. Now I can run so much old software on linux! Compiled my old database program. <br />
<br />
Found source code for a neat little web server (nweb) at IBM that serves static files. Compiled it and works great on linux. Perfect for our robotics project.<br />
<br />
Time to watch football...</div>

]]></content:encoded>
			<dc:creator>peonuser</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34371</guid>
		</item>
		<item>
			<title>Stragest BugZ Part 1</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34370</link>
			<pubDate>Sun, 15 Jan 2012 16:14:27 GMT</pubDate>
			<description><![CDATA[Before I forget, I want to jot some notes on the screwiest bugs I've seen. 
 
First, openSUSE. 
 
I'm using version 11.4, but it's very likely that...]]></description>
			<content:encoded><![CDATA[<div>Before I forget, I want to jot some notes on the screwiest bugs I've seen.<br />
<br />
First, openSUSE.<br />
<br />
I'm using version 11.4, but it's very likely that some of these misfeatures are still present in 12.1 though the newer kde seems to behave a bit better. Better, at least when JAWS appears.  The newer KDE it may self correct better but you may well still see the effect for an instant even so.<br />
<br />
JAWS!<br />
<br />
The exploding desktop bug, or &quot;JAWS&quot;, which is what I named it for the  ripped up appearance of my desktop and even menu text at times.<br />
<br />
This is apparently caused by or exacerbated by an incorrect setting for full screen applications and open GL screensavers.  Screensavers are fullscreen applications.<br />
<br />
To see one run non-fullscreen type:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">/usr/lib/xscreensaver/atlantis</pre>
</div>Look in that directory for other screensavers you can launch from the terminal as well.<br />
<br />
Here's what happened on my system.  <br />
<a href="http://rainbowsally.net/pub/cdab-pixel-mixup.png" target="_blank">http://rainbowsally.net/pub/cdab-pixel-mixup.png</a><br />
<br />
Nobody at the openSUSE forums believed me.  I posted a bug report, yes, but that was the last bug report I posted.  If nobody else thinks these are bugs, well...  Maybe it's just a matter of preference.  ;-)<br />
<br />
If you have seen that bug, I for one, believe you. Try this: Make sure that your<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">System Settings -&gt; Desktop Effects -&gt; / Advanced \</pre>
</div>settings for 'Suspend desktop effects for fullscreen windows is <b>UN-checked</b>.<br />
<br />
Other side effects include (but are not limited to) inability to unlock a locked screen -- the unlock widget may disappear, appear in parts and may not include a cursor in the password text entry field.  This may be because the unlock widget DOES require plasma effects.<br />
<br />
And here's another openSUSE puzzler.<br />
<br />
LOGOUT/LOST-DATA<br />
<br />
For some reason, especially when I was compiling, using konqueror, konsole, and switching windows with Alt-TAB, but sometimes with other Alt-&lt;key&gt; combos and  even once when I tried to ascend a directory clicking on the up-arrow in my file manager, I would get kicked out to the 'greeter' and have to log back in.<br />
<br />
Fortunately files I was editing would be restorable, but files I was moving, copying etc., occasionally got fouled up when this happened.  And it happened often, averaging about once every two hours at one point, which was REALLY puzzling.<br />
<br />
I wondered: Was 'superuser' on a timeout?  That was one possibility I investigated but that was not the case.<br />
<br />
It took two months to track this down, by the way.  It's a simple fix, but it was sooooooo random that I want to make sure to jot this down in case it's helpful to anyone else.<br />
<br />
This bug may be caused by or exacerbated by another poor choice in my desktop effects.<br />
<br />
If you have this problem try this:  Check here...<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 34px;
		text-align: left;
		overflow: auto">System Settings -&gt; Desktop Effects -&gt; / All Effects \</pre>
</div>And see how many of the four effects at the top of the Window Management section are selected.<br />
<br />
The main culprit appears to be the second in the list (Cover Switch), which appears to run too slowly or get confused when an Alt-&lt;KEY&gt; is pressed.  <br />
<br />
These keys are tossed around through the DBus and they are global, so more than one app may  use the same keys, depending on the context of the key press.<br />
<br />
Also helpful in this (which I discovered as the first signs of improvement before I noticed  that the aforementioned desktop effect was the real cause on my machine) was using a static-linked i915_dri.so file.  It's from the Mesa (7.11-rc1) for the intel i915 driver.  It's not  easy to compile, because Mesa wants you to compile the whole collection, but I may post a  work-around for that later, especially if anyone gives a me shout needing that file.<br />
<br />
BUT I STILL USE OPENSUSE.<br />
<br />
What I DO like about openSUSE is that despite their attempts to make it impossible to &quot;boot installed system&quot; ever since version 10.x it is still possible to use the installation DVD to boot into a pretty broken or inaccessible installation.<br />
<br />
Use the DVD.  Say you want to install/update. For the update select ZERO FILES.  Proceed through the update and reboot process.  Fix whatever may still need repairs and reboot to test.<br />
<br />
This has saved my system several times.  I wish there was still that little button in the  installer, but nevermind.  Let others learn the hard way too, eh?  :-)<br />
<br />
I also like yast a lot, especially the software management.  It gives you a lot of control  over which files to install and some ability to override it's decisions.  When that fails rpm on the commandline can really enforce your preference, and all's well that ends well.<br />
<br />
An example of this forced override might be if you need libreadline.so.5 but installing it would uninstall libreadline.so.6 and a gazillion other files that require the newer lib. Manually installing the older lib using rpm on the commandline allows forcing the installation.  I did have to  do this when I needed the older lib for xmaxima.  Actually I think I may have had to extract and copy the binary into the /lib folder that time, but you get the point. All's well that  ends well.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34370</guid>
		</item>
		<item>
			<title><![CDATA[So you'd like to run apps from the commandline as su or user]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34369</link>
			<pubDate>Sun, 15 Jan 2012 05:24:15 GMT</pubDate>
			<description><![CDATA[So you'd like to run apps from the commandline as su or user 
 
In case it's not clear, and it probably isn't, this modification (openSUSE version so...]]></description>
			<content:encoded><![CDATA[<div>So you'd like to run apps from the commandline as su or user<br />
<br />
In case it's not clear, and it probably isn't, this modification (openSUSE version so far):<br />
<br />
[x] Allows users to run gui apps (such as kate or kwrite, konqueror or dolphin) and non-gui apps with the same syntax, no wrappers.  I.e., makes kde work WITH linux instead of against it.<br />
<br />
[x] Allows uniform syntax for calling script-based programs which may now call gui apps or not and run without crashing, whether run as user or superuser.  <br />
<br />
[x] superuser handling done once, programatically instead requiring recurring wrapper call every time you run a gui app (which WILL crash in kde without this modification if you are already superuser).<br />
<br />
Try this without the modification.  It will demonstrate half the reason this modification (or something like it) is necessary.<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 50px;
		text-align: left;
		overflow: auto">su # enter password
kdesu kwrite</pre>
</div>CRASH!<br />
<br />
Here's the finished version for openSUSE.  The code for kubuntu is still not quite finished.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto"># For openSUSE, run apps as user or 'su' 
# without kdesu/xdg-su or any other su 
# wrapper.
# Integrates gui and terminal apps the way 
# you'd expect them to be.
# How:
# add this to, or create /root/(dot)bashrc 
# containing this code.

function _su_check_connected
{
  dbus-send --dest=org.freedesktop /org/freedesktop org.freedesktop.Hello 2&gt;/dev/null
}

function _su_check
{
  if [ &quot;$USER&quot; != &quot;root&quot; ]; then
    for i in /root/.dbus/session-bus/*; do
      source $i
      export DBUS_SESSION_BUS_ADDRESS
      if _su_check_connected ; then
        # we are now connected to the first dbus-daemon that worked
        return
      fi
    done
    # if no files contain a valid address, we'll just create one.
    export $(dbus-launch)
    # if root logs in before su does, root's daemon will get reused
    # otherwise there will be one for su and one for root.
    # two daemons is tolerable.  600+ is not.
  fi
}

_su_check</pre>
</div>The above is tested and bug-free for openSUSE 11.4.  (At least it is for me and I've been using it for several months.)<br />
<br />
Kubuntu Note:<br />
<br />
The kubuntu code will be forthcoming soon but may require some help from some of the old timers around here because we need to catch and handle relaying a SIGHUP to root's 'knotify' in order to prevent SUDO_USER hanging in the dimmed state when trying to logout or shutdown.<br />
<br />
Root's knotify can be looked up using 'pgrep knotify -u root' and sent the signal (kill -s 15 &lt;PID&gt;) as superuser in order to clear the stuff that hangs, but that shouldn't be necessary.<br />
<br />
That *should* be handled programmatically too.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34369</guid>
		</item>
		<item>
			<title>This is very cool.  I have a blog.</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34368</link>
			<pubDate>Sun, 15 Jan 2012 04:58:09 GMT</pubDate>
			<description>Thanks for the blog LQ! 
 
Maybe this is where I should have been posting before. 
 
Stay tuned.</description>
			<content:encoded><![CDATA[<div>Thanks for the blog LQ!<br />
<br />
Maybe this is where I should have been posting before.<br />
<br />
Stay tuned.</div>

]]></content:encoded>
			<dc:creator>rainbowsally</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34368</guid>
		</item>
		<item>
			<title>OpenLDAP and Perl</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34367</link>
			<pubDate>Thu, 12 Jan 2012 23:15:46 GMT</pubDate>
			<description>I recently deployed a slapd(8) instance, and immediately recognized the need for a robust directory entry management utility. After doing some...</description>
			<content:encoded><![CDATA[<div>I recently deployed a slapd(8) instance, and immediately recognized the need for a robust directory entry management utility. After doing some reading and experimentation, I discovered that Perl - and a few accompanying modules - handle the job nicely. What I'm sharing here is a <i>brief</i>, rather disjointed synopsis and some code samples. <br />
<br />
In order to understand and use the samples, you should be comfortable with Perl and the installation of modules. And you'll certainly want a good fundamental understanding of LDAPv3 itself. (Both are outside the scope of this post.) <br />
<br />
<b><u>References</u></b><ul><li> <i>LDAP System Administration</i>, by Gerald Carter, 2003 O'Reilly</li>
<li> <a href="http://www.linuxjournal.com/article/7086" target="_blank">An Introduction to perl-ldap</a></li>
<li> <a href="http://search.cpan.org/~gbarr/perl-ldap/lib/Net/LDAP/Examples.pod" target="_blank">Net::LDAP examples</a></li>
</ul><br />
<b><u>Useful Lingo</u></b><br />
<br />
Before we get started, there are some acronyms and other terminology that you should become familiar with. This list is very limited, and is no substitute for a strong understanding of the object class you will be working with (e.g. <a href="http://tools.ietf.org/html/rfc2798" target="_blank">inetOrgPerson</a>).  <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 370px;
		text-align: left;
		overflow: auto">      |                                          |
 TERM |         DESCRIPTION                      |         EXAMPLE 
--------------------------------------------------------------------------------------
      | Distinguished name of an LDAP entry.     | dn: 
dn    | (Uniquely identifies it.)                | uid=tia,ou=users,dc=shushu,dc=local 
      |                                          |
--------------------------------------------------------------------------------------
      | Relative distinguished name of an LDAP   | rdn:
rdn   | entry. (Think of 'rdn' as relative name, | uid=tia
      | vs. 'dn' as fully-qualified name.)       |
--------------------------------------------------------------------------------------
      | Domain component. For instance, in the   | dc:
dc    | root DN &quot;dc=shushu,dc=local&quot;, the first  | shushu
      | domain component is &quot;shushu&quot;.            | 
--------------------------------------------------------------------------------------
      | Common name. An entry attribute that,    | cn: 
cn    | for user entries, is often first and     | Tia Sato
      | last name.                               | 
--------------------------------------------------------------------------------------
      | User account ID. Another entry attribute | uid: 
uid   | often used to identify users.            | t.sato
      |                                          |</pre>
</div><b><u>Connecting to your LDAP service with Perl</u></b><br />
<br />
The first example utilizes Net::LDAP to connect to a localhost instance. Note the bind-&gt;code check; this is generally important for error handling after Net::LDAP operations. <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 338px;
		text-align: left;
		overflow: auto">#!/usr/bin/perl
 
use warnings ;
use strict ;
use Net::LDAP ;
 
my $auth_account = qq/cn=Mr Admin,dc=shushu,dc=local/ ; 
my $auth_pass    = qq/good.nice.password/ ;
 
# Connect to the OpenLDAP daemon
my $ldap_conn = Net::LDAP-&gt;new(&quot;localhost&quot;, port =&gt; 389, timeout =&gt; 15)
  or die &quot;Unable to connect to LDAP server: $@&quot; ;
 
# Login (aka &quot;bind&quot;) to the directory
my $bind = $ldap_conn-&gt;bind($auth_account, password =&gt; $auth_pass ) ;
 
# Check code for success or failure (0 is success)
if($bind-&gt;code) {
  die $bind-&gt;error_name . ': ' . $bind-&gt;error_text ;
}</pre>
</div>Connecting to the same localhost instance over TLS (assuming it's configured and available) is only slightly different. We simply use Net::LDAPS instead. <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 114px;
		text-align: left;
		overflow: auto">...
use Net::LDAPS ;
...
# Connect to the OpenLDAP daemon
my $ldap_conn = Net::LDAPS-&gt;new(&quot;localhost&quot;, port =&gt; 636, timeout =&gt; 15)
  or die &quot;Unable to connect to LDAP server: $@&quot; ;</pre>
</div><b><u>Performing a search using Perl</u></b><br />
<br />
In order to ensure that we're writing proper and efficient search criteria, a quick look at search scope first. <br />
<ul><li> sub -- Recursively search all subtrees / entries below the specified entity</li>
<li> one -- Search only the immediate children of the specified entity</li>
<li> base -- Search only the specified entity itself </li>
</ul><br />
In the code example that follows, search scope is specified in the Net::LDAP-&gt;search( scope =&gt; ... ) value. <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 322px;
		text-align: left;
		overflow: auto"># Code assumes active, authenticated Net::LDAP session in $ldap_conn..

my $cn = 'Beverly Xin' ;
 
my $search = $ldap_conn-&gt;search(
  base   =&gt;     &quot;ou=users,dc=shushu,dc=local&quot;,
  scope  =&gt;     &quot;one&quot;,
  filter =&gt;     &quot;cn=$cn&quot;) ;
 
# Unbind when finished with the query
$ldap_conn-&gt;unbind() ;

print $search-&gt;error_name . ': ' . $search-&gt;error_text . &quot;\n&quot; ;
 
foreach($search-&gt;entries) {

  print $_-&gt;ldif() ;
 
}</pre>
</div>Some points to note about the code above: The Beverly Xin cn is a child of ou=users, so we use the &quot;one&quot; scope. We are able to unbind() after $ldap_conn-&gt;search(), because the results (if any) are stored in the $search object.<br />
<br />
<b><u>Adding a new entry using Perl</u></b><br />
<br />
This example provides a way to add users without using LDIF entries. Note the error checking via Net::LDAP-&gt;code. <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 386px;
		text-align: left;
		overflow: auto"># Code assumes active, authenticated Net::LDAP session in $ldap_conn..

my $dn = 'cn=Sasha Lee,ou=users,shushu,dc=local' ;
my $cn = 'Sasha lee' ;
my $sn = 'Lee' ;
my $uid = 's.lee' ;
my $mail = 'sasha.lee@shushu.local' ;
my @dept = ['Info Tech', 'Financial'] ;
my $objclass = 'inetOrgPerson' ;
 
my $add =
  $ldap_conn-&gt;add( $dn,
         attr =&gt; [ 'cn' =&gt; $cn, 
                   'sn' =&gt; $sn, 
                   'uid' =&gt; $uid,
                   'mail' =&gt; $mail,
                   'departmentNumber' =&gt; @dept,
                   'objectClass' =&gt; $objclass ] ) ;
 
# add() failure checking ('code' is 0 upon success)
if($add-&gt;code) {
  die $add-&gt;error_name . ': ' . $add-&gt;error_text ;
}</pre>
</div><b><u>Deleting an entry using Perl</u></b><br />
<br />
This example deletes the user we just created - referring to the entry by dn. <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 178px;
		text-align: left;
		overflow: auto"># Code assumes active, authenticated Net::LDAP session in $ldap_conn..

my $dn = 'cn=Sasha Lee,ou=users,shushu,dc=local' ;
 
my $delete = $ldap_conn-&gt;delete($dn) ;
 
# delete() failure checking ('code' is 0 upon success)
if($delete-&gt;code) {
  die $delete-&gt;error_name . ': ' . $delete-&gt;error_text ;
}</pre>
</div><b><u>Modifying entry attributes using Perl</u></b><br />
<br />
Modifying entries is slightly more complicated. At least three types of modifications can be made: <ol style="list-style-type: decimal"><li> Attributes can be added</li>
<li> Attributes can be deleted</li>
<li> Attributes can be changed</li>
</ol><br />
The following example provides a look at all three operations. <br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 498px;
		text-align: left;
		overflow: auto"># Code assumes active, authenticated Net::LDAP session in $ldap_conn..

my $dn = 'cn=Crystal Zhao,ou=users,dc=shushu,dc=local' ;
 
# Replace attribute (i.e. change an existing value to a new value)
my $mod = $ldap_conn-&gt;modify($dn, 
            replace =&gt; { 'mail' =&gt; 'hmm@localhost' } ) ;
 
# Status checking ('code' is 0 upon success)
if($mod-&gt;code) {
  die $mod-&gt;error_name . ': ' . $mod-&gt;error_text ;
}
 
# ------------------------------------------------------------------- #
 
# Add attribute values
$mod = $ldap_conn-&gt;modify($dn, 
          add =&gt; { 'departmentNumber' =&gt; ['Unknown', 'Payroll'] } ) ;
 
# Status checking ('code' is 0 upon success) and commit
if($mod-&gt;code) {
  die $mod-&gt;error_name . ': ' . $mod-&gt;error_text ;
}
 
# ------------------------------------------------------------------- #
 
# Delete attribute by value
$mod = $ldap_conn-&gt;modify($dn, 
          delete =&gt; { 'departmentNumber' =&gt; 'Unknown' } ) ;
 
# Status checking ('code' is 0 upon success) and commit
if($mod-&gt;code) {
  die $mod-&gt;error_name . ': ' . $mod-&gt;error_text ;
}
 
# Alternatively, we can delete all attribute values
$mod = $ldap_conn-&gt;modify($dn, 
          delete =&gt; [ 'departmentNumber' ] ) ;
 
# Status checking ('code' is 0 upon success) and commit
if($mod-&gt;code) {
  die $mod-&gt;error_name . ': ' . $mod-&gt;error_text ;
}</pre>
</div>This approach is <i>not</i> the only (or necessarily the best) way to modify entries. The Net::LDAP module also provides an excellent interface through <a href="http://search.cpan.org/~gbarr/perl-ldap-0.43/lib/Net/LDAP/Entry.pod" target="_blank">Net::LDAP::Entry</a>.</div>

]]></content:encoded>
			<dc:creator>anomie</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34367</guid>
		</item>
		<item>
			<title>RedHat Cluster Suite and Conga - Linux Clustering</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34366</link>
			<pubDate>Wed, 11 Jan 2012 22:14:24 GMT</pubDate>
			<description>This how to describes an easy step by step installation of the Red  Hat Cluster Suite on 3 centos nodes and prepare them as nodes of a  cluster. You...</description>
			<content:encoded><![CDATA[<div>This how to describes an easy step by step installation of the Red  Hat Cluster Suite on 3 centos nodes and prepare them as nodes of a  cluster. You will also install the Management suite which is web based  and is known as Conga.<br />
<br />
You will use 3 nodes to form the cluster  and 1 node as the cluster management node and as a cluster node it will  not take part. All the nodes and the management node should be  resolvable either by host file entries or by DNS.<br />
<br />
Cluster Nodes:<br />
cnode1:<br />
    eth0-192.168.2.151/24 - external-lan<br />
    eth1-192.168.1.200/26 - internal-lan cluster<br />
cnode2:<br />
    eth0-192.168.2.152/24 - external-lan<br />
    eth1-192.168.1.201/26 - internal-lan cluster<br />
cnode3:<br />
    eth0-192.168.2.153/24 - external-lan<br />
    eth1-192.168.1.202/26 - internal-lan cluster<br />
 <br />
Cluster Management Node:<br />
centos:<br />
    eth0-192.168.2.150/24<br />
<br />
As  the cluster, its management interface and the service deamons use tcp,  for the purpose of this article you can disable the firewalls at these  nodes.<br />
<br />
OS - All Nodes:<br />
    CentOS 6 Minimal<br />
    <br />
Cluster Nodes - Software Installation:<br />
    yum groupinstall &quot;High Availability&quot;<br />
    yum install ricci<br />
    <br />
Cluster Management Node - Software Installation:<br />
    yum groupinstall &quot;High Availability Management&quot;<br />
    yum install ricci<br />
<br />
Copy this initial sample cluster config file into /etc/cluster/cluster.conf at all the nodes cnode1, cnode2, cnode3.<br />
&lt;?xml version=&quot;1.0&quot;?&gt;<br />
&lt;cluster config_version=&quot;1&quot; name=&quot;cl1&quot;&gt;<br />
    &lt;clusternodes&gt;<br />
        &lt;clusternode name=&quot;cnode1&quot; nodeid=&quot;1&quot;/&gt;<br />
        &lt;clusternode name=&quot;cnode2&quot; nodeid=&quot;2&quot;/&gt;<br />
        &lt;clusternode name=&quot;cnode3&quot; nodeid=&quot;3&quot;/&gt;<br />
    &lt;/clusternodes&gt;<br />
&lt;/cluster&gt;<br />
<br />
This initial file states that the cluster name is 'cl1' and defines the cluster nodes.<br />
<br />
Now some services have to be configured and started at the nodes first and then at the management node as below.<br />
<br />
Cluster Nodes:<br />
    chkconfig iptables off<br />
    chkconfig ip6tables off<br />
    chkconfig ricci on<br />
    chkconfig cman on<br />
    chkconfig rgmanager on<br />
    chkconfig modclusterd on<br />
<br />
    create a password for the ricci service user with 'passwd ricci'<br />
    <br />
    service iptables stop<br />
    service ip6tables stop<br />
    service ricci start<br />
    service cman start<br />
    service rgmanager start<br />
    service modclusterd start<br />
<br />
Cluster Management Node:<br />
    chkconfig iptables off<br />
    chkconfig ip6tables off<br />
    chkconfig luci on<br />
    chkconfig ricci on<br />
<br />
    service iptables stop<br />
    service ip6tables stop<br />
    service luci start<br />
    service ricci start<br />
<br />
luci  service is the management service that presents the web based cluster  interface via https at port 8084 and can be accessed in any browser at<br />
https://&lt;cluster management node FQDN or hostname:8084&gt;/<br />
<br />
ricci  service is the under laying daemon that helps in cluster configuration  sync and file copy, service start, stop etc. and uses tcp port 11111.<br />
<br />
cman,  rgmanager and modclusterd are the actual cluster services which futher  start other services that actually make the clustering happen and keep  it live.<br />
<br />
Open a browser and enter the conga node url which in tis case is <a href="https://centos:8084/" target="_blank">https://centos:8084/</a><br />
After  clicking 'ok' to the initial warning information you will be presented  with the login screen. Enter the root user and root password of that  system and start the interface.<br />
<br />
Now click Add cluster and add the  first node cnode1 and the ricci password, click 'ok' and it will detect  the other two nodes also, add the ricci passwords and the cluster will  be added to the Cluster Management interface. The cluster can be managed  and configured from this interface. Care should be take as the  cluster.conf file sometimes does not get synced to all cluster nodes  they will get fenced due to version misconfiguration. At such times copy  the cluster.conf file from node1 to all the other nodes. If all the  nodes are in sync then the up time is shown in the cluster nodes list.<br />
<br />
Getting  a cluster, configuring and managing, your cluster is up, live and  configured in no time and later other clusters can be added into this  management interface for easy maintenance.<br />
<br />
<br />
- Bellamkonda Sudhakar</div>

]]></content:encoded>
			<dc:creator>sudhagud</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34366</guid>
		</item>
		<item>
			<title>git commit</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34365</link>
			<pubDate>Wed, 11 Jan 2012 02:20:32 GMT</pubDate>
			<description><![CDATA[Creating and Commiting 
 
$ cd (project-directory) 
$ git init 
$ (add some files) 
$ git add . 
$ git commit -m 'Initial commit' 
 
Cloning and...]]></description>
			<content:encoded><![CDATA[<div>Creating and Commiting<br />
<br />
$ cd (project-directory)<br />
$ git init<br />
$ (add some files)<br />
$ git add .<br />
$ git commit -m 'Initial commit'<br />
<br />
Cloning and Creating a Patch<br />
<br />
$ git clone git://github.com/git/hello-world.git<br />
$ cd hello-world<br />
$ (edit files)<br />
$ git add (files)<br />
$ git commit -m 'Explain what I changed'<br />
$ git format-patch origin/master<br />
<br />
<br />
Basic Commands<br />
$ git status<br />
$ git log<br />
<br />
<br />
Set Up SSH Keys<br />
~$ cd .ssh<br />
/home/bambreeze/.ssh<br />
.ssh$ ll<br />
total 4.0K<br />
-rw-r--r-- 1 bambreeze bambreeze 1.3K 2011-08-09 21:55 known_hosts<br />
.ssh$ ssh-keygen -t rsa -C &quot;bambreeze@gmail.com&quot;<br />
Generating public/private rsa key pair.<br />
Enter file in which to save the key (/home/bambreeze/.ssh/id_rsa): <br />
Enter passphrase (empty for no passphrase): <br />
Enter same passphrase again: <br />
Your identification has been saved in /home/bambreeze/.ssh/id_rsa.<br />
Your public key has been saved in /home/bambreeze/.ssh/id_rsa.pub.<br />
The key fingerprint is:<br />
...<br />
The key's randomart image is:<br />
...<br />
.ssh$ ls<br />
id_rsa  id_rsa.pub  known_hosts<br />
.ssh$ vim id_rsa.pub<br />
<br />
...<br />
&lt;Add your SSH key to GitHub.&gt;<br />
<br />
&lt;On the GitHub site Click “Account Settings” &gt; Click “SSH Public Keys” &gt;Click “Add another public key”&gt;<br />
<br />
...<br />
.ssh$ ssh -T <a href="mailto:git@github.com">git@github.com</a><br />
Hi bambreeze! You've successfully authenticated, but GitHub does not provide shell access.<br />
<br />
Set Up Your Info<br />
<br />
Now that you have Git set up and your SSH keys entered into GitHub, it’s time to configure your personal info.<br />
<br />
Set your username and email.<br />
<br />
Git tracks who makes each commit by checking the user’s name and email. In addition, we use this info to associate your commits with your GitHub account. To set these, enter the code below, replacing the name and email with your own. The name should be your actual name, not your GitHub username.<br />
<br />
config$ git config --global user.name &quot;bambreeze&quot;<br />
config$ git config --global user.email <a href="mailto:bambreeze@gmail.com">bambreeze@gmail.com</a><br />
<br />
Some tools connect to GitHub without SSH. To use these tools properly you need to find and configure your API Token.<br />
<br />
On the GitHub site Click “Account Settings” &gt; Click “Account Admin.”<br />
~$ git config --global github.user bambreeze<br />
~$ git config --global github.token &lt;your_token&gt;<br />
<br />
<br />
Create A Repository @ GitHub<br />
ldd3$ git init<br />
Initialized empty Git repository in /home/bambreeze/workspace/git-space/ldd3/.git/<br />
ldd3$ git add .<br />
ldd3$ git status<br />
...<br />
ldd3$ git commit -m &quot;initial commit for Linux Device Driver (3rd) examples&quot;<br />
Created initial commit ec142ce: initial commit for Linux Device Driver (3rd) examples<br />
 99 files changed, 13387 insertions(+), 0 deletions(-)<br />
...<br />
ldd3$ git status<br />
# On branch master<br />
nothing to commit (working directory clean)<br />
ldd3$ touch README<br />
ldd3$ vim README<br />
ldd3$ git add README<br />
ldd3$ git status<br />
# On branch master<br />
# Changes to be committed:<br />
#   (use &quot;git reset HEAD &lt;file&gt;...&quot; to unstage)<br />
#<br />
#       new file:   README<br />
#<br />
ldd3$ git commit -m &quot;adding README file for LDD3-Examples project&quot;<br />
Created commit 40db767: adding README file for LDD3-Examples project<br />
 1 files changed, 2 insertions(+), 0 deletions(-)<br />
 create mode 100644 README<br />
ldd3$ git remote add origin <a href="mailto:git@github.com:bambreeze/LDD3-Examples.git">git@github.com:bambreeze/LDD3-Examples.git</a><br />
ldd3$ git push origin master<br />
Counting objects: 123, done.<br />
Compressing objects: 100% (121/121), done.<br />
Writing objects: 100% (123/123), 100.69 KiB, done.<br />
Total 123 (delta 46), reused 0 (delta 0)<br />
To <a href="mailto:git@github.com:bambreeze/LDD3-Examples.git">git@github.com:bambreeze/LDD3-Examples.git</a><br />
 * [new branch]      master -&gt; master<br />
<br />
<br />
Linux Kernel Source of Linus's Tree<br />
git-space$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git<br />
Initialized empty Git repository in /home/bambreeze/workspace/git-space/linux/.git/<br />
remote: Counting objects: 2132239, done.<br />
remote: Compressing objects: 100% (333476/333476), done.<br />
Receiving objects: 100% (2132239/2132239), 416.26 MiB | 275 KiB/s, done.<br />
remote: Total 2132239 (delta 1779248), reused 2131825 (delta 1778914)<br />
Resolving deltas: 100% (1779248/1779248), done.<br />
Checking out files: 100% (37083/37083), done.<br />
git-space$ cd linux/<br />
/home/bambreeze/workspace/git-space/linux<br />
linux$ git pull<br />
Already up-to-date.</div>

]]></content:encoded>
			<dc:creator>915086731</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34365</guid>
		</item>
		<item>
			<title>TODO List</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34364</link>
			<pubDate>Tue, 10 Jan 2012 12:17:05 GMT</pubDate>
			<description><![CDATA[Here's my todo list for 2012, in no particular order: 
Learn to type, using more than two fingers of one hand.  
Learn how to use vim and emacs....]]></description>
			<content:encoded><![CDATA[<div>Here's my todo list for 2012, in no particular order:<br />
Learn to type, using more than two fingers of one hand. <br />
Learn how to use vim and emacs.<br />
Learn how to program: bash scripting, C, Python or Perl, assembly.<br />
Learn more in general about using GNU/Linux.<br />
<b><i>But</i></b>, acknowledging the fact that I'm incurably lazy, I shall be making the same todo list this time next year. :)</div>

]]></content:encoded>
			<dc:creator>brianL</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34364</guid>
		</item>
		<item>
			<title>How to pass command line arguments to main() through GDB? - C</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34363</link>
			<pubDate>Tue, 10 Jan 2012 12:12:47 GMT</pubDate>
			<description><![CDATA[test.c 
 
Code: 
--------- 
#include <stdio.h> 
#include <string.h> 
 
int main (int argc, char *argv[]) 
{ 
   if (argc >= 2)]]></description>
			<content:encoded><![CDATA[<div>test.c<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 274px;
		text-align: left;
		overflow: auto">#include &lt;stdio.h&gt;
#include &lt;string.h&gt;

int main (int argc, char *argv[])
{
   if (argc &gt;= 2)
   { 
      int i;
      for (i = 1; i &lt; argc; i++)
         printf (&quot;\nHaalloo! %s&quot;, argv[i]);
   }
   else
      printf (&quot;\nForgot to key in something?&quot;);

   return 0;
}</pre>
</div>Passing command line arguments to main() through GDB:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<pre class="bbcodeblock" dir="ltr" style="
		margin: 0px;
		margin-right: -99999px;
		padding: 3px;
		border: 1px inset;
		width: 98%;
		height: 290px;
		text-align: left;
		overflow: auto">anisha@linux-dopx:~/&gt; <b><font color="Yellow">gcc -g</font></b> test.c 
anisha@linux-dopx:~/&gt; <b><font color="yellow">gdb</font></b> a.out <b><font color="yellow">-silent</font></b>
<font color="Silver">Reading symbols from /home/anisha/a.out...done.</font>
<b>(gdb)</b> <font color="Yellow"><b>r</b></font>
Starting program: /home/anisha/a.out 

<i>Forgot to key in something?</i>

Program exited normally.
<b>(gdb)</b> <b><font color="yellow">r</font></b> anisha kaul
<font color="Silver">Starting program: /home/anisha/a.out anisha kaul</font>

<i>Haalloo! anisha
Haalloo! kaul </i>

<font color="silver">Program exited normally.</font>
<b>(gdb) </b></pre>
</div></div>

]]></content:encoded>
			<dc:creator>Anisha Kaul</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34363</guid>
		</item>
		<item>
			<title>samba Account with LDAP in Centos 6</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34362</link>
			<pubDate>Mon, 09 Jan 2012 14:07:59 GMT</pubDate>
			<description>Please Help I am using Centos 6. I wanted to configure samba to use ldap account as i am using LDAP for SVN . 
Regards 
Unnikrishnan P R...</description>
			<content:encoded><![CDATA[<div>Please Help I am using Centos 6. I wanted to configure samba to use ldap account as i am using LDAP for SVN .<br />
Regards<br />
Unnikrishnan P R<br />
<a href="mailto:unni.kpr@gmail.com">unni.kpr@gmail.com</a><br />
<br />
Thanks in Advance</div>

]]></content:encoded>
			<dc:creator>unni.kpr@gmail.com</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34362</guid>
		</item>
		<item>
			<title>To copy the Content of web in unix file.</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34361</link>
			<pubDate>Mon, 09 Jan 2012 06:42:04 GMT</pubDate>
			<description>Hi, 
   I have one quey iam hitting one URL in browser its giving a expected output,but when iam trying through SSH then its connecting to that site...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
   I have one quey iam hitting one URL in browser its giving a expected output,but when iam trying through SSH then its connecting to that site but not able to copy the content of that file.<br />
  I need that browser contents in one file,i want to apply some manipulation on that one,these contents are in XMl and changes daily so daily i need that content so i can perform some operation and get a desired result,but iam not getting the contents in UNix Environment,so anyone can help me out from this issue..<br />
<br />
<br />
<br />
Regards,<br />
Azher</div>

]]></content:encoded>
			<dc:creator>azheruddin</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34361</guid>
		</item>
		<item>
			<title>Computer Industry is in trouble</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34359</link>
			<pubDate>Sun, 08 Jan 2012 21:55:14 GMT</pubDate>
			<description><![CDATA[I have settled for kde debian on my other machine. I'm however worried more about another topic....]]></description>
			<content:encoded><![CDATA[<div>I have settled for kde debian on my other machine. I'm however worried more about another topic. <a href="http://www.amazon.com/Future-Internet-How-Stop/dp/0300124872%3FSubscriptionId%3D0G81C5DAZ03ZR9WH9X82%26tag%3Dzem-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0300124872" target="_blank">http://www.amazon.com/Future-Interne...N%3D0300124872</a><br />
<br />
I believe this is to be true even though I have not read the book and only the description. <a href="http://carpetbomberz.com/2011/12/19/the-pc-is-dead/" target="_blank">http://carpetbomberz.com/2011/12/19/the-pc-is-dead/</a><br />
<br />
This guy makes perfect sense I must admit I own a smartphone and a mini notebook. I feel those objects especially the smartphone is way too restrictive. I can go out and replace any computer part to my fit. The smartphone however can't be really upgraded inside and the mini notebook is nice and all but really not expandable or freeform. The modern ipads and list goes on in my view are also extremely limited.  We are loosing our ability to control our devices and they are soon going to control us. I don't mean in a paranoid fashion but rather that our technology will be only allowed to do what the creator of the device has allowed us. No more none brand name put your own computer together either.<br />
<br />
  Add to that cloud computing strips more rights in my opinion. Imagine if you are an inventor/ creator and now your ideas are in the cloud!  You can't but a hard drive in 2020 as you are not a major cloud storage provider. You can't have things locally unless you go back to paper and pen. Now add that to security issues and mistrust of the cloud computing.</div>

]]></content:encoded>
			<dc:creator>MystikMitch</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34359</guid>
		</item>
		<item>
			<title>initramfs Emergency Shell</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34358</link>
			<pubDate>Sun, 08 Jan 2012 03:19:11 GMT</pubDate>
			<description><![CDATA[When moving my system between drives today, I forgot to change the entry for / in /etc/fstab . 
When booting, it couldn't find / , so it dropped me...]]></description>
			<content:encoded><![CDATA[<div>When moving my system between drives today, I forgot to change the entry for / in /etc/fstab .<br />
When booting, it couldn't find / , so it dropped me to the initramfs emergency shell.<br />
I solved my problem from that shell.<br />
I belive this is the first time a problem was solved in that shell in all recorded history.</div>

]]></content:encoded>
			<dc:creator>Bratmon</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34358</guid>
		</item>
		<item>
			<title>This might sound crazy here.</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34357</link>
			<pubDate>Sat, 07 Jan 2012 03:54:46 GMT</pubDate>
			<description>This might seem like a crazy question to ask here. 
I have a virus in my Seagate 500 GB Exteral Hard Drive.  Question can I use on my Ubuntu or...</description>
			<content:encoded><![CDATA[<div>This might seem like a crazy question to ask here.<br />
I have a virus in my Seagate 500 GB Exteral Hard Drive.  Question can I use on my Ubuntu or Kubuntu, with out getting a virus into my computer?  I don't like to throw it away yet, I don't think can format like my hard drive inside your computer.  As know say can't get virus on Ubuntu so this is reason why I like to use on a Kubuntu.<br />
What you think?</div>

]]></content:encoded>
			<dc:creator>bobacker</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34357</guid>
		</item>
		<item>
			<title>Planets</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34356</link>
			<pubDate>Sat, 07 Jan 2012 01:56:37 GMT</pubDate>
			<description>I uploaded some planet images I created using techniques from Gimp tutorials. (link (http://frigidcode.com/digital-art/blue-planet), link...</description>
			<content:encoded><![CDATA[<div>I uploaded some planet images I created using techniques from Gimp tutorials. (<a href="http://frigidcode.com/digital-art/blue-planet" target="_blank">link</a>, <a href="http://frigidcode.com/digital-art/green-planet" target="_blank">link</a>). It is a lot of fun to create planets and I'd like to create a lot more in the future. I also updated my <a href="http://frigidcode.com/code/xinequery" target="_blank">Xinequery</a> code, adding a Gentoo ebuild, plus some functionality that should make it a little more useful.</div>

]]></content:encoded>
			<dc:creator>hydraMax</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34356</guid>
		</item>
		<item>
			<title>Christmas Computer</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34355</link>
			<pubDate>Sat, 07 Jan 2012 01:53:26 GMT</pubDate>
			<description>Ahh... for Christmas I got a new computer 
 
My old computer was a 2005 Dell Dimension B110 with 32-bit 2.53 GHz Celeron 256 MB (upgraded to 1.2)...</description>
			<content:encoded><![CDATA[<div>Ahh... for Christmas I got a new computer<br />
<br />
My old computer was a 2005 Dell Dimension B110 with 32-bit 2.53 GHz Celeron 256 MB (upgraded to 1.2) RAM, 40GB (160 GB) and a CD RW (upgraded to a DVD-RW drive) drive. Those specs probably bring back memories of computer history. I remember freaking because it didn't have a floppy drive.<br />
That computer could only virtualize Linuxes before 2008, couln't run 8 preview, barely ran 7, and could barely run openSUSE 12.1 with desktop effects. Kubuntu 11.10 did not even work right on it and Solaris dropped support for my architecture. It had drivers created for it to be able to run versions of Windows as far back as 95 and (Linux [if you've tried] doesn't run well on computers newer than it) could run SUSE 9.2 without a problem, and get X up on DemoLinux 1, 2 and 3.<br />
The new one - a Dell Inspiron 620 - has a 1 TB hard disk, 4 GB of RAM, a DVD drive (of course), and a quad-core 64-bit i3 processor. The same openSUSE installation that took an hour on the old one took 15 minutes in VirtualBox. It is so much nicer!<br />
<br />
Moral of the story... if you have a computer old enough to be 32-bit or to have come with XP - replace it.</div>

]]></content:encoded>
			<dc:creator>wagscat123</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34355</guid>
		</item>
		<item>
			<title><![CDATA[Auto upgrade & Administrative password changing]]></title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34354</link>
			<pubDate>Fri, 06 Jan 2012 23:52:17 GMT</pubDate>
			<description>I got two new question. 1.  I have this problem when I use a Ubuntu, also now with my new Kubuntu. 
It tell me I have 6 security update are available...</description>
			<content:encoded><![CDATA[<div>I got two new question. 1.  I have this problem when I use a Ubuntu, also now with my new Kubuntu.<br />
It tell me I have 6 security update are available and also 20 software upgrade are available, to down on bottom of my task bar. (automatic upgrade system) Went I try to upgrade all these program I get a pop up box saying Another application seems to be using the package system at this time. You must close all other package  managers, before you will be able to install  or remove any packages.<br />
Where do I go or find this to turn it off?, where are they talking about? <br />
It also told me I have to individual upgrade each one on new package, so that mean, I have type each one in manual?  Because it won't let you upgrade all them at once?<br />
<br />
2nd question: when I try to upgrade the system now it ask me for a administrative password which is differ from the one I was giving by manufacture, where I brought this computer. How do I change this? It do this will it mess  up thing more by doing so?<br />
I have found in system setting on this page saying Enter the administrative password ,<br />
it said also user management system setting 1 users &amp; Group Administrative. Asking for a password to be created.  Question what is next step, after I do this?  Am I suppose to create or change this password  so I can  use whole system if going ask me for a administration password from old one from where I brought from?</div>

]]></content:encoded>
			<dc:creator>bobacker</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34354</guid>
		</item>
		<item>
			<title>Finally getting into it ...</title>
			<link>http://www.linuxquestions.org/questions/blog.php?b=34352</link>
			<pubDate>Fri, 06 Jan 2012 15:32:07 GMT</pubDate>
			<description><![CDATA[I've been using Linux for about seven years now, somehow without ever really knowing what I was doing. I use Linux because I like to tinker with my...]]></description>
			<content:encoded><![CDATA[<div>I've been using Linux for about seven years now, somehow without ever really knowing what I was doing. I use Linux because I like to tinker with my operating system. I can install and remove software from the command line, edit configuration files, change file permissions, create aliases, that sort of thing. And I understand the general theory behind networking, enough to troubleshoot basic connectivity problems on my own. But I never really got much further than that. I bought a couple books and used them as references, but never really had a real grasp of what I was doing.<br />
<br />
My wife, who uses Linux (she uses Mint)because of her open-source principles and because, as she puts it, &quot;it (Linux) just makes sense,&quot; thinks I'm a lot more capable than I do, because I've been really good at finding information and following online instructions, so most issues that come up for her occasionally get solved pretty quickly. My own system is always having some issue or other because I'm always poking at it, but I rarely ask for help with those. After all, they're the reason I do the poking in the first place.<br />
<br />
A couple days ago, my wife asked me if it might be possible to block access to certain domains on her desktop computer during working hours. I wasn't sure how to go about that, though I suspected it had something to do with the hosts file or the firewall. So I spent the next two days reading about iptables and DNS and hosts files, not going to the forums to look for answers as I normally would, but instead turning to my three reference books and online articles and sample files. And while I still haven't gotten it quite working yet, I've learned a tremendous amount, and can easily see where in the past I've made a complete ass of myself in other forums by thinking I'd looked dilligently for information, when in fact I hadn't even looked beyond searching a forum or two and a quick pull-up on Google.<br />
<br />
None of that here.</div>

]]></content:encoded>
			<dc:creator>sabresong</dc:creator>
			<guid isPermaLink="true">http://www.linuxquestions.org/questions/blog.php?b=34352</guid>
		</item>
	</channel>
</rss>

