collection of HOW-TO's

This HOW-TO/FAQ is no longer being maintained. Some commands might not work as shown

Collected/edited by Nasser Abbasi

April 10, 2014

 

1.      Update section for Solaris 10. 8

2.      General HOWTO's. 10

1.      How to force firefox to open a file in a link as “text/plain”?. 10

2.      What is the order of searching for DLL's in windows?. 11

3.      How to use anti alias fonts with X?. 11

4.      I am getting unable to open terminal error from application (cscope), why?. 12

5.      How to convert ASN.1 to XML?. 13

6.      How to convert genbank asn.1 to xml?. 14

7.      How to parse genbank?. 14

8.      How to use windows Look and Feel on Solaris?. 14

9.      How to read string from command line in Java?. 15

10.         How to get class name from static method in Java?. 16

11.         How to use safe enumeration in Java?. 16

12.         How to connect solaris and win2k using SAMBA?. 17

13.         What environment variables used by alladin ghostscript?. 18

14.         How to delete the route in windows?. 18

15.         Where does Mozilla keep email folder on windows?. 18

16.         How to change where mozilla looks for bookmarks?. 18

17.         How to use J2EE?. 19

18.         How to convert IE bookmarks (favoriets) to Netscape bookmarks?. 33

19.         Where is favorites folder used by IE stored on the PC?. 33

20.         How to print on 11x17 from visio, to get max page size?. 33

21.         some java applications. 33

22.         What network interfaces are there for Solaris?. 34

23.         How to find what HW and devices are known to Solaris and other OS info?. 34

24.         How to send signal to a process on solaris. 35

25.         NFS. Solaris as server, Linux as client. Linux mounting Solaris filesystem over NFS. 36

26.         NFS. Solaris as client, Linux as server. Solaris mounting linux filesystem over NFS. 38

27.         How to find what filesystems are allready set shared on solaris?. 40

28.         what are the tcpdump flags?. 41

29.         How to convert router to multi-homed on Solaris. 41

30.         How to force a host to become a router on Solaris?. 41

31.         How to force a host to use dynamic routing?. 41

32.         How to turn off ICMP router discovery on Solaris?. 41

33.         How to change the MTU of an interface?. 42

34.         What is the smallest MTU that can be used?. 42

35.         How to change IP address of machine on Solaris?. 42

36.         How to add entry to routing table on Solaris?. 42

37.         How to look at routing table on Solaris?. 42

38.         What files used to setup a host on a network for Solaris?. 42

39.         How to change or look at TCP/IP setting on solaris?. 48

40.         How to allow root to use telnet on Solaris?. 51

41.         How to allow root to use ftp on Solaris?. 51

42.         How to use truss command to debug program on solaris?. 51

43.         1.42 How to debug shell scripts?. 51

44.         How does traceroute work?. 52

45.         How to tell apache to deny browsing a directory?. 52

46.         How to start and configure apache on Linux?. 53

47.         How to install and use the htdig search engine on Linux?. 53

48.         How to restart nfs server so that it reads in /etc/exports?. 56

49.         How to use hypermail to archive a netscape Inbox?. 56

50.         How to find if same email message exist in the email Inbox?. 57

51.         What are the protocol numbers in the IP protocol field?. 57

52.         How to substitute one word for another in a file from command line?. 60

53.         How to configure Netscape browser preferences for different mime types?. 60

54.         How to use perl to display a button?. 61

55.         How to install ext2fs on Solaris?. 61

56.         How to tell a MPEG-1 bitstream from a MPEG-2 bitstream?. 62

57.         How to start xterm with large scroll buffer?. 62

58.         How to use CVS?. 62

59.         How to convert files from unix to mac to windows format?. 63

60.         How to mount things?. 64

61.         What are the common RPM commands?. 65

62.         How to start and stop the network on Linux?. 65

63.         How to find where some of gcc object files are?. 65

64.         How to extract object files from a library?. 65

65.         How to look at assembler of an object file on Linux?. 65

66.         How to print the symbol table of a library?. 66

67.         How to apply a patch file in Linux?. 66

68.         How to debug a running process?. 66

69.         How to find what files are open on linux?. 66

70.         On Linux, what to do if an application it can't see a shared library?. 66

71.         How do you sync your computer's clock with the National Institute of Standards and Technology through Linux?. 67

72.         How do display the index.html file at some URL from command line?. 67

73.         How do download ftp or websites in batch mode from command line?. 67

74.         How to create bean manifest file in jar file?. 67

75.         How to start X in different depths on linux?. 68

76.         How to clone the system disk on Solaris?. 68

77.         How to make douple-click in X selects the whole file name?. 68

78.         How to bring down an interface, then up, on linux?. 69

79.         How to find what is running as a module on linux?. 69

80.         How to start a secure shell session?. 69

81.         How to convert an RPM file to DEB file?. 69

82.         How to count lines of source code in a tree?. 69

83.         How to the largest sub-directory in current path?. 70

84.         How to find what version of redhat one is running (Linux)?. 70

85.         How to compile and link a simple gtk+ program?. 70

86.         How to cat a file, with a line number printed next to each line?. 70

87.         How to find what fonts are there for X?. 70

88.         How to remove lines from a file that matches some regexp using emacs?. 71

89.         How to find what font is used by xterm?. 72

90.         How to start print daemon on linux?. 72

91.         How to add tags to file using SCCS?. 72

92.         How to access sybase database using isql?. 73

93.         How to disable or enable CDE on linux?. 73

94.         How to disable or enable CDE on Solaris (run with no X)?. 73

95.         How to configure network on linux?. 73

96.         How to use find command to list directories only to some depth?. 76

97.         How to login to Solaris if you lost the root password?. 76

98.         How to append the date to a file name?. 76

99.         How to print to remote printer from Linux?. 77

100.      How to search name of tunables in solaris kernel libraries?. 78

101.      How to prevent DNS lookup in Solaris?. 78

102.      How to find what NFS version is used?. 78

103.      How to find total size of selected files?. 78

104.      How to find limits of a process?. 78

105.      How to add swap space on Solaris?. 79

106.      How to find what patches are installed on Solaris?. 80

107.      How to find what dynamic libraries are linked to an executable?. 80

108.      How to look at dynamic section information on Solaris?. 80

109.      How to format a floppy on Solaris?. 80

110.      How to insert a page break in emacs?. 81

111.      How to use SCCS?. 81

112.      How to find default printer on Solaris?. 81

113.      How to send email from command line?. 82

114.      How to find what ports are used on the host?. 82

115.      How to find what process is using which files and ports?. 82

116.      How to start SNMP trap daemon on Solaris?. 82

117.      How to detect when filesystem size reaches some threshold?. 83

118.      How to copy large file system from one host to another?. 84

119.      How to execute a remote script and check for its final status?. 85

120.      How do netscape plugins work?. 86

121.      How to restart inted after making changes to inted.conf?. 87

122.      How to turn off IP forwarding in Solaris?. 87

123.      How to turn on IP forwarding in Solaris on specific interface?. 87

124.      How to stop nfs and sendmail on Solaris?. 87

125.      How to install new disk and mount it on Solaris?. 88

126.      How to extract tar content that has /net/... files on Solaris?. 88

127.      How to copy trees from one file system to another?. 88

128.      How to tar and gzip a tree to some location?. 89

129.      What is the difference between DER and BER encoding ?. 89

130.      How to remove comments line from an Ada program ?. 89

131.      How to disable and enable CDE on Linux?. 90

132.      How to find what search paths is set for gcc ?. 90

133.      How to use pax to tar files from IBM OS390 to ascii machine ?. 90

134.      How to use indent program ?. 90

135.      How to find information about RPC registered programs ?. 90

136.      How to rename files using sed from command line?. 91

137.      How to capture all commands and output of a session into a file?. 91

138.      How to remove a directory from being NFS mounted?. 91

139.      How to set the clock on HPUX?. 91

140.      How to print using enscript?. 92

141.      How to find the version of glibc on a Linux box?. 92

142.      How to change tcp/ip setting on Linux?. 94

143.      Why can't one use floating point math in Linux kernel?. 94

144.      How to add a new system call in Linux?. 94

145.      How to start NFS on Solaris?. 95

146.      How to find what is the device name for CDROM to mount on Linux?. 96

147.      How to find what web server is running on a web site?. 96

148.      How to download the main web page of a site from command line?. 97

149.      How to download Sun web page style sheet?. 97

150.      How to boot Solaris in 32 bit mode?. 97

151.      How to change the IP address of an interface on Linux?. 98

152.      How to find resolution and number of colors used by X?. 98

153.      How to find disk and terminal IO statistics on Solaris?. 98

154.      How to find/monitor system activity on Solaris?. 98

155.      How to find how much physical memory and monitor memory on Solaris?. 98

156.      apropos gives error /usr/share/man/windex: No such file or directory on Solaris, why?  99

157.      On Linux, How to exit X to CLI and then back to X without killing X?. 99

158.      On Linux, How to switch between Xterms using keyboard ?. 99

159.      What files are used on Linux to setup network?. 99

160.      how to change color depth when starting gnome using GDM?. 101

161.      how to set an environment variable for a CGI?. 101

162.      how to start SAMBA automatically on Solaris?. 102

163.      What are Mimi types for known files?. 103

164.      How to do backup on Solaris?. 103

165.      How to find what scsi and ide devices connected to Solaris box?. 104

166.      How to add second IDE (or scsi) disk to a solaris box?. 104

167.      How to use GNOME and KDE on Solaris?. 105

168.      How to change between GNOME or KDE on linux?. 105

169.      What are the different key lengths used with different crypto algorithms?. 105

170.      How to find the list of native instruction sets executable on your Solairs box?. 106

171.      How does the Solaris linker find the libraries it needs?. 106

172.      How to analyze a core dump on solaris?. 107

173.      How to load kadb kernel debugger so that solaris jumps to it when it crashes?. 107

174.      How to find if Solaris booted in 32 or 64 bit mode?. 107

175.      How to compile for 64 or 32 bit Solaris using Sun Forte C compiler?. 107

176.      What are the data type sizes in 64 and 32 bit images for Solaris?. 108

177.      How to convert a static library to dynamic library on Solaris?. 109

178.      How to load a dynamic library of DLL into java?. 109

179.      How to use java programs in command lines using unix pipes?. 110

180.      I've installed Linux on disk, and now when I install windows, it won't boot from disk, why?. 110

181.      How to start a command and logout from the terminal leaving the command running?. 111

182.      How to run cscope?. 111

183.      How to start CDE in solaris from console?. 111

184.      How to install PERL for windows?. 112

185.      How to change the resolution (and start X) using X server running under CYGWIN?. 112

186.      How to set HOME env variable when starting X under cygwin?. 113

187.      How to change emacs fonts under windows?. 113

188.      Clicking on a URL from inside email message in outlook express does not work after uninstalling mozilla on windows, why?. 115

189.      How to view a dvi?. 115

190.      How to create a debian package from source?. 115

191.      How to find what DLL's are missing from a WINE application on linux?. 116

192.      How to install windows registery file into WINE on linux?. 116

193.      How to find the version of X installed?. 116

194.      How to close X in cygwin?. 117

195.      How to starts X with different dpi values?. 117

196.      Where does the outlook express email folder hides in widows?. 117

197.      How to import outlook express messages in a .dbx file from different location?. 118

198.      Dennis Ritchie URL's. 120

199.      How to connect linux and win2k using SAMBA?. 120

200.      What is the C code for a typical server loop?. 121

201.      How to Compile and Link OpenGL Applications?. 122

202.      How to use RPC with a firewall?. 123

203.      How to convert video tapes to digital to store on a PC?. 124

204.      MBR?. 125

205.      How to write a pixel (and line) to the screen?. 127

206.      How to access CVS anonymous? (for java giat tree, gjt) ?. 129

207.      On pathnames on different OS's. 130

208.      How to change X resolution in linux by chaging XF86Config?. 132

209.      How to covert byte to int in Java without expansion?. 133

210.      How to setup a signal handler in C?. 133

211.      How big are java classes?. 134

212.      Where are the java FAQ's ?. 135

213.      What is the command to list symbols in an exec of shared lib on solari?. 135

214.      What are some usefull escape sequences in C (to make alerts and others)?. 135

215.      How to find values of shared memory info in Solaris?. 136

216.      How to find interface speed on solaris?. 136

217.      How to change X resolution on solaris?. 136

218.      How to dump an image (executable) on solaris?. 137

219.      How to dump the symbol table of an executable?. 137

220.      How to show line numbers in vi?. 137

221.      How to read UNICODE from file?. 137

222.      How to convert UNICODE to ANSI in windows and vis versa?. 138

223.      what is UNICODE?. 138

224.      how to create a character device on linux?. 140

225.      How to convert man pages to HTML?. 140

226.      What are the conversion programs, how to convert from one file to another?. 140

227.      How to use rsh with the same environment on each host?. 141

228.      How to list files contained in a Solaris package?. 142

229.      How to find which package a file belong to? Solaris package. 142

230.      How to examine shared memory on linux?. 143

231.      RPC for linux?. 143

232.      How to turn on the openboot diagnostics during the boot process for Solaris/Sparc?. 143

233.      I've installed new device on Solaris sparc, but it does not see it, why?. 143

234.      Which file systems are mounted always at boot time in Solaris/sparc?. 144

235.      How to recover corrupted tar file?. 144

236.      What are some big java applications?. 145

237.      How to get version of sw in linux kernel?. 145

238.      How to write to CD on Unix/Linux?. 146

239.      How to use XCOPY on DOS to copy files?. 146

240.      How to output an integer with worrying about its size. 146

241.      Where to get some free application servers?. 147

242.      How to use stream IO in Ada?. 147

243.      How to make emacs use LF for line termination (Unix style) on windows?. 148

244.      How to set the editor mode for the shell on Unix?. 148

245.      Hints for ftp security?. 149

246.      What is the difference between MPEG and JPEG?. 151

247.      How to call fortran from Ada?. 151

248.      How to use gdb to look at linux kernel image, debugging linux kernel?. 153

249.      What is NIS and what is it used for?. 153

250.      What is DNS and what is it used for?. 153

251.      How to use Java in Makefiles under cygwin using windows JDK, classpath problems?. 154

252.      How to find if a connection exist with some host?. 154

253.      Why is ifconfig -a showing a different netmask than what is in /etc/netmasks?. 154

254.      How does Solaris find the nis server (for use by yp commands)?. 156

255.      Where are bookmark folder kept with IE browser?. 157

256.      Where does Netscape 7 keeps the email?. 157

257.      How to view postscript files on windows?. 157

258.      How to Convert a document to PDF on windows? (such as Mathematica note book?) 157

3.      Latex  HOW TO.. 159

259.      how to configure latex on cygwin?. 159

260.      How to put a box around verbatim?. 159

261.      notes on setting paper size in latex and dvips. 160

262.      How to make latex2html (version 2000) not use absolute path for images?. 161

263.      How to generate PDF from Latex?. 162

264.      How to install latex2html under windows?. 164

265.      How to configure latex2html to run on cygwin. 169

266.      I am getting error unable to find html.sty when running Latex, how to fix?. 174

267.      How to install/use Latex2html on Solaris?. 174

268.      How to use specific font in latex?. 174

269.      From where to download latex packages? where is CTAN?. 175

270.      How to use HTML links in latex?. 175

271.      how make text bold, italic?. 175

272.      how to insert index?. 175

273.      how to make table?. 176

274.      How to put spaces between letters?. 176

275.      How to find mismatched paranthesis in latex, is lint for latex?. 177

276.      How to display a PDF file using ghostscipt?. 177

277.      How can I indent the first line after a section heading?. 178

278.      How not to print page number on a title page?. 178

279.      How to reduce space between enumeration list lines?. 178

280.      How to change fonts in scientific word?. 178

281.      How to fix paragraph spacing in SW?. 179

282.      What commands to add to SW in preamble to make it look better?. 179

283.      What commands in SW to make title show up when previewing?. 179

284.      How to include graphics in latex for best PDF output?. 179

285.      How to convert ps to pdf?. 181

286.      Why I get error tcilatex file not found when compiling tex document?. 181

287.      How do I know which packages needed for which special Math symbols?. 181

288.      Why there is no vertical spacing added automatically between paragphs?. 182

289.      How to install Cygwin?. 182

290.      How to use latex2html?. 182

291.      How to put things side-by-side in latex?. 183

292.      How to make sure VISIO eps output ok for latex?. 183

4.      VI 184

293.      VI commands. 184

294.      Another VI reference. 188

5.      MATLAB.. 193

295.      How to put single quote in matlab string?. 193

296.      How to print structure field names in matlab (not the values)?. 193

297.      How to close all figures in matlab?. 194

298.      How to clear all workspace variables ?. 195

299.      roundeven?. 195

300.      netlib, where to get?. 196

301.      speed tricks in matlab?. 196

302.      Plotting tricks in matlab?. 197

303.      How to pass arguments to matlab from command line?. 197

304.      How to generate noise signal in matlab?. 199

305.      Using mean, variance, and standard deviation. 200

306.      How to evaluate a polynomial?. 200

307.      How to normalize data?. 200

308.      How to plot using log scale for y axis?. 202

309.      matlab curve fitting. 202

310.      How to use Matlab symbolic math?. 203

311.      How to find dimensions of matrix?. 206

312.      How to find if a variable is integer or not?. 207

313.      How to find length of a vector?. 207

314.      How to look at performance of a function?. 207

315.      How to superimpose more than one graph on the same screen?. 207

316.      How to draw a line in matlab. 207

317.      How to draw a circle in matlab. 208

318.      How to fit a vector to a matrix. 208

319.      Adding noise signal?. 209

6.      Scientifc Word HOWTO.. 210

320.      How to make Math fonts larges when exporting to HTML?. 210

321.      How to join AVI files?. 210

7.      Virtual box HOW to. 210

322.      How to mount shared folder from linux guest?. 210

 

1.Update section for Solaris 10

I recived email on 4/20/2008 from Dr David Kirkby updating some of the commands below so they work for Solaris 10.

At this time I do not have time to edit the commands/sections to update each specific cmmand, so I include the mail itself below.

 

Source of this section is  david.kirkbyREMOVETHIS@onetelANDTHIS.net

 

“A few notes I can think of related to Solaris. It seems to me many of the commands you have are old, and in particular are not going to work on Solaris 10.

26) It's easier to just type 'share' to see the directories shared on Solaris.

kestrel /export/home/drkirkby % share
-               /usr/local/config   ro,anon=0   ""
-               /usr/local/install/Solaris_10/Tools/Boot   ro,anon=0   ""

Since you show how to allow root to use telnet (#39) and ftp (both pretty unsafe, as password easily sniffed), it would be worth doing it for ssh too. At least the password cant be sniffed. It needs a change in the file /etc/ssh/sshd_config

kestrel / % grep Root /etc/ssh/sshd_config
PermitRootLogin yes

#58) How to mount things.

To mount the CDROM on a Solaris system:

% mount -r -F hsfs /dev/dsk/c0t6d0s0 /cdrom

You need to be root to do this, so I would change the prompt to a #.

Also, if volume management is running, this should happen automatically when the CD is inserted.

#66) How to debug a running process.

truss can be used too.

#67) How to find what files are open on linux.
Since you mention Solaris a lot, it is worth stating lsof can be installed on solaris.

#75) Cloning system disk on Solaris
If ufsdump is used, you will need to pipe it to ufsrestore, *not* restore as stated. There is no 'restore' command on Solaris.
It *will* also be necessary to put the boot block onto the disk using installboot

Actually, your example #116 shows the use of ufsrestore to copy a file system.

#95) Logging into Solaris if the root password is lost.

Using
boot cdrom -s

would be faster, as it will not load the GUI installation program, but will give you a root shell as quickly as possible.

The device file very much depends on how a particular machine is set up, the type of disk etc.

On my Solaris x86 laptop (SATA disk)
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1d0s0         15G   6.0G   8.6G    42%    /

On my Blade 2000 (SCSI fibre channel disk)
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1t1d0s0       19G    19G   334M    99%    /

On an Ultra 60 (conventional SCSI disk)
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0t0d0s0      8.2G   4.2G   3.9G    53%    /


So that is 3 Solaris systems I happen to have switched on, and all have different devices for the root partition. The format for IDE type disks is different to those for SCSI

# 123) stoping nfs and sendmail

The use of /etc/init.d scripts is depricated in Solaris 10. Instead svcs and svcadm are used.

# svcadm disable svc:/network/smtp:sendmail

You can usually abreviate the commands a bit, so in this case sendmail will do.

# svcadm disable sendmail

123) You suggest using mkfs to make the file system. newfs is easier. The mkfs tells you this.
148) Solaris 10 cant be booted in 32-bit mode. It seems a lot of your Solaris commands are quite old.
172) The isinfo command does not exist in Solaris 10”

2.General HOWTO's

1.   How to force firefox to open a file in a link as “text/plain”?

Assume the file has extension .foo and I want firefox to open it as if it had a .txt extension, then I did
1)  Cd C:\Users\userName\AppData\Roaming\Mozilla\Firefox\Profiles\i8c0jwyy.default
2)  Close firefox
3)  Edit the file mimeTypes.rdf
and added the following
<RDF:Description RDF:about="urn:mimetype:text/plain"
                   NC:fileExtensions="foo"
                   NC:description=""
                   NC:value="text/plain"
                   NC:editable="true">
    <NC:handlerProp RDF:resource="urn:mimetype:handler:text/plain"/>
Save and start firefox. Now click on the link pointing to file.foo and firefox will now open it internally as if it was plain text

2.   What is the order of searching for DLL's in windows?

 
[begin SDK help file quote]
 
When no path is specified, [LoadLibrary] searches for the file in the
following sequence:
 
   1. The directory from which the application loaded.
   2. The current directory.
   3. Windows 95: The Windows system directory. Use the
      GetSystemDirectory function to get the path of this directory. Windows
      NT: The 32-bit Windows system directory. Use the GetSystemDirectory
      function to get the path of this directory. The name of this directory
      is SYSTEM32.
   
   4. Windows NT: The 16-bit Windows system directory. There is no
      Win32 function that obtains the path of this directory, but it is
      searched. The name of this directory is SYSTEM.
   5. The Windows directory. Use the GetWindowsDirectory function to
      get the path of this directory.
   6. The directories that are listed in the PATH environment variable.

3.   How to use anti alias fonts with X?

 
see http://www.xfree86.org/~keithp/render/aafont.txt
 
here it is in case it is moved:
 
"You need FreeType 2 from their CVS (freetype.org), not the sourceforge 
mirror which is ancient.
 
        configure and install that
        $ ./configure
        $ make
        # make install
 
You need XFree86 CVS (not 4.0.1h, that's not new enough, it's from last 
night).
 
        Edit config/cf/host.def and add:
 
        #define Freetype2Dir            /usr/local
 
        (assuming you installed Freetype in the default place)
 
        $ make World
        (...)
        # make install
 
You need my hacked version of Qt
 
        http://xfree86.org/~keithp/download/qtkernel.tar.bz2
 
        Extract that and rebuild Qt
 
You need some TrueType fonts
 
        http://keithp.com/~keithp/fonts/truetype.tar.gz
 
        $ cd /usr/X11R6/lib/X11/fonts
        # tar xzf truetype.tar.gz
 
You need an updated config file for the Xft library
 
        http://keithp.com/~keithp/fonts/XftConfig
 
        $ (edit it to change /usr/XFree86 to /usr/X11R6)
        # cp XftConfig /usr/X11R6/lib/X11
 
Now you're all set.
 
Easy as pie, no?"
 
 
Also see this note on
 
http://www.xfree86.org/~keithp/render/
 
"xterm has been modified to use Xft to display text, once you've got FreeType2 built and installed, add
 
#define Freetype2Dir /usr/local
 
to your config/cf/host.def file and rebuild X."

4.   I am getting unable to open terminal error from application (cscope), why?

 
check the environemnt variables TERM and TERMINFO. 
 
on solaris, I have these:
 
bash-2.03$ echo $TERM
xterm
 
bash-2.03$ echo $TERMINFO
/usr/share/lib/terminfo
 
( i need to learn more about all of this one day).

5.   How to convert ASN.1 to XML?

from NCBI asnxml read me, an example of asn.1 is give, and how to map it:

 
For this specification:
 
Record ::= SEQUENCE {
        create-date Date,
        update-date Date }
 
Date ::= SEQUENCE {
        month INTEGER,
        year INTEGER }
 
and some sample data might be:
 
Record ::= SEQUENCE {
        create-date {
                month 6,
                year 1999 },
        update-date {
                month 8,
                year 2000 } }
 
the direct mapping to XML requires that every ELEMENT be explicitly tagged 
and not implied by the context. So the equivalent DTD is more verbose:
 
<!ELEMENT Record ( create_date, update_date )>
<!ELEMENT create_date (Date)>
<!ELEMENT update_date (Date)>
 
<!ELEMENT Date (month, year)>
<!ELEMENT month (#PCDATA)>
<!ELEMENT year (#PCDATA)>
 
as is the XML data itself:
 
<Record>
<create_date>
<Date>
<month>6</month>
<year>1999</year>
</Date>
</create_date>
<update_date>
<Date>
<month>8</month>
<year>2000</year>
</Date>
</update_date>
</Record>

6.   How to convert genbank asn.1 to xml?

from an email I got:

You may try to use the asn2xml tool on our ftp site at:
ftp://ftp.ncbi.nlm.nih.gov/toolbox/xml/asn2xml/CURRENT/
 
xml DTD is located here:
ftp://ftp.ncbi.nlm.nih.gov/toolbox/xml/xmlspecs/

7.   How to parse genbank?

from the net.

 
Now, I could mention the fact that by using the underlying ASN.1
representation of the data in GenBank (are those groans that I'm
hearing? ;-) one can completely bypass the parsing step. In this
mode you would:
 
1) obtain the dataset of interest, in ASN.1 format (a "Bioseq-set")
 
2) write a program that reads the contents of the Bioseq-set, one
   "Seq-entry" at a time (the function is SeqEntryAsnRead)
 
   Each call to SeqEntryAsnRead yields a C-structure (set of
   linked structures, actually) populated with every bit information
   associated with a given record. The references, the Medline
   identifiers, the sequence data, the features...
 
3) process each Seq-entry, pulling out the bits and pieces that you
   wish to store in your database
 
It's the third step that many find difficult, because you have to
understand the relationship between the data model for GenBank sequences
(the ASN.1 specification) and the C-structures that get populated when
a sequence (in ASN.1 format) is read via SeqEntryAsnRead .
 
Once you have an idea of what's going on, it's fairly easy to explore
the C-structures, plucking out exactly what you want. Provided that you
are an experienced programmer... The learning curve can be pretty steep
otherwise.
 
Mark Cavanaugh
GenBank

8.   How to use windows Look and Feel on Solaris?

from the net:

 
In article <35509CBC.5AEB8107@discountlabels.com>, Tony Manners <tonym@discountlabels.com> wrote:
>I believe I read somewhere that Microsoft did not give Sun permission to
>reproduce the Windows look and feel on other platforms, but I found a way to
>get around this.  It requires you to modify a method in one of the Windows
>L&F classes and recompile it and put it in the swing jar file, cant remember
>the name of it since I'm not using Swing anymore, but you need to chage the
>IsNativeLookAndFeel method to return true no matter what (by default it only
>returns true when you are really running Windows) and you will then be able
>to set the Windows L&F an any platform.
 
Or, to do it more cleanly, subclass WindowsLookAndFeel and override the 
isSupportedLookAndFeel() method to always return true.   Then just set the 
look and feel to whatever the name of your subclass is.  Works like a 
charm.
 
 
--
Richard L. Ahrens              | phone 212.209.1529

Ok, I tried the above, so, simply create a class, say M.java, that look like this:

 
bash-2.03$ cat M.java 
public class M extends com.sun.java.swing.plaf.windows.WindowsLookAndFeel
{
    public boolean isSupportedLookAndFeel(){ return true;}
}
 
and in the code, do this:
 
 UIManager.setLookAndFeel("M");
 
 
of course, need to set classpath, and proper naming for the class etc..., but that
is the idea.

9.   How to read string from command line in Java?

 
System.out.println("Enter name");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
name = br.readLine();

10.             How to get class name from static method in Java?

from comp.lang.java.programmer

 
Title: Re: Class name from within a static method
Author: not.for.email@see.signature (Gordon Beaton)
Date: 28 Sep 2001 09:39:49 GMT
 
It is possible to get the classname even from a static context,
although it is a little convoluted.
 
SecurityManager.getClassContext() returns an array of classnames from
the top to the current context. Unfortunately the method is protected,
so you need to subclass SecurityManager to call the method, something
like this:
 
  public class Foo {
    public Foo() {
    }
 
    public static void main(String[] args) {
      System.out.println("this class is: " + new ClassGetter().getClassName());
    }
 
    // inner class is necessary since getClassContext is protected
    static class ClassGetter extends SecurityManager {
      public String getClassName() {
        return getClassContext()[1].getName();
      }
    }
  }
 
 
In 1.4, you can do this instead:
 
  public class Bar {
    public static void main(String[] args) {
      StackTraceElement[] ste = new Throwable().getStackTrace();
      System.out.println("this class is: " + ste[0].getClassName());
    }
  }
 
/gordon

11.             How to use safe enumeration in Java?

Nasser, added 092701

base it on the pattern shown in effective java book by Bloch. The patternin the book uses a static enumeration objects. This example, I changed it to use enumeration class internal to the class where the enumeration are used. not much difference.

 
public class testEnum
{
 
    private Suit s= new Suit();
 
    class Suit
    {
      Suit CLUBS, DIAMONDS, HEARTS, SPADES;
      private int 
      private String _name=null;
      private Suit(String name) { _name= name; }
      String  getName() { return _name; } //toString() does not work here.
      
      Suit()
      {
           CLUBS = new Suit("clubs");
           DIAMONDS = new Suit("diamonds");
           HEARTS = new Suit("hearts");
           SPADES = new Suit("spades");
      }
    }
 
 
    public static void main(String[] argv)
    {
        new testEnum();
    }
 
    private testEnum()
    {
        Suit c1= s.CLUBS;
 
        System.out.println("c1 is " + c1.getName() );  // prints "clubs"
        c1 = c1.
    }
 
}

12.             How to connect solaris and win2k using SAMBA?

I need to update this later, but for now, a note:

Make sure that the Netbios support for tcp/ip option in win2k is selected in win2k. without this selected, I was not able to get it working.

 

To start samba on Solaris, use swat netscape http://localhost:901.

13.             What environment variables used by alladin ghostscript?

Environment variables GS_DEVICE, GS_FONTPATH, GS_LIB, GS_OPTIONS.

need to verify.

14.             How to delete the route in windows?

 
I had this problem. I had set win2k with 2 interfaces. an internal network one (192.168.10.21) and an external one.
 
Every time I disable the external interface, and then enable it again,
I found I am not able to use the internet (external interface). It turned out that the default gateway switches to the internal interface.
 
So to fix this, after I enable the external interface, I need to remove the route to the internal interface with the 0.0.0.0 network. Do this from DOS:
 
C:\>route delete 0.0.0.0 MASK 0.0.0.0 192.168.10.20
 
Now I am able to connect to the internet and my internal interface still is working ok.

15.             Where does Mozilla keep email folder on windows?

mozilla keeps the mail here:

 
C:\Documents and Settings\Administrator\Application Data\Mozilla\Profiles\USER\da3ofpc0.slt\Mail\postoffice.pacbell.net
 
To change where mozilla looks for email folder, edit the file 
 
C:\Documents and Settings\Administrator\Application Data\Mozilla\Profiles\USER\da3ofpc0.slt\prefs.js
 
I wanted to changed where mozilla looks for my email. I wanted it to look at G:\disk1\nabbasi\nsmail (this is becuase I had the above mounted on Solaris and I wanted all my email to be in one place).

16.             How to change where mozilla looks for bookmarks?

 
Edit the preferences file, one windows it is 
 
C:\Documents and Settings\Administrator\Application Data\Mozilla\Profiles\USER\da3ofpc0.slt\prefs.js
 
and add this line:
 
user_pref("browser.bookmarks.file","g:\\disk1\\USER\\nsmail\\bookmarks.html");

17.             How to use J2EE?

By Nasser Abbasi

 

These are my notes setting up and running J2EE software.

First, the tutorial document I have is located in

 

/export/home/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-beta-tutorial-draft4.pdf
 

The source code for the examples used in the above tutorial, is located in

 
/export/home/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/

downloaded J2SE (JDK) 1.4 beta2. j2sdk-1_4_0-beta2-solsparcv9.tar.Z and j2sdk-1_4_0-beta2-solsparc.tar.Z , and extracted the packages and did a pkgadd on all of them (the 32 bit version first, then the 64bit or the v9 ones second) .

 
32 bit version of JDK 1.4 that I installed using pkgadd:
 
drwxr-xrwx   4 nabbasi  staff        512 Sep 19 03:17 SUNWj3man
drwxr-xrwx   4 nabbasi  staff        512 Sep 19 03:17 SUNWj3dmo
drwxr-xrwx   4 nabbasi  staff        512 Sep 19 03:17 SUNWj3dev
drwxr-xrwx   4 nabbasi  staff        512 Sep 19 03:17 SUNWj3rt
drwxr-xrwx   4 nabbasi  staff        512 Sep 19 03:17 SUNWjuj3m
drwxr-xrwx   4 nabbasi  staff        512 Sep 19 03:17 SUNWjpj3m
drwxr-xrwx   4 nabbasi  staff        512 Sep 19 03:17 SUNWjej3m
 
 
64 bit version. Installed after the above using pkgadd:
 
# ls -lrt
total 36660
drwxr-xr-x   4 10       143          512 Aug 22 09:33 SUNWj3rtx
drwxr-xr-x   4 10       143          512 Aug 22 09:33 SUNWj3dvx
-rwxr--r--   1 nabbasi  staff    18737152 Sep 19 01:36 j2sdk-1_4_0-beta2-solsparcv9.tar
# pwd
/share/disk1/nabbasi/data/nabbasi_work/JDK_area/solaris/j2sdk-1_4_0-beta2-solsparcv9
#

The above installs JDK 1.4 and the JRE also (packages to do both are in the above tar files). Which installed, it goes to /usr/j2se/, this is the final tree:

 
# ls -lrt /usr/j2se
total 20092
-rw-r--r--   1 root     bin      10251576 Aug 17 21:15 src.zip
-rw-r--r--   1 root     bin        10485 Aug 17 21:18 README.html
-rw-r--r--   1 root     bin         1512 Aug 17 21:18 COPYRIGHT
-rw-r--r--   1 root     bin         3359 Aug 17 21:18 README
drwxr-xr-x   2 root     bin          512 Sep 19 03:32 lib
drwxr-xr-x   3 root     bin          512 Sep 19 03:32 include
drwxr-xr-x   6 root     bin          512 Sep 19 03:36 man
drwxr-xr-x   3 root     bin          512 Sep 20 00:39 bin
drwxr-xr-x   6 root     bin          512 Sep 20 00:39 jre
#

downloaded J2EE SKD 1.3 beta2. j2sdkee-1_3-solsparc.sh. I executed the above file, and it created the directory j2sdkee1.3/ in /export/home/nabbasi/data/nabbasi_work/JDK_area/solaris/j2sdkee1.3/

 
drwxr-xr-x   2 nabbasi  staff        512 Sep 20 00:46 bin/
drwxr-xr-x   2 nabbasi  staff        512 Sep 20 00:46 cloudscape/
drwxr-xr-x   2 nabbasi  staff        512 Sep 20 00:46 conf/
drwxr-xr-x   5 nabbasi  staff        512 Sep 20 00:46 config/
drwxr-xr-x   3 nabbasi  staff        512 Sep 20 00:46 connector/
drwxr-xr-x   5 nabbasi  staff        512 Sep 20 00:46 doc/
drwxr-xr-x   3 nabbasi  staff        512 Sep 20 00:46 help/
drwxr-xr-x   2 nabbasi  staff       5120 Sep 20 00:46 images/
drwxr-xr-x   9 nabbasi  staff        512 Sep 20 00:46 lib/
drwxr-xr-x   2 nabbasi  staff        512 Sep 20 00:46 logs/
drwxr-xr-x   2 nabbasi  staff        512 Sep 20 00:46 nativelib/
drwxr-xr-x   2 nabbasi  staff        512 Sep 20 00:46 public_html/
drwxr-xr-x   2 nabbasi  staff        512 Sep 20 00:46 repository/

edited my $HOME/.bashrc and added these

export J2EE_HOME=/export/home/nabbasi/data/nabbasi_work/JDK_area/solaris/j2sdkee1.3
export JAVA_HOME=/usr/j2se
#
J2EE=$J2EE_HOME/bin
JDK=$JAVA_HOME/bin
#
export PATH=$JDK:$J2EE:$PATH

The J2EE server uses a JDBC driver to access a database. It locates the driver's JAR files by referencing the J2EE_CLASSPATH environment variable. The cloudscape database JDBC driver is located in

 
$J2EE_HOME/lib/system
-rw-r--r--   1 nabbasi  staff     249008 Aug 22 00:27 cloudutil.jar
-rw-r--r--   1 nabbasi  staff    2121323 Aug 22 00:27 cloudscape.jar
 
so, I edited $J2EE_HOME/bin/useconfig.sh. This is how it was at first, after the installation:
--------- 
# J2EE_CLASSPATH is appended to the classpath referenced by the EJB server.
# J2EE_CLASSPATH must include the location of the JDBC driver classes 
# (except for the Cloudscape driver shipped with this release).
# Each directory is delimited by a colon.
 
#J2EE_CLASSPATH=
#export J2EE_CLASSPATH
 
# JAVA_HOME refers to the directory where the Java(tm) 2 SDK
# Standard Edition software is installed.
 
if [ -z "$JAVA_HOME" ]
then
    JAVA_HOME=/usr/local/java/jdk1.3.1/solsparc
    export JAVA_HOME
fi
-----------
 
I edit the above file, and now it looks like this:
 
J2EE_CLASSPATH=$J2EE_HOME/lib/system/cloudutil.jar:$J2EE_HOME/lib/system/cloudscape.jar
export J2EE_CLASSPATH
 
# JAVA_HOME refers to the directory where the Java(tm) 2 SDK
# Standard Edition software is installed.
 
if [ -z "$JAVA_HOME" ]
then
    JAVA_HOME=/usr/local/java/jdk1.3.1/solsparc
    export JAVA_HOME
fi

Test starting and stopping the database server:

bash-2.03$ which cloudscape
/export/home/nabbasi/data/nabbasi_work/JDK_area/solaris/j2sdkee1.3/bin/cloudscape
 
 
bash-2.03$ cloudscape -start
Fri Sep 21 00:53:23 PDT 2001: [RmiJdbc] Starting Cloudscape RmiJdbc Server Version 1.7.2 ...
Fri Sep 21 00:53:29 PDT 2001: [RmiJdbc] COM.cloudscape.core.JDBCDriver registered in DriverManager
Fri Sep 21 00:53:29 PDT 2001: [RmiJdbc] Binding RmiJdbcServer...
Fri Sep 21 00:53:29 PDT 2001: [RmiJdbc] No installation of RMI Security Manager...
Fri Sep 21 00:53:30 PDT 2001: [RmiJdbc] RmiJdbcServer bound in rmi registry
 
Ok, looks good, lets me stop it now.
 
bash-2.03$ cloudscape -stop
URL=[jdbc:rmi:jdbc:cloudscape:]
 
Attempting to shutdown RmiJdbc server
RmiJdbc Server RmiAddr is: //dipsy/RmiJdbcServer
 
WARNING: Shutdown was successful!
 
Below shows the messages from the first windows after shutting down the database:
 
Fri Sep 21 00:54:27 PDT 2001: [RmiJdbc] Shutting down Cloudscape System...
Fri Sep 21 00:54:27 PDT 2001: [RmiJdbc] Cloudscape System has been shutdown
Fri Sep 21 00:54:27 PDT 2001: [RmiJdbc] WARNING: Shutting down RmiJdbc server !
Fri Sep 21 00:54:28 PDT 2001: [RmiJdbc] RmiJdbcServer unbound from rmi registry

Test isql with the database.

From J2EE release notes:

The default database used by the Cloudscape server is named CloudscapeDB. This database will reside in the cloudscape directory of your J2EE SDK installation. The CloudscapeDB database will be created automatically the first time it is accessed. The driver for the Cloudscape server is already configured in the config/default.properties file. No further changes by you are necessary.

 
From one terminal, start the database server, and from another windows start isql:
 
bash-2.03$ cloudscape -start
Fri Sep 21 00:56:41 PDT 2001: [RmiJdbc] Starting Cloudscape RmiJdbc Server Version 1.7.2 ...
Fri Sep 21 00:56:45 PDT 2001: [RmiJdbc] COM.cloudscape.core.JDBCDriver registered in DriverManager
Fri Sep 21 00:56:45 PDT 2001: [RmiJdbc] Binding RmiJdbcServer...
Fri Sep 21 00:56:45 PDT 2001: [RmiJdbc] No installation of RMI Security Manager...
Fri Sep 21 00:56:45 PDT 2001: [RmiJdbc] RmiJdbcServer bound in rmi registry
 
 
windows 2:
------------
 
bash-2.03$ cloudscape -isql 
ij version 4.0 (c) 1997-2001 Informix Software, Inc.
CONNECTION0* -  jdbc:cloudscape:CloudscapeDB;create=true
* = current connection
 
How to print schema of the database? I think there is some dummy data there allready.
How to find out?

test J2EE server. Start it and stop it.

 
bash-2.03$ j2ee -verbose     
  
Warning: This J2EE SDK release is designed to run on J2SE 1.3
J2EE server listen port: 1050
Naming service started:1050
Binding DataSource, name = jdbc/EstoreDB, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/DB1, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/InventoryDB, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
Binding DataSource, name = jdbc/XACloudscape__xa, dataSource = COM.cloudscape.core.RemoteXaDataSource@46d228
Starting JMS service...
Initialization complete - waiting for client requests
Binding: < JMS Destination : jms/Topic , javax.jms.Topic >
Binding: < JMS Destination : jms/Queue , javax.jms.Queue >
Binding: < JMS Cnx Factory : jms/QueueConnectionFactory , Queue , No properties >
Binding: < JMS Cnx Factory : jms/TopicConnectionFactory , Topic , No properties >
Binding: < JMS Cnx Factory : TopicConnectionFactory , Topic , No properties >
Binding: < JMS Cnx Factory : QueueConnectionFactory , Queue , No properties >
Starting web service at port: 8000
Starting secure web service at port: 7000
J2EE SDK/1.3
Starting web service at port: 9191
J2EE SDK/1.3
J2EE server startup complete.

Looks like no problems here. from Netscape, I typed http://localhost:8000/index.html and got the J2EE webserver home page ok, so it is up and running.

Next, typed https://localhost:7000

and went throught he process of accepting the certificate, but at the end if failed to log me in to the webserver at port 7000. Need to find out why:

Encryption: 
         Sun Microsystems Inc
         Sun Microsystems Inc
         Export Grade (RC4-40 with 40-bit secret key

Ok, lets stop it now

$ j2ee -stop
Warning: This J2EE SDK release is designed to run on J2SE 1.3
Shutting down the J2EE server.

1.     download ant (to build the examples from the j2ee tutorials). goto http://jakarta.apache.org/builds/jakarta-ant/release/v1.3/bin/

download the zip file and extracted into:

/export/home/nabbasi/data/nabbasi_work/JDK_area/common/jakarta-ant-1.3

then, edit my .bashrc file and added:

 
export JAVA_HOME=/usr/j2se     <--- this is JDK 1.4, no good for j2ee 1.3, see below for
                                    correct path.
export J2EE_HOME=/export/home/nabbasi/data/nabbasi_work/JDK_area/solaris/j2sdkee1.3
export ANT_HOME=/export/home/nabbasi/data/nabbasi_work/JDK_area/common/jakarta-ant-1.3
 
PATH=$JAVA_HOME/bin:$J2EE_HOME/bin:$ANT_HOME/bin:.....etc...

check that all paths are ok:

 
bash-2.03$ which ant
/export/home/nabbasi/data/nabbasi_work/JDK_area/common/jakarta-ant-1.3/bin/ant
 
bash-2.03$ which java
/usr/j2se/bin/java
 
bash-2.03$ which j2ee
/export/home/nabbasi/data/nabbasi_work/JDK_area/solaris/j2sdkee1.3/bin/j2ee

build the examples in the j2ee tutorial bundle.

 
bash-2.03$ pwd
/export/home/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/src
 
bash-2.03$ ant web
Buildfile: build.xml
 
init:
 
date:
 
hello1:
 
hello2:
 
bookstore1:
    [javac] Compiling 13 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore1
    [javac] /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/src/web/bookstore1/filters/OrderFilter.java:47: reference to Currency is ambiguous, both class util.Currency in util and class java.util.Currency in java.util match
    [javac]       Currency c = (Currency)session.getAttribute("currency");
    [javac]       ^
    [javac] /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/src/web/bookstore1/filters/OrderFilter.java:47: reference to Currency is ambiguous, both class util.Currency in util and class java.util.Currency in java.util match
    [javac]       Currency c = (Currency)session.getAttribute("currency");
    [javac]                     ^
    [javac] 2 errors
 
BUILD FAILED
 
/share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/src/build.xml:214: Compile failed, messages should have been provided.
 
Total time: 13 seconds
bash-2.03$ 
 
 
bash-2.03$ ant ejb
Buildfile: build.xml
 
init:
 
savingsaccount:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/savingsaccount
    [javac] Compiling 5 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/savingsaccount
 
bank:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/bank
    [javac] Compiling 5 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/bank
 
cart:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/cart
    [javac] Compiling 6 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/cart
 
checker:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/checker
    [javac] Compiling 4 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/checker
 
confirmer:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/confirmer
    [javac] Compiling 4 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/confirmer
    [javac] /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/src/ejb/confirmer/ConfirmerClient.java:14: '.' expected
    [javac] import Confirmer;
    [javac]                 ^
    [javac] /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/src/ejb/confirmer/ConfirmerClient.java:15: '.' expected
    [javac] import ConfirmerHome;
    [javac]                     ^
    [javac] 2 errors
 
BUILD FAILED
 
/share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/src/build.xml:79: Compile failed, messages should have been provided.
 
Total time: 20 seconds
 
 
 
bash-2.03$ ant connector 
Buildfile: build.xml
 
init:
 
get-cci-jar:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/archive
    [unzip] Expanding: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/solaris/j2sdkee1.3/lib/connector/cciblackbox-tx.rar into /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/archive
 
procs:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/procs
    [javac] Compiling 1 source file to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/procs
     [echo] Reminder: Add the classpath for the ../build/connector/procs/Procs.class to the J2EE_HOME variable in bin/userconfig.sh (UNIX) or bin\userconfig.bat (Windows) and restart the Cloudscape server.
 
cci:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/cci
    [javac] Compiling 4 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/cci
 
connector:
 
BUILD SUCCESSFUL
 
Total time: 13 seconds
bash-2.03$

Ok, I found the problem why I was getting errors in the above. those examples do not support JDK 1.4 beta, which I was using. So, I downloaded JDK 1.3.1 for solaris, and used that instead, so now it work ok:

 
Use these path, these work. 
 
export JAVA_HOME=/export/home/nabbasi/data/nabbasi_work/JDK_area/solaris/j2sdk1_3_1_01
export J2EE_HOME=/export/home/nabbasi/data/nabbasi_work/JDK_area/solaris/j2sdkee1.3
export ANT_HOME=/export/home/nabbasi/data/nabbasi_work/JDK_area/common/jakarta-ant-1.3
#
 
ant all
 
now generates no errors!
 
---------- showing the output of 'ant all' -------------------
Buildfile: build.xml
 
init:
 
savingsaccount:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/savingsaccount
    [javac] Compiling 5 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/savingsaccount
 
bank:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/bank
    [javac] Compiling 5 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/bank
 
cart:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/cart
    [javac] Compiling 6 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/cart
 
checker:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/checker
    [javac] Compiling 4 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/checker
 
confirmer:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/confirmer
    [javac] Compiling 4 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/confirmer
 
converter:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/converter
    [javac] Compiling 4 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/converter
     [copy] Copying 1 file to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/converter
 
enroller:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/enroller
    [javac] Compiling 10 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/enroller
 
order:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/order
    [javac] Compiling 5 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/order
 
salesrep:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/salesrep
    [javac] Compiling 7 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/salesrep
 
storagebin:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/storagebin
    [javac] Compiling 7 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/storagebin
 
teller:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/teller
    [javac] Compiling 4 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/teller
 
htmlreader:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/htmlreader
    [javac] Compiling 5 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/htmlreader
    [javac] Note: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/src/ejb/htmlreader/HTMLReaderBean.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -deprecation for details.
 
warehouse:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/warehouse
    [javac] Compiling 4 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/warehouse
 
simplemessage:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/simplemessage
    [javac] Compiling 2 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/simplemessage
 
cmproster:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/cmproster
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/cmproster/client
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/cmproster/roster
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/cmproster/team
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/cmproster/util
    [javac] Compiling 17 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/ejb/cmproster
 
ejb:
 
date:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/date
     [copy] Copying 3 files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/date
    [javac] Compiling 2 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/date
 
hello1:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/hello1
     [copy] Copying 1 file to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/hello1
    [javac] Compiling 2 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/hello1
 
hello2:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/hello2
     [copy] Copying 3 files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/hello2
 
bookstore1:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore1
     [copy] Copying 2 files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore1
     [copy] Copied 7 empty directories to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore1
    [javac] Compiling 21 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore1
 
web-ejb:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/ejb
    [javac] Compiling 6 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/ejb
 
bookstore2:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore2
     [copy] Copying 11 files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore2
     [copy] Copied 4 empty directories to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore2
    [javac] Compiling 7 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore2
      [war] Building war: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore2/bookstore2.war
 
bookstore3:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore3
     [copy] Copying 13 files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore3
     [copy] Copied 5 empty directories to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore3
    [javac] Compiling 14 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/web/bookstore3
 
web:
 
all:
 
BUILD SUCCESSFUL
 
Total time: 55 seconds
------------- end of output of 'ant all' ----------------------
 
for some reason, 'ant all' did not build the connector, so do this:
 
bash-2.03$ ant connector 
Buildfile: build.xml
 
init:
 
get-cci-jar:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/archive
    [unzip] Expanding: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/solaris/j2sdkee1.3/lib/connector/cciblackbox-tx.rar into /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/archive
 
procs:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/procs
    [javac] Compiling 1 source file to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/procs
     [echo] Reminder: Add the classpath for the ../build/connector/procs/Procs.class to the J2EE_HOME variable in bin/userconfig.sh (UNIX) or bin\userconfig.bat (Windows) and restart the Cloudscape server.
 
cci:
    [mkdir] Created dir: /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/cci
    [javac] Compiling 4 source files to /share/disk1/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/build/connector/cci
 
connector:
 
BUILD SUCCESSFUL
 
Total time: 11 seconds

start j2ee

 
bash-2.03$ j2ee -verbose
J2EE server listen port: 1050
Naming service started:1050
Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/DB1, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/EstoreDB, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/InventoryDB, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;create=true
Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
Binding DataSource, name = jdbc/XACloudscape__xa, dataSource = COM.cloudscape.core.RemoteXaDataSource@9de5b
Starting JMS service...
Initialization complete - waiting for client requests
Binding: < JMS Destination : jms/Topic , javax.jms.Topic >
Binding: < JMS Destination : jms/Queue , javax.jms.Queue >
Binding: < JMS Cnx Factory : TopicConnectionFactory , Topic , No properties >
Binding: < JMS Cnx Factory : QueueConnectionFactory , Queue , No properties >
Binding: < JMS Cnx Factory : jms/QueueConnectionFactory , Queue , No properties >
Binding: < JMS Cnx Factory : jms/TopicConnectionFactory , Topic , No properties >
Starting web service at port: 8000
Starting secure web service at port: 7000
J2EE SDK/1.3
Starting web service at port: 9191
J2EE SDK/1.3
J2EE server startup complete.

use deploytool to assemble and deploy the app.

 
bash-2.03$ pwd
/export/home/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/src/ejb/converter
 
bash-2.03$ ls -lrt
total 62
-rw-rw-r--   1 nabbasi  staff       1782 Sep 11 16:27 index.txt
-rw-rw-r--   1 nabbasi  staff       1782 Sep 11 16:27 index.jsp
-rw-rw-r--   1 nabbasi  staff        432 Sep 11 16:27 ConverterHome.java
-rw-rw-r--   1 nabbasi  staff       1194 Sep 11 16:27 ConverterClient.java
-rw-rw-r--   1 nabbasi  staff        736 Sep 11 16:27 ConverterBean.java
-rw-rw-r--   1 nabbasi  staff        438 Sep 11 16:27 Converter.java
-rw-r--r--   1 nabbasi  staff       1615 Sep 25 03:33 app-client-temp28174.jar
-rw-r--r--   1 nabbasi  staff       1430 Sep 25 03:41 web_temp28182.war
-rw-r--r--   1 nabbasi  staff       6133 Sep 25 03:49 converterApp.ear
-rw-r--r--   1 nabbasi  staff      11837 Sep 25 03:50 converterAppClient.jar
 
export APPCPATH=/export/home/nabbasi/data/nabbasi_work/JDK_area/common/j2ee-1_3-doc-tutorial-draft1/examples/src/ejb/converter/converterAppClient.jar

 

18.             How to convert IE bookmarks (favoriets) to Netscape bookmarks?

http://help.netscape.com/kb/consumer/19980914-23.html http://www.magnusbrading.com/bmc/

19.             Where is favorites folder used by IE stored on the PC?

 
C:\Documents and Settings\Administrator\Favorites

20.             How to print on 11x17 from visio, to get max page size?

 
in Visio, file->pagesetup->printer setup:
select pagesize as 11x17, select printzoom as 100%
 
in file->pagesetup->page size:
select 'same as printer pagesize'
 
in file->pagesetup->drawing scale:
select 'no scale (1:1)'
 
When printing, if the options allows it, select tray that 
contains 11x17.

21.             some java applications

 
F1Java - A spreadsheet designer that works like Excel
Tomcat - A kick-ass application server
JLoox - A GIS mapping system
JPing - An ICMP networking library
ICEBrowser - A web browser 
ImageJ - A sophisticated image processing library and app
Javacomm - Talk to your COM ports
Jasmine - A Java byte code Assembler (rocks)
Lumberjack - An application logging mechanism that rivals syslog
mmsql - MySQL database drivers
NetComponents - A TCP/IP library for
FTP/HTTP/NNTP/SMTP/POP3/FINGER/REXEC/RSHELL...
Jlgui - An MP3 player
Hypersonic SQL - A tiny embeddable ANSI-SQL database engine

22.             What network interfaces are there for Solaris?

By Nasser Abbasi:

This table summarize the interfaces I know of as of now, more will be added when found

 

description

device driver

interface name

ATM 4.0, ATM 5.0

ba

ba0, ba1, ...

Token ring

trp

trp0, trp1, ...

ATM 1.0

sa

sa0, sa1, ...

ATM lan emulation mode

lane

lane0, lane1, ...

loopback

lo

lo0

The SUNW,hme device provides 10BASE-TX or 100BASE-T networking interfaces using the Fast Ethernet Parallel Port SCSI (FEPS) ASIC and an internal transceiver. The driver automatically sets the link speed to 10 or 100 Mbps and conforms to the 100BASE-T IEEE 802.3u Ethernet standard.

hme

hme0, hme1, ...

10/100 QuadEthernet, 10BASE-TX or 100BASE-T

qfe

qfe0, qfe1, ...

FDDI

nf

nf0, nf1, ...

Quad-MACE ethernet driver

qe

qe0, qe1, ...

23.             How to find what HW and devices are known to Solaris and other OS info?

 

#man prtconf

 

#prtconf -D -v

 

also

 

prtdiag  (can't find this command?)

 

also

 

#psrinfo -v

Status of processor 0 as of: 11/26/00 20:57:33

  Processor has been on-line since 11/26/00 14:28:20.

  The sparcv9 processor operates at 270 MHz,

        and has a sparcv9 floating point processor.

24.             How to send signal to a process on solaris

 
man kill.
 
kill -s singal <pid>
 
To find what signals are there, so
 
cat  /usr/include/sys/iso/signal_iso.h 
 
#define SIGHUP  1       /* hangup */
#define SIGINT  2       /* interrupt (rubout) */
#define SIGQUIT 3       /* quit (ASCII FS) */
#define SIGILL  4       /* illegal instruction (not reset when caught) */
#define SIGTRAP 5       /* trace trap (not reset when caught) */
#define SIGIOT  6       /* IOT instruction */
#define SIGABRT 6       /* used by abort, replace SIGIOT in the future */
#define SIGEMT  7       /* EMT instruction */
#define SIGFPE  8       /* floating point exception */
#define SIGKILL 9       /* kill (cannot be caught or ignored) */
#define SIGBUS  10      /* bus error */
#define SIGSEGV 11      /* segmentation violation */
#define SIGSYS  12      /* bad argument to system call */
#define SIGPIPE 13      /* write on a pipe with no one to read it */
#define SIGALRM 14      /* alarm clock */
#define SIGTERM 15      /* software termination signal from kill */
#define SIGUSR1 16      /* user defined signal 1 */
#define SIGUSR2 17      /* user defined signal 2 */
#define SIGCLD  18      /* child status change */
#define SIGCHLD 18      /* child status change alias (POSIX) */
#define SIGPWR  19      /* power-fail restart */
#define SIGWINCH 20     /* window size change */
#define SIGURG  21      /* urgent socket condition */
#define SIGPOLL 22      /* pollable event occured */
#define SIGIO   SIGPOLL /* socket I/O possible (SIGPOLL alias) */
#define SIGSTOP 23      /* stop (cannot be caught or ignored) */
#define SIGTSTP 24      /* user stop requested from tty */
#define SIGCONT 25      /* stopped process has been continued */
#define SIGTTIN 26      /* background tty read attempted */
#define SIGTTOU 27      /* background tty write attempted */
#define SIGVTALRM 28    /* virtual timer expired */
#define SIGPROF 29      /* profiling timer expired */
#define SIGXCPU 30      /* exceeded cpu limit */
#define SIGXFSZ 31      /* exceeded file size limit */
#define SIGWAITING 32   /* process's lwps are blocked */
#define SIGLWP  33      /* special signal used by thread library */
#define SIGFREEZE 34    /* special signal used by CPR */
#define SIGTHAW 35      /* special signal used by CPR */
#define SIGCANCEL 36    /* thread cancellation signal used by libthread */
#define SIGLOST 37      /* resource lost (eg, record-lock lost) */
 
 
use the symbolic name above. i.e 
 
SunOS>kill -s SIGHUP 206
 
will send a SIGHUP, or signal value 1.

25.             NFS. Solaris as server, Linux as client. Linux mounting Solaris filesystem over NFS.

 
by Nasser Abbasi. added Nov 10, 2000.
 
This show how to mount Solaris file system from a Linux box.
 
This is the layout.  
 
              +-------+                                        +-------+
              | Linux |--190.190.190.10--------190.190.190.11--|Solaris|
              +-------+                                        +-------+
               
This shows the two boxes attached using cross over direct ethernet cable. (you can use a hub just as well).
 
On linux, first remove the default gateway (your ISP one) and make Solaris  
as the default gatway for the linux box.
 
         linux> route delete  default gw <ISP_current_default_gw_IP>
         linux> route add  default gw 190.190.190.11
         
On Solaris, just edit the /etc/hosts file, and add entry for linux box 
just like normal.
 
Now, lets assume you want /export/home/nabbasi, which is on the Solaris 
file system, to be seen from Linux as /export/g  
 
On Solaris, do (as root)
 
        solaris> share -F nfs -o ro /export/home/nabbasi
        
On Linux, as root edit /etc/fstab and added line:
 
   190.190.190.11:/export/home/nabbasi /export/g  nfs
 
where on Linux, the directory /export/g is some existing
directory where I wanted to use as mount point.
   
On Linux, now do
   linux> mount -a
   
   now If you get this error:
   RPC program not registered (this error comes from Solaris).
 
   (also if you get  mount: RPC: Timed out)
 
then, go back to Solaris and do:
 
   solaris> /usr/lib/nfs/nfsd -a 16
   solaris> /usr/lib/nfs/mountd
 
   The rpc:program not registered means that the necessary daemons
   to serve NFS drives aren't loaded.
   
Now back to Linux, do again
   linux> mount -a
 
   and now it should be mounted.
 
On Solaris, make sure directories has mod o+x else I was
getting permission denied from linux when I try to 'cd' to them.
 
you can make Solaris share the /export/home/nabbasi everytime it
boots up. on soalris, as root, edit /etc/dfs/dfstab file, and
add the share commands. This means when solaris boots, it will
execute those commands. put the above share command in the file.
 
Now, on solaris, to unshare the devices do:
 
unshareall
 
to make all devices shared again, do on solaris
 
shareall
 
 
NOTE: If on linux, you get the errors:
root@linux:/etc > mount -a
mount: me:/nabbasi failed, reason given by server: Permission denied
 
It means you have not made the directory shared on SOlaris.
Then go to solaris and do:
 
me> share  -F nfs  -o rw /nabbasi
 
TYhe above makes /nabbasi shared. Then now go back to linux and do
 
#mount -a
 
where this is the entry in linux /etc/fstab
 
root@linux:/etc > cat /etc/fstab
me:/nabbasi     /home/nabbasi/mnt       nfs    <---- this line

26.             NFS. Solaris as client, Linux as server. Solaris mounting linux filesystem over NFS.

 
by Nasser Abbasi. added June 1, 2001.
 
Assume in this example, the linux box is named linux and solaris host is called 'me'.
 
On Linux make sure rpc.nfsd and rpc.mountd are running. If not do on linux
 
/usr/sbin/rpc.mountd
/usr/sbin/rpc.nfsd
 
Let assume you want to mount linux:/disks/d1/nabbasi from Solaris.
 
First, on linux, we need to export /disks/d1/nabbasi. so edit /etc/exports
 
root@linux:/disks/d1/nabbasi > cat /etc/exports
# See exports(5) for a description.
# This file contains a list of all directories exported to other computers.
# It is used by rpc.nfsd and rpc.mountd.
/disks/d1/nabbasi (rw)
 
 
Now, type the following command to tell nfsd about the exported file system:
 
linux$exportfs -r
 
To look at what file systems are exported on linux, do
 
root@linux:/disks/d1/nabbasi > exportfs
/disks/d1/nabbasi
                <world>
 
One last thing, make sure the linux kernel is build with NFS support. I compiled
the kerenl with NFS v3. (I think Solaris default to NFS v3).
 
NOw, on solaris, I am not sure if this is needed or not (since solaris acts as
client here, probably not needed), but issue these commands:
 
   solaris> /usr/lib/nfs/nfsd -a 16
   solaris> /usr/lib/nfs/mountd
 
Now, from solaris, mount the linux file system.
 
solaris>mount linux:/disks/d1/nabbasi /mnt
 
This shows the NFS protocol between solaris and linux.
doing a mount from solaris to mount a filesystem on linux.
Linux is the server here, and solaris is the client.
 
 
mount linux:/disks/d1/nabbasi /export/home/nabbasi/linux
 
NOTE: Make sure the /etc/hosts files on Solaris and Linux has
entries of each hosts name and its ip address.
 
This below shows snoop on solaris showing the protocol exchange.
 

 

me_qfe0 -> linux        PORTMAP C GETPORT prog=100005 (MOUNT) vers=3 proto=UDP

       linux -> me_qfe0      PORTMAP R GETPORT port=32768

     me_qfe0 -> linux        MOUNT3 C Null

       linux -> me_qfe0      MOUNT3 R Null

     me_qfe0 -> linux        MOUNT3 C Mount /disks/d1/nabbasi

       linux -> me_qfe0      MOUNT3 R Mount OK FH=0089 Auth=none,unix

     me_qfe0 -> linux        PORTMAP C GETPORT prog=100003 (NFS) vers=3 proto=TCP

       linux -> me_qfe0      PORTMAP R GETPORT port=0

     me_qfe0 -> linux        PORTMAP C GETPORT prog=100003 (NFS) vers=3 proto=UDP

       linux -> me_qfe0      PORTMAP R GETPORT port=2049

     me_qfe0 -> linux        NFS C NULL3

       linux -> me_qfe0      NFS R NULL3

     me_qfe0 -> linux        NFS C FSINFO3 FH=0089

       linux -> me_qfe0      NFS R FSINFO3 OK

     me_qfe0 -> linux        NFS C GETATTR3 FH=0089

       linux -> me_qfe0      NFS R GETATTR3 OK

 

 

------------------------------
 
This below shows the client douning an 'ls -l' on the
NFS mounted file system. ls is done on solaris, the NFS is
on linux.
 
 
ls -l /export/home/nabbasi/linux
Using device /dev/qfe (promiscuous mode)
 
     me_qfe0 -> linux        NFS C FSSTAT3 FH=0089
       linux -> me_qfe0      NFS R FSSTAT3 OK
       linux -> *            ARP C Who is 195.0.0.2, me_qfe0 ?
     me_qfe0 -> linux        ARP R 195.0.0.2, me_qfe0 is 8:0:20:9e:6:9c
     me_qfe0 -> linux        NFS C GETATTR3 FH=0089
       linux -> me_qfe0      NFS R GETATTR3 OK
     me_qfe0 -> linux        NFS_ACL C GETACL3 FH=0089 mask=10
       linux -> me_qfe0      RPC R (#23) XID=1440339577 Program unavailable
     me_qfe0 -> linux        NFS C ACCESS3 FH=0089 (read)
       linux -> me_qfe0      NFS R ACCESS3 OK (read)
     me_qfe0 -> linux        NFS C READDIRPLUS3 FH=0089 Cookie=0 for 1048/8192
       linux -> me_qfe0      UDP IP fragment ID=43257 Offset=4440 MF=0
       linux -> me_qfe0      UDP IP fragment ID=43257 Offset=2960 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43257 Offset=1480 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43257 Offset=0    MF=1
     me_qfe0 -> linux        NFS C READDIRPLUS3 FH=0089 Cookie=620 for 1048/8192
     me_qfe0 -> linux        NFS C ACCESS3 FH=0089 (lookup)
       linux -> me_qfe0      UDP IP fragment ID=43258 Offset=4440 MF=0
       linux -> me_qfe0      UDP IP fragment ID=43258 Offset=2960 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43258 Offset=1480 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43258 Offset=0    MF=1
       linux -> me_qfe0      NFS R ACCESS3 OK (lookup)
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 slickedi
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=A791
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 XF86Config
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=A1B4
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 foo
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=C381
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 solaris_info.txt
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=2842
     me_qfe0 -> linux        NFS C READDIRPLUS3 FH=0089 Cookie=1304 for 1048/8192
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 data
       linux -> me_qfe0      UDP IP fragment ID=43259 Offset=4440 MF=0
       linux -> me_qfe0      UDP IP fragment ID=43259 Offset=2960 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43259 Offset=1480 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43259 Offset=0    MF=1
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=93C1
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 viavoice
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=9638
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 just_info.txt
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=EAC9
     me_qfe0 -> linux        NFS C READDIRPLUS3 FH=0089 Cookie=2004 for 1048/8192
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 download
       linux -> me_qfe0      UDP IP fragment ID=43260 Offset=4440 MF=0
       linux -> me_qfe0      UDP IP fragment ID=43260 Offset=2960 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43260 Offset=1480 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43260 Offset=0    MF=1
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=DE7F
     me_qfe0 -> linux        NFS C READDIRPLUS3 FH=0089 Cookie=3100 for 1048/8192
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 Mail
       linux -> me_qfe0      UDP IP fragment ID=43261 Offset=4440 MF=0
       linux -> me_qfe0      UDP IP fragment ID=43261 Offset=2960 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43261 Offset=1480 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43261 Offset=0    MF=1
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=4208
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 mpeg-4_stuff
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=4CD6
     me_qfe0 -> linux        NFS C READDIRPLUS3 FH=0089 Cookie=4268 for 1048/8192
     me_qfe0 -> linux        NFS C LOOKUP3 FH=0089 StarOffice52
       linux -> me_qfe0      UDP IP fragment ID=43262 Offset=4440 MF=0
       linux -> me_qfe0      UDP IP fragment ID=43262 Offset=2960 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43262 Offset=1480 MF=1
       linux -> me_qfe0      UDP IP fragment ID=43262 Offset=0    MF=1
       linux -> me_qfe0      NFS R LOOKUP3 OK FH=B5D7
     me_qfe0 -> linux        NFS C READDIRPLUS3 FH=0089 Cookie=5224 for 1048/8192
 
etc....

27.             How to find what filesystems are allready set shared on solaris?

cat /etc/dfs/sharetab

Solaris writes into the above file the devices that are shared.

28.             what are the tcpdump flags?

 
 The general format of a tcp protocol line is:
 
      src > dst: flags data-seqno ack window urgent options
 
 Flags are  some  combination  of  
       S  (SYN) 
       F  (FIN)  
       P  (PUSH)  
       R  (RST) 
       single `.' (no flags).

29.             How to convert router to multi-homed on Solaris

 
      $rm /etc/notrouter
      $touch /etc/notrouter
      $init 6

when machine reboots, it will NOT start in.routed nor in.rdisc, and will not turn on the ip forwarding flag in the kernel.

30.             How to force a host to become a router on Solaris?

create an empty /etc/gateway file. reboot.

31.             How to force a host to use dynamic routing?

create an empty /etc/defaultrouter file. reboot. When host reboots, it will look for /usr/sbin/in.rdisc, if found, in.disc daemon is started. If no router on network found running RDISC, in.disc exits, and in.routed is started which uses RIP.

32.             How to turn off ICMP router discovery on Solaris?

#mv /usr/sbin/in.rdisc /usr/sbin/in.rdisc.notused

33.             How to change the MTU of an interface?

Assume you want to set MTU to 100 on interface qfe0. The command is
#ifconfig qfe0 mtu 100

34.             What is the smallest MTU that can be used?

72

35.             How to change IP address of machine on Solaris?

edit /etc/netmaks, make sure netmask and network number are correct.

     edit /etc/hosts and update the IP address.

36.             How to add entry to routing table on Solaris?

 
 To add an entry such as

 

      Routing Table:

  Destination           Gateway           Flags  Ref   Use   Interface

-------------------- -------------------- ----- ----- ------ ---------

10.0.0.0              10.10.10.19           U      3   6880  hme0

 

do

 
$route add net 10.0.0.0  10.10.10.19

37.             How to look at routing table on Solaris?

#netstat -rn

38.             What files used to setup a host on a network for Solaris?

By Nasser Abbasi

This is a brief description of how to setup a Solaris host that uses a DNS server.

To make it easier to describe, we will use the following values: (made up IP addresses)

 
host name :  SOL8
DNS IP    :  206.13.28.12
host IP   :  216.101.264.39  (static IP address, not DHCP served).
default gateway (default router) IP : 216.101.264.254
Network mask : 255.255.255.0  (class C)
domain name : worldwide.com

Assume the machine network device name is elx10.

Notice that a machine on an ethernet is only able to talk directly to another machine that is on the same network. This means that for a machine to talk to another machine not on the same network, a router must be used (also called gateway).

A router is a machine that connects 2 or more physical networks together.

Notice also, that the netmask 255.255.255.0 is applied automatically to the interface by the system. From the host IP format, since it is found to be a class C, the network mask is found to be 255.255.255.0.

 
class      Range of      Network address    Host address   network mask
           first byte 
-----------------------------------------------------------------------
A          0-127         xxx              xxx.xxx.xxx     255.0.0.0
B          128-191       xxx.xxx          xxx.xxx         255.255.0.0
C          192-223       xxx.xxx.xxx      xxx             255.255.255.0

Network mask is used to extract the host address or network address portions given an IP address.

The following table shows all the files needed to setup the above host on Solaris using the name server shown above.

 
+--------------------------+---------------------------------------------------------
| file name                |                 description
+--------------------------+----------------------------------------------------------
| /etc/hosts               | This file contains the name and IP address of
|                          | localhost and any interfaces on the machine.
|                          | Since we are using DNS for name server, only
|                          | these 2 entries are needed. If you are using
|                          | "files" as your name server for the resolver to
|                          | use for lookup, then you need to add entries for
|                          | all other hosts.
|                          | This is how this file looks like based on above
|                          |
|                          |     $ cat /etc/hosts
|                          |     #
|                          |     # Internet host table
|                          |     #
|                          |     127.0.0.1       localhost
|                          |     216.101.264.34  sol8    loghost
+--------------------------+---------------------------------------------------------------
| /etc/resolv.conf         | The resolver configuration file contains information that is
|                          | read by the resolver routines the first time a process calls
|                          | them. This file will contains an entry that lists the IP
|                          | address of the name server. Usually this IP address is assigned
|                          | to you by your ISP to use. You can add at most 3 name servers.
|                          | see 'man resolv.conf' for more info.
|                          | NOTE: make sure /etc/nsswitch file has dns next to hosts entry also
|                          |
|                          |   #cat /etc/resolv.conf
|                          |   nameserver 206.13.28.12
+--------------------------+------------------------------------------------------------
| /etc/defaultrouter       | This file contains one entry which is the IP 
|                          | address of the interface that acts as the router
|                          | (This is normally called the default gateway, and is
|                          | given to your by your ISP). If the host is connected to
|                          | more than one router, each will have an entry.
|                          |    
|                          |     #cat /etc/defaultrouter
|                          |     216.101.264.254
+--------------------------+------------------------------------------------------------
| /etc/nodename            | This file contains one entry, the host name of the local
|                          | machine. (If the machine contains more than one interface,
|                          | this will be the name of the primary network interface).
|                          |
|                          |    # cat /etc/nodename
|                          |    sol8
+--------------------------+---------------------------------------------------------------
 
+--------------------------+---------------------------------------------------------
| file name                |                 description
+--------------------------+-----------------------------------------------------------
| /etc/hostname.elxl0      | There is one file called hostname.<interface_name> for
|                          | each interface on the machine. It will contain one entry
|                          | which is the name assigned to the interface. If the machine
|                          | contains one interface, then the name of the interface will
|                          | be the same as the hostname as in /etc/nodename. If the machine
|                          | contains more than one interface, each other interface will
|                          | be given different name.
|                          | on IPV6, the file name will be called /etc/hostname6.<interface>
|                          |
|                          |   #cat /etc/hostname.elx10
|                          |   sol8
+--------------------------+-------------------------------------------------------------
| /etc/defaultdomain       | This file contains one entry, which is the fully qualified 
|                          | domain name to which this machine network belongs to.
|                          | 
|                          |  # cat /etc/defaultdomain
|                          |  worldwide.com
+--------------------------+-----------------------------------------------------------
| /etc/netmasks            | This file needs to be edited only if you subnet your network
|                          | (notice that each subnet must be physically on a separate
|                          | network, one can not subnet a single physical network. 
|                          | since in this example, no subnetting is used, this file is
|                          | empty.
+--------------------------+---------------------------------------------------------------
 
+--------------------------+---------------------------------------------------------
| file name                |                 description
+--------------------------+----------------------------------------------------------
| /etc/nsswitch.conf       | This file lists which name service to use for different
|                          | services. The name service can be NIS, NIS+, DNA, or FILES.
|                          | i.e. For example, to use dns to look up hosts name, we
|                          | lists 'dns' next to the 'hosts' service. The order is
|                          | left to right. 'files' is usually read first, and if that
|                          | fails to look up the name, then dns server is used. This 
|                          | is created during installation. Just  make sure 'dns' is listed
|                          | for the 'hosts' entry.
|                          |
|                          |   $cat /etc/nsswitch
|                          |    #
|                          |    # /etc/nsswitch.dns:
|                          |    #
|                          |    # An example file that could be copied over to /etc/nsswitch.conf; it uses
|                          |    # DNS for hosts lookups, otherwise it does not use any other naming service.
|                          |    #
|                          |    # "hosts:" and "services:" in this file are used only if the
|                          |    # /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.
|                          |
|                          |    passwd:     files
|                          |    group:      files
|                          |    # You must also set up the /etc/resolv.conf file for DNS name
|                          |    # server lookup.  See resolv.conf(4).
|                          |    hosts:      files dns  # <--------------- dns here looks up reolve.conf
|                          |    ipnodes:    files
|                          |    # Uncomment the following line and comment out the above to resolve
|                          |    # both IPv4 and IPv6 addresses from the ipnodes databases. Note that
|                          |    # IPv4 addresses are searched in all of the ipnodes databases before
|                          |    # searching the hosts databases. Before turning this option on, consult
|                          |    # the Network Administration Guide for more details on using IPv6.
|                          |    #ipnodes:   files dns
|                          |
|                          |    networks:   files
|                          |    protocols:  files
|                          |    rpc:        files
|                          |    ethers:     files
|                          |    netmasks:   files
|                          |    bootparams: files
|                          |    publickey:  files
|                          |    # At present there isn't a 'files' backend for netgroup;  the system will 
|                          |    #   figure it out pretty quickly, and won't use netgroups at all.
|                          |    netgroup:   files
|                          |    automount:  files
|                          |    aliases:    files
|                          |    services:   files
|                          |    sendmailvars:   files
|                          |    printers:       user files
|                          |
|                          |    auth_attr:  files
|                          |    prof_attr:  files
+--------------------------+-------------------------------------------------------------------------------
 
+--------------------------+---------------------------------------------------------
| file name                |                 description
+--------------------------+----------------------------------------------------------
| /etc/bootparams          | This file is used for diskless clients. Not needed here.
+--------------------------+-------------------------------------------------------------------------------
| /etc/networks            | associates Internet Protocol (IP) network numbers # with network names. 
|                          | created by Solaris installation. no need to change unless you add more
|                          | networks to your current network, and you need to refer to the network
|                          | by name.
|                          |
|                          |     $cat /etc/networks
|                          |     #
|                          |     # The networks file associates Internet Protocol (IP) network numbers
|                          |     # with network names.  The format of this file is:
|                          |     # 
|                          |     #       network-name    network-number  nicnames . . .
|                          |     #
|                          |
|                          |     #
|                          |     # The loopback network is used only for intra-machine communication
|                          |     #
|                          |     loopback        127
|                          |
|                          |     #
|                          |     # Internet networks
|                          |     #
|                          |     arpanet         10              arpa    # Historical
+--------------------------+--------------------------------------------------------------------------------
| /etc/protocols           | Lists the tcp/ip protocols installed on system. Created by installation
|                          | no need to change.
|                          |
|                          |   $cat /etc/protocols
|                          |   #
|                          |   # Internet (IP) protocols
|                          |   #
|                          |   ip              0       IP              # internet protocol, pseudo protocol number
|                          |   icmp            1       ICMP            # internet control message protocol
|                          |   ggp             3       GGP             # gateway-gateway protocol
|                          |   tcp             6       TCP             # transmission control protocol
|                          |   egp             8       EGP             # exterior gateway protocol
|                          |   pup             12      PUP             # PARC universal packet protocol
|                          |   udp             17      UDP             # user datagram protocol
|                          |   hmp             20      HMP             # host monitoring protocol
|                          |   xns-idp         22      XNS-IDP         # Xerox NS IDP
|                          |   rdp             27      RDP             # "reliable datagram" protocol
|                          |
|                          |   #
|                          |   # Internet (IPv6) extension headers
|                          |   #
|                          |   hopopt          0       HOPOPT          # Hop-by-hop options for IPv6
|                          |   ipv6            41      IPv6            # IPv6 in IP encapsulation
|                          |   ipv6-route      43      IPv6-Route      # Routing header for IPv6
|                          |   ipv6-frag       44      IPv6-Frag       # Fragment header for IPv6
|                          |   esp             50      ESP             # Encap Security Payload for IPv6
|                          |   ah              51      AH              # Authentication Header for IPv6
|                          |   ipv6-icmp       58      IPv6-ICMP       # IPv6 internet control message protocol
|                          |   ipv6-nonxt      59      IPv6-NoNxt      # No next header extension header for IPv6
|                          |   ipv6-opts       60      IPv6-Opts       # Destination Options for IPv6
+--------------------------+--------------------------------------------------------------------------------------
 
+--------------------------+---------------------------------------------------------
| file name                |                 description
+--------------------------+----------------------------------------------------------
| /etc/services            | This file lists TCP and UDP services and their well known
|                          | port number.  created during installation, no need to change.
|                          |
|                          |    $ cat /etc/services
|                          |    .... not shown..
+--------------------------+------------------------------------------------------------------------------
| /etc/inetd.conf          | The inetd.conf  file  contains  the  list  of  servers  that
|                          | inetd(1M)  invokes when it receives an Internet request over
|                          | a socket.
|                          | Created by installation. No need to modify.
|                          | see 'man inetd.conf' for more info.
+--------------------------+-----------------------------------------------------------------------------------
| /etc/inet/ipnodes        |  The ipnodes file is a local  database  that  associates  the
|                          |  names  of nodes with their Internet Protocol (IP) addresses.
|                          |  Created by installation. no need to modify. see 'man ipnodes' for more info.
+--------------------------+--------------------------------------------------------------------------------

39.             How to change or look at TCP/IP setting on solaris?

To look at TCP parameters do
 
# ndd /dev/tcp
 
to look at/set IP parameters do
 
# ndd /dev/ip
 
The following is the output of the above two commands
 
 
# ndd /dev/ip
name to get/set ? ?
?                             (read only)
ip_forwarding                 (read and write)
ip_respond_to_address_mask_broadcast(read and write)
ip_respond_to_echo_broadcast  (read and write)
ip_respond_to_timestamp       (read and write)
ip_respond_to_timestamp_broadcast(read and write)
ip_send_redirects             (read and write)
ip_forward_directed_broadcasts(read and write)
ip_debug                      (read and write)
ip_mrtdebug                   (read and write)
ip_ire_cleanup_interval       (read and write)
ip_ire_flush_interval         (read and write)
ip_ire_redirect_interval      (read and write)
ip_def_ttl                    (read and write)
ip_forward_src_routed         (read and write)
ip_wroff_extra                (read and write)
ip_ire_pathmtu_interval       (read and write)
ip_icmp_return_data_bytes     (read and write)
ip_send_source_quench         (read and write)
ip_path_mtu_discovery         (read and write)
ip_ignore_delete_time         (read and write)
ip_ignore_redirect            (read and write)
ip_output_queue               (read and write)
ip_broadcast_ttl              (read and write)
ip_icmp_err_interval          (read and write)
ip_reass_queue_bytes          (read and write)
ip_strict_dst_multihoming     (read and write)
ip_addrs_per_if               (read and write)
ip_ill_status                 (read only)
ip_ipif_status                (read only)
ip_ire_status                 (read only)
ip_ipc_status                 (read only)
ip_rput_pullups               (read and write)
ip_enable_group_ifs           (read and write)
ip_proxy_status               (read only)
name to get/set ?  
#

 

 
# ndd /dev/tcp
name to get/set ? ?
?                             (read only)
tcp_time_wait_interval        (read and write)
tcp_conn_req_max_q            (read and write)
tcp_conn_req_max_q0           (read and write)
tcp_conn_req_min              (read and write)
tcp_conn_grace_period         (read and write)
tcp_cwnd_max                  (read and write)
tcp_debug                     (read and write)
tcp_smallest_nonpriv_port     (read and write)
tcp_ip_abort_cinterval        (read and write)
tcp_ip_abort_linterval        (read and write)
tcp_ip_abort_interval         (read and write)
tcp_ip_notify_cinterval       (read and write)
tcp_ip_notify_interval        (read and write)
tcp_ip_ttl                    (read and write)
tcp_keepalive_interval        (read and write)
tcp_maxpsz_multiplier         (read and write)
tcp_mss_def                   (read and write)
tcp_mss_max                   (read and write)
tcp_mss_min                   (read and write)
tcp_naglim_def                (read and write)
tcp_rexmit_interval_initial   (read and write)
tcp_rexmit_interval_max       (read and write)
tcp_rexmit_interval_min       (read and write)
tcp_wroff_xtra                (read and write)
tcp_deferred_ack_interval     (read and write)
tcp_snd_lowat_fraction        (read and write)
tcp_sth_rcv_hiwat             (read and write)
tcp_sth_rcv_lowat             (read and write)
tcp_dupack_fast_retransmit    (read and write)
tcp_ignore_path_mtu           (read and write)
tcp_rcv_push_wait             (read and write)
tcp_smallest_anon_port        (read and write)
tcp_largest_anon_port         (read and write)
tcp_xmit_hiwat                (read and write)
tcp_xmit_lowat                (read and write)
tcp_recv_hiwat                (read and write)
tcp_recv_hiwat_minmss         (read and write)
tcp_fin_wait_2_flush_interval (read and write)
tcp_co_min                    (read and write)
tcp_max_buf                   (read and write)
tcp_zero_win_probesize        (read and write)
tcp_strong_iss                (read and write)
tcp_rtt_updates               (read and write)
tcp_wscale_always             (read and write)
tcp_tstamp_always             (read and write)
tcp_tstamp_if_wscale          (read and write)
tcp_rexmit_interval_extra     (read and write)
tcp_deferred_acks_max         (read and write)
tcp_slow_start_after_idle     (read and write)
tcp_slow_start_initial        (read and write)
tcp_co_timer_interval         (read and write)
tcp_sack_permitted            (read and write)
tcp_extra_priv_ports          (read only)
tcp_extra_priv_ports_add      (write only)
tcp_extra_priv_ports_del      (write only)
tcp_status                    (read only)
tcp_bind_hash                 (read only)
tcp_listen_hash               (read only)
tcp_conn_hash                 (read only)
tcp_acceptor_hash             (read only)
tcp_host_param                (read and write)
tcp_1948_phrase               (write only)
tcp_close_wait_interval(obsoleted- use tcp_time_wait_interval) (no read or write)
name to get/set ?

40.             How to allow root to use telnet on Solaris?

Suppose you have host A and host B. from host A, as root, you attempt to telnet to B. If you get error from B that root not allowed to login, then you need to edit the following file on host B:

 

        /etc/default/login

Edit the above file on B, and comment the line

 

CONSOLE=/dev/console

make sure the above line is commented, add "#" to start of line.

41.             How to allow root to use ftp on Solaris?

On the host you are trying to ftp to as root, edit the file /etc/ftpusers and remove the root entry.

42.             How to use truss command to debug program on solaris?

If you have a program called a.out, and you want to see what system services it calls as it runs, do

 
# truss -f -v all -ae ./a.out

43.             1.42 How to debug shell scripts?

use the command

 

for 'sh' shell:

 

       sh -xv <script>

You can also add set -xv at start of script file itself.

For example, to look at what the activate script was doing, this command was used

 

      sh -x /opt/SUNWicg/SunScreen/ssadm/activate Initial

44.             How does traceroute work?

By Nasser Abbasi

traceroute sends a UDP packet to the final destination, but it starts with ttl=1, then increment the ttl by one each time before sending another UDP packet to the same final destination. IP decrements the ttl by 1 before it forwards the packet. If the ttl become 0 after decrementing, then an ICMP packet is send back to the original sender.

 

The router will send an ICMP packet back to original host (type=11, time exceeded). The Orginal host running traceroute records the IP address of the router that sends the ICMP packet.

 

This way, by sending UDP packets with ttl=1,2,3,4,.. the sender collects back the IP addresses of the first, seconds, third, etc.. hops (gateways or routers) along the route to the final destination.

 

The trick is that an IP packet with ttl=0 will result in an ICMP error packet send back that contains the IP address of where ttl was found to be 0.

 

Notice that before a router forwards an IP packet, it will automatically decrement the ttl on the packet.

traceroute uses raw socket mode to create the UDP packet, and to set the ttl field in the IP header before calling sendto() to send it.

45.             How to tell apache to deny browsing a directory?

 
In the directory directives 
 
<Directory "i:/htdocs">
Options Indexes FollowSymLinks Inc  ----> change to:  Options FollowSymLinks Inc
AllowOverride None
Order allow,deny
Allow from all
</Directory>

46.             How to start and configure apache on Linux?

 
add Nov 17, 2000. By Nasser Abbasi
 
nabbasi>rpm -qa | grep -i apache
apache-1.3.9-18
 
To start apache do
 
#/usr/sbin/httpd -f /etc/httpd/httpd.conf
 
To stop apache, do
 
#killall httpd
 
edit /etc/httpd/httpd.conf and make sure the following are set correctly
 
 
ServerRoot "/usr/local/apache"
Port 80
DocumentRoot "/usr/local/apache/htdocs" 
<Directory "/usr/local/httpd/htdocs">
ErrorLog /var/log/httpd.error_log
CustomLog /var/log/httpd.access_log common
 
also, check the Alias section, and make sure they are correct.
 
ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"
 
 
<Directory "/usr/local/apache/cgi-bin">    <------- change this to ScriptAlias
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

47.             How to install and use the htdig search engine on Linux?

 
1. download htdig search engine from http://www.htdig.org/.
 
2. gunzip and unstar.
 
   ./configure; make; su; make install
 
   The above will install it in /opt/www
 
3. make sure apache (or the web server on your machine is running.)
 
4. Assume you want to create a search database for your site http://localhost/,
   then edit the file
 
   /opt/www/htdig/conf/htdig.conf  
 
   and change the base URL to what you want to build the database for.
 
5. Next, run the htdig program that builds the database (as root) do:
 
   /opt/www/htdig/bin/rundig
 
6. now copy some needed files from where htdigs got installed, to your
   web server cgi-bin and document root.  assume your web server cgi-bin is
   in /usr/local/apache/cgi-bin, and document root is /usr/local/apache/htdocs/,
   then do
 
   cp  /opt/www/cgi-bin/htsearch /usr/local/apache/cgi-bin/
   cp  -R /opt/www/htdocs/htdig  /usr/local/apache/htdocs/
 
7. NOw, do netscape http://htdig/search.html
 
The above will bring up a search html form. When you enter something, it will
invoke cgi-bin/htsearch script, which in turn will run programs in /opt/www/htdig/bin
(hardcoded path, and will access the database in /opt/www/htdig/db/*.db)
 
Now, you can edit your index.html to make a link to htdig/search.html for search on
your web page.
 
HOw to make htdig use separate databases, one for each part of the web?
------------------------------------------------------------------------
 
This is a diagram of there things go
 
 
                     /
                     +
                     |
       +--------------------------------+------------------+
       |                                |                  |   
      opt/                            cgi-bin/           document_root/
       |                               htsearch*  <----- search.html
      www/                                         calls
       |
      htdig/
       |
       |-------------+----------------+
      conf/         bin/             db/
       |             |                |
     all.conf      rundig        +----+------+
     faq.conf                    |    |      |
     sales.conf                all/  faq/   sales/
     etc...                      |    |      |
  (points to URL)              
 
 
 
Lets assume you want to build a separate database 'faq' for your 'faq' part of the web page only.
First create a faq.conf file in /opt/www/htdig/conf/, and exit the file to point the
URL you want to search, also, edit the file to point ti the database directory for this
part of the web, i.e. tell it to create the database in /opt/www/htdig/db/faq/.
 
NOw run the search, i.e. do /opt/www/htdig/bin/rundig -c /opt/www/htdig/conf/faq.conf
 
The above will create the database.
 
Now, make a specific html search FORM to use from the 'faq' web page. Make sure you
pass the CONFIG form parameter and give it the value of FAQ. Like this:
 
                <form method="get" action="/cgi-bin/htsearch">
                <font size=-1>
                Match: <select name=method>
                <input type="text" size="30" name="words" value="">
                <input type="submit" value="Search">
                <input type="hidden" name="config" value="faq">    <-----
                </form>
 
 
The above will cause the HTML to pass config=faq to the CGI htsearch program,
which in turn will make the CGI program search for a file called faq.conf
under /opt/www/htdig/conf, which will contain in it the location of the
database to search.

 

 

Next, run htmerge:
 
``Htmerge is used to create a document index and word database from the files 
that were created by htdig. These databases are then used by htsearch to 
perform the actual searched.''
 
 
/opt/www/htdig/bin/htmerge
 
Next, run htfuzzy, in /opt/www/htdig/bin/
 
 
see also,
 
    htnotify [-b database][-c configfile][-v] 
 
 
btw, you can use /opt/www/htdig/bin/rundig  as a script to do all the above, it 
will run htdig, followed by htmerge, followed by htfuzzy.
 
 
htsearch is the actual search engine of the ht://Dig search system. It is a CGI program 
that is expected to be invoked by an HTML form. It will accept both the GET and POST methods 
of passing data to the CGI program. 
 
Files used by htsearch 
 
CONFIG_DIR/htdig.conf 
    The default configuration file. 
COMMON_DIR/header.html 
    The default search results header file 
COMMON_DIR/footer.html 
    The default search results footer file 
COMMON_DIR/wrapper.html 
    The default search results wrapper file, that contains the header and footer together in one file 
COMMON_DIR/nomatch.html 
    The default 'no matches found' HTML file 
COMMON_DIR/syntax.html 
    The default file that explains boolean expression syntax errors

48.             How to restart nfs server so that it reads in /etc/exports?

 
restart mountd.
   kill -HUP `ps ax | grep mountd | awk '{print $1}' `
 
or
 
   kill -s HUP `cat /var/run/mountd.pid`
 
or
 
   killall -HUP mountd

49.             How to use hypermail to archive a netscape Inbox?

 
hypermail -d <directoy_to_put_archive_in> -m <path_to_netscape_inbox>
 
the inbox is usually in $HOME/nsmail/Inbox

50.             How to find if same email message exist in the email Inbox?

 
   grep -i '^message-id:' my.mbox | sort | uniq | wc -l
 
and 
 
    grep -i '^message-id:' my.mbox | sort | wc -l
 
If the above results in different values, then there are duplicates.

51.             What are the protocol numbers in the IP protocol field?

 
see http://www.isi.edu/in-notes/iana/assignments/protocol-numbers
 
PROTOCOL NUMBERS
 
In the Internet Protocol version 4 (IPv4) [RFC791] there is a field,
called "Protocol", to identify the next level protocol.  This is an 8
bit field.  In Internet Protocol version 6 (IPv6) [RFC1883] this field
is called the "Next Header" field.
 
Assigned Internet Protocol Numbers
 
Decimal    Keyword     Protocol                         References
-------    -------     --------                         ----------
     0     HOPOPT      IPv6 Hop-by-Hop Option            [RFC1883]
     1     ICMP        Internet Control Message           [RFC792]
     2     IGMP        Internet Group Management         [RFC1112]
     3     GGP         Gateway-to-Gateway                 [RFC823]
     4     IP          IP in IP (encapsulation)          [RFC2003]
     5     ST          Stream                     [RFC1190,IEN119]
     6     TCP         Transmission Control               [RFC793]
     7     CBT         CBT                             [Ballardie]
     8     EGP         Exterior Gateway Protocol     [RFC888,DLM1]
     9     IGP         any private interior gateway         [IANA]
                       (used by Cisco for their IGRP)
    10     BBN-RCC-MON BBN RCC Monitoring                    [SGC]
    11     NVP-II      Network Voice Protocol         [RFC741,SC3]
    12     PUP         PUP                             [PUP,XEROX]
    13     ARGUS       ARGUS                                [RWS4]
    14     EMCON       EMCON                                 [BN7]
    15     XNET        Cross Net Debugger            [IEN158,JFH2]
    16     CHAOS       Chaos                                 [NC3]
    17     UDP         User Datagram                  [RFC768,JBP]
    18     MUX         Multiplexing                    [IEN90,JBP]
    19     DCN-MEAS    DCN Measurement Subsystems           [DLM1]
    20     HMP         Host Monitoring                [RFC869,RH6]
    21     PRM         Packet Radio Measurement              [ZSU]
    22     XNS-IDP     XEROX NS IDP               [ETHERNET,XEROX]
    23     TRUNK-1     Trunk-1                              [BWB6]
    24     TRUNK-2     Trunk-2                              [BWB6]
    25     LEAF-1      Leaf-1                               [BWB6]
    26     LEAF-2      Leaf-2                               [BWB6]
    27     RDP         Reliable Data Protocol         [RFC908,RH6]
    28     IRTP        Internet Reliable Transaction  [RFC938,TXM]
    29     ISO-TP4     ISO Transport Protocol Class 4 [RFC905,RC77]
    30     NETBLT      Bulk Data Transfer Protocol    [RFC969,DDC1]
    31     MFE-NSP     MFE Network Services Protocol  [MFENET,BCH2]
    32     MERIT-INP   MERIT Internodal Protocol             [HWB]
    33     SEP         Sequential Exchange Protocol        [JC120]
    34     3PC         Third Party Connect Protocol         [SAF3]
    35     IDPR        Inter-Domain Policy Routing Protocol [MXS1] 
    36     XTP         XTP                                   [GXC]
    37     DDP         Datagram Delivery Protocol            [WXC]
    38     IDPR-CMTP   IDPR Control Message Transport Proto [MXS1]
    39     TP++        TP++ Transport Protocol               [DXF]
    40     IL          IL Transport Protocol            [Presotto]
    41     IPv6        Ipv6                              [Deering]    
    42     SDRP        Source Demand Routing Protocol       [DXE1]
    43     IPv6-Route  Routing Header for IPv6           [Deering]
    44     IPv6-Frag   Fragment Header for IPv6          [Deering]
    45     IDRP        Inter-Domain Routing Protocol   [Sue Hares]
    46     RSVP        Reservation Protocol           [Bob Braden]
    47     GRE         General Routing Encapsulation     [Tony Li]
    48     MHRP        Mobile Host Routing Protocol[David Johnson]
    49     BNA         BNA                          [Gary Salamon]
    50     ESP         Encap Security Payload for IPv6   [RFC1827]
    51     AH          Authentication Header for IPv6    [RFC1826]
    52     I-NLSP      Integrated Net Layer Security  TUBA [GLENN]
    53     SWIPE       IP with Encryption                    [JI6]
    54     NARP        NBMA Address Resolution Protocol  [RFC1735]
    55     MOBILE      IP Mobility                       [Perkins]
    56     TLSP        Transport Layer Security Protocol   [Oberg]
                       using Kryptonet key management
    57     SKIP        SKIP                              [Markson]
    58     IPv6-ICMP   ICMP for IPv6                     [RFC1883]
    59     IPv6-NoNxt  No Next Header for IPv6           [RFC1883]
    60     IPv6-Opts   Destination Options for IPv6      [RFC1883]
    61                 any host internal protocol           [IANA]
    62     CFTP        CFTP                            [CFTP,HCF2]
    63                 any local network                    [IANA]
    64     SAT-EXPAK   SATNET and Backroom EXPAK             [SHB]
    65     KRYPTOLAN   Kryptolan                            [PXL1]
    66     RVD         MIT Remote Virtual Disk Protocol      [MBG]
    67     IPPC        Internet Pluribus Packet Core         [SHB]
    68                 any distributed file system          [IANA]
    69     SAT-MON     SATNET Monitoring                     [SHB]
    70     VISA        VISA Protocol                        [GXT1]
    71     IPCV        Internet Packet Core Utility          [SHB]
    72     CPNX        Computer Protocol Network Executive  [DXM2]
    73     CPHB        Computer Protocol Heart Beat         [DXM2]
    74     WSN         Wang Span Network                     [VXD]
    75     PVP         Packet Video Protocol                 [SC3]
    76     BR-SAT-MON  Backroom SATNET Monitoring            [SHB]
    77     SUN-ND      SUN ND PROTOCOL-Temporary             [WM3]
    78     WB-MON      WIDEBAND Monitoring                   [SHB]
    79     WB-EXPAK    WIDEBAND EXPAK                        [SHB]
    80     ISO-IP      ISO Internet Protocol                 [MTR]
    81     VMTP        VMTP                                 [DRC3]
    82     SECURE-VMTP SECURE-VMTP                          [DRC3]
    83     VINES       VINES                                 [BXH]
    84     TTP         TTP                                   [JXS]
    85     NSFNET-IGP  NSFNET-IGP                            [HWB]
    86     DGP         Dissimilar Gateway Protocol     [DGP,ML109]
    87     TCF         TCF                                  [GAL5]
    88     EIGRP       EIGRP                           [CISCO,GXS]
    89     OSPFIGP     OSPFIGP                      [RFC1583,JTM4]
    90     Sprite-RPC  Sprite RPC Protocol            [SPRITE,BXW] 
    91     LARP        Locus Address Resolution Protocol     [BXH]
    92     MTP         Multicast Transport Protocol          [SXA]
    93     AX.25       AX.25 Frames                         [BK29]         
    94     IPIP        IP-within-IP Encapsulation Protocol   [JI6]
    95     MICP        Mobile Internetworking Control Pro.   [JI6]
    96     SCC-SP      Semaphore Communications Sec. Pro.    [HXH]     
    97     ETHERIP     Ethernet-within-IP Encapsulation     [RXH1]
    98     ENCAP       Encapsulation Header         [RFC1241,RXB3]
    99                 any private encryption scheme        [IANA]
   100     GMTP        GMTP                                 [RXB5]
   101     IFMP        Ipsilon Flow Management Protocol   [Hinden]
   102     PNNI        PNNI over IP                       [Callon]
   103     PIM         Protocol Independent Multicast  [Farinacci]
   104     ARIS        ARIS                              [Feldman]
   105     SCPS        SCPS                                [Durst]
   106     QNX         QNX                                [Hunter]
   107     A/N         Active Networks                    [Braden]
   108     IPComp      IP Payload Compression Protocol   [RFC2393]
   109     SNP         Sitara Networks Protocol          [Sridhar]
   110     Compaq-Peer Compaq Peer Protocol                [Volpe]
   111     IPX-in-IP   IPX in IP                             [Lee]
   112     VRRP        Virtual Router Redundancy Protocol [Hinden]
   113     PGM         PGM Reliable Transport Protocol  [Speakman]
   114                 any 0-hop protocol                   [IANA]
   115     L2TP        Layer Two Tunneling Protocol        [Aboba]
   116     DDX         D-II Data Exchange (DDX)           [Worley] 
   117     IATP      Interactive Agent Transfer Protocol  [Murphy]
   118     STP         Schedule Transfer Protocol            [JMP]
   119     SRP         SpectraLink Radio Protocol       [Hamilton]      
   120     UTI         UTI                              [Lothberg]      
   121     SMP         Simple Message Protocol            [Ekblad]
   122     SM           SM                             [Crowcroft]
   123     PTP         Performance Transparency Protocol   [Welzl]
   124     ISIS over IPv4                             [Przygienda]
   125     FIRE                                        [Partridge]
   126     CRTP         Combat Radio Transport Protocol  [Sautter]
   127     CRUDP        Combat Radio User Datagram       [Sautter]
   128     SSCOPMCE                                        [Waber]
   129     IPLT                                         [Hollbach]
   130     SPS         Secure Packet Shield             [McIntosh] 
   131     PIPE   Private IP Encapsulation within IP       [Petri]
   132     SCTP   Stream Control Transmission Protocol   [Stewart]
   133     FC     Fibre Channel                        [Rajagopal]
   134-254             Unassigned                           [IANA]
   255                 Reserved                             [IANA]

52.             How to substitute one word for another in a file from command line?

 
for x in *.txt
do
     sed -e 's/word1/longerword/g' $x >$x.new
     mv -f $x.new $x
done

53.             How to configure Netscape browser preferences for different mime types?

 
For pdf:
=========
 
   Description:
   MIME: application/acrobat
   suffix: pdf
   handled by: 
       application: acroread %s
 
   Description:
   MME: application/pdf
   suffix: pdf
   handled by: 
       application: acroread %s
 
For postscript:
================
 
   description: Postscript Document
   MIME: application/postscript
   suffix: ai,eps,ps
   handled by
       application: gv %s  <--- on linux
                    softimage %s  <---- on Solaris
 
For binaries:
==============
 
   Description:
   MIME: application/octet-stream
   suffix: bin,exe
   handled by:
        Save To DIsk
 
 
For dvi:
========
 
  description: Tex DVI Data
  MIME: application/x-dvi
  suffix: dvi
  handled by:
    application: xdvi %s   <--- on linux

54.             How to use perl to display a button?

from the net.

 
perl -MTk -e 'MainWindow->new()->Button(-text=>"Poof!",-command => sub{exit})->pack; MainLoop'

55.             How to install ext2fs on Solaris?

from the net.

 
 get lxrun  from 
 
      http://soldc.sun.com/articles/lxrun/#ext2fs
 
follow these notes I got from the net:
 
Installing ext2fs on solaris
 
  1.Untar the ext2fs tar file, and either rebuild from source (preferred) 
    or use the prebuilt binaries.
 
  2.From the right directory (SPARCTM or i386), copy the "ext2fs"
    module to /usr/kernel/fs and the "mount" binary to /usr/lib/fs/ext2fs/mount.
    The getext2fs script was run to install it on the test machines. No
    64-bit module is currently available.
 
  3.Find your Linux drive and add an entry to /etc/vfstab for it. 
    On SPARC, the entry might look like this:
 
                      /dev/dsk/c0t0d0s0 - /linux ext2fs - no ro 
 
                  On x86, it might look like this:
 
                      /dev/dsk/c0t0d0p1 - /linux ext2fs - no ro 
 
   (Use "yes" instead of "no" if you want it mounted at boot). This is 
   just for the root drive; add more if you need to
   mount other partitions.

56.             How to tell a MPEG-1 bitstream from a MPEG-2 bitstream?

 
from the net: 
 
All MPEG-2 bitstreams must have certain extension headers that immediately 
follow MPEG-1 headers. At the highest layer, for example, the MPEG-1 style 
sequence_header() is followed by sequence_extension() which is exclusive to MPEG-2. 
Some extension headers are specific to MPEG-2 profiles.For example, 
sequence_scalable_extension() is not allowed in Main Profile 
 
A simple program need only scan the coded bitstream for byte-aligned start 
codes to determine whether the stream is MPEG-1 or MPEG-2

57.             How to start xterm with large scroll buffer?

 
      xterm -fg white -bg black -sb -sl 5000

58.             How to use CVS?

 
1. Set up an empty CVS reposiroty. Suppose to you want to use
   /usr/local/cvsroot as the repository. THen do
   cvs -d /usr/local/cvsroot init
 
2. Add your directory to CVS so it will under CVS control from there on.
   Assume you have directory /home/nabbasi/proj/, do
  
  cd /home/nabbasi/proj
  cvs import -m "Imported sources" proj proj start
 
3. Remove the proj/ directory now since it was moved to CVS
   cd ..
   mv proj proj.orig
  
4. checkout proj from CVS
   cvs checkout proj
   cd proj
 
5. To add a new file foo.c into the repository then do
   cd proj
   cvs add foo.c
   cvs commit -m "new file added"  foo.c
 
6. To remove a file
   cd proj
   cvs remove foo.c
   cvs commit -m "new file added"  foo.c

59.             How to convert files from unix to mac to windows format?

 
line feed, or lf, or \n, has the value 0x0A, or 10.
carriage return, of cr, or \r, has vsalue 0X0D or 13.
 
Lines in Files created under DOS, are terminated by 
 
    cr  lf  (or \r \n).
 
you can see this, by doing
 
    od -t a dos.txt
 
where dos.txt is a file created under dos/windows.
 
Lines in files created under unix are terminated by lf only.
 
 
To convert a mac text file to a Unix text file:
=================================================
 
note, CR= \r
      LF= \n
 
mac uses CR only to terminate text file, replace with LF:
 
       cat mac_file.txt | tr \\015 \\012 > unix_file.txt
 
or
 
       cat mac_file.txt | tr \\r \\n > unix_file.txt
 
the above should translate ^M to line feed.
 
to convert a windows text file to unix text file
=================================================
 
DOS files uses CR LF, so remove the CR:
 
       cat win_file.txt | tr -d \\r > unix_file.txt 
 
 
THis program below translates a Unix file to DOS file
(could not figure how to use 'tr' to change \n to ``\r\n''
 
/* changes the argument file to a DOS format */
 
#include <stdio.h>
int main(int argc, char *argv[])
{
 
  FILE *f;
  FILE *f2;
  int c;
 
  f=fopen(argv[1],"r");
  f2=fopen("tmp","w");
 
 
  c=fgetc(f);
  while( c != -1)
  {
    if( c == '\n')
    {
      fputc('\r',f2);
      fputc('\n',f2);
    }
    else
      fputc((char )c,f2);
 
    c=fgetc(f);
  }
 
  fclose(f); fclose(f2);
}

60.             How to mount things?

 
to mount a cdrom on Linux do :
 
     mount -t iso9660 /dev/scd0 /mnt/cdrom
 
to mount a floppy formated on dos or OS/2 do (on Linux)
 
     mount /dev/fd0 /mnt/floppy -t msdos
 
to mount a floppy formated for fat16 (on linux)
 
     mount /dev/fd0 /mnt/floppy -t vfat
 
to mount jaz drive do (on linux)
 
 mount /dev/sda4 /mnt/jaz -t vfat
 
I found that it is sda4 device by reading the system log file /var/messages
 
To mount the CDROM on a Sun 4.1.* system:
% mount -r -t hsfs /dev/sr0 /cdrom
 
To mount the CDROM on a Solaris system:
% mount -r -F hsfs /dev/dsk/c0t6d0s0 /cdrom
 
To mount the CDROM on a FreeBSD or NetBSD system:
% mount -t cd9660 -r /dev/cd0a /cdrom

61.             What are the common RPM commands?

 
rpm -qp --list foo.rpm       # lists files in rpm pkg
rpm -i   pkg                 # disply pkg info
rpm -q --requires pkg.rpm    #list pakcages this package requires
rpm -q --provides pkg.rpm    #list stuff this package provides
rpm -q --list pkg.rpm        # list files in pkg
rpm -e pkg                   #removes pkg
rpm -q -file  <file>         # tells which pkg this file belongs to.
 
This command below will find rpm packages with shlibs in them:
 
rpmfind --apropos shlibs

62.             How to start and stop the network on Linux?

 
/etc/rc.d/init.d/network stop
/etc/rc.d/init.d/network start
/etc/rc.d/init.d/network restart

63.             How to find where some of gcc object files are?

 
nabbasi>gcc --print-file-name=crtbegin.o
 
/usr/lib/gcc-lib/i486-linux/egcs-2.91.66/crtbegin.o

64.             How to extract object files from a library?

 
  ar -x libc.a

65.             How to look at assembler of an object file on Linux?

 
#objdump  --disassemble open.o
 
open.o:     file format elf32-i386
Disassembly of section .text:
00000000 <__libc_open>:
   0:   53                      pushl  %ebx
   1:   8b 54 24 10             movl   0x10(%esp,1),%edx
   5:   8b 4c 24 0c             movl   0xc(%esp,1),%ecx
   9:   8b 5c 24 08             movl   0x8(%esp,1),%ebx
   d:   b8 05 00 00 00          movl   $0x5,%eax
  12:   cd 80                   int    $0x80
  14:   5b                      popl   %ebx
  15:   3d 01 f0 ff ff          cmpl   $0xfffff001,%eax
  1a:   0f 83 fc ff ff ff       jae    1c <__libc_open+0x1c>
  20:   c3                      ret

66.             How to print the symbol table of a library?

 
  nm --print-file-name  libc.a

67.             How to apply a patch file in Linux?

 
patch -p0 < patch_file
 
so you might want to use the -s flag to patch, which tells patch to only
report error messages

68.             How to debug a running process?

 
on Linux:
 
   gdb -p <process_id>
 
On Solaris, see pstack.

69.             How to find what files are open on linux?

 
use the 'lsof' command.

70.             On Linux, what to do if an application it can't see a shared library?

 
if an application complain it can not see a shared
library, edit  /etc/ld.so.conf and add the library path
to the file, then issue the command
 
ldconfig
 
as root.

71.             How do you sync your computer's clock with the National Institute of Standards and Technology through Linux?

 
get the program called rdate. install it.
 
type
 
      rdate -p -s 132.163.135.130
 
The above IP address is for the NIS. type the command as root.

72.             How do display the index.html file at some URL from command line?

 
  telnet www.sun.com 80
  GET /index.html HTTP/1.0
 
  hit couple of CR after the above line.

73.             How do download ftp or websites in batch mode from command line?

 
use wget program.
 
example of usage:
 
for a websites
 
wget --tries=0 --force-directories --level=200 --no-parent  -v --recursive --convert-links  -Dthe_domain_name http://domain
 
(make sure no trailing "/" in front, it seems to confuse wget)
 
for ftp site:
 
wget --tries=0 --force-directories --level=200 --no-parent  -S --retr-symlinks  -v --recursive --convert-links  ftp://...../
 
wget can be obtained from GNU web site.

74.             How to create bean manifest file in jar file?

 
You should create the jar WITHOUT manifest first:
jar cvf SimpleBean.jar SimpleBean.class
 
Then, extract the default Manifest:
jar xvf SimpleBean.jar META-INF
 
Then, edit the META-INF\MANIFEST.MF file and add the the needed lines, 
example
       Class Name: SimpleBean.class
       Java-Bean: True
and add it:
 
jar uvmf META-INF\MANIFEST.MF SimpleBean.jar

75.             How to start X in different depths on linux?

 
startx -- -bpp <num>
 
where <num> can be 8, 16, 24 or 32.
 
 
for XFree 4.0 use
 
startx -- -depth <num>

76.             How to clone the system disk on Solaris?

 
from the net:
 
       Hi - you need to be carefull using tar - both tar and cpio have 
       limitations. 
 
       For instance, tar won't copy special files, i.e., your devices pointers
      in /dev, and unless you explictly tell it to follow links, i.e., add the
      'h' flag, it won't follow links either.
 
       Use 'ufsdump' and pipe it into 'restore' instead.
 
(what about boot block? probably not). see man installboot

77.             How to make douple-click in X selects the whole file name?

 
to make select in X selects the whole file namem add this line to .Xdefaults
 
xterm*charClass: 33:48, 37:48, 42:48, 45-47:48, 63-64:48, 126:48

78.             How to bring down an interface, then up, on linux?

 
      ifconfig eth0 down
 
to bring it up, do
 
      ifconfig eth0 up
      route add -net 0.0.0.0 gw <your_gateway_IP> netmask 0.0.0.0

79.             How to find what is running as a module on linux?

 
nabbasi>cat /proc/modules
vmnet                  16992   3
vmmon                  18308   0 (unused)
 
or
 
 
nabbasi>modprobe -l
/lib/modules/2.4.0-test7/misc/vmmon.o
/lib/modules/2.4.0-test7/misc/vmnet.o

80.             How to start a secure shell session?

 
    ssh -l [login_name_on_remote_machine] [remote_machine]

81.             How to convert an RPM file to DEB file?

 
alien package.rpm
dpkg --install package.deb

82.             How to count lines of source code in a tree?

 
        cat `find . -name \*.c -o -name \*.h -o -name \*.java `| wc -l

83.             How to the largest sub-directory in current path?

 
du -sk * | sort -n

84.             How to find what version of redhat one is running (Linux)?

 
rpm -q redhat-release

85.             How to compile and link a simple gtk+ program?

 
gcc -o simple simple.c `gnome-config --cflags --libs gnomeui`

86.             How to cat a file, with a line number printed next to each line?

 
$cat foo.txt | grep -n ^

87.             How to find what fonts are there for X?

 
      cat /usr/lib/X11/fonts/misc/fonts.alias 
 
also look at 
 
       xlsfonts
 
then to look at any, do:
 
xfd -fn '-b&h-lucida-bold-r-normal-sans-26-190-100-100-p-166-iso8859-1'
 
as an example, this will bring up an X windw with the fonts.
 
fonts on Linux comes in files called pcf (portable compiled font data),
this file also is compressed (Z).
 
how do I use theses font in Latex?

88.             How to remove lines from a file that matches some regexp using emacs?

 
from the net:
 
> lets assume I want to remove every line in my file that
> contains the expression "|" followed by any number of characters, followed
> by the string "FOO" . the above can occur anywhere on the line.
...
> how does one remove a line from a file in emacs that match some
> reqular expression? can someone show me how using the above example?
 
I did replace-regexp
^.*|.*FOO.*C-q C-j
 
which took care of those lines. The 'C-q C-j' part means that I wanted
to quote control-j which is the newline character. Besides, you may
want to try the interactive isearch-forward-regexp, which highlights
the text that the regexp hits while you type it.
 
another answer:
From:         Aaron Gross <aaron@morannon.bfr.co.il>
Date:         1997/11/25
 
> Hello,
> 
> lets assume I want to remove every line in my file that contains the
> expression "|" followed by any number of characters, followed by the
> string "FOO" . the above can occur anywhere on the line.
 
The easiest way to do this is with delete-matching-lines, not with
regexp replace. You type M-x delete-matching-lines RETURN, then at the
prompt you type in the regular expression: |.*FOO   Look at the
documentation for delete-matching-lines for more details.
 
The "M-x" above means "Meta x", which is different on different
keyboards. On most keyboards, you would hold down the ALT key while
you press the "x" key. On other keyboards you'd have to type ESC-x.
 
> I have tried to use emacs menu, choosing the subtitute using reqular
> expression option, but it always fails to find a replacment even
> though I have many line with this expression. so I must be not doing
> it right.
 
I was able to find and replace it with the regular expression option
from the menu, so maybe you typed in the regular expression wrong?
Note that when you type in a regexp at the prompt, you don't put
quotes around it.
 
Also, note that all of the search and replace functions, plus many
other functions such as delete-matching-lines, only operate on the
part of the buffer after "point", i.e., from your "current location"
to the end of the buffer. It's possible that all the occurrences of
this regexp are before point. So if you want to operate on the whole
buffer, you'll have to move to the top first. This default behavior is
a Good Thing.
 
> how does one remove a line from a file in emacs that match some
> reqular expression? can someone show me how using the above example?
 
If you really want to use regexp replace to remove the whole line, you
can select replace regexp and type in the regexp as
 
.*|.*FOO.* C-q C-j RETURN
 
(without the spaces). The C-j (holding down the ctrl key and typing j)
is a newline. The C-q before it means that the next thing is literal;
otherwise, Emacs would have interpreted it the same as if you'd just
hit RETURN. So this regexp matches an entire line containing what you
want, including the newline. If you hit RETURN when it asks you what
to replace it with, the whole line should be deleted. But like I said,
I think delete-matching-lines is the way to go. Hope this helps.

89.             How to find what font is used by xterm?

 
#cat /usr/lib/X11/fonts/misc/fonts.alias | grep ^fixed
fixed        -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
 
note: under cygwin these are the fonts files:
 
/usr/X11R6/lib/X11/fonts/100dpi/fonts.alias
/usr/X11R6/lib/X11/fonts/75dpi/fonts.alias
/usr/X11R6/lib/X11/fonts/cyrillic/fonts.alias
/usr/X11R6/lib/X11/fonts/misc/fonts.alias

90.             How to start print daemon on linux?

 
on linux, I noticed that at netscape the print was not being printed.
I did
 
lpc> status
and found no daemon for the printer.
so I did
lpc> restart print236
where print236 is the printer name.
now, I see it printting. doing status should say sending to ...

91.             How to add tags to file using SCCS?

 
to add tags to your files automatically by SCCS, add a line like this
in the source code:
 
/*  SCCS: %Z% %M% %I% %E% %U%
 
after I do sccs delta, and sccs get, I see this:
 
/*  SCCS: @(#) s2dbMain.cc 1.4 98/02/27 22:32:15 */
 
you can also use this:
 
static char sccsid[] = "%Z% %M% %I% %E% %U%";

92.             How to access sybase database using isql?

 
isql -U user-name -P pass-word -S server-name -h host-name
>use database-name
>go
 
> 
1> select .....

93.             How to disable or enable CDE on linux?

 
linux, 11/18/97:
 
CDE will automatically startup as my default login if there is a file
called dtlogin in directory /etc/rc.d/init.d/
 
so, to diable CDE, delete this file.
 
to enable CDE run
 
/usr/dt/bin/dtconfig -e
 
to start the login server from command line:
 
/usr/dt/bin/dtlogin -daemon

94.             How to disable or enable CDE on Solaris (run with no X)?

 
from the net. not verified:
 
    As root type "dtconfig -d".   Also, type "/etc/init.d/dtlogin stop" to stop
    the currently running CDE.
 
    man dtconfig

95.             How to configure network on linux?

 
These are my notes of configuring linux to be on the network when
I was at work at the porting center. They are old, but should help
if I forget something.
 
11/15/97
 
 
my host IP is allready known, it is 205.217.236.250
the gateway is known, just replace the last number with one: 205.217.236.1
the netmask is known since class C network, so use 255.255.255.0
the network IP is known, replace last number inhost IP with zero: 205.217.236.1
the DNS name you need to know, it is for us : 205.217.234.197 and
205.217.234.198 and 205.217.236.6
 
OK, here we go, after I installed Linux I did this:
 
1. edit /etc/hosts and added my IP address and my hosts name (IBM390-8)
2. edit /etc/resolve like this:
 
[root@localhost /etc]# cat resolv.conf
#search npec.netscape.com mcom.com netscape.com
domain npec.netscape.com
nameserver 205.217.234.197
nameserver 205.217.234.198
nameserver 205.217.236.6
 
I took the "search" line off, not sure if that makes any difference.
 
3. Now, use command 'ifconfig' to see if the 'eth0' is there, this is the
interface you need to talk to the network, it was not, I did
 
ifconfig eth0 up netmask 255.255.255.0
 
3.a
 
if you leave it like this, and you see that localhost is 0.0.0.0 in ifconfig:
 
eth0      Link encap:10Mbps Ethernet  HWaddr 00:60:97:B0:7F:AD
          inet addr:0.0.0.0  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:138 errors:0 dropped:0 overruns:0
          TX packets:0 errors:0 dropped:0 overruns:0
          Interrupt:4 Base address:0xff00
 
(see that inet address is 0.0.0.0)  this is not good, if you try to ping now,
you'll get network not reachable. so , you need to tell it to use my hostname
for this interface, at work I use host name IBM390-8 (from /etc/hosts), this name
can be anything, as long as it is an entry in hosts file so that it will know the
IP address for the eth0. so I did now:
 
#ifconfig eth0 ibm390-8 netmask 255.255.255.0
 
and now when I look at ifconfig, I see:
 
eth0      Link encap:10Mbps Ethernet  HWaddr 00:60:97:B0:7F:AD
          inet addr:205.217.236.250  Bcast:205.217.236.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:168 errors:0 dropped:0 overruns:0
          TX packets:0 errors:0 dropped:0 overruns:0
          Interrupt:4 Base address:0xff00
 
much better. the eth0 interface now has an IP !
 
4. Now, this is the part that came me the hardest time, it turned out
I need to use the route command to get it right. first add the NETWORK to the
route:
 
[root@localhost /etc]#  route add -net 205.217.236.0
[root@localhost /etc]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
205.217.236.0   0.0.0.0         255.255.255.0   U     0      0        1 eth0
 
you see, the network is there, 205.217.236.0 is the IP for the network I am on, now
when you start say netscape, it seem to just sit there looking for name resolution, so
something was still missing, it was not finding the nameserver. what I had missing was
gateway, so I did this:
 
[root@localhost /etc]#  route add default gw 205.217.236.1
[root@localhost /etc]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
205.217.236.0   0.0.0.0         255.255.255.0   U     0      0        3 eth0
0.0.0.0         205.217.236.1   0.0.0.0         UG    0      0        0 eth0
 
and now things work fine ! befor this, I could only get out to the network using
IP numbers, not names.
 
Notice: DO NOT DO this below, every time I did it , linux 2.0.30 would crash !
 
#NOTICE: if the lo interface (loopback) is up, I brought down, not sure if
#that is needed, I was worried it might be confusing things, I did
 
#ifconfig lo down
 
#OK, now everything is ok.

96.             How to use find command to list directories only to some depth?

 
(linux)
 
$find . -maxdepth 1 -type d
 
for example, the above lists the name of the directories in the current directory only.
 
For solaris, to list directories only in current directory do
 
ls -lF | grep /

97.             How to login to Solaris if you lost the root password?

 
obtained from the net, by Nick Smith:
 
If you have got a CD-ROM attached to the machine and you have a screen and
keyboard then your OK. Type 'Stop-A' on the Sun keyboard to shutdown the
machine after waiting for disk traffic to stop etc.  You should now see
the 'ok>' prompt.
 
At this prompt with the Solaris CD in the drive type
 
ok> boot cdrom
 
It should start Openwindows and the installation procedure.  When said procedure
starts asking questions start a command tool as you would normally under Openwindows.
From there here you can mount the root partition of your disk and remove the
password from
'/etc/shadow'.  I.e.
 
# mount /dev/dsk/c0t0d0s0 /mnt  <- Partition maybe c0t3d0s0 I think.
# vi /mnt/etc/shadow
# shutdown -i6 -g0 -y

98.             How to append the date to a file name?

 
nabbasi>echo "foo" >>  'file1.'`date +%d%m%y`
 
ls
 
-rw-r--r--    1 nabbasi  users           4 Nov 22 23:10 file1.221100

99.             How to print to remote printer from Linux?

 
11/25/97
 
At work, I needed to print on a network printer,
the printer was a host by itelf, it has host name:
 
printer236.npec.netscape.com
 
add printer in the file /etc/printcap, add this:
 
##PRINTTOOL3## REMOTE ljet4 600x600 letter {} LaserJet4 Default 1
print236:\
        :sd=/var/spool/lpd/print236:\
        :mx#0:\
        :sh:\
        :rm=print236.npec.netscape.com:\
        :rp=lpr:\
        :if=/var/spool/lpd/print236/filter:
 
 
the 'rp' is the name of the remote print queue.
 
now, to print to this printer simply do:
 
$ lpr -Pprint236  file_name
 
that is it.
 
note:
=====
 
while trying to print, I was playing with /etc/printcap for lp0 printer
(remote) and suddenly I could not print, was getting this:
 
lp0:
        queuing is enabled
        printing is enabled
        no entries
        waiting for lp0 to become ready (offline ?)
 
even though the printer itself was OK.
 
so, I used the 'lpc' command and did 'restart lp0' , then
'start lp0' , then typed 'status' and saw :
 
lp0:
        queuing is enabled
        printing is enabled
        no entries
        no daemon present
 
now, I went and did
 
lpr -Plp0 foo.txt
and it printed !

100.        How to search name of tunables in solaris kernel libraries?

 
example:
/usr/ccs/bin/nm /kernel/sys/shmsys | grep shminfo
 
[60]    |         0|       0|NOTY |GLOB |0    |UNDEF  |shminfo
[71]    |         0|       4|OBJT |GLOB |0    |2      |shminfo_shmmax
[68]    |         4|       4|OBJT |GLOB |0    |2      |shminfo_shmmin
[93]    |         8|       4|OBJT |GLOB |0    |2      |shminfo_shmmni
[69]    |        12|       4|OBJT |GLOB |0    |2      |shminfo_shmseg

101.        How to prevent DNS lookup in Solaris?

 
look at /etc/nsswitch

102.        How to find what NFS version is used?

 
look at 'nfsstat -m'
 
also try
    rpcinfo -p <server> | grep nfs

103.        How to find total size of selected files?

 
this find the total size of all *.txt files:
 
     ls -l *.txt | awk '{s+=$5} END {print s}'
 
$5 means the fifth column. do an 'ls -l' and find what column
the file size is printed at. change if needed.

104.        How to find limits of a process?

 
man limit.
To change limits, use 'ulimit'

105.        How to add swap space on Solaris?

 
From: Nasser Abbasi <nasser@paralysys>
Subject: Re: how to add swap space on your system
 
These are the complete steps to add more swap space.
 
1. become a super user.
2. you can find what swap space files you allready have by doing:
   $ swap -l
   this will list the file and space on them etc..
3. to add more swap files you can do this, first find a partition
   on your disk with enough spaces, you can put the file anywhere
   you want. do df -k to find out how much disk you have. suppose
   you decided to put it in /usr, then do
   $cd /usr
   $mkfile -v -100m  SWAP_FILE
   in the above, we asked to create a dynamic extention swap file
   up to 100 MB called SWAP_FILE. now the next step is to make it
   a swap file:
   $swap -a /tmp/SWAP_FILE
 
   This will create an additional swap file. if you now do
   $swap -l you should see it listed.
 
   ps. The swap -a command can sometimes fail with error:
 
   .. may contain holes - can't swap on it.
      : Error 0
 
   If you get this error, please let me know, I'll look
   more into it, it might be that the disk is too fragmented
   or something like this.
 
4. Make the swap space file peremnant by adding an entry in the
   /etc/vfstab file. This way if you reboot your machine, the
   swap file is still known to the system and wil show up when
   doing sawp -l .
 
   Assume that the swap file name is /usr/extra_swap , then add this
   line into the end of the /etc/vfstab file:
 
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
/usr/extra_swap         -       -                swap   -       no      -

106.        How to find what patches are installed on Solaris?

 
look at 
 
    /var/sadm/patch

107.        How to find what dynamic libraries are linked to an executable?

 
    ldd <pgm>

108.        How to look at dynamic section information on Solaris?

 
  dump -Lv <pgm>

109.        How to format a floppy on Solaris?

 
Without volum manager:
 
su
/etc/init.d/volmgt stop
fdformat -H -e /dev/rdiskette
(the above is for 1.44 MB)
 
With volum manager:
 
su
!start the volumen manager if not up
   /etc/init.d/volmgt start
   volcheck
   fdformat -H -e /vol/dev/aliases/floppy0
(the above for 1.44 MB)
 
(NOTICE: if the device is mounted, then use the -U option:
     fdformat -H -U -e /vol/dev/aliases/floppy0
 
the above says to Unmount it first if it is mounted.
 
to format a floopy (MS-DOS) media do:
 
     fdformat -t dos -H /vol/dev/aliases/floppy0
 
(the above command assumes the floopy is not mounted, if it is
add -U to the options). The above command for 1.44 MB floopy.

110.        How to insert a page break in emacs?

 
^Q ^L

111.        How to use SCCS?

 
first create an SCCS directory, or have a sumbolic link to on.
now, in the same directory where SCCS is, to RESERVE out a file do:
 
$sccs edit foo.c
 
to put it back, i.e. REPLACE do
 
$sccs delta foo.c
 
to fetch a file do
$sccs get foo.c
 
This will allow other to RESERVE it.
 
to find what files are RESERVED out do:
 
$sccs check
 
to look at history of one file foo  do:
 
sccs prt SCCS/s.foo
 
To get a specific version out , after the above command do:
 
sccs get -r2.9 Makefile
 
as an example, where 2.9 is the SID you want
 
or, you can checkout the version you want stright out:
sccs edit -r1.9 Makefile.solaris
 
if you get an error from sccs "... can;t be sccs gotten", then
just do a touch on the file you have in your directory.

112.        How to find default printer on Solaris?

    
  lpstat -d
 
also you can
 
cat /etc/lp/default

113.        How to send email from command line?

 
$ mailx -s "subject" foo@boo.com  < message.txt

114.        How to find what ports are used on the host?

 
netstat -a

115.        How to find what process is using which files and ports?

 
on Solaris and Linux, use 'lsof'. For Solaris, get the lsof
package from freeware web site and install it.
 
To find which process is using port 161 for example, do
 
lsof | grep 161
 
Also, for Solaris 8+, you can use /usr/proc/bin/pfiles

116.        How to start SNMP trap daemon on Solaris?

 
(this is started when Solaris boots):
 
ps -eaf | grep snmp
    root   452     1  0 09:28:47 ?        0:00 /usr/lib/snmp/snmpdx -y -c /etc/snmp/conf
    root   462     1  0 09:28:50 ?        0:00 /usr/lib/dmi/snmpXdmid -s dvd
 
To see when snmp reads pkts on port 161 (i.e. an alert is send), start
it with '-d 4'
 
SunOS>/usr/lib/snmp/snmpdx -d 4 -c /etc/snmp/conf
Local IP Addresss : 190.190.190.1
SUBTREES:
        1.3.6.1.4.1.42.2.15            1 1 relay-agent                    161 1
AGENTS:
        44128 relay-agent                    localhost.161                  900000000        1        3        0 0
MANAGERS:
---------
*                              0
        COMMUNITIES(READ_WRITE):  private public
#EFILTER:
TRAP RECIPIENTS:
-----------------
Waiting for incoming SNMP requests on UDP port 161
SESSIONS:
---------
NUMBER OF SESSIONS: 0
SESSIONS:
---------
NUMBER OF SESSIONS: 0

117.        How to detect when filesystem size reaches some threshold?

 
Title: Re: program to check filesystem sizes 
Author: Tor Slettnes <tor@slett.net>
Date: Sat, 25 Nov 2000 09:02:47 GMT
 
>>>>> "Lloyd" == Lloyd Goodman <l.goodman@kitbag.com> writes:
 
    Lloyd> Has any one out there written a script I can scrounge thats
    Lloyd> checks file system usage against some predefined limits and
    Lloyd> will email the sys admin if any of the limits are exceeded?
 
 
Here.  Slightly modified from a HP-UX version, but it should work.
 
------------------------------------------------------------------------
#!/usr/bin/nawk -f 
######################################################################## 
### FILE:       fscheck 
### PURPOSE:    Check filesystem usage, mail root if overruns 
######################################################################## 
 
BEGIN { 
    ### Warning thresholds for various filesystems 
    max["/export/data"] = 95; 
    max["/export"]      = 80; 
    defaultmax          = 20; 
 
    pager = "pagernumber@pagergateway.com"; 
 
    cmd = "df -k"; 
    cmd | getline; 
    while (cmd | getline > 0) 
    { 
        percentage = int($5); 
        currentmax = max[$6] ? max[$6] : defaultmax; 
 
        if (percentage > currentmax) 
            system("echo '<hostname>: " $6 " is " $5 " full' | mailx " pager); 
    } 
    close(cmd); 
} 
 
another answer:
===============
 
Ed F. de Guzman <efguzman@kodak.com> wrote:
 
> Might want to take a look at the following script:
 
> #!/bin/sh
> # Disk usage program
> #
> rm -f /bin/diskuse.txt
> users=`ls -1 /export/home`
> limit=10000 # space limit in mega bytes - change according to your limit
> for user in $users
> do
>        diskuse=`du -s /export/home/$user | awk '{ print $1 }' -`
>        if [ $diskuse -gt $limit ]
>        then
>                echo $user >> /bin/diskuse.txt
>        fi
> done

118.        How to copy large file system from one host to another?

 
Title: Re: file transfer 
Author: Jefferson Ogata <ogata@antibozo-u-spam-u-die.net>
Date: Sat, 25 Nov 2000 14:20:50 -0500
 
"James R. Gillespie" wrote:
> Cliff Chen wrote:
> 
> > Can someone advise me the fastest way to copy a file system from
> > one server to another ? The du command shows it is approx. 10G
> > including all sub directories. Both servers are Sun E250 running
> > Solaris 2.6.
> >
> > Thanks, Cliff
> 
> mount remotehost:/<receive_filesystem> /mnt
> cd /mnt
> ufsdump 0f - <local_filesystem>|ufsrestore rf -
 
NFS will be significantly slower than a straight ufsdump over an ssh/rsh
pipe, especially if you are writing to the NFS filesystem, rather than
reading from it.
 
oldhost# ufsdump 0f - /send_fs | ssh -o Compression=no root@newhost "cd /recv_fs && ufsrestore rf -"
 
You might need to stick a dd in from of the ufsrestore to collect input into
blocks so it doesn't get any partial reads. Obviously you'll have to set up
ssh. If you have a slow network connection and/or plenty of CPU, eliminate
the Compression=no option and ssh will gzip-compress the traffic on the fly
for better throughput.
 
If you don't have ssh, you can use rsh, but it's a deeply insecure protocol.
 
If you wish to use tar rather than ufsdump/ufsrestore, be sure you're using
a large-file-aware version, since you're dealing with a 10GB file system.
 
-- 
Jefferson Ogata : Internetworker, Antibozo
<ogata@antibozo-u-spam-u-die.net>  http://www.antibozo.net/ogata/
whois: jo317@whois.networksolutions.com

119.        How to execute a remote script and check for its final status?

 
Title: Re: Remote Script Execution 
Author: "James R. Gillespie" <jgilles5@mediaone.net>
Date: Sat, 25 Nov 2000 16:10:39 GMT
 
I would break the execution of the script up into sub-routines, and echo the
return code to a log file, then from the machine where you executed the script
from, you can check the log file for the returncodes. Here is a small example,
where Master is the server you are running the script from and Client is the
host you are running the script on.
 
Master # rsh Client /var/tmp/script
Sat Nov 25 11:02:52 EST 2000
Master # rsh Client cat /var/tmp/Client.log
date command executed with a return code of 0
Master # rsh Client cat /var/tmp/script
#!/bin/ksh
 
# Demo script
 
# This section sets up the log file
LOG=/var/tmp/`uname -n`.log
if [ -f "$LOG" ];then
        cp /dev/null $LOG
fi
 
# This is the first command routine
date
RESULT="$?"
echo "date command executed with a return code of $RESULT" >> $LOG
 
# Put more routines here
 
Master #

120.        How do netscape plugins work?

 
from http://developer.netscape.com/docs/manuals/communicator/plugin/basic.htm#1005540
 
When Communicator starts up, it checks for plug-in modules in the plug-ins directory for
the platform: 
 
    MS Windows: plugins subdirectory, in the same directory as the Communicator
    application. 
 
    Mac OS: Plug-ins folder. A Mac OS plug-in can reside in a different directory if you
    install a Macintosh alias that links to the plug-in in the Plug-ins folder. 
 
    Unix: usr/local/lib/netscape/plugins or
    $HOME/.netscape/plugins. If you want to use a different directory, set the
    NPX_PLUGIN_PATH environment variable to its filepath, for example,
    $HOME/yourplugins:/usr/local/lib/netscape/plugins.
    Communicator searches any directory that this variable specifies. The local user
    location, if it exists, overrides the network location. 
 
When the user opens a page that contains embedded data of a media type that invokes a
plug-in, Communicator responds with the following sequence of actions: 
 
    check for a plug-in with a matching MIME type 
 
    load the plug-in code into memory 
 
    initialize the plug-in 
 
    create a new instance of the plug-in 
 
Communicator can load multiple instances of the same plug-in on a single page, or in several
open windows at the same time. 
 
When the user leaves the page or closes the window, the plug-in instance is deleted. When
the last instance of a plug-in is deleted, the plug-in code is unloaded from memory. A
plug-in consumes no resources other than disk space when it is not loaded. The next section,
"Understanding the Runtime Model," describes these stages in more detail. 
 
HTML Tags for Plug-in Display
 
A plug-in runs in an HTML page in a Communicator window. The HTML author uses the
HTML EMBED and OBJECT tags to invoke the plug-in and control its display. 
 
    EMBED: Display the plug-in as part of the HTML document in a rectangular area of
    the page. 
 
    OBJECT: Embed a variety of object types, including, but not limited to, plug-ins, Java
    components, ActiveX controls, applets, and images in an HTML page.

121.        How to restart inted after making changes to inted.conf?

 
pkill -HUP inted

122.        How to turn off IP forwarding in Solaris?

 
ndd -set /dev/ip ip_forwarding 0

123.        How to turn on IP forwarding in Solaris on specific interface?

 
ndd -set /dev/ip qfe0:ip_forwarding 1

124.        How to stop nfs and sendmail on Solaris?

 
/etc/init.d/nfs.server stop
/etc/init.d/sendmail stop

125.        How to install new disk and mount it on Solaris?

 
after physcially installing the disk, do
 
#touch /reconfigure
#init 6
 
To find what disks you know have do
 
#format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <Seagate Medalist 34342A cyl 8892 alt 2 hd 15 sec 63>
          /pci@1f,0/pci@1,1/ide@3/dad@0,0
       1. c0t2d0 <Maxtor 92720U8 cyl 52753 alt 2 hd 16 sec 63>
          /pci@1f,0/pci@1,1/ide@3/dad@2,0
Specify disk (enter its number): 
 
assume your new disk is disk 1 above c0t2s0. select it, and partion it, and save changes
and exit format.assume the slice you used in patition table is 2, 
 
make file system  (use mkfs).
 
then mount it as
 
mount /dev/dsk/c0t2d0s2 /export/b

126.        How to extract tar content that has /net/... files on Solaris?

 
on Solaris /net is a special directory used by automountd. if
you try to 'tar xf foo.tar' into /net, it will not work. one way 
is to 'mv /net /net.old' and then extract the tar, then move the content 
somewhere else, then recreate /net.

127.        How to copy trees from one file system to another?

 
assume you want to copy /a/from/...  to /b
 
cd a
tar cpf - from | (cd /b; tar xpf -)
 
this will create /b/from/....

128.        How to tar and gzip a tree to some location?

 
tar cpf - /from | ( gzip - > file.gz )

129.        What is the difference between DER and BER encoding ?

 
from the net:
 
   Derek Atkins (warlord@mit.edu)
  
   There is a difference. With Basic Encoding Rules (BER), you have many
   many ways to encode a single object in binary (or octet) form. For
   example, if you have a list of object, you can order them in any way
   you like, and the encoding is correct.
   Distinguished Encoding Rules (DER), on the other hand, sets a single
   method of coding any one ASN.1 object. DER is a subset of BER, i.e.,
   any object encoded using DER can be read using BER, but not the other
   way around.
   IMHO, If you are doing ASN.1 coding, you should encode using DER, but
   decode using BER, just to be safe.
   Does this help?
        -derek
        Derek Atkins, SB '93 MIT EE, G MIT Media Laboratory
        Member, MIT Student Information Processing Board (SIPB)

130.        How to remove comments line from an Ada program ?

 
 from the net, by Dan Eilers:
 
#!/usr/bin/perl
 
while (<>) {
  s/^\s*--.*\n//;                        # remove lines with only comments
 
  while ($_ ne '') {
    print $1 if s/^(\'.\')//;            # character literals
    print $1 if s/^(\"[^\"]*\")//;       # quoted string
    print $1 if s/^(\%[^\%]*\%)//;       # % signs as quotes
 
    s/^--.*//;                           # delete comments
 
    print $1 if s/^([^\"\%\-\']+|.)//;   # skip anything else
  }
}

131.        How to disable and enable CDE on Linux?

 
linux, 11/18/97:
 
CDE will automatically startup as my default login if there is a file
called dtlogin in directory /etc/rc.d/init.d/
 
so, to diable CDE, delete this file.
 
to enable CDE run 
 
/usr/dt/bin/dtconfig -e
 
to start the login server from command line:
 
/usr/dt/bin/dtlogin -daemon

132.        How to find what search paths is set for gcc ?

 
 gcc -print-search-dirs

133.        How to use pax to tar files from IBM OS390 to ascii machine ?

 
On the IBM computer do:
 
pax -wf tar_file_name.tar -o from=IBM-1047,to=ISO8859-1  file_or_directory_to_tar
 
now ftp to ascii machine, and with binary mode send it.
 
on ascii machine, do:
 
tar xvf tar_file_name.tar

134.        How to use indent program ?

 
#echo ``-bacc -bad -bl -di5 -nei -i4 -nce'' > $HOME/.indent.pro
#indent original.c new.c

135.        How to find information about RPC registered programs ?

 
man rpcinfo
 
for example, to find all RPC registered programs on local host do
 
nabbasi> rpcinfo -p localhost
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp    685  status
    100024    1   tcp    687  status
    100029    1   udp    723  keyserv
    100029    2   udp    723  keyserv

136.        How to rename files using sed from command line?

 
suppose you want to rename all *.HTM files to *.html, do
 
$ for i in *.HTM
do
mv $i `echo $i | sed "s/HTM/html/"`
done

137.        How to capture all commands and output of a session into a file?

 
man script

138.        How to remove a directory from being NFS mounted?

 
Assume /usr/local/ is NFS mounted on another machine, and you
do not want it to be NFS mounted any more. 
 
edit /etc/auto_master 
and make it -null, but make sure it is the first line, before the + line.
 
(now restart something? not sure what. just reboot when in doubt.)

139.        How to set the clock on HPUX?

 
# date -u 111919091999
Fri Nov 19 19:09:00 UTC 1999
 
make sure you set the env. variable TZ to the correct value. for 
example, in the above, the TZ was
 
# echo $TZ
US/Pacific

140.        How to print using enscript?

 
an example is:
 
enscript -fCourier6 -PPrinter-name  file.txt

141.        How to find the version of glibc on a Linux box?

 
one way: (Author: kimoto@lightlink.com (Paul Kimoto)
-----------------------------------------------------
 
First the library itself:
 
nabbasi>ls -l /lib/libc.so*
lrwxrwxrwx    1 root     root           13 Mar 19  2000 /lib/libc.so.4 -> libc.so.4.7.6
-rwxr-xr-x    1 root     root       634880 Apr 29  1996 /lib/libc.so.4.7.6
-rwxr-xr-x    1 root     root      4223971 Nov  6  1999 /lib/libc.so.6
 
so, from above we see that /lib/libc.so.6 is the current library. To find what
version it is, run it !
 
nabbasi>/lib/libc.so.6
GNU C Library stable release version 2.1.2, by Roland McGrath et al.     <----- Here is the version.
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
Compiled on a Linux 2.2.13 system on 1999-11-06.
Available extensions:
        GNU libio by Per Bothner
        crypt add-on version 2.1 by Michael Glad and others
        linuxthreads-0.8 by Xavier Leroy
        NoVersion patch for broken glibc 2.0 binaries
        BIND-4.9.7-REL
        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
        NSS V1 modules 2.0.2 by Thorsten Kukuk
Report bugs using the `glibcbug' script to <bugs@gnu.org>.
 
 
Another way is to use objdump (Author: John Reiser <jreiser@BitWagon.com>)
---------------------------------------------------------------------------
 
nabbasi>objdump --private-headers /lib/libc.so.6
/lib/libc.so.6:     file format elf32-i386
Program Header:
    PHDR off    0x00000034 vaddr 0x00000034 paddr 0x00000034 align 2**2
         filesz 0x000000a0 memsz 0x000000a0 flags r-x
  INTERP off    0x000f27fe vaddr 0x000f27fe paddr 0x000f27fe align 2**0
         filesz 0x00000013 memsz 0x00000013 flags r--
    LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
         filesz 0x000f2811 memsz 0x000f2811 flags r-x
    LOAD off    0x000f2820 vaddr 0x000f3820 paddr 0x000f3820 align 2**12
         filesz 0x00003358 memsz 0x00006e1c flags rw-
 DYNAMIC off    0x000f5ac0 vaddr 0x000f6ac0 paddr 0x000f6ac0 align 2**2
         filesz 0x000000b8 memsz 0x000000b8 flags rw-
Dynamic Section:
  NEEDED      ld-linux.so.2
  SONAME      libc.so.6
  INIT        0x18170
  FINI        0xe68b0
  HASH        0xd4
  STRTAB      0x9a64
  SYMTAB      0x2c74
  STRSZ       0x7a48
  SYMENT      0x10
  PLTGOT      0xf5ff8
  PLTRELSZ    0xe58
  PLTREL      0x11
  JMPREL      0x15574
  REL         0x1237c
  RELSZ       0x31f8
  RELENT      0x8
  TEXTREL     0x0
  VERDEF      0x12298
  VERDEFNUM   0x5
  VERNEED     0x1233c
  VERNEEDNUM  0x1
  VERSYM      0x114d8
Version definitions:
1 0x01 0x0865f4e6 libc.so.6
2 0x00 0x0d696910 GLIBC_2.0
3 0x00 0x0d696911 GLIBC_2.1
        GLIBC_2.0
4 0x00 0x09691f71 GLIBC_2.1.1
        GLIBC_2.1
5 0x00 0x09691f72 GLIBC_2.1.2   
        GLIBC_2.1.1                  <---- this is the version
Version References:
  required from ld-linux.so.2:
    0x09691f71 0x00 08 GLIBC_2.1.1
    0x0d696911 0x00 07 GLIBC_2.1
    0x0d696910 0x00 06 GLIBC_2.0

142.        How to change tcp/ip setting on Linux?

 
On Linux, tcp/ip settings are available in  /proc/sys/net/ipv4
 
for example, to find the value of one paramters, do
 
nabbasi>cat /proc/sys/net/ipv4/tcp_abort_on_overflow
0
 
To set it, do
 
echo 1 > /proc/sys/net/ipv4/tcp_abort_on_overflow
 
(must be root).
Do I need to restart the net after I do this??

143.        Why can't one use floating point math in Linux kernel?

 
becuase floating point is implemented in libm.so, which is
a user space only library. Linux kernel does not link to libm.so
(since some HW might not have floating point instructions, which
will make linux kernel not portable to those processors.

144.        How to add a new system call in Linux?

 
credit: Macro <martycsh@pchome.com.tw>
Date: Sun, 26 Nov 2000 04:15:23 +0800
 
First, search for the include file: /usr/include/asm/unistd.h and add
the following:
 
#define __NR_test 191
 
under the line
 
#define __NR_vfork 190
 
Then add the following line to /usr/include/bits/syscall.h
 
#define SYS_test __NR_test
 
After that, search for the source file: /usr/src/linux/kernel/sys.c and
add a function as following:
 
asmlinkage int sys_test(int a)
{
        return a*2;
}
 
Note that this function is just a test, and it will return twice of the
input value (int a). Now, it comes to a difficult step, goto a
source file: /usr/src/linux/arch/i386/kernel/entry.S Search for the last
few lines, it should be like this:
 
        .long SYMBOL_NAME(sys_sigaltstack)
        .long SYMBOL_NAME(sys_sendfile)
        .long SYMBOL_NAME(sys_ni_syscall)       /* streams1 */
        .long SYMBOL_NAME(sys_ni_syscall)       /* streams2 */
        .long SYMBOL_NAME(sys_vfork)    /* 190 */
 
        .rept NR_syscalls-190
                .long SUMBOL_NAME(sys_ni_syscall)
        .endr
 
Right, you should change the code to:
 
        .long SYMBOL_NAME(sys_sigaltstack)
        .long SYMBOL_NAME(sys_sendfile)
        .long SYMBOL_NAME(sys_ni_syscall)       /* streams1 */
        .long SYMBOL_NAME(sys_ni_syscall)       /* streams2 */
        .long SYMBOL_NAME(sys_vfork)    /* 190 */
        .long SYMBOL_NAME(sys_test)
 
        .rept NR_syscalls-191
                .long SUMBOL_NAME(sys_ni_syscall)
        .endr
 
 
Another thing need to note is the last few lines, it defines the remaining
space for the system call symbol table. NR_syscalls is the
maximum system call. Therefore, to fill up the remaining space of the
table, we need to modify the last few lines to
 
        .rept NR_syscalls-191
                .long SYMBOL_NAME(sys_ni_syscall)
        .endr

145.        How to start NFS on Solaris?

 
/etc/init.d/nfs.server start
 
before running you should have the path of resources you want to share
in /etc/dfs/dfstab
 
to start NFS when system reboot automaticlly, need a startup script in
/etc/rc2.d or /etc/rc3.d (scripts that start with S).

146.        How to find what is the device name for CDROM to mount on Linux?

 
you can check in the file /va/log/boot.msg
 
Look for something like this:
 
 <4>Detected scsi CD-ROM sr0 at scsi1, channel 0, id 0, lun 0
 <4>scsi : detected 1 SCSI cdrom total.
 <4>sr0: scsi3-mmc drive: 32x/32x writer cd/rw xa/form2 cdda tray
 
NOtice above, it says 'sr0'.  So, the command to mount cdrom in this
case on linux is
 
mount -r -t iso9660 /dev/sr0 /mnt
 
You can also verify this way. 
 
ls -l /dev/sr0
brw-r-----    1 root     disk      11,   0 Nov  8  1999 /dev/sr0
 
root>cdrecord -scanbus
Cdrecord release 1.8a30 Copyright (C) 1995-1999 Jörg Schilling
Using libscg version 'schily-0.1'
scsibus1:
        1,0,0   100) '        ' 'CD-R/RW RW7083A ' '1.10' Removable CD-ROM
        1,1,0   101) *
        1,2,0   102) *
        1,3,0   103) *
        1,4,0   104) *
        1,5,0   105) *
        1,6,0   106) *
        1,7,0   107) *
root>

147.        How to find what web server is running on a web site?

 
lets say you want to find the web server running on www.sun.com, so
 
       #telnet www.sun.com 80
       CR
 
 
(CR above is a carriage return, i.e. empty line. (this is becuase
HTTP request must end with a blank line. (to separate it from any
data that can follow the header).
 
So, the above is an ivalid HTTP header, you should see an HTTP message
come back with an error. the message will contain the web server version:
 
nabbasi>telnet www.sun.com 80
Trying 192.18.97.241...
Connected to www.sun.com.
Escape character is '^]'.
HTTP/1.1 400 Bad Request
Server: Netscape-Enterprise/3.6
Your browser sent a message this server could not understand.Connection closed by foreign host.
nabbasi>
 
You see in the above, the server is Netscape web server.

148.        How to download the main web page of a site from command line?

 
lets say want to download the sun web page. do
 
       ------------------------------------
       #telnet www.sun.com 80
       GET /  HTTP/1.0
 
       -----------------------------------
 
i.e. remember to hit carriage return to end the HTTP request.

149.        How to download Sun web page style sheet?

 
telnet www.sun.com 80
GET /template/sunstyle.css HTTP/1.0

150.        How to boot Solaris in 32 bit mode?

 
Jan 3, 2001
 
(thanks to Kevin Song for this).
 
Assume you are running 64 bit solaris and want to boot it in 32 bit. do
 
#init 0
 
at the boot prompt, type
 
boot -D kernel/unix

151.        How to change the IP address of an interface on Linux?

 
as root
 
#ifconfig eth0  <new_ip>

152.        How to find resolution and number of colors used by X?

xdpyinfo

153.        How to find disk and terminal IO statistics on Solaris?

man iostat

The iostat utility iteratively reports terminal, disk, and tape I/O activity, as well as CPU utilization.

154.        How to find/monitor system activity on Solaris?

man sar

155.        How to find how much physical memory and monitor memory on Solaris?

man vmstat

also try

/usr/platform/sun4u/sbin/prtdiag [ -v ]

or dmesg | grep mem

try 'memconf', a very useful script available at http://netnow.micron.net/ tschmidt/unix.html

156.        apropos gives error /usr/share/man/windex: No such file or directory on Solaris, why?

You need to create the windex database.

To do that, run the command catman

157.        On Linux, How to exit X to CLI and then back to X without killing X?

 
Assume you need to kill netscape browser which has hanged your desktop. do
 
CTRL-ALT-F2 to a CLI, then "killall -9 netscape" and then 
CTRL-ALT-F7 to return to X.

158.        On Linux, How to switch between Xterms using keyboard ?

ALT-TAB

159.        What files are used on Linux to setup network?

 
on linux, to config an interface:
 
 root# ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
 
next, add a route to your network
 
root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0
 
next, add a route to default networks (everything other than your
network)
 
root# route add default gw 192.168.1.1 eth0
 
                
So, your complete configuration would look like:
 
         root# ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up
         root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0
         root# route add default gw 192.168.1.1 eth0
 
 
       
/etc/resolv.conf  is used to set the name server. example:
 
         domain maths.wu.edu.au
         search maths.wu.edu.au wu.edu.au
         nameserver 192.168.10.1
         nameserver 192.168.12.1
 
 
/etc/host.conf
 
The /etc/host.conf file is where you configure some items that 
govern the behaviour of the name resolver code. The format of this file is
described in detail in the `resolv+' man page. In nearly all circumstances 
the following example will work for you:
 
                           
         order hosts,bind                                          
         multi on  
         
This configuration tells the name resolver to check the /etc/hosts file 
before attempting to query a nameserver and to return all valid
addresses for a host found in the /etc/hosts file instead of just the first.
 
 
/etc/hosts  same as on solaris.
 
/etc/services. same as on solaris
 
/etc/inetd.conf
 
The /etc/inetd.conf file is the configuration file for the inetd server 
daemon. Its function is to tell inetd what to do when it receives a
connection request for a particular service. For each service that you 
wish to accept connections for you must tell inetd what network server
daemon to run and how to run it.
 
/etc/protocols
 
The /etc/protocols file is a database that maps protocol id numbers 
against protocol names. 
 
 
/etc/networks
 
The /etc/networks file has a similar function to that of the 
/etc/hosts file. It provides a simple database of network names against
network addresses. Its format differs in that there may be only two fields 
per line and that the fields are coded as:
 
   networkname networkaddress
   
An example might look like:
 
         loopnet    127.0.0.0
         localnet   192.168.0.0
         amprnet    44.0.0.0
 
When you use commands like the route command, if a destination is a network 
and that network has an entry in the /etc/networks file then
the route command will display that network name instead of its address.
 
 
/etc/ftpusers
 
The /etc/ftpusers file is a simple mechanism that allows you to deny 
certain users from logging into your machine via ftp. The
/etc/ftpusers file is read by the ftp daemon program (ftpd) when an 
incoming ftp connection is received. The file is a simple list of those
users who are disallowed from logging in. It might looks something like:
 
         # /etc/ftpusers - users not allowed to login via ftp
         root
         uucp
         bin
         mail

160.        how to change color depth when starting gnome using GDM?

 
030101
 
From the net, did not verify:
 
   In /etc/X11/gdm/gdm.conf, look at the bottom for a [servers] section.
   Mine reads like this:
 
   [servers]
   0=/usr/bin/X11/X :0 -bpp 32 -dpi 100
 
   You can omit the '-dpi 100', that's just there because of my monitor. These
   lines give, for each display server number, the command used to start the
   X server on it.

161.        how to set an environment variable for a CGI?

 
030101
 
from the net. did not verify:
 
    Your http server can usually set this variable for you.
    If you're using apache or a similar daemon, the SetEnv directive will do.
 
    From the apache doc:
 
    SetEnv directive
 
    Syntax: SetEnv variable value
    Context: server config, virtual host
    Status: Base
    Module: mod_env
    Compatibility: SetEnv is only available in Apache 1.1 and later.
 
    Sets an environment variable, which is then passed on to CGI scripts. 
    Example: 
 
    SetEnv SPECIAL_PATH /foo/bin

162.        how to start SAMBA automatically on Solaris?

 
030101
 
From the net. did not verify:
 
"Tim Watkins" <tim.watkins@analog.com> writes:
 
> "Neil Guinto" <neil_guinto@relinc.com> wrote in message
> news:BVJ06.1845$XY5.21421@insync...
> > Great! I can see my SAMBA server on my private windows network.  Only
> > problem now is I had to manually start SAMBA at the command line using:
> >
> > # /etc/rc.d/init.d/smb start
> >
> > How do I set it up automatically at startup?  Appreciate any help.
> 
> Put a symlink in your rc3.d or equivelent (or rc5.d if you boot into X)
> with a capital S as the first character.
> 
> eg.. in your rcx.d dir type this.
> 
> ln -s /etc/rc.d/init.d/smb S60Samba
> 
> Then it will execute on startup.  The number (60) next to the 'S' sets the
> order in which things start up.  You'll also want to put another sysmlink in
> the same directory with the first letter being 'K'.  This is the shutdown
> command.
 
Or, you can use chkconfig(8):
 
chkconfig --add smb --level 35
 
Will add smb to levels 3 and 5 as starting, and as killing in all
other run levels.

163.        What are Mimi types for known files?

 
                Extension                    Type/Subtype
                    rpm                   application/rpm
                    zip                   application/zip
                    bin, sfx, exe         application/octet-stream
                    Z                     application/x-compress
                    gz                    application/x-gzip
                    sh                    application/x-sh
                    pdf                   application/pdf
                    ps                    application/postscript
 
Where to find more?

164.        How to do backup on Solaris?

 
Use ufsdump. Make sure the file system you want to backup is umounted.
 
for example, to backup /dev/rdsk/c0t1d0s0 to a dump file on /disk3.
First you can find out how much disk space the backup will take, do:
 
      ufsdump 0Sf foo /dev/rdsk/c0t1d0s0
 
Now do the backup
 
      ufsdump 0f /disk3/full_backup  /dev/rdsk/c0t1d0s0
 
see man ufsdump.
 
 
you can compress output as this:
 
       fsdump 0uf - /filesystem | gzip -v1 > filesystem.dump.gz
 
to extract it do
 
       gunzip < filesystem.dump.gz | ufsrestore ivf -
 
\textit{Another related note, from the net, not tested}
 
 > Hi,All:
 > I am a newbie on solaris. Now I want to backup my file system such as the
 > "/export/home" directory. And the <<System Administration Guide>> suggests
 > that I must umount it before I run the "ufsdump" command. But the problem is
 > that our server must keep working all the day.
  
 Well, do the backup at night time... ;-)
  
 ufsdump manages to get most of the files copied but if yoy \_really\_ must 
 have your users online around the clock then you
 should consider vxfs and snapshot or use fssnap in Solaris 9...

165.        How to find what scsi and ide devices connected to Solaris box?

 
at the boot prompt do
 
probe-scsi-all
 
this will list all scsi adapters and any scsi devices on them.
 
probe-ide will show ide devices.

166.        How to add second IDE (or scsi) disk to a solaris box?

 
make sure jumpers are correct (master/slave) for the IDE disks, on the disk itself.
for scsi disks, make sure the scsi id on new disk is not conflicting with any current
one on the system allready.
 
add the disk to the box.
 
   boot -r
 
now do
   
   format
 
it should show the new device. If not, do
 
   devfsadm  (this basically will create a new /dev/dsk and /dev/rdsk/ 
              device files and link them to the /devices directory).
 
and try format again. if the new device shows up, then partition it.
select partition. select all hog space. hit return for all questions,
then type quit twice.  (usually it shows slice 2 as backup, and
alice 6 for the actuall all space).
 
then do
 
   newfs  /dev/rdsk/c0t1d0s6
 
assuming you paritioned the disk c0t1d0 with one slice (s6). 
 
now, mount it to some mount point
 
  mount /dev/dsk/c0t1d0s0 /mount

167.        How to use GNOME and KDE on Solaris?

Solaris 8, update 4 (01/01) companion CD has gnome and KDE pre-build for solaris. install those packages. (they install to /opt/sfw/gnome, /opt/sfw/kde).

Next, run 'install-dtlogin' scripts, which are located under gnome and kde directories.

now logout of the desktop and when you login again, select from the session, the desktop you want (CDE or gnome, or KDE, etc...)

Another answer

In /opt/sfw/gnome/dtlogin there's a script called install-dtlogin, so cd to that directory and run the script as root; then log out and gnome will be listed under the sessions on the CDE login screen. [Same procedure to add KDE to the available login sessions. Beware if you have a .xsession file, as that gets run as well, which may be bad if you have it set up for something else.]

168.        How to change between GNOME or KDE on linux?

 
For gnome: At the cli type echo "exec gnome-session" > ~/.xinitrc
 
then startx as usual
 
 
for KDE: echo "exec startkde" > ~.xinitrc

169.        What are the different key lengths used with different crypto algorithms?

 
+------------+---------+--------+-------+
| crypto     | keysize | digest | block |
|            |         | size   | size  |
+------------+---------+--------+-------+
| HMAC-MD5   |  128    |  96    |       |
+------------+---------+--------+-------+
| HMAC-SHA-1 |  160    |  96    |       |
+------------+---------+--------+-------+
| DES-CBC    |  56     |        |       |
|            |(64 with |        |  64   |
|            |the 8 bit|        |       |
|            | parity) |        |       |
+------------+---------+--------+-------+
| 3DES-CBC   | 192     |        |  64   |
+------------+---------+--------+-------+
| Blowfish   | variable|        |       |
|            | 32..448 |        |  64   |
+------------+---------+--------+-------+

170.        How to find the list of native instruction sets executable on your Solairs box?

man isalist

nabbasi>isalist sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc

171.        How does the Solaris linker find the libraries it needs?

Solaris linker, /usr/ccs/bin/ld , uses this order

 
1. LD_LIBRARY_PATH (it searches these directories to find libraries listed in
   in the -l argument for ld.
   This env. variable is also used by the run-time linker to resolve dynamic libraries
   locations.
2. object's runpath (-R). Also can be specified using the LD_RUN_PATH. This 
   affect the run-time linker. When building the executable file, you can pass
   it -R option to list the directories to search at load-time to resolve the
   libraries. the build-time linker records these info into the excutable file itself,
   and when it is loaded, the run-time linker reads this list. (use ldd to look at
   the list of link dependcies).
3. look into /var/ld/32/ld.config for list of paths to search.
   If the object is 64 bit instead, it looks at /var/ld/64/ld.config
   
   Notice, if you do NOT want the linker to use step 3 above, then do
 
   export LD_NOCONFIG=foo
 
   Use the command crle to  configure a new ld.config file.
   (man crle).

172.        How to analyze a core dump on solaris?

 
use mdb or adb.
 
for example, with adb do
 
  cd /var/crash/<name_of_machine>/
  adb -k <dump_file> <core_file>
  $c                     <------ to get list of stack
  $<msgbuf               <------ to show kernel buffer that contained
                                 last messages (it might not have been written to /var/adm/messages file
  $q                     <------ to exit debugger

173.        How to load kadb kernel debugger so that solaris jumps to it when it crashes?

 
set and env variable in the boot subsyetem.  type STOP-A to get to the 
  
   OK
 
boot prompt. Then type
 
  setenv boot-file  kadb
  go

174.        How to find if Solaris booted in 32 or 64 bit mode?

isinfo -b

175.        How to compile for 64 or 32 bit Solaris using Sun Forte C compiler?

 
To compile for 64 bit
 
    cc -xtarget=ultra  -xarch=v9  foo.c
 
To compile for 32 bit
 
    cc -xtarget=ultra  -xarch=v8  foo.c

176.        What are the data type sizes in 64 and 32 bit images for Solaris?

 
a small t.c program was written to show the sizes:
 
  #include <sys/stat.h>
  int main(){
   printf("sizeof char      =%d\n",sizeof(char));
   printf("sizeof short     =%d\n",sizeof(short));
   printf("sizeof int       =%d\n",sizeof(int));
   printf("sizeof long      =%d\n",sizeof(long));
   printf("sizeof long long =%d\n",sizeof(long long));
   printf("sizeof double    =%d\n",sizeof(double));
   printf("sizeof float     =%d\n",sizeof(float));
   printf("sizeof off_t     =%d\n",sizeof(off_t));
   printf("sizeof time_t    =%d\n",sizeof(time_t));
   printf("sizeof char*     =%d\n",sizeof(char *));
 }
 
 
(notice: long long is NOT strict ANSI C. so if you use -Xc with Solaris
compiler, one can't use long long).
 
a 64 bit compiled image on Solaris has these data type sizes:
 
nabbasi>cc  -xtarget=ultra  -xarch=v9 t.c
 
nabbasi>file a.out
a.out:          ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped
 
nabbasi>./a.out 
sizeof char      =1
sizeof short     =2
sizeof int       =4
sizeof long      =8
sizeof long long =8
sizeof double    =8
sizeof float     =4
sizeof off_t     =8
sizeof time_t    =8
sizeof char*     =8
 
 
 
32 bit compiled image on Solaris has these data type sizes:
 
nabbasi>cc  -xtarget=ultra  -xarch=v8 t.c
 
nabbasi>file a.out
a.out:          ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped
 
nabbasi>./a.out 
sizeof char      =1
sizeof short     =2
sizeof int       =4
sizeof long      =4
sizeof long long =8
sizeof double    =8
sizeof float     =4
sizeof off_t     =4
sizeof time_t    =4
sizeof char*     =4
nabbasi>
 
 
so, difference, is that a 64 bit program has long as 64 bit instead of 32 bit, and
file offset and pointer size is 64 bit instead of 32 bit. so, be carfull in
using these data types across different programs. (such as saving them to 
binary files, or sending them in messages across). notice an int is always 32 bit,
so is safe to use.

177.        How to convert a static library to dynamic library on Solaris?

 
I wanted to use some C functions from Java. But the library I have access to is
static library called libcisam.a, so to convert it to .so, this is what I did:
 
mkdir tmp
cp libcisam.a tmp
cd tmp
ar -x libcisam.a
ld  -G -Bdynamic *.o  -o libcisam.so

178.        How to load a dynamic library of DLL into java?

 
Assume you have a library called libcisam.so that you want to load into java. do
 
 
----- t.java-----
class t
{
    static { System.loadLibrary("cisam"); }
 
    static public void main(String[] argv){
      System.out.println("Loaded ok");
    }
}
-----------------   
 
cd /home
ls libcisam.a
 
javac t.java
 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home
 
nabbasi>java t
loaded ok
 
  Notice: If you use -Djava.library.path=/home  in the java command, and LD_LIBRARY_PATH is defined or not,
  then that will only be used. i.e. java.library.path is being igonred (this is when I tested this
  on solaris 8, jdk 1.2.2
  Solaris VM (build Solaris_JDK_1.2.2_06, native threads, sunwjit). 
  sounds like a bug to me?
  so, as a rule, use depend on LD_LIBRARY_PATH, no -Djava.library.path

179.        How to use java programs in command lines using unix pipes?

 
Suppose we have pgm1.class and we want to use these in something like this
 
cat  foo.txt | pgm1 -i arg1 -j arg2 
 
then create script called pgm1 
 
---- pgm1 ---
#!/bin/sh
exec java pgm1.class ``$@''
 
 
This way, all command line arguments passed to script is passed to java. So, the 
script acts as very thin layer to hide the java invocation part.

180.        I've installed Linux on disk, and now when I install windows, it won't boot from disk, why?

 
Windows installation does not install a new boot sector. do this:
 
put a dos bootable floppy in drive A:\ and boot to dos. then type
 
FDISK /MBR
 
Now you should be able to continute or start installation of windows NT ok.
 
(you would think windows would take over the MBR, but it does not).

181.        How to start a command and logout from the terminal leaving the command running?

 
Assume you want to make a copy operation (to show as an example), do this:
 
 
nohup nice sh -c 'tar cpf - src | (cd dest; tar xpf -)' </dev/null
   >logfile.txt 2>&1 &

182.        How to run cscope?

 
To use cscope you need to find index the tree. cscope needs a list of the
directories to search.
 
Go to the top of the tree that you need to index. Say $HOME/src, then do
 
$cscope -s `find . -type d | awk 'BEGIN { ORS = "," } { print }'`
 
  OR (this below sometimes does not work. the above works all the time).
 
$find . -type d -print > cscope.files
$cscope   (cscope uses cscope.files automatically)

183.        How to start CDE in solaris from console?

 
if you are logged in to solaris and there is not CDE, do this
 
xinit /usr/dt/bin/Xsession
 
to kill X, do
 
/usr/dt/bin/dtconfig -kill
/usr/dt/bin/dtconfig -d

184.        How to install PERL for windows?

goto www.perl.org and download the Active perl binary distro. Run and install. Make sure to install it under C: drive (as this makes it easier to use latex2html under windows). Make sure the path set is correct.

To use Activestate's Perl distribution from cygwin, download perl.exe stub from cygwin utils web page  http://cygutils.fruitbat.org/perl-contrib/index.html  , and put it in /usr/local/bin

http://www.activestate.com/Products/ActivePerl/   to download the actual wind32 activestate perl

so do this:

1.     download ActivePerl for windows. Install it.

2.     .Download the perl.exe stub from the above url (cygwin utils) and put the perl.exe in cygwin’s /usr/local/bin

that is it.

 

See this for perl on cygwin

http://www.xav.com/perl/lib/Pod/perlcygwin.html 

the above is not working. Forget about it, just stick to cygwin oerl

 

185.        How to change the resolution (and start X) using X server running under CYGWIN?

There are two ways to start X under windows. One by using the windows file manager and double click on the file C:\cygwin\usr\X11R6\bin\startxwin.bat , and the other way is while under bash in cygwin by executing the file C:\cygwin\usr\X11R6\bin\startxwin.sh

I prefer to do it from bash.

So, first start cygwin shell as normal. and edit the above file.

Assume you want to use then change the line as below.

XWin -screen 0 1280 1024 &

If you want to edit the file C:\cygwin\usr\X11R6\bin\startxwin.bat change this line:

 
REM start /B XWin -screen 0 1024 768
start /B XWin -screen 0 1280 1024

Make sure make the changes in the correct OS section.

186.        How to set HOME env variable when starting X under cygwin?

I found that when I start X under cygwin using the startxwin.bat file, there was no HOME env. variable set. One way to solve this is to edit the file C:\cygwin\usr\X11R6\bin and add a line

SET HOME=/cygdrive/f/nabbasi

This assumes my home directory under windows is F:\nabbasi .

Notice that one does not have to have their HOME under /cygwin at all. It can be anywhere under windows and on any drive.

Next, I created a file .bashrc in my home directory, so the first thing I do after I start X is this:

 
cd $HOME
source .bashrc

187.        How to change emacs fonts under windows?

 
From: Michael M Mason (admin@cambridge-optical.com)
Subject: Re: Better fonts for ntemacs under windows 
Newsgroups: comp.emacs
View complete thread (4 articles) 
Date: 2001-05-29 04:49:08 PST 
 
 
On 24 May 2001 09:23:32 -0700, Joe Lisp <joelisp@yahoo.REMOVE.com>
wrote:
 
>I run ntemacs on my Windows box.  Is there some way I can get better fonts
>for this?  The fonts I get when I run emacs under freebsd are so much
>better.  But windows comes with such crummy fonts... where can I get a
>better font, how do I install it on my machine, and how do I tell ntemacs
>to use it?
 
As someone else has already said, Lucida Console and Andale Mono both
look reasonable.  I've found that altering the font size can have
quite a dramatic effect on the appearance of these fonts -- just
changing from (say) 10pt to 9pt can change an ugly-looking font into
something much better.
 
If you're currently using "Courier New" you could try switching to
"Courier".  This is a bit-mapped font (not Truetype) in a small number
of fixed sizes; it looks better at small sizes than Courier New, and
you'll get a LOT more lines displayed in your Emacs frame because it
doesn't have the huge amount of airspace between each line.
 
Andale Mono is a Microsoft font that you can download for free from
http://www.microsoft.com/typography -- look for the section headed
"Free utilities and Truetype fonts".
 
To use a font you need to configure it in your .emacs file.  To set up
the default frame appearance you need something like this:-
 
(setq default-frame-alist
  '((top          . 5)
    (left         . 480)
    (width        . 80)
    (height       . 78)
    (cursor-color . "red")
    (font         . "-*-XXX-normal-r-*-*-11-*-*-*-c-*-iso8859-1")))
 
where  top    = distance from top of screen in pixels
       left   = distance from left of screen in pixels
       width  = width of frame in characters
       height = height of frame in lines
 
In the 'font' line, change the XXX to the name of your chosen font; do
not put the name in quote marks even if the name includes spaces!  So
change the XXX to Courier, Courier New, Andale Mono or Lucida Console.
 
The number '11' part-way along the 'font' line indicates the size; 11
is 8 point and you might want to increase this to 12 or 13 -- I can't
recall exactly how these numbers relate to the font size (maybe
they're the character height in pixels).

another answer from the net:

 
See the FAQ at http://www.gnu.org/software/emacs/windows/
 
There are several X fonts that people have turned into Windows Bitmap
fonts, also the truetype fonts "Andale Mono" and "Lucida Console" look
reasonable. Emacs also supports BDF fonts (the source format for most
X fonts) on NT since version 20.4. The FAQ should have pointers to
these, and instructions for setting them up.
 
-------------
 
to find emacs fonts:
 
 
(insert (prin1-to-string (w32-select-font)))
 
"-*-Courier New-normal-r-*-*-11-82-96-96-c-*-iso8859-1"

188.        Clicking on a URL from inside email message in outlook express does not work after uninstalling mozilla on windows, why?

After I installed Mozilla 0.91 on windows, then I uninstalled it, I found that outlook express email messages with URL's in them, when I click on the URL, the browser does not open any more.

 

It looks like Mozilla uninstallation broke something.

 

I think this is the problem and how to fix it.

 

Use the registery and search for something with -url "%1" at the end of it. Change it from using mozilla program to IE, as below

C:\Program Files\Internet Explorer\iexplore.exe -url "%1"

 

check HKEY_LOCAL_MACHINE/SOFTWARE/classes/applications/http/shell/open/DDEEXC

It should have a Name of default, a type of REG_SZ and the above value. It also has name of NoActiveHandler which is empty.

189.        How to view a dvi?

If you have KDE, use the command kviewshell dvi webtv.dvi

190.        How to create a debian package from source?

From the net:

 
Here are the quick-and-dirty instructions for creating deb's from source
 
- extract the tgz or tar.gz to subdirectory (e. g. foo-1.0.tar.gz to
  subdir foo-1.0/ )
 
- cd to the subdirectory (cd foo-1.0/)
 
- run deb-make
 
- now cd to foo-1.0/debian
 
mv menu.ex (example) menu, and enter the desired category.
 
- edit the file 'control'. You must only edit 'Section:' and
  'Description:' The other entries aren't so important
 
- save the file, close the editor and cd ..
 
- you are now in foo-1.0/ again. Run dpkg-buildpackage
 
 
- When dpkg-buildpackage is finished, in the directory above foo-1.0/
  you will find the deb-packages which you can install with dpkg -i.
 
 
NOTE: This method works only if a ./configure script is available.
Otherwise you have to edit the Makefile manually after deb-make.
This procedure works for me in 90 % of the cases.
 
-- 
Kind Regards from Terry

191.        How to find what DLL's are missing from a WINE application on linux?

wine --debugmsg +module,+file FOO.EXE

copy the DLL's to c/windows/system

192.        How to install windows registery file into WINE on linux?

programs/regapi/regapi setValue < winedefault.reg

193.        How to find the version of X installed?

X -version

 
XFree86 Version 4.1.0 / X Window System
(protocol Version 11, revision 0, vendor release 6510)
Release Date: 2 June 2001
        If the server is older than 6-12 months, or if your card is
        newer than the above date, look for a newer version before
        reporting problems.  (See http://www.XFree86.Org/FAQ)
Build Operating System: Linux 2.4.4 i686 [ELF] 
Module Loader present

194.        How to close X in cygwin?

ALT-F4

195.        How to starts X with different dpi values?

From the net. Not tested.

 
>I installed Redhat Linux 7.0 on my machine and updated XFree86 to >version 4.1.0. 
But I have to startx like this to load the 100 dpi font I  installed
 
> startx -- -dpi 100 
 
>Is there a configuration file for you to edit and set 100 dpi font as >the default? 
[hal@feenix hal]$ cat ~/.xserverrc 
 
X :0 -dpi 120 
 
This works for startx only AFAIK. xdm/kdm/gdm/wdm/etc have their own config files.

196.        Where does the outlook express email folder hides in widows?

 
C:\Documents and Settings\Administrator\Local Settings\Application Data\Identities\{FF1E2994-7804-41C1-816D-D79D6AAA2D24}\Microsoft\Outlook Express
 
Look here also:
 
C:\Documents and Settings\USER\Local Settings\Application Data\Microsoft\Outlook\archive.pst
 

197.        How to import outlook express messages in a .dbx file from different location?

1. startoutlook and select file->import->messages->outlook express 6

 

 
Choose these options below:
 
 
Click OK, and browse to the FOLDER where the .dbx file are location, and click OK, then you’ll get a screen asking you what to import, select all as shown:
 
 
 
 

198.        Dennis Ritchie URL's

 
                        Dennis Ritchie's page at Bell Labs: 
                        http://cm.bell-labs.com/cm/cs/who/dmr/ 
                        Bell Laboratories: 
                        http://www.bell-labs.com/ 
                        Ken Thompson's page at Bell Labs: 
                        http://cm.bell-labs.com/cm/cs/who/ken/index.html 
                        Bell Labs's Plan 9 page: 
                        http://plan9.bell-labs.com/plan9 
                        A good Plan 9 FAQ with basic information: 
                        http://www.fywss.com/plan9/plan9faq.html 
                        Vita Nuova's Inferno page: 
                        http://www.vitanuova.com/inferno/index.html 
                        C9X information page: 
                        http://web.onetelnet.ch/~twolf/tw/c/c9x_changes.html 
                        The C Programming Language, Brian W. Kernighan and Dennis M. Ritchie (Prentice Hall, 1988): 
                        http://cm.bell-labs.com/cm/cs/cbook/index.html 
                        Brian Kernighan's page at Bell Labs: 
                        http://cm.bell-labs.com/cm/cs/who/bwk/index.html 
                        Historical perceptions about the VAX architecture: 
                        http://cm.bell-labs.com/cm/cs/who/dmr/vax.html 
                        A tribute to PDP-11 machines: 
                        http://www.psych.usyd.edu.au/pdp-11/ 
                        Audio file of further conversations with Dennis Ritchie: 
                        http://mithras.itworld.com/media/001021kalev_ritchie.ram

199.        How to connect linux and win2k using SAMBA?

I did this sometime ago, these are some notes:

 

access the samba server configuration using netscape http://localhost:901

configure it such that it look like this (change the share folder as needed).

 
# Samba config file created using SWAT
  # from localhost (127.0.0.1)
  # Date: 2001/05/29 16:39:15
 
  # Global parameters
  [global]
          coding system = 
          client code page = 850
          browseable = No
…….
  [nabbasi]
          path = /disks/d1
          writeable = Yes
          guest ok = Yes
 
 
**** also make sure /etc/hosts contains this
 
nabbasi@linux:~ > cat /etc/hosts
#
# hosts         This file describes a number of hostname-to-address
#               mappings for the TCP/IP subsystem.  It is mostly
#               used at boot time, when no name servers are running.
#               On small systems, this file can be used instead of a
#               "named" name server.
# Syntax:
#
# IP-Address  Full-Qualified-Hostname  Short-Hostname
#
# special IPv6 addresses
127.0.0.1       localhost
195.0.0.2 linux
 
 
nabbasi@linux:~ > uname
Linux

200.        What is the C code for a typical server loop?

Found this on the net, seems like a good summary. Have not tested it :)

 
struct servent    *sp;
        struct sockaddr_in sin,from;
 
        if ((sp=getservbyname(service,"tcp")) == NULL) then error...
        sin.sin_family=etc...
        if ((s=socket(AF_INET,SOCK_STREAM,0)) < 0) then error...
        if (bind(s, &sin, sizeof(sin)) < 0) then error...
        if (listen(s,QUELEN) < 0) then error...
        for (;;) {
           if ((g=accept(f,&from,&len)) < 0) then error...
           if (!fork()) {
              child handles request...
                 ...and exits
               exit(0);
           }
           close(g);   /* parent releases file */
        }

201.        How to Compile and Link OpenGL Applications?

From the net

 
How to Compile and Link OpenGL Applications
 
When using IBM's OpenGL with auxlib, specify the following: 
 
    include files:               <GL/aux.h> 
    OpenGL libraries:            -lGL, -lGLU
    windowing toolkit libraries: -laux
    X Windows libraries:         -lXm, -lXt -lX11 
 
When using IBM's OpenGL with GLUT, specify the following: 
 
    include files:                <GL/glut.h> 
    OpenGL libraries:             -lGL, -lGLU
    windowing toolkit libraries:  -lglut
    X Windows libraries:          -lXmu, -lX11 
 
When using IBM's OpenGL with GLX library, specify the following: 
 
    include files:        <GL/gl.h>, <GL/glx.h>
    OpenGL libraries:     -lGL, -lGLU
    X Windows libraries:  -lX11 
 
When using Mesa with auxlib, specify the following: 
 
 
   include files:                "glaux.h"
   include files:                -I/local/include/mesa, 
                                   -I/local/include/mesa/GL
   Mesa libraries                -L/local/lib/mesa, -lMesaGL,
                                   -lMesaGLU
   windowing toolkit libraries:  -lMesaaux 
 
When using Mesa with GLUT, specify the following: 
 
   include files:                <GL/glut.h>
   include files:                -I/local/include/mesa
   Mesa libraries:               -L/local/lib/mesa, -lMesaGL,
                                   -lMesaGLU
   windowing toolkit libraries:  -L/local/lib/mesa, -lglut
   X Windows libraries:          -lXmu, -lX11
 
When using Mesa with off-screen rendering, specify the following: 
 
    include files:    <GL/osmesa.h>, <GL/gl.h>, 
                        <GL/glu.h>
    include files     -I/local/include/mesa
    Mesa libraries:   -L/local/lib/mesa, 
                        -lMesaGL -lMesaGLU 17

202.        How to use RPC with a firewall?

from the net

 
Hello,
 
In order for RPC to work through a firewall, several things have to be
configured/designed right.
 
First, the client needs to be able find out the port number that the
service is accepting requests on.  Most RPCGEN generated applications
use a program number and a version number in conjunction with
portmap/rpcbind (running at port 111) to find out the port number to
use.
 
If the above is the case, then either the firewall has to be running
portmap or it has to open up port 111.  Opening up port 111 has an
undesirable effect of letting untrusted or external systems with rpcinfo
find out what else is running.
 
Second, the firewall has to be "RPC aware" in order for it to
dynamically open up the service port.  The service port is the "next
available free port", and it changes everytime a service starts.  Most
firewall administrators do not have much choice other than to open up a
range of ports.  Again, this is rather undesirable: it defeats the
purpose of having a firewall.
 
Accord RPCGEN (ARPCGEN) is an enhanced RPCGEN that allows applications
to specify the port number to use.  ARPCGEN applications can also work
with or without portmap.
 
ARPCGEN's ability to set the port numbers in conjunction with or without
a portmap goes a long way toward making the task of firewall
administrators easier.
 
For application developers, there is also Internet Function Call
Compiler, IFCC, that provides a higher level of abstraction then RPC.
IFCC uses C language as its IDL compared with .x for RPCGEN.  IFCC makes
remote function invocation possible.
 
You can download Accord IFCC or ARPCGEN from
 
        http://www.accord.com/products/Download.html
 
The download includes source code as well as pre-compiled examples for:
 
    AIX 4.x/PowerPC
    HP-UX 9.x/10.x/11.x HPPA 1.1
    IRIX 5.x/6.x/R4X00 series
    Linux 2.x Kernel/Red Hat 5.x/6.x
    OpenBSD 2.x/SPARC
    OpenBSD 2.x/Intel or compatible
    SunOS 5.x/Intel or compatible
    SunOS 5.x/SPARC
    SunOS 4.1.x/SPARC
    UnixWare 1.x/2.x/Intel compatible
    Windows 1995/1998/2000, NT 4.x
 
If you would like to see IFCC/ARPCGEN ported to an OS that is not
included in the above list, please send me e-mail.
 
Hope this helps.
 
-Arun Taylor
 
 
http://www.accord.com/products/Download.html

203.        How to convert video tapes to digital to store on a PC?

from the net.

 
After several weeks of monitoring the group I have not seen this
specific question addressed, so...
 
I want to convert a bunch of old video tapes into digital video for
storage and replay from CD-R disks. The source material is off-air 2 or
8 hour format S-VHS, I'm going to capture it using my ATI All-in-Wonder
128, I want to fit at least 45 minutes of video onto a CD, and I will
only be playing it back on the computer. The capture system is a 700MHz
PIII with 2 ATA66 EIDE drives (one for system and one for video) which
easily handles either avi or mpeg captures at the size I care about
(normally 352x240, but have also tried 640x480). All that to say that I
am not interested in "best" quality and I am not interested in VCD - I
just want something reasonable for usually background entertainment that
is portable. 
--------------------
From: Zed Mister (zedmister@hotmail.com)
 Subject: Re: best codec for computer only playback? 
 Newsgroups: rec.video.desktop
 Date: 2000/11/19 
 
You should capture at 640x480 30fps, then encode to 512x384 30fps mpeg4v2 or
divx (divx allows you to adjust color brightness, contrast, hue, etc.)
during playback, mpeg4v2 doesn't.  For the audio, you should capture using
PCM 44100Hz 16bit stereo, and encode to MP3.
 
Using precise bicubic resizing (640x480 -> 512x384), 1350 kbps video / 128
kbps audio, and using Donald Graft's "smart deinterlace" filter for
VirtualDub, you can get some pretty kickass results.  You can fit roughly 60
minutes of video with these settings on a single CD.  Drop the bitrates if
you wanna fit more on a CD.  You can fit 2 hours on a CD using 600 kbps
mpeg4v2 / 96 kbps mp3, which is still very good, even at 512x384 30fps.
 
That's what I'd do.  320x240 is just too small by today's standards.
512x384 is a nice size for video with a 4:3 aspect ratio.  640x360 is good
for video with a 16:9 aspect ratio.
 
Keep in mind, the larger the image size you can capture, the better.
Capture at 768x576 if your capture device allows you to.  My Asus V6800
Deluxe can capture at 702x480, and I capture at that setting using the ASV2
hardware codec for video and PCM for audio (it doesn't miss a beat).  I then
encode to 512x384 30fps MPEG4v2/MP3.
 
MPEG4v2 is more portable than divx, since the playback codec is downloaded
automatically on a computer with Internet connection using Media Player,
while the divx codec isn't downloaded automatically.  DivX has some nice
perks that make it good for outputting to television (ability to adjust
brightness, contrast, etc. during playback as discussed earlier).  But
overall I prefer MPEGv2 to DivX.  I can't see any quality difference between
DivX Low-Motion and MPEG4v2 at equal bitrates.

204.        MBR?

This is a good note on MBR from the net

 
The MBR has to parts, the first part is code to load next
stage loader, the second part is the primary partition table.
 
Executing fdisk /MBR under DOS will write some standard code
to the MBR. The standard code will search for ONE active
partition in the table at the end of the MBR, it will then
load and execute the first sector of that partition.
 
LILO can be installed in different ways, you can install
LILO in the MBR in which case the code written by DOS will
be overwritten. You can also install LILO on a primary
partition, in which case the standard code in the MBR will
run first and load the LILO code which runs next.
 
If you actually get the L printed to the screen it means
that the first sector of LILO was loaded and executed, this
means that there for sure is no problem with the code in the
MBR. LILO does not use the table in the MBR during boot, but
uses the partition table known by Linux when installing, if
Linux sees partitions correctly there is not a problem with
the partition table either.
 
Using the original BIOS disk access interface you will get
trouble accessing data beyond some limit. The limit depends
on lots of parameters but will be in the range from 32MB -
8064MB.
 
If you are using a new BIOS with the extended interface and
a new version of LILO configured to use this interface the
limit will be removed, and CHS geometry will no longer be
used.
 
The best way to avoid problems is to create a small partiton
at the start of the disk. That could be the first 31MB of
the disk and mounted as /boot. That would require moving any
DOS partition of one such is present. The layout could then
look similar to this:
 
+-------------------------+
|  31 MB /boot            |
+-------------------------+
|   1 GB C:               |
+-------------------------+
|     Extended            |
|  +-------------------+  |
|  |  512 MB SWAP      |  |
|  +-------------------+  |
|  |    /              |  |
|  +-------------------+  |
+-------------------------+
 
You can also choose to place /boot on an existing DOS
partion, you just have to notice that moving the files
would make the system unable to boot. After installing
LILO in this way it is a good idea to boot DOS and mark
all the files needed by LILO with the SYSTEM attribute.
(Does anybody know if this can be done directly from
Linux using some ioctl?)
 
A completely different approach that will work if
everything else fails is to not use LILO at all. Instead
you can use LOADLIN, place the LOADLIN program, your
kernel and optionally a ramdisk on the DOS partition.
Create a DOS boot menu that will offer the options to
start Linux or DOS. In order for this to work you just
have to be able to boot DOS and read files from the DOS
partition.
 
(Notice that WIN98 is runing on top of DOS, I think it
is version 7.10)
 
-- 
Kasper Dupont

205.        How to write a pixel (and line) to the screen?

good note from the net. author unknown.

 
> How do you write a pixel to the screen at a specific location?
 
Get a pointer to screen through mechanism your OS allows you to use. You
will generally need five variables to describe the screen.
 
width,height,pitch,bpp,address
 
The width and height are self-explatonary. Pitch means "width" of one
scanline in screen, in bytes. Bpp means "width" of one pixel in screen, in
bytes. Address is ofcourse a pointer to where the screen is at. On some
systems you cannot get the pointer to screen no matter what. A good example
of this is a Windows box without DirectDraw or WinG.
 
So, you have (x,y) coordinate pair, and possible color you want to write to
the screen.
 
You get the "offset" inside the screen with a simple formula:
 
int offset = pitch * y + bpp * x;
 
Now you just add the offset to "address", or vice-versa. Ofcourse the
address pointer has to be a char-pointer if you want the offset to work, so
let's assume it was.
 
Then simply write into memory address[offset] the color you want.
 
It's actually simpler than above in practise, since you always have to know
the pixelformat of screen, to be able to call the correct routine. Most
graphics programs support only one or two formats, for example 16bit RGB565
or 32bit ARGB8888. The most common way to write FAST software rendering is
to have the buffer in system memory, in format of your own choise, then just
copy the final image to the videomemory.
 
What makes this approach faster ( often ) is that when you have to READ from
videomemory ( which you will be doing a lot when you want alphablending,
antialiasing, etc. ) it will be slower than practical. Reading from
videomemory is too slow to do in realtime, just don't do it.
 
If we know the format in advance, the code becomes much simpler... here's
code to write pixel in 32bit pixelformat:
 
typedef unsigned int uint32; // assuming unsigned int IS 32bits ;-)
char* screen = ...; // get this from your OS/API combination
int x = ...;
int y = ...;
uint32 color = ....;
 
uint32* buffer = (uint32*)( screen + y*pitch + x*sizeof(uint32) );
*buffer = color;
 
That's it. This is far from optimal, ofcourse. The x*sizeof(uint32) is just
bit-shift ( x<<2 ) so I wouldn't worry about it, the y*pitch is a MUST if
you want correct rendering. Naively a lot of programmers assume width of
screen multiplied by bpp equals to pitch, but this is WRONG. Some hardware
just does not work that way, and then your assumptions get shafted at rear
really quickly.
 
So you have one multiplication per pixel, sorry, cannot get rid of that
unless you can be sure the pitch is same number on all hardware ( you
can't ). What you can do, is, to guarantee the pitch IS same for your buffer
in SYSTEM memory, and get rid of the multiply ( but why you would want to do
that is beyond me ;-)
 
Fast graphics routines don't use putpixel() or pixels, they work in "stream"
of pixels. When you are drawing something simple like 2D "sprite" onto
target buffer, you don't actually go and do it pixel-at-time, no, the loop
looks more like this pseudo-code:
 
for ( int y=0; y<height; y++ )
{
  memcpy( dest, source, width );
  dest += pitch;
  source += pitch;
}
 
Replace the memcpy with:
 
int count = width;
do { *dest++ = *source++; } while (--count);
dest += (pitch-width);
source += (pitch-width);
 
If you want, doesn't change anything-- the idea remains the same. Fast
graphics routine doesn't think in terms of "pixels", but in blocks of
memory. A block of memory is predictable, pixel to the right is the next
memory address ( or cell if you may ), and one pixel down is simply address
plus pitch. So multiplications and other overhead is thrown overboard right
there in the starting line.
 
 
> How do you write a line to the screen?
 
Bresenham line algorithm is quite often used when you implement linedraw in
software, it's very easy to write, brancless or branching variety. I doubt
you are interested in anti-aliasing, subpixel precision or those issues.
Lookup "bresenham line" with your favourite search-engine, a lot of
information will come up.

206.        How to access CVS anonymous? (for java giat tree, gjt) ?

http://www.gjt.org/src/cvs/anon/

 
You can access the anonymous CVS server of the Giant Java 
Tree with your cvs client. To do this, you will will be accessing
           the server via 'pserver' mode. You may not be 
familiar with pserver mode, however, once your CVSROOT is properly set, you
           will not even notice the difference in how you use CVS. 
 
           The parameters essential to the pserver connection are: 
 
              Mode: pserver 
              Hostname: cvs.gjt.org 
              Repository: /gjt/cvsroot 
              Username: anoncvs 
              Password: anoncvs 
 
           You can establish these parameters either by setting 
your CVSROOT environment, or by using the '-d' option when running
           cvs. Here are examples of both: 
 
           Setting the CVSROOT environment variable: 
 
           CVSROOT=:pserver:anoncvs@cvs.gjt.org:/gjt/cvsroot
           export CVSROOT
           cvs login   (use anoncvs for password)
 
           Using the '-d' option with cvs: 
 
           cvs -d :pserver:anoncvs@cvs.gjt.org:/gjt/cvsroot login

207.        On pathnames on different OS's

good note from the net. author unknown.

 
Indeed, a PR1ME system for instance used '>' for pathnames (at
least, such is my understanding; I've seen command lines from the
PR1ME exactly once in my lifetime).
 
However:
 
VMS uses '.', but only within the directory spec; one has to
construct pathnames such as "DRA0:[USER.SUBDIR.SUBDIR2]NAME.EXT;VER",
where VER is any positive integer between 1 and probably 32767.
All parts except the filename are optional, and even that might be
optional as well, although I'm not sure how well the system will handle
a totally empty pathname; the pathname "." would be totally misparsed
(it specifies a file with no extension; if the default is also blank,
one gets a file named ".;VER" -- I forget whether that's legal or not)
and ".." may not work at all.  (I can't say I've used VMS since V3.7;
4.0 had some major modifications which allowed for long filenames.
The current version IIRC is something like 5.2.)
Directories are actually files with a .DIR suffix, and are readable to
processes with SYSTEM privilege -- although making sense out of the data
might be tricky (Unix systems used to allow read-only access to
directories, too; nowadays one just gets the error code EISDIR).  The
root directory is DRA0:[000000] or DRA0:[000000]000000.DIR depending
on how one looks at it.
 
MacOS used to use colons; it probably still does, although it might
support '/' as well now.  Porting Java to MacOS should work, and
has probably already been done, although I have no idea how Java
would deal with the resource fork, which is a peculiarity in MacOS.
(A nice one, to be sure, but I know of no other system that implements
the concept, although NT might have hooks for it.)
 
I know little about MacOSX.  My understanding is that it's a BSD
derivative, which would make it Unix -- if so, I hope it does well.
 
I know nothing about BeOS, except that it's tuned for multimedia.
Whatever that means. :-)
 
AmigaOS used '/', but also had logical names ("MYDIR:"), and '/' at
the front of a pathname meant "go to the parent", insted of
"go to the root"; two slashes meant "go to the grandparent", etc.
There was no concept of '..'.  ':' would go to the root of the
current directory's file system at the start of the path; one can
also use 'MYDIR:a/b/c'.  I don't remember if 'MYDIR:/a/b/c' worked or
not -- it probably did, but it would go to the parent of the root
directory; if "MYDIR:" is a logical name, it made some sense.
 
Amiga physical disk names were "DF0:" and "DH0:", but volume names
can also be used in pathnames, which made for a flexible, if
slightly confusing at times, system, since one could copy a
floppy (e.g., a game) to a subdirectory on the hard drive and then
assign a logical name to it.
 
RSX-11M didn't have subdirectories (neither did DOS 1.0), just
directories, and those were very restrictively named:
DR0:[uid,gid] or DR0:[0,0]uidgid.DIR;ver.  The root
directory is [0,0].  Mind you, porting Java to RSX-11M makes as much
sense to me as putting a supercharger on an electric bicycle.... :-)
But one never knows -- and in any event, if one had a PDP 11/70,
one was better off running Unix V7 anyway. :-)
 
Apollo DOMAIN Aegis had UNIX-style pathnames, except for its canned
root ('//') concept; it also had a very transparent volume access
scheme that was simple, if somewhat inflexible; if node A wanted
a file from node B, and node B had it located at /x/y/z, then node
A could specify //B/x/y/z, ACLs and network conditions permitting.
Of course, Apollo is now dead, and the closest thing to this notion
might be NT's ability to share directories and files, although NFS
automounting isn't too far away either.  Older versions of Aegis
also had symbolic links that could read process environment variables.
That's about as weird as it gets; nowadays, one might simply use
NFS mounts and/or a naming convention, instead.  It's not the same, but
the only reason for environment name symbolic links anyway was
because Aegis also wanted to implement or emulate BSD and SYSV.
This was probably dropped in 10.1 or 10.0 -- I don't remember now.
 
Aegis also had the notion of typed files (so did VMS and RSX-11M).
If one wanted to create an ASCII file, one had to specify such during
file creation.  Attempting to read ASCII from non-ASCII files
tended to yield slightly unpredictable results, although I forget
the details now.  Nothing major like a system crash, just weird data.
(VMS actually had multiple types of text files; the classical one
used a shortword prefix to count the bytes in each record; records
were preceded by linefeed and succeeded by carriage return.  Another
variant ate the first character of each record and used it as a
formatting code; this was important for FORTRAN program output.)
 
I've totally forgotten how VM/CMS does its pathnames.  I remember
one uses "LOAD programname (START" to load and run a program
(the "(START" is an option; one can also start the program later,
but I'm not sure what the command line for that is -- it's probably
"START"), and that XEDIT is an editor thereon, but that's about it.
 
I don't know what else is out there, now.  Everything else I can
remember -- MAESTRO, Daisy DNIX, SCO Xenix, QNX -- are either dead,
UNIX-like, or both.
 
>- lookup paths from a configuration file.
> 
>But, using "\\" as part of a file name in a .java file is simply
>incorrect.
 
Note that '\\' is necessary to escape the backslash; the system will
see only a single backslash.  But you're right, it's definitely not
kosher.
 
Most likely, properties from a property file would be the correct way,
especially for servlets.

208.        How to change X resolution in linux by chaging XF86Config?

from the net. author unknown.

 
>hi,
>  currently when i start X via startx, i have to press Ctrl, Alt, + to
>change the resoultion from 800x600 to 1024x768. How can i start X with a
>resoultion of 1024x768 but still switch to 800x600 by pressing Ctrl, Alt, -
>if i want?
 
Edit your /etc/X11/XF86Config and in the screen section for the
different modes, make sure the resolution you want is first.
eg: Modes "1600x1200" "1280x1024" "1152x864" "1024x768" is
what I use and I run in 1600x1200 as default.
 
From your /etc/X11/XF86Config, I see no resolutions are
listed in the screen section. Mine looks like:
 
Section "Screen"
        Identifier "Screen0"
        Device "Matrox|MGA G600 AGP"
        Monitor "My Monitor"
        DefaultDepth 16
        Subsection "Display"
                Depth 32
                Modes "1280x1064" "1152x864" "1024x768" "800x600"
        EndSubSection
        Subsection "Display"
                Depth 24
                Modes "1280x1064" "1152x864" "1024x768" "800x600"
        EndSubSection
        Subsection "Display"
                Depth 16
                Modes "1280x1064" "1152x864" "1024x768" "800x600"
        EndSubSection
        Subsection "Display"
                Depth 8
                Modes "1280x1064" "1152x864" "1024x768" "800x600"
        EndSubSection
EndSection

209.        How to covert byte to int in Java without expansion?

from the net. author unknown.

Here is the code I was thinking of (converts a byte to a hex-doublet, ie. 0F instead of F).

 
    private String toHexDoublet(byte b)
    {
        StringBuffer sb = new StringBuffer(2);
        String hex = Integer.toHexString((int)b & 0x00ff);  // Remove signbit carry-over
        if (hex.length() == 1) sb.append('0');
        sb.append(hex);
        return sb.toString();
    }

210.        How to setup a signal handler in C?

from the net. author unknown. not tested.

 
#include <stdio.h>
#include <stdlib.h>
 
int signal_exit = 0;
                   
void EnableSignal(int SIGNO,void Func(int)) {
    struct sigaction Int;
 
    /* Set the handler to Func */
    Int.sa_handler = Func;
 
    /* Mask no other signals */
    sigemptyset(&Int.sa_mask);
    Int.sa_flags=0;
    if (sigaction(SIGNO,&Int,NULL)==-1)
        fprintf(stderr, "Signal error.\n");
}
 
void ExitCleanUp() {
   printf("In exitCleanUp\n\n");
}
 
void IntCatch(int SIGNO) {
   signal_exit = 1;
   printf("signal has been received\n");
}
 
int main(){
 
   /* Enable the signals for ^C and kill */
   EnableSignal( SIGINT,  IntCatch );
   EnableSignal( SIGTERM, IntCatch );
 
   if (atexit(ExitCleanUp)){
      return 1;
   }
 
   while (!signal_exit){
      /* do something */
   }
   printf("program ending\n");
} 
 
 
 
 
/home/andy->a.out
^Csignal has been received
program ending
In exitCleanUp
 
/home/andy->

211.        How big are java classes?

by Nasser Abbasi. I did this in summer of 2001.

 

empty class= 24 byte.

 

class with one 'char c' = 30. so since char is wide char in java, that is 2 bytes, there is 4 bytes overhead for each field member (field ID?).

 

class with one 'int i' is 32. since int=4 bytes, then the same as above, there is 4 bytes overhead for each field.

 

class with one 'long i' is 36. i.e. log =8 bytes, plus the 4 bytes overhead.

 

class with one String reference (null) is 50 bytes. So an object ref byitself uses 26 bytes. 24 bytes overhead for class and 2 bytes for Object ID?

 

class with one String reference (new String() is 52 bytes. So an object ref byitself uses 26 bytes. 24 bytes overhead for class and 4 bytes for Object ID?

 

class with one String reference (new String("A") is 53 bytes. So an object ref byitself uses 26 bytes. 24 bytes overhead for class and 4 bytes for Object ID? and one byte for A ?

 

class with one String reference (new String("AB") is 54 bytes. So an object ref byitself uses 26 bytes. 24 bytes overhead for class and 4 bytes for Object ID? and one byte for A and one byte for B.

 

class with one Integer object reference is 51 bytes. an overhead of 27 bytes.

 

class with on Long object reference is 48 bytes. So Long ref uses 24 bytes.

 

class with one Short object reference is 49 bytes. i.e. Short object referece uses 25 bytes.

 

Class with one Character object ref is 53 bytes. Which means 29 bytes for Character ref.

 

Class with one Class ref is 49 bytes. SO overhead is 25 bytes.

212.        Where are the java FAQ's ?

 
- Java/Javascript/Powerbuilder HOWTO (Real Gagnon)
  http://www.rgagnon.com/howto.html
- Java Glossary (Roedy Green)  http://www.mindprod.com/gloss.html
- Java Programmers' FAQ (Peter van der Linden) http://www.afu.com/javafaq.html
- jGuru jFAQs (John Zukowski)    http://www.jguru.com/jguru/faq/
- Focus on Java (John Zukowski)   http://java.about.com/
- Java Q&A (David Reilly)  http://www.davidreilly.com/jcb/faq/

213.        What is the command to list symbols in an exec of shared lib on solari?

 
/usr/ccs/bin/elfdump -s
   -or-
/usr/ccs/bin/dump -t

214.        What are some usefull escape sequences in C (to make alerts and others)?

 
K&R2, Appendix A 2.5.2
 or
 ISO/IEC 9899:1999, Ch. 5.2.2
  
 with following lists of escape sequences:
  
 \a (alert) Produces an audible or visible 
   alert without changing the active position.
 \b (backspace) Moves the active position to 
   the previous position on the current line.
   If the active position is at the initial 
   position of a line, the behavior of the 
   display device is unspecified. 
 \f ( form feed) Moves the active position to
   the initial position at the start of the
   next logical page. \n (new line) Moves the 
   active position to the initial position of 
   the next line. 
 \r (carriage return) Moves the active position
   to the initial position of the current line. 
 \t (horizontal tab) Moves the active position 
   to the next horizontal tabulation position 
   on the current line. If the active position 
   is at or past the last defined horizontal 
   tabulation position, the behavior of the display
   device is unspecified. 
 \v (vertical tab) Moves the active position to
   the initial position of the next vertical 
   tabulation position. If the active position 
   is at or past the last defined vertical 
   tabulation position, the behavior of the 
   display device is unspecified.

215.        How to find values of shared memory info in Solaris?

 
 # adb -k /dev/ksyms /dev/mem
 shminfo_shmmax/E  <-(you type this)
 shminfo_shmmax:  123456  <-(it shows this)

216.        How to find interface speed on solaris?

 
# ndd -get /dev/hme link_speed
 1
  
 A "1" indicates 100Mbs, a "0" is 10Mbs.

217.        How to change X resolution on solaris?

From the net.

 
In article <94nfpe$qtd$1@nnrp1.deja.com>,  <napboy@my-deja.com> wrote:
 >I'm testing KDE2 on a Ultra Sparc 5 400MHz running Solaris 8. The icons look
 >like a mess, i would like to increase the color depth of the screen colors (
  
 OK, since you probably have a darwin+ try this command:
  
 /usr/sbin/m64config -res 1152x900 -depth 24 now
  
 PS. Solaris doesn't support 16 bit graphics for some reason.
  
 /wfr
 Fredrik
---------------------------------------
 
 
You need to ensure that the X server is actually running in 24bit mode. Since you say you have
 a 400MHz Ultra 5 I think this is a Series 3 model which will beable to support 24bit at
 1152x900 but not 1280x1204. 
  
 As root you need to run fbconfig.
  
 # fbconfig -depth 24 -res 1152x900

218.        How to dump an image (executable) on solaris?

man elfdump (/usr/ccs/bin/elfdump)

elfdump file

to look at linked libraries, do elfdump -d <file>, or ldd <file> to see how these libraries are resolved locally.

219.        How to dump the symbol table of an executable?

man nm (/usr/ccs/bin/nm on solaris)

nm file

(sort of same as elfdump -s)

220.        How to show line numbers in vi?

 
       :set nu
 
or, in the file ~/.exrc include:  set number
 
To turn off, type
 
       :set nonu
 
 
To show the current line number do
 
        :=

221.        How to read UNICODE from file?

 
from net, not tested. august 23, 2001.
 
Well, one thing you're missing is the functions in <wchar.h> and
<wctype.h>. These do a locale-specific conversion from file format to
wchar_t on input, and the reverse on output. For example:
 
    FILE *f1, *f2;
    wint_t c;
 
    setlocale (LC_ALL, "Unicode);
    f1 = fopen ("oldfile", r);
    f2 = fopen ("newfile", w);
    while (c = getwc (f1), c != WEOF)
        putwc (c, f2);

222.        How to convert UNICODE to ANSI in windows and vis versa?

from the Microsoft Knowledge Base.

 
HOWTO: Convert from ANSI to Unicode & Unicode to ANSI         [oleprog]
ID: Q138813    CREATED: 29-OCT-1995   MODIFIED: 26-OCT-1999
 

223.        what is UNICODE?

 
From: Markus Kuhn (mskuhn@unrza3.dialin.rrze.uni-erlangen.de)
Subject: Re: Linux and UNICODE? 
Newsgroups: comp.os.linux.development.system, comp.std.internat
View complete thread (22 articles) 
Date: 1996/04/08 
 
A concept for ISO 10646 support in GNU recode
---------------------------------------------
 
Markus Kuhn -- 1995-04-20
 
 
The 31-bit Universal Character Set (UCS) defined in ISO 10646 is
intended as a common superset of all other existing computer character
set standards and will probably eventually replace most other
character sets in many systems.
 
 
1  Introduction
 
From the 2^31 possible UCS character codes, today only positions in
the Basic Multilingual Plane (BMP) which comprises the first 2^16 code
positions are defined. The BMP can be encoded with 16-bit values,
however is is possible that for some exotic historical character sets
and special applications, positions outside the BMP will be used in
the future.
 
The following encodings of UCS characters have been defined and might
be used in text files which recode should be able to convert:
 
  UCS-2    Only characters from the BMP can be used in this encoding
           which stores each character as a bigendian (most significant
           byte first) 16-bit value.
 
  UCS-4    The bigendian 4-byte representation of the UCS character
           number.
 
  UTF-1    A ISO 2022 compatible encoding, which encodes all ASCII
           characters as ASCII characters and other UCS characters as
           multi-byte combinations from the C0 and C1 range. Not used
           today, UTF-8 is the better alternative.
 
  UTF-7    A 7-bit encoding of UCS characters embedded in ASCII text
           designed for usage with the Internet MIME standard.
           Technically, this is a mixture of the quoted-printable and
           base64 encodings used in MIME.
 
  UTF-8    An ASCII compatible UCS encoding in which only ASCII
           characters are encoded using bytes below 128. All other 
           non-ASCII characters are encoded as multi-byte sequences
           consisting only of bytes in the range 128-253. This avoids
           critical bytes like '\0' and '/' in UTF-8 strings, which
           makes the UTF-8 encoding suitable for being handled by
           the standard C string library and being used in UNIX
           file names. Other properties include the preserved
           lexical sorting order and that UTF-8 allows easy
           self-synchronization of software receiving UTF-8 strings.
 
  UTF-16   This is an encoding, which allows UCS-2 systems to access
           over 1 million characters from the full UCS code space
           by assigning pairs of UCS-2 characters from an area reserved
           for this purpose in the BMP to characters outside the
           BMP. It is not expected that characters outside this
           1 million character area accessable by UTF-16 will ever
           be used.
 
 
Accented characters can be represented in ISO 10646 in two different
ways:
 
  - For all accented characters existing in other character set
    standards, there exist 'precomposed characters' in the UCS, e.g.
    0x017B is LATIN CAPITAL LETTER Z WITH DOT ABOVE.
 
  - Accented characters can also be composed of the code for an
    unaccented letter followed by a special non-spacing 'combining
    character' which indicates the accent. E.g., the above letter can
    also be represented as 0x005a = LATIN CAPITAL LETTER Z followed by
    0x0307 = COMBINING DOT ABOVE.
 
The ISO 10646 standard specifies 3 levels of implementation:
 
  - Level 1 allows no combining characters at all and no characters from
    the HANGUL JAMO block.
 
  - Level 2 allows in addition to level 1 a number of combining characters
    in certain scripts such as Hebrew, Arabic, Devangari, Bengali, Gurmukhi,
    Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Thai, Lao, etc. but
    not all of these combining characters and no combining characters for
    the latin script.
 
  - Level 3 allows all characters and combining combinations.
 
The Unicode 1.1 standard is a level 3 implementation of ISO 10646 BMP
using the UCS-2 or UTF-8 encoding and it specifies a little bit more
semantic of the characters than the ISO specification does. For most
character sets currently supported by GNU recode, the difference
between level 1 and 2 does not matter, so I will only refer to level 1
and 3 in the following text.

224.        how to create a character device on linux?

mknod video0 c 81 0 will create a character device called video0 with a major of 81 and minor of 0.

225.        How to convert man pages to HTML?

use man2html.

this is how I process man page for sunscreen as an example

 
$nabbasi>pwd
/usr/share/man
 
$cd cat4sunscreen
 
nabbasi>for file in `ls`; do man2html -solaris < $file > $file.html; done
 
nabbasi>cd ../cat1m
 
nabbasi>for file in `ls ss*`; do man2html -solaris < $file > $file.html; done

226.        What are the conversion programs, how to convert from one file to another?

Started doing this on 082501. Collect all programs that converts format from one to another.

See http://www.imagemagick.org/www/mogrify.html  to convert all sort of images to other formats.

 

from

to

program name

location

man files

html

man2html

 

dvi

text

dvitype

ctan

dvi

dvi

dvicopy

removes VF from dvi files

dvi

pdf

dvipdfm

ctan

WEB

pascal

tangle

ctan

HTML

pdf

htmldoc

 

tex

dvi

tex, latex

ctan

tex

pdf

pdftex

special version of tex that outputs pdf, part of teTeX

tex

pdf

pdflatex

special version of tex that outputs pdf. part of teTeX

aux

bbl

bibtex

part of latex. creates reference list.

MetaPost

Postscipt

mp

part of latex

gif

Postscript

Eps

PCX

PICT

PPM

gifconv

http://hepax6.rl.ac.uk/DELPHI/Adye/gifconv.html

 

eps

pdf

epstopdf

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=pdftexgraphics

ps

psd

Ps4pdf

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=pdftexgraphics

WMF (window media files)

EPS

Mayura

http://www.mayura.com/

227.        How to use rsh with the same environment on each host?

from the net, not tested.

 
> 
 >In our dozen-or-so Sun family I often need to execute some commands
 >remotely, as root. It is kind of annoying that the root's shell
 >(/sbin/sh) invoked that way (i.e. through a rsh from remote machine)
 >does not seem to read /.profile, so I can't make it use the PATH
 >containing more than the standard "/usr/sbin:/usr/bin".
 >
 >Is there a way to change this?
  
 I don't think so, but this is not a bad thing. It tends to make one write 
 scripts with full path name for executables.
  
 or you can write something like `xon' which carries part of the 
 environment over, like
  
 dir=`pwd`
 MYPATH=<whatever>
 rsh $target "(cd $dir; PATH=$MYPATH; <etc>; $command)" 
  
 Or more likely, commands to be run on all machines: (this one checks for 
 hang mail on client machines no
 running sendmail as a daemon.)
 #!/bin/sh
 #
 for i in <list of machines>
 do
     if [ $i != "server1" -a  $i != "server2" -a $i != server3 ] ; 
         then if /usr/sbin/ping $i 5 > /dev/null ; then
             rsh $i /usr/lib/sendmail -q
         fi
     fi
 done
  
 -- 
 http://www.math.fsu.edu/~bellenot
 bellenot <At/> math.fsu.edu 
 +1.850.644.7189 (4053fax)

228.        How to list files contained in a Solaris package?

If you know the name of the package, do as an example (package name here is SUNWetc)

pkgchk -l SUNWetc

or

grep SUNWetc /var/sadm/install/contents

229.        How to find which package a file belong to? Solaris package

Assume you want to find which package ls belong to. Do

pkgchk -l -p /usr/bin/ls

or

grep /usr/bin/ls /var/sadm/install/contents

230.        How to examine shared memory on linux?

man ipcs

231.        RPC for linux?

A linux port for OSF RPC (also called as DCE RPC) is available at several places on the internet. The following are some of them:

http://www.netwaysglobal.com/DCE/

http://www.ibiblio.org/pub/Linux/ALPHA/dce-rpc/!INDEX.html

232.        How to turn on the openboot diagnostics during the boot process for Solaris/Sparc?

This is from playing with sparc machine.

Perform the following steps to start OpenBootDiag:

 
  
       1. At the ok prompt, type:
 
          ok setenv mfg-mode on
          mfg-mode = on
         
       2. Then type:
 
          ok setenv diag-switch? true
          diag-switch? = true
 
       3. Then type:
 
          ok setenv auto-boot? false
          auto-boot? = false
  
       4. Then type:
 
          ok reset-all
 
  type  obdiag

233.        I've installed new device on Solaris sparc, but it does not see it, why?

boot -r

234.        Which file systems are mounted always at boot time in Solaris/sparc?

From the net, author unknown, not tested.

 

Filesystems /, /usr, /var, /var/sadm, /var/tmp are treated specially and mounted early during Solaris startup, before /etc/vfstab is processed (which is why they have "mount at boot" set to "no" - they are already mounted when the file is processed). /var/tmp isn't even included in /etc/vfstab.

235.        How to recover corrupted tar file?

 
Title: Re: Recovering data from corrupt tar file? 
Author: John Ekins <jre@globalnet.co.uk>
Date: Sun, 24 Dec 2000 13:05:03 +0000
 
 
Simon Lyall wrote:
> 
> Does anyone have any pointers to this? I have a 700MB tar file that is
> corrupt about half way through. At this point I get:
> 
> tar: skipping to next header
> home/temp/P
> [ repeated about 20 times ]
> tar: unexpected EOF in archive
> tar: error is not recoverable: existing now
> 
> Any pointers anyone has to recovering the data in the 2nd half of the file
> would be much appreciated.
> 
> --
> Simon J. Lyall  |  Very Busy  |  Mail: simon@darkmere.gen.nz
> "Inside me Im Screaming, Nobody pays any attention."  | eMT.
> 
> Welcome to the world of strategic analysis, where we build weapons
>     that don't work to counter threats that don't exist.
 
 
You can give this a try:
 
cat <tarfilename> | tar xf -
 
 
It's worked for me in the past.
 
----------------------------
 
Have you tried GNU tar? It may be able to recover from the errors.
 
Something else that may be worthwhile is carving a chunk out of it
with dd and dumping it to another file. If you wanted to skip over
the first 384 mb of the file and dump the remaining to another file
you could do this:
 
   dd if=tarfile.tar of=newtarfile.tar bs=512 skip=393216
 
Ideally your flavor of tar would read from newtarfile.tar discarding
data until it found a valid header. If not, the file headers are on
512 byte boundaries and you will have to meander around with dd
until you find one.
 
 
SunOS>dd if=cvsroot.tar of=newtar.tar  bs=512
4149580+0 records in
4149580+0 records out
SunOS>

236.        What are some big java applications?

from the net.

 
big java applications
 
o  Eastman Chemical B2B Exchange
o  Arrow Electronics arrow.com PRO-Series.
o  Bestoffer.com
o  Buildpoint.com E-Commerce Marketplace
o  Intellishop.com
o  NetClerk New Permit Management System
o  Pentax online catalog
o  Sparks.com Internet Storefront
o  TotalMRO.com
·        3Com Planet Project
 

I do know that AutoCAD's competitor MicroStation from Bentley comes in a Java version.

I do know that Mpower Communications (formerly MGC Communications), a regional telephone company is doing a great deal of internal development in Java.

I know NASA's got a nifty Java-based app for showing us where the shuttle is in flight (JTracker).

I know when I set my watch at www.time.gov, it shows the current atomic time (usually accurate within 1/2 second) using a Java app.

237.        How to get version of sw in linux kernel?

nabbasi> /export/c/src/linux-2.4.0/scripts/ver_linux

238.        How to write to CD on Unix/Linux?

First, use mkisofs to create an iso image on disk, then use cdwrite to write the image to the CD.

 
mkisofs  -r   -o   cd_image       private_collection/
                  `---------'   `-----------------'
                       |               |
              write output to   take directory as input
 
 
Here we mount the ISO image file on a device to make sure it OK before we
write it.
 
mount -t iso9660 -o ro,loop=/dev/loop0 cd_image /cdrom
 
 
Now write it.
 
cdwrite  --device /dev/sgd  cd_image
    or
cdrecord -v speed=2 dev=4,0 cd_image
 
 
CDRs need to be SCSI devices. From Linux you can emulate SCSI by compiling 
it into the kernel.
  
You need to disable IDE for the CDROM in the kernel, enable SCSI emulation 
and then enable SCSI for the CDR.

239.        How to use XCOPY on DOS to copy files?

 
C:\> XCOPY source destination /S/E/V/H/K/C
 
/C means "continue after error".  (The rest means something like "copy
everything from here on down, and make sure you did it right."  I'll
leave the details as an exercise.)

240.        How to output an integer with worrying about its size

I think this from Robert Dewar on the net, but do not remember now.

 
Here is my favorite example of recursion, to output an integer
without worrying about its size:
 
  with Text_IO; use Text_IO;
  procedure Print_Nat (N : Natural) is
  begin
     if N >= 10 then
        Print_Nat (N / 10);
     end if;
 
     Put (Character'Val (N mod 10 + Character'Pos ('0')));
  end Print_Nat;
 

I like this example since it is not simple tail recursion like the factorial example, and it is in fact very hard work to turn this into a loop without imposing some arbitrary limit on the length. Note that this algorithm would work fine in a language that had arbitrary precision integers.

241.        Where to get some free application servers?

Some application servers are free for development and production, whilst some are free for development, but require a runtime license. Note that you should confirm from each site whether or not any licensing terms have changed

 

jBoss 2.0 from http://www.jboss.org supports EJB 1.1, and is free for development and production

 

JRun Server 3.0 from http://www.allaire.com supports EJB 1.1, and is free for development

 

Enhydra from http://www.enhydra.org supports EJB 1.1, and is free for development and production

 

OpenEJB from http://www.openejb.org supports EJB 1.1, and is free for development and production

242.        How to use stream IO in Ada?

from the net, author unknown.

 
with Ada.Text_Io;
with Ada.Text_Io.Text_Streams;
 
procedure Show_Improper_Stream_Use is
 
  type My_Byte_Type is mod 2**8;
  for My_Byte_Type'Size use 8;
 
  Zero_Byte : My_Byte_Type := 0;
 
  File : Ada.Text_Io.File_Type;
 
begin
  Ada.Text_Io.Create(
    Name => "test_file1",
    File => File);
  Ada.Text_Io.Put_Line(
    File => File,
    Item => "Hello");
 
  for My_Byte in My_Byte_Type'range loop
    My_Byte_Type'Write(Ada.Text_Io.Text_Streams.Stream(File), Zero_Byte);
    My_Byte_Type'Write(Ada.Text_Io.Text_Streams.Stream(File), Zero_Byte);
 
 
    My_Byte_Type'Write(Ada.Text_Io.Text_Streams.Stream(File), My_Byte);
  end loop;
 
  Ada.Text_Io.Close(File);
 
end Show_Improper_Stream_Use;
 
 
 
Hex dump of first part of file:
 
00000000   48 65 6C 6C 6F 0D 0A 00  00 00 00 00 01 00 00 02 00 00 03 00 00
04 00 00   Hello...............
00000024   05 00 00 06 00 00 07 00  00 08 00 00 09 00 00 0D 0A 00 00 0B 00
00 0C 00   ....................
 
^----I don't think this should be here.

243.        How to make emacs use LF for line termination (Unix style) on windows?

set emacs to use a Unix encoding with the sequence:

C-x RET f undecided-unix

244.        How to set the editor mode for the shell on Unix?

 
If you're using the Korn shell, either (1) execute "set -o vi" at the command
line or (2) put "export EDITOR=vi" in your .profile and resource your .profile. 
Then to see the history, you can type "history" or "fc -l -n" where n represents
the number of lines you want to see.  You might find it handy to put something
like "export HISTSIZE=1000" in your .profile so you can see many lines.

245.        Hints for ftp security?

From the net, author unknown, not tested.

 
do this for ftp security:
 
4. Secure it up
 
The anonftp RPM places some binaries and libraries in the /home/ftp directories 
to allow FTP users to do things like automatically
gunzip files as they are being retrieved, or retrieve whole directories as tar files. 
There are a few extra files placed by the anonftp RPM
that probably will never be used, and should probably be removed in the interest of security. 
 
            cd /home/ftp/bin
            rm cpio sh zcat
            cd ../etc
            rm ld.so.cache
            cd ../lib
            rm ld.so* libtermcap*
 
Finally, you should change the permissions on these files to improve security. 
 
            chmod 111 ~ftp/bin/* ~ftp/bin ~ftp/etc ~ftp/lib
            chmod 444 ~ftp/etc/*
            chmod 555 ~ftp ~ftp/lib/*
 
When you're done, you should have the following: 
 
            bin:
            total 164
            ---x--x--x   1 root     root        14776 Oct 31 09:54 compress
            ---x--x--x   1 root     root        45277 Oct 29 21:59 gzip
            ---x--x--x   1 root     root        22977 Oct 29 20:07 ls
            ---x--x--x   1 root     root        77873 Oct 25 17:49 tar
 
            etc:
            total 2
            -r--r--r--   1 root     root          495 Mar 20 19:46 group
            -r--r--r--   1 root     root          921 Mar 20 19:45 passwd
 
            lib:
 
            total 702
            -r-xr-xr-x   1 root     root        20994 Oct 30 18:58 ld-linux.so.1
            -r-xr-xr-x   1 root     root        20994 Oct 30 18:58 ld-linux.so.1.7.5
            lrwxrwxrwx   1 root     root           13 Mar 20 19:43 libc.so.5 -> libc.so.5.0.9
            -r-xr-xr-x   1 root     root       669157 Oct 30 19:53 libc.so.5.0.9
 
If you're missing any of these files, re-install the anonftp RPM and try again.To 
see the permissions as shown aboive type the command 
 
            ls -al
 
You will get the listings as shown above 
 
Now that everything's secure, you're ready to create a pub directory where you can place 
files for access via anonymous FTP. 
 
            mkdir ~ftp/pub
            chmod 555 ~ftp/pub
 
Place any files you want to make available via FTP in the pub directory. You can 
make subdirectories in pub as well. 
 
For security, and to make sure anonymous users can read the files, all files in pub should be set to mode 444, and all directories to mode
555. Do this with: 
 
            chmod 444 (name-of-file)
            chmod 555 (name-of-directory)
 
Some sites have an ``incoming'' directory, where users can drop off files to be 
added to your archive. I do not recommend this unless it's
absolutely necessary, since such directories are inevitably abused by pirated-software 
traders and the like (Note: Under US Federal Law a
site is responsiable for its content). If you want an incoming directory anyway: 
 
            mkdir ~ftp/incoming
            chmod 333 incoming
 
The mode 333 means that people will be able to change into the directory, and place 
files there, but not list any files in the directory. This
will deter improper use somewhat, but don't put too much faith in it - again, the 
best way to make sure an incoming directory isn't
abused is not to have one. If you do have an incoming directory, check it daily 
and clean out anything you don't want around. 
 
You're all set! For security, make sure that nothing below /home/ftp is writeable by anyone: 
 
            chmod -R a-w ~ftp
 
(You'll still be able to write to the FTP directories as root.)

246.        What is the difference between MPEG and JPEG?

From the net. Author unknown.

The most fundamental difference between MPEG and JPEG is MPEG's use of block-based motion compensated prediction (MCP), a general method falling into the temporal DPCM, category.

247.        How to call fortran from Ada?

 
Title: Re: Anyone have an example of a Fortran call from within Ada. 
Author: gisle@struts.ii.uib.no (Gisle Sælensminde)
Date: 10 Jun 2000 16:47:14 +0200
 
 
 
In article <4W505.4421$Q7.174416@news-east.usenetserver.com>, Ken Parrish wrote:
>I need to make a FORTRAN subroutine call from within Ada...  Anyone have any
>suggestions?
> 
> 
Look in a text book for interfacing to fortran. Anyway - here is an
example of binding a Fortran subroutine doing matrix multiplication
 
If you use GNAT and g77, you can compile with the following commands:
 
% g77 -c matmul.f
% gnatmake fortranbind.adb -largs matmul.o
 
 
First the Fortran subroutine:
 
C     Calculates the product of two square matrices MAT1 and MAT2 of
C     dimension N, and returns the answer in MAT3.
 
      SUBROUTINE MATMUL(MAT1, MAT2, MAT3, N)
      
      INTEGER*4 N,I,J,K
      DOUBLE PRECISION MAT1(N,N), MAT2(N,N), MAT3(N,N)
      DOUBLE PRECISION SUM
 
      DO I = 1,N
         DO J = 1, N
            SUM = 0.0
            DO K = 1,N
               SUM = SUM + MAT1(I,K) * MAT2(K,J) 
            END DO
            MAT3(I,J) = SUM
         END DO
      END DO
 
      END
 
 
Then the Ada example program:
 
with Interfaces.Fortran;
with Ada.Text_IO; use Ada.Text_IO;
 
procedure Fortranbind is
 
   package Fortran renames Interfaces.Fortran;
 
   type Fortran_Matrix is array(Positive range<>,
                                Positive range<>) of Fortran.Double_precision;
 
   -- This ensure that the matrix is in column-major form like
   -- fortran requires.
   pragma Convention(Fortran, Fortran_Matrix);
 
   procedure Fortran_Matmul(Mat1, Mat2: in Fortran_Matrix;
                            Mat3 : out Fortran_Matrix;
                            N : in Fortran.Fortran_Integer);
 
   -- Declare that the "Fortran_Matmul" is a fortran procedure
   -- with linker name "matmul_". Since Fortran compilers often
   -- inserts underscore on different places, even on the same
   -- platform.
 
   pragma Import(Fortran, Fortran_Matmul, "matmul_");
 
   
   -- The matrices to be multiplied.
   Mat1 : Fortran_Matrix := ((1.0, 0.0, 0.0, 0.0),
                            (0.0, 1.0, 0.0, 0.0),
                            (0.0, 0.0, 1.0, 0.0),
                            (0.0, 0.0, 0.0, 1.0));
 
   Mat2 : Fortran_Matrix := ((1.0, 0.0, 0.0, 0.0),
                            (0.0, 1.0, 0.0, 0.0),
                            (0.0, 0.0, 1.0, 0.0),
                            (0.0, 0.0, 0.0, 1.0));
 
   Mat3 : Fortran_Matrix(1..4,1..4);
 
 
begin
   -- Call the fortran subroutine.
   Fortran_Matmul(Mat1, Mat2, Mat3, Mat1'Length(1));
 
   -- print out the result
   for I in Mat3'Range(1) loop
      for J in Mat3'Range(1) loop
         Put(Fortran.Double_Precision'Image(Mat3(I,J)) & " ");
      end loop;
      New_Line;
   end loop;
end;

248.        How to use gdb to look at linux kernel image, debugging linux kernel?

 
ernel core (/proc/kcore) format
CONFIG_KCORE_ELF
  If you enabled support for /proc file system then the file 
  /proc/kcore will contain the kernel core image. This can be used 
  in gdb:
 
  $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
 
-------------------------
 
HOw do I compile kernel in -g ?? find out.
 
 This is especially useful if you have compiled the kernel with the 
  "-g" option to preserve debugging information.
 
--------------------------------------
 
"Linux Kernel Module Programming Guide" by Ori Pomerantz
 
------------------------------
 
I think printk() is the easiest way to debug.
You can see plenty of uses of it in drivers for examples.
Depending on your environment, the messages may or may not appear on
your command line.  In any case the messages are appended to the end of
/var/log/messages

249.        What is NIS and what is it used for?

NIS was formerly known as the Yellow Pages, or YP. With NIS you have the same passwd and group files (same uid and gid) and can be placed into the same home directory on each of your machines.

250.        What is DNS and what is it used for?

DNS is a name service. It translates a host name (such as www.sunw.com) to an IP address.

251.        How to use Java in Makefiles under cygwin using windows JDK, classpath problems?

Install the windows JDK as you would normally do.

use the same Makefiles from Unix under cygwin. The only trick to do is to use the command cygwin --path --window on the CLASSPATH before passing it to javac and to quote the classpath. Like this from my Makefiles:

 
CLASSPATH =  ... set your class path here as normall ....
 
OS              := $(subst /,_,$(shell uname -s))
 
ifeq ($(OS),CYGWIN_NT-5.0)
CLASSPATH := $(shell cygpath --path --windows $(CLASSPATH))
endif
 
#this is the rule to use, notice the quotes around CLASSPATH variable.
 
.java.class :
        $(JAVA_COMPILER) $(JAVA_COMPILER_OPTIONS) -classpath "$(CLASSPATH)" $<

252.        How to find if a connection exist with some host?

Use netstat. On Solaris at least, type

netstat -a | grep -i hostname

253.        Why is ifconfig -a showing a different netmask than what is in /etc/netmasks?

by Nasser (added 090601)

 

On my of the machines at work, ifconfig -a was showing a netmask that is different from what /etc/netmasks was saying. It turned out that the file /etc/nsswitch.conf was pointing to nis for the netmask. when using nis to find the netmask, the mask for the network class my machine IP indicated was set to use a different netmask than the one in /etc/netmasks.

 
$ cat /etc/netmasks 
 
#
# The netmasks file associates Internet Protocol (IP) address
# masks with IP network numbers.
# 
#       network-number  netmask
#
# The term network-number refers to a number obtained from the Internet Network
# Information Center.  Currently this number is restricted to being a class
# A, B, or C network number.  In the future we should be able to support
# arbitrary network numbers per the Classless Internet Domain Routing
# guidelines.
#
# Both the network-number and the netmasks are specified in
# "decimal dot" notation, e.g:
#
#               128.32.0.0 255.255.255.0
#
157.57.0.0      255.255.254.0   <----- why does this not match ifconfig -a ??
                                       i.e. FFFFFE00  ??
 
 
$ ifconfig -a
 
le0: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu 1500
        inet 157.57.204.52 netmask ffffff00 broadcast 157.57.204.255
                                  ^^^^^^^^^^
 
Lets look at nsswitch to see where the machine is reading the netmask from:
 
$ cat /etc/nsswitch.conf 
 
#
# /etc/nsswitch.nis:
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# uses NIS (YP) in conjunction with files.
#
# "hosts:" and "services:" in this file are used only if the
# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.
 
# the following two lines obviate the "+" entry in /etc/passwd and /etc/group.
passwd:     files nis
group:      nis files
 
# consult /etc "files" only if nis is down. 
hosts:      dns nis [NOTFOUND=return] files
networks:   nis [NOTFOUND=return] files
protocols:  nis [NOTFOUND=return] files
rpc:        nis [NOTFOUND=return] files
ethers:     nis [NOTFOUND=return] files
netmasks:     nis [NOTFOUND=return] files
bootparams: nis [NOTFOUND=return] files
publickey:  nis [NOTFOUND=return] files
 
netgroup:   nis
 
automount:  files nis
aliases:    files nis
 
# for efficient getservbyname() avoid nis
services:   files nis
sendmailvars:   files
 
 
Notice in the above, it says to use nis. 
Lets look at what nis says to use as netmask for my class (class B, which
has network id of 157.57.0.0
 
$ ypcat -k netmasks.byaddr | grep 157.57 
157.57.196.61 255.255.254.0
157.57.212.0 255.255.255.0
157.57.210.0 255.255.254.0
157.57.208.0 255.255.254.0
157.57.202.0 255.255.254.0
157.57.200.0 255.255.254.0
157.57.183.0 255.255.255.0
157.57.0.0 255.255.255.0      <-------- this is the netmask.
 
$  ypcat -h                
Usage:
        ypcat [-k] [-d domainname] [-t] mapname
        ypcat -x
where
        mapname may be either a mapname or a nickname for a map.
        -t inhibits map nickname translation.
        -k prints keys as well as values.
        -x dumps the map nickname translation table.
 
$  ypcat -x
Use "passwd"    for map "passwd.byname"
Use "group"     for map "group.byname"
Use "networks"  for map "networks.byaddr"
Use "hosts"     for map "hosts.byname"
Use "protocols" for map "protocols.bynumber"
Use "services"  for map "services.byname"
Use "aliases"   for map "mail.aliases"
Use "ethers"    for map "ethers.byname"

254.        How does Solaris find the nis server (for use by yp commands)?

by Nasser (added 090601)

 

The file /etc/defaultdomain lists the NIS domain.

# cat /etc/defaultdomain
WTVDevNet

in /var/yp/binding there is a directory with the domain name, which contains a file called ypservers which lists the NIS servers

# cat /var/yp/binding/WTVDevNet/ypservers
gort.artemis.com
tobor.artemis.com

 

255.        Where are bookmark folder kept with IE browser?

For user nabbasi, it is located under this folder:

 

C:\Documents and Settings\USER\Favorites\

 

256.        Where does Netscape 7 keeps the email?

C:\Documents and Settings\USER\Application Data\Mozilla\Profiles\default\yy8ocovo.slt\Mail\mail.covad.net

257.        How to view postscript files on windows?

Need to install gohstscript and next install gsview. Go to http://www.cs.wisc.edu/~ghost/

 

258.        How to Convert a document to PDF on windows? (such as Mathematica note book?)

Create a printer device using windows printer wizard. Select a post script printer. I found this works: (cannon PS):

 

 

Select PRINT TO FILE when creating it. Call it POSTSCRIPT so to know.

Then from the application, such as WORD or Mathematica, select print to a FILE. Save as .PS extension.

Now start GSVIEW, and OPEN the .PS file. The select CONVERT, and choose PDFWriter as the device:

 

Enter a name for the output, which will be a .PDF file.

That is all.

 

3.Latex  HOW TO

259.        how to configure latex on cygwin?

install latex as part of cygwin downloads, then read the file

/usr/doc/Cygwin/tetex-beta-20001218.README

260.        How to put a box around verbatim?

 
This is what I do. Make sure the new env. macro is written as is, starting
from first column (ie. watch for spaces, it is sensitive). The only problem
with this, is that latex2thml does not know how to process it. So, if you
plan to use latex2html, this might not work for you.
 
\usepackage{fancybox}
 
\newenvironment{VBox}%
 {\VerbatimEnvironment
   \begin{Sbox}\begin{BVerbatim}
}%
 {
\end{BVerbatim}\end{Sbox}
  \setlength{\fboxsep}{8pt}\fbox{\TheSbox}}
 
 
\begin{document}
 
\begin{VBox}
       This verbatim stuff
       will  have a box
       around it
\end{VBox}
      
\end{document}

261.        notes on setting paper size in latex and dvips

 
From: David Carlisle (carlisle@ma.man.ac.uk)
Subject: Re: Change papersize default in teTeX?
Date: 1996/09/06
 
> Can someone offer me a clue or two about where to look? I'd like to 
> change the paper size in LaTeX and the dvi driver(s)
 
The default paper size for LaTeX is *always* US letter size.
 
The default paper size for dvips is normally set in config.ps
 
David
 
-----------------------------------------
 
From: Timothy Murphy (tim@maths.tcd.ie)
Subject: Re: Changing paper size/orientation in LaTeX2e
Date: 1995/11/12 
 
>I'd like to be able to print on several different sizes of paper,
>sometimes in landscape or seascape.
 
You probably have to do 2 things:
 
(1) Say eg \documentclass[landscape,a4paper]{article}
 
(2) Tell dvips (assuming you are using that like everyone else).
In the case of landscape you can do this by saying
 
\landscape
 
in the preamble to your LaTeX document,
or by giving the appropriate switch to dvips:
 
% dvips -t landscape ...
 
(3) To change the paper size for one document you can give the -t switch.
To change it for many you should edit your .../config.ps ,
or create a new config.ps, eg a5.ps, and then say
 
% dvips -P a5 ...
 
---------------------------------
making pdflatex also uses different paper size?
 
 
 Anyway, you put this in the document:
  \setlength{\pdfpagewidth}{\paperwidth}
  \setlength{\pdfpageheight}{\paperheight}
That's for LaTeX, of course, and assumes you set 
\paper... by the appropriate \documentclass option 
(or accept letterpaper as the default). 
 
 
NOTE: use geometry package, easist.
Also, make sure you do NOT use the anysize package, it seem to overrid
what geometry does, and it flips things back to letter size.

262.        How to make latex2html (version 2000) not use absolute path for images?

nasser abbasi, added 092391

Problem was that l2h was generating HTML with image SRC as absolute path to where the .PNG files were on my disk. This is OK, but if I move the page somehere else, it will break.

A solution is this: in the latex document do something like this:

 
%\begin{latexonly}    <---- this not commented !
\begin{figure}[htbp]
\centering
\label{fig:firstimage}
 
  \includegraphics[scale=0.60]{webtv_first_view}
 
\label{fig:webtv_first_view.vsd}
\vspace{0.2 in}
\caption{MSNtv general overview}
\end{figure}
%\end{latexonly}   <---- this not commented !
 
 
\htmladdimg{../webtv_first_view.png}

In the above, it will generate this HTML:

 
P>
<IMG
 ALIGN="BOTTOM" BORDER="0" SRC="../webtv_first_view.png"
 ALT="webtv_first_view.png">

So, it is a RELATIVE path. which is what I wanted.

263.        How to generate PDF from Latex?

by Nasser Abbasi, added 092201.

 
Ok, this is a tough one. I spend 8 hours on this, but finally it works.
This is on Solaris.
 
To generate PDF from Latex, use pdflatex <file.tex>
 
Downloaded and installed AFLP ghostscript 7.0 from sources (There is
a solaris package for 6.0 also, but I wanted to upgrade to 7.0).
 
build gs 7.0, and installed it. (needed to first download the libjpeg
source code and libpng source code).
 
also downloaded ghostscript 6.0 standard fonts and extracted that into some 
directory. Need this, make sure you add it to the GS_LIB path as shown below!
 
Ok, after installing gs 7.0, edited .bashrc and added this:
 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export GS_LIB=/usr/openwin/lib/X11/fonts/Type1:
              /usr/openwin/lib/X11/fonts/Type3: 
              /export/home/nabbasi/data/GHOSTSCRIPT_related/GS_stadard_fonts_6.0
 
OK, now for the latex stuff itself. 
 
Used VISIO to make the drawing. Then for each diagram, I saved it as .png
and also as .eps. This is imporant: Make sure when saving as eps, NOT to select
the "include TIFF preview". This was causing epstopdf to fail.
 
Now, for each diagram, say X, I will have 3 files: X.vsd, X.png, X.eps.
 
Now in latex document do this:
 
\documentclass[10pt]{report}
\usepackage[]{graphicx}         
 
NOtice above, do not use any specific options to ps or pdf.
 
Now to include the image do:
 
\begin{figure}[htbp]
\centering
\label{fig:firstimage}
\includegraphics[scale=0.60]{picture}
\vspace{0.2 in}
\caption{some caption}
\end{figure}
 
Notice in the above, the picture file has NO extension, i.e. no .eps nor .pdf,
pdflatex and latex will select the correct file extension.
 
This is the makefile I used to build my report for one of my projects
as an example:
 
------------ Makefile -----------------
all:
        if test -d webtv.old; then \
                rm -rf webtv.old;  \
        fi;                             \
        if test -d webtv    ; then \
                mv webtv webtv.old;  \
        fi; \
        echo "Removing webtv.toc"
        rm -f webtv.toc
        ls -l webtv.toc
        latex webtv
        latex webtv
        latex webtv
        dvips webtv -o webtv.ps
        echo "Removing webtv.toc"
        rm -f webtv.toc
        rm -f webtv.aux
        ls -l webtv.toc
        ./generate_pdf.sh
        pdflatex  webtv
        pdflatex  webtv
        pdflatex  webtv
        latex2html -split 0 -auto_navigation  -local_icons \
                   -numbered_footnotes -show_section_numbers -short_extn webtv 
 
 
----------- end of Makefile ---------------- 
 
The file generate_pdf.sh above is simply a script which generates .pdf from
all my .eps files. (this is becuase PDF can't include eps).
 
------ start of file ------
bash-2.03$ more generate_pdf.sh 
#!/bin/sh
for file in *.eps
do
echo "processing $file"
epstopdf $file
done
---- end of file ------

264.        How to install latex2html under windows?

by Nasser Abbasi, added 081601.

The final tree structure will be like this:

 
                       /cygdrive/c
                            |
   -----------------------------------------------------------------------
   |              |          |          |            |                   |
 texutils        gs         Perl     Ghostgum     LATEX2HTML           usr
   |              |          |          |            |                   |
  netpbm         gs7.00     bin        gsview       bin                local
   |              |          |          |            |                   |
   bin           bin        Perl.exe   gsview32.exe latex2html.bat      bin
                  |                                                      |
                 gswin32c.exe                                          perl.exe
                                     
 
 
                       /cygdrive/f
                           |
                    ------------------
                           |
                          nabbasi
                           |
                          data
                           |
                         texmf 
                           |
                         miktex
                           |
                          bin
                           |
                          latex
  1. create directory c:\textutils .
  2. Download netpbm.zip (or netpbm.cab) from ftp://miktex.sourceforge.net/pub/miktex/util/netpbm . Extract into c:\textutils , this will create a directory c:\textutils\netpm\
  3. download and install MikTex. Install into c:\texmf and c:\localtexmf . (or anywhere of your choice).
  4. download and install Ghostscript from http://www.cs.wisc.edu/~ghost/index.html . Install into c:\gs .
  5. download and install gsview from http://www.cs.wisc.edu/~ghost/index.html . Install into c:\Ghostgum\ .
  6. download and install Perl for widnows from http://aspn.activestate.com/ASPN/Downloads/ActivePerl/ . Install into c:\perl .
  7. Download latex2html from http://saftsack.fs.uni-bayreuth.de/~latex2ht/current/ . When writing this, latex2html-2k.1beta.tar.gz was the latest release. gunzip and untar the file into some directory, say c:\temp\latex2html .
  8. Edit the file pref.pm in the above directory.
9.   
10.line 123
11. 
12.$prefs{'EXTRAPATH'}='C:\\GS\\GS7.00;C:\\TEXUTILS\\NETPBM\\BIN';
13. 
14.line 129
15. 
16.$prefs{'PREFIX'}= 'C:\\LATEX2HTML';

17.  using windows system icon, add to the PATH the needed components (must do this, since the EXTRAPATH above does not seem to work, at least for finding gswin32c.exe, but when I added it to the PATH for windows, then config.bat did find gs. The same applies for the netpbm binaries. So the above EXTRAPATH setting in pref.pm is pretty much not needed for windows configuration.

18. 
19.c:\Perl\bin\;f:\nabbasi\data\texmf\miktex\bin;c:\latex2html\bin;c:\gs\gs7.00\bin;C:\TEXUTILS\NETPBM\BIN

20.  set temp space. continue with pref.pm configuration, look for the line below and set to where you want temporary space to be used

21. 
22.$prefs{'TMPSPACE'} = 'F:\TEMP';

23.  configure latex2html

24. 
25.F:\temp\latex2html>config
26.Starting Configuration...
27. 
28.config.pl, Release 2K.1beta (Revision 1.35)
29.Accompanies LaTeX2HTML, (C) 1999 GNU Public License.
30. 
31.checking for old config file (cfgcache.pm)... not found (ok)
32.checking for platform... MSWin32 (Windows 32 bit)
33.win32, setting GS to gswin32cchecking for c:\Perl\bin\Perl.exe... c:\Perl\bin\Perl.exe
34.checking perl version... 5.006001
35.checking if perl supports some dbm... yes
36.checking if perl globbing works... yes
37.checking for tex... f:\nabbasi\data\texmf\miktex\bin\tex.exe
38.checking for latex... f:\nabbasi\data\texmf\miktex\bin\latex.exe
39.checking for initex... f:\nabbasi\data\texmf\miktex\bin\initex.exe
40.checking for kpsewhich... no
41.checking for TeX include path... NONE
42.Warning: Will not automatically install LaTeX2HTML style files.
43.checking for dvips... f:\nabbasi\data\texmf\miktex\bin\dvips.exe
44.checking dvips version...
45.5.86
46.checking if dvips supports the combination of -E and -i -S 1... yes
47.checking for html4-check... no
48.checking for gswin32c... c:\gs\gs7.00\bin\gswin32c.exe
49.checking for ghostscript version... 7.00
50.checking for ghostscript portable bitmap device... pnmraw
51.checking for full color device for anti-aliasing... ppmraw
52.checking for ghostscript library and font paths... built-in paths are correct
53.checking for pnmcrop... C:\TEXUTILS\NETPBM\BIN\pnmcrop.exe
54.checking if pnmcrop can crop from one direction... yes
55.checking for pnmflip... C:\TEXUTILS\NETPBM\BIN\pnmflip.exe
56.checking for ppmquant... C:\TEXUTILS\NETPBM\BIN\ppmquant.exe
57.checking for pnmfile... C:\TEXUTILS\NETPBM\BIN\pnmfile.exe
58.checking for pnmcat... C:\TEXUTILS\NETPBM\BIN\pnmcat.exe
59.checking for pbmmake... C:\TEXUTILS\NETPBM\BIN\pbmmake.exe
60.checking for ppmtogif... C:\TEXUTILS\NETPBM\BIN\ppmtogif.exe
61.checking if ppmtogif can make transparent GIFs... yes
62.checking if ppmtogif can make interlaced GIFs... yes
63.checking for pnmtopng... C:\TEXUTILS\NETPBM\BIN\pnmtopng.exe
64.checking if multiple pipes work... no
65.Unfortunately multiple pipes are not reliable on this OS.
66.checking for temporary disk space... C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp
67.creating cfgcache.pm
68.creating test.bat
69.creating install.bat
70.Note: Will install...
71.      ... executables to   : C:\LATEX2HTML\bin
72.      ... library items to : C:\LATEX2HTML
73.Starting build...
74.... building latex2html
75.build.pl (Revision 1.5)
76.Building "latex2html.bat" from "latex2html.pin"
77.... building pstoimg
78.build.pl (Revision 1.5)
79.Building "pstoimg.bat" from "pstoimg.pin"
80.... building texexpand
81.build.pl (Revision 1.5)
82.Building "texexpand.bat" from "texexpand.pin"
83.... building configuration module
84.build.pl (Revision 1.5)
85.Building "l2hconf.pm" from "l2hconf.pin"
86.Configuration procedure finished

87.  This is important: Edit the file l2hconf.pm and change this line as shown (assuming you have installed Perl on C:\perl .

88. 
89.$PERL = 'c:\Perl\bin\Perl.exe';
90.#$PERL = '/usr/bin/perl';

91.  run the test.bat

92. 
93.... checking latex2html
94.F:\nabbasi\data\latex2html-2K.1beta.missing_pstoimage\latex2html.bat syntax OK
95.... checking texexpand
96.F:\nabbasi\data\latex2html-2K.1beta.missing_pstoimage\texexpand.bat syntax OK
97.... checking pstoimg
98.F:\nabbasi\data\latex2html-2K.1beta.missing_pstoimage\pstoimg.bat syntax OK
99.*** Running F:\nabbasi\data\latex2html-2K.1beta.missing_pstoimage\latex2html.bat -test_mode          l2htest.tex
100. This is LaTeX2HTML Version 2K.1beta (1.55)
101. by Nikos Drakos, Computer Based Learning Unit, University of Leeds.
102.  
103. Revised and extended by:
104.  Marcus Hennecke, Ross Moore, Herb Swan and others
105. ...producing markup for HTML version 3.2
106.  
107.  
108.  
109. Loading F:\nabbasi\data\latex2html-2K.1beta.missing_pstoimage\versions\html3_2.pl
110.  
111.  *** processing declarations ***
112.  
113. Loading F:\nabbasi\data\latex2html-2K.1beta.missing_pstoimage\versions\latin1.pl
114. OPENING F:\nabbasi\data\latex2html-2K.1beta.missing_pstoimage\tests\l2htest.tex
115.  
116. Cannot create directory l2htest\: File exists, reusing it.
117. Reusing directory l2htest\:
118.  
119. Note: Working directory is F:\nabbasi\data\latex2html-2K.1beta.missing_pstoimage\tests\l2htest
120. Note: Images will be generated in F:\TEMP\l2h928
121.  
122. texexpand V2K.1beta (Revision 1.11)
123.  
124.  
125.  
126. Loading F:\nabbasi\data\latex2html-2K.1beta.missing_pstoimage\styles\texdefs.perl...
127. Loading F:\nabbasi\data\latex2html-2K.1beta.missing_pstoimage\styles\article.perl
128. Reading ...
129. ++
130. @@@
131.  
132. Doing .\basic.tex
133. %%%
134.  *** opening brace #27  is unmatched ***
135.  preceding: \Large Large and {\bf boldface
136.  
137.  
138.  *** opening brace #28  is unmatched ***
139.  preceding: \bf boldface
140.  
141.  
142. Processing macros ...++
143. @@@@@@@@@@@@@@@@@@@@
144.  
145. Doing .\basicinc.tex
146. %%%
147.  *** matching brace #28 found ***
148.  
149.  *** matching brace #27 found ***
150.  
151. Processing macros ...++
152. @@@@@@@@@@@
153.  
154. Doing .\formulas.tex
155. %%
156. Processing macros ...++
157. @@@
158.  
159. Translating ...
160. 0/6:top of l2htest:"LaTeX2HTML Test Document" for l2htest.html
161.  
162.  *** translating preamble ***
163. ....
164.  *** preamble done ***
165. ;;.
166.  
167. 1/6:section:.."Some basic stuff" for node1.html
168. ;..;
169.  
170. 2/6:subsection:..."Fonts" for node2.html
171. ;.......................;..
172.  
173. 3/6:subsection:..."Lists" for node3.html
174. ;.,..,..;.
175.  
176. 4/6:subsection:..."Table" for node4.html
177. ;..,..;.
178.  
179. 5/6:section:.."Mathematic formulas" for node5.html
180. ;.,.,;..
181.  
182. 6/6:sectionstar:.."About this document ..." for node6.html
183. ;;.
184.  
185. Doing section links ................
186. Unknown commands: basicinc formulas
187. Done.
188.  
189. To view the results, point your browser at:
190. file:///F|/nabbasi/data/latex2html-2K.1beta.missing_pstoimage/tests/l2htest/index.html

191.                   run install.bat

192.  
193. ...
194. Info: Installed C:\LATEX2HTML\bin\latex2html.bat
195. Info: Installed C:\LATEX2HTML\makemap
196. Info: Installed C:\LATEX2HTML\makeseg\makeseg
197. Info: Installed C:\LATEX2HTML\makeseg\makeseg.tex
198. Info: Installed C:\LATEX2HTML\readme.hthtml
199. Info: Installed C:\LATEX2HTML\styles\afrikaan.perl
200. Info: Installed C:\LATEX2HTML\styles\alltt.perl
201. Info: Installed C:\LATEX2HTML\styles\american.perl
202. Info: Installed C:\LATEX2HTML\styles\amsart.perl
203. Info: Installed C:\LATEX2HTML\styles\amsbook.perl
204. Info: Installed C:\LATEX2HTML\styles\amsfonts.perl
205. ...

265.        How to configure latex2html to run on cygwin

 
Need 2 things.
Download netpbm for sygwin and install it. From
ftp://ftp.uni-erlangen.de/pub/pc/gnuwin32/cygwin/porters/Humblet_Pierre_A/V1.1
 
Download latex2html from http://www.latex2html.org/ and build it. See the INSTALL file.
 
Also see these notes on http://www.cs.utexas.edu/users/suvrit/work/l2h.html
Here they are copied below in case the above page goes away:
 

Latex2Html on cygwin

This page gives simple instructions for getting the nice tool
Latex2Html up and running on a cygwin system.

  1. Get the latest beta version of latex2html
  2. Be sure your cygwin has perl
  3. Get the netpbm programs for cygwin (search on google)
  4. Make sure the netpbm tools are in your path.   I have latest (June 2005) netpbm v 10.28 in F:\nabbasi\data\CDROM\DVD_2\CYGWIN\netpbm
    go there and do ./configure
      I took all defaults
    then do ‘make’

    make package pkgdir=/usr/local/bin/netpbm

    ”Netpbm has been successfully packaged under directory
     /usr/local/bin/netpbm.  Run 'installnetpbm' to install it on your system.”

    ./installnetpbm

  5. Untar latex2html
  6. In the latex2html directory there is a file called L2hos.pm
  7. Edit this file by replacing $^O with 'unix'
  8. run ./configure   currently I have it saved in F:\nabbasi\data\CDROM\DVD_2\CYGWIN\LATEXHTML 
  9. You should me all set. Just do a make and make install
  10. While running latex2html explicitly specify a tmp directory
  11. With MikTeX included figures won't be processed correctly

I tried this out on a MikTeX distribution. I guess with the teTeX distribution we won't need to edit prefs.pm
Good Luck

 

 

Note: If you get this error

“unable to remap” when running perl or latex2html, try the command

rebaseall –v

 

to fix cygwin DLL libraries.

Then do ./configure

Make

Make install

To insall latex2html on cygwin

 

Note: If you get an error from latex2html that “no such image file ‘’”, this means netpbm problem.

Make sure you instll netpbm ok, and install Latex2html After words, and the path for netpbm is set OK.

 

---- my notes:

I can’t get it to run on cygwin.

Installation went ok, but when I try latex2html foo.tex

I get

 

$ latex2html foo

Fatal (use l2hconf): l2hconf.pm did not return a true value at (eval 7) line 2.

BEGIN failed--compilation aborted at (eval 7) line 2.

 

I am getting this error building netpbm

(I reinstalled libpng-devel again from setup.exe cygwin, and now error gone)

 

gcc  -o pnmtopng pnmtopng.o pngtxt.o \

  `/cygdrive/f/nabbasi/data/CDROM/DVD_2/CYGWIN/netpbm/netpbm-10.28/buildtools/libopt /cygdrive/f/nab

basi/data/CDROM/DVD_2/CYGWIN/netpbm/netpbm-10.28/lib/cygnetpbm10.dll  libpng.so libz.so` \

  -lm

libopt results: ' /cygdrive/f/nabbasi/data/CDROM/DVD_2/CYGWIN/netpbm/netpbm-10.28/lib/cygnetpbm10.dl

l -lpng -lz'

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lpng

collect2: ld returned 1 exit status

make[2]: *** [pnmtopng] Error 1

make[2]: Leaving directory `/cygdrive/f/nabbasi/data/CDROM/DVD_2/CYGWIN/netpbm/netpbm-10.28/converte

r/other'

make[1]: *** [other/all] Error 2

make[1]: Leaving directory `/cygdrive/f/nabbasi/data/CDROM/DVD_2/CYGWIN/netpbm/netpbm-10.28/converte

r'

make: *** [converter/all] Error 2

 

 

July 9,2005.

I am getting this error when I run ./configure in latex2html

$ ./configure

creating cache ./config.cache

checking for perl... /usr/bin/perl

checking whether #! works in shell scripts... yes

launching proprietary configuration...

 

config.pl, Release 2002-2-1 (Revision 1.49)

Accompanies LaTeX2HTML, (C) 1999 GNU Public License.

 

checking for old config file (cfgcache.pm)... loaded

checking for platform... cygwin (assuming unix)

checking for /usr/bin/perl... /usr/bin/perl

checking perl version... 5.008007

checking if perl supports some dbm... yes

checking if perl globbing works... yes

checking for /usr/bin/tex... /usr/bin/tex

checking for /usr/bin/latex... /usr/bin/latex

checking for /cygdrive/c/texmf/miktex/bin/initex... /cygdrive/c/texmf/miktex/bin/initex

checking for /usr/bin/kpsewhich... /usr/bin/kpsewhich

checking for kpsewhich syntax...       7 [main] perl 3856 fixup_mmaps_after_fork: WARNING: VirtualPr

otectEx to return to previous state in parent failed for MAP_PRIVATE address 0x18460000, Win32 error

 87

    381 [main] perl 3856 fixup_mmaps_after_fork: WARNING: VirtualProtect to copy protection to child

 failed forMAP_PRIVATE address 0x18460000, Win32 error 87

    583 [main] perl 3856 fixup_mmaps_after_fork: ReadProcessMemory (2nd try) failed for MAP_PRIVATE

address 0x18460000, Win32 error 87

C:\cygwin\bin\perl.exe (3856): *** recreate_mmaps_after_fork_failed

     14 [main] perl 340 fork_parent: child 3856 died waiting for dll loading

updating cache ./config.cache

creating ./config.status

creating Makefile

 

If everything went well,  you may run 'make'

 

win@toshiba-user /cygdrive/f/nabbasi/data/CDROM/DVD_2/CYGWIN/LATEXHTML/latex2html-2002-2-1

$

 

 

 

Error while converting image

Converting image #139

pstoimg: Error: "/usr/local/bin/netpbm/bin//pnmcrop -verbose  < /cygdrive/c/Temp/l2h3472/p2504.pnm |

 /usr/local/bin/netpbm/bin//ppmquant -floyd 256 | /usr/local/bin/netpbm/bin//pnmtopng -interlace -tr

ans 'gray85'  > img139.png" failed:

 

 

 

 


Suvrit Sra
Last modified: Tue Jan 8 20:21:10 CST 2002
 
 
Converting image #3
Debug (syswait): Running "/usr/bin/perl /usr/local/bin/pstoimg -type png -debug -tmp/cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452 -discard -interlace -antialias -depth 1 -scale 1.6 -geometry 37x8 -margins 58,72 -crop abls -transparent -out img3.png /cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452/image003.ps"
 at /usr/local/bin/latex2html line 4165
pstoimg V99.2beta8 (Revision 1.11, Perl 5.008007)
pstoimg: Temporary directory is /cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452
pstoimg: Processing /cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452/image003.ps
pstoimg: EPSF dimensions are 43x15
pstoimg: Running /usr/bin/gs  -sDEVICE=ppmraw -g69x24  -r115 -dTextAlphaBits=4  -sOutputFile=/cygdri
ve/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452/p5040.pnm
GS>-57 -706 translate
GS>(/cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452/image003.ps) run
GS>showpage
GS>quit
 
GPL Ghostscript 8.15 (2004-09-22)
Copyright (C) 2004 artofcode LLC, Benicia, CA.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>GS>>>showpage, press <return> to continue<<
GS>>>showpage, press <return> to continue<<
GS>Running "/usr/local/bin/netpbm/bin/pnmcrop < /cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452/p5040
.pnm | /usr/local/bin/netpbm/bin/pnmcrop -bot | /usr/local/bin/netpbm/bin/pnmcrop -l  > /cygdrive/c/
DOCUME~1/win/LOCALS~1/Temp/l2h3452/p5040.t01"
Image "/cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452/p5040.pnm" is PPM, 64x21
Running "/usr/local/bin/netpbm/bin/pnmcrop -bot < /cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452/p50
40.pnm > /cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452/p5040.t02"
Image "/cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452/p5040.t02" is PPM, 64x21
Image "/cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452/p5040.pnm" is PPM, 64x21
Running "/usr/local/bin/netpbm/bin/ppmquant -floyd 256 < /cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3
452/p5040.pnm | /usr/local/bin/netpbm/bin/pnmtopng -interlace -trans '#ffffff'  > img3.png"
pnmcolormap: making histogram...
pnmcolormap: 16 colors found
pnmcolormap: Image already has few enough colors (<=256).  Keeping same colors.
seek back to zero on input file failed.
pnmtopng: Error reading magic number from Netpbm image stream.  Most often, this means your input fi
le is empty.
pstoimg: Error: "/usr/local/bin/netpbm/bin/ppmquant -floyd 256 < /cygdrive/c/DOCUME~1/win/LOCALS~1/T
emp/l2h3452/p5040.pnm | /usr/local/bin/netpbm/bin/pnmtopng -interlace -trans '#ffffff'  > img3.png"
failed:
Debug (syswait): Finished child process: #5040
 at /usr/local/bin/latex2html line 4165
 
I’ve narrowed it to this command:
$ /usr/local/bin/netpbm/bin/ppmquant -floyd 2 < p2380.pnm
pnmcolormap: making histogram...
pnmcolormap: 16 colors found
pnmcolormap: choosing 2 colors...
seek back to zero on input file failed.
 
win@toshiba-user /cygdrive/c/DOCUME~1/win/LOCALS~1/Temp/l2h3452
 
now downloading netpbm 10.26.12 to try that.
 

266.        I am getting error unable to find html.sty when running Latex, how to fix?

using mikTeX:

 

One way to fix the missing style file when using latex is to find the style file needed and put it in the same directory as the .tex file.

Under windows, html.sty is located in c:\\latex2html\\texinputs\\html.sty (part of latex2html for windows).

 

A BETTER way is this:

Under windows (cygwin) using MikTex, find the location of the directory localtexmf/ (this should have been created when miktex was installed) if not there, use the main texmf/ directory instead.

 

Next, create a directory localtextmf/tex/latex , next create a directory of name of your choice under the above, say html/.

 

Next copy the file html.sty to the above directory.

 

Next, run the command (from cygwin): initexmf -u

 

Now when running latex, it will find the style files.

267.        How to install/use Latex2html on Solaris?

 
download teTeX solaris package and install.
 
download netpbnm solaris package and install it.
 
download latex2html tar.gz file from the net, and ./configure; make; make install

See more detailed steps somewhere else in this document.

268.        How to use specific font in latex?

 
find the name of the font file, i.e.
 
cd /usr/lib/texmf/texmf/fonts/source/public/cm
 
for example, look for files with .mf extention, I see file called
 
cmu10.mf
 
so, in my latex document I do
 
\newfont{\sss}{cmu10 at 12pt}
 
\begin{document}
\begin{sss}
 
....
 
\end{sss}
\end{document}
 
this makes my document all written in the selected font.

269.        From where to download latex packages? where is CTAN?

http://www.ctan.org/ CTAN.

http://www.tug.org/ tex user group.

http://www.ams.org/tex/public-domain-tex.html

270.        How to use HTML links in latex?

 
\documentclass{article}
\usepackage{html}
 
\begin{document}
 
\htmladdnormallink{this is a link}{http://www.t.com}
 
\end{document}

Now do

latex2html t.tex

and it will work.

271.        how make text bold, italic?

 
\textbf{ bold text }
\textit{ italic text }

bold text

italic text

272.        how to insert index?

\index{}

273.        how to make table?

 
this is 3x3 table.
 
\begin{tabular}{|l|l|l|} \hline
 &  &  \\ \hline
 &  &  \\ \hline
 &  &  \\ \hline
\end{tabular}

 

 

 

 

 

 

 

 

 

274.        How to put spaces between letters?

 
Kees de Bruin wrote:
> 
> Hi,
> 
> is it possible to generate some additional space between each character in
> a string, as in:
> 
>         S O M E  T E X T
> 
> Any help appreciated,
 
Reading the thread "How do I manipulate token lists?" (very interesting
indeed) I came up with the following piece of code:
 
----------------------------------------------
\def\spread#1{\dospread#1\end}
\def\dospread#1{\ifx#1\end
    \let\next=\relax
\else
    #1\hglue 10pt\let\next=\dospread
\fi \next}
 
\spread{SOME\ TEXT}
----------------------------------------------
 
Oscar Lazzarino
 
 
another answer:
 
 
Author: "Erwin Kipperman" <E.D.Kipperman@lr.tudelft.nl>
Date: Thu, 23 Aug 2001 09:01:07 +0200
 
 
Try typing the string of text in LaTeX as : S \ O \ M \ E \ T \ E \ X \ T.
Or you can try changing the letterspacing itself (see other post)
 
HTH,
 
Erwin.
 
 
 
another answer:
 
Author: Olaf Dietrich <olaf.dietrich@urz.uni-heidelberg.de>
Date: 23 Aug 2001 06:54:57 GMT
 
 
Kees de Bruin <kees.de.bruin@altium.nl>:
> 
> is it possible to generate some additional space between each character in
> a string, as in:
> 
>        S O M E  T E X T
 
Have a look at soul.sty or letterspacing.tex.
 
Olaf

275.        How to find mismatched paranthesis in latex, is lint for latex?

download lacheck from

 
http://ftp.sunsite.dk/pub/text/lacheck/
 
and do 
 
lacheck foo.tex

276.        How to display a PDF file using ghostscipt?

 
GS reads .ps or .pdf file and display them to screen, OR can convert the
file to another format to print on nonpostscript printer.
 
 
invoke ghostscript, and load the file.
 
gs
gs> (file.pdf) run
 
Now it will open the file.pdf on the screen.  hit RETURN to see next page.
 

277.        How can I indent the first line after a section heading?

From http://www.math.tamu.edu/~harold.boas/courses/math696/LaTeX-tips-for-text.html

 

The default LaTeX style does not indent the first line of the first paragraph following a section heading. You can disable this feature by putting the declaration \usepackage{indentfirst} in the preamble of your source file (between the \documentclass line and the \begin{document} line).

 

278.        How not to print page number on a title page?

Do this

 

\maketitle

\thispagestyle{empty}  

 

279.        How to reduce space between enumeration list lines?

From David Griffel (d.griffel@bris.ac.uk)

 

% New version of itemize, with no vertical space between items.
\newcommand{\BI}{%
\begin{list}{$\bullet$}{\itemsep=0pt\parsep=0pt\listparindent=1em\topsep=0pt}}
\newcommand{\EI}{\end{list}}
 
%new version of enumerate, with reduced space between items
\newcommand{\BE}{\begin{enumerate}%
  \setlength{\itemsep}{0em}\setlength{\parsep}{0em}}
\newcommand{\EE}{\end{enumerate}}

 

 

280.        How to change fonts in scientific word?

For typesetting specification (how it will print) can do this:

 

(see help in SW)

281.        How to fix paragraph spacing in SW?

in SW, when I hit a CR leaving an empty line betwee 2 paragraphs, processing it in latex does not produce a new paragraph as expected. I need to hit CR 2 times to get the effect needed, which makes the document LOOK bad but latex output works OK.

 

In SW, after hitting CR, hit TAB. Then hit CR again.

 

282.        What commands to add to SW in preamble to make it look better?

\setlength{\parindent}{0pt}

\geometry{left=1in,right=.8in,top=1in,bottom=1in}

 

also add package nopagno and package geometry

283.        What commands in SW to make title show up when previewing?

Typeset->frontmatter, and make sure you add a TAG maketitle, as an example:

284.        How to include graphics in latex for best PDF output?

From VISIO, save the drawing as .PDF directly (using adobe professional). Then in latex just include it using includegraphics with no extension, then using pdflatex will automtically read it.

This method does NOT work with scientific word. Need to call and see if there is a solution. Scientific word does not support including .PDF as an image type.

 

Update June 25, 2005

To get EPS files to show up right do this:

  1. include graphicx pahe, and choose dvips as driver.
  2. set latex graphics export as this:
 
 
now use SW for editing only.
When want to print, use cygwin latex
Do latex foo.tex
Dvips foo.dvi –o foo.ps
To convert to pdf do
Ps2pdf foo.ps foo.pdf
 

285.        How to convert ps to pdf?

From net:


ps2pdf -dAutoFilterColorImages=false

           -dAutoFilterGrayImages=false

           -dEncodeColorImages=false

           -dEncodeGrayImages=false

           -dEncodeMonoImages=false   file.ps   file.pdf

This has worked for me to preserve the quality of the images when converting to PDF.

Mike”

 

from:

scott+ctt@pakin.org

 

“pdflatex supports the PDF and MPS (MetaPost-generated EPS) vector
formats and the PNG and JPEG bitmap formats.

You may be interested in reading what the UK TeX FAQ has to say about
imported graphics in pdflatex:

    http://www.tex.ac.uk/cgi-bin/texfaq2html?label=pdftexgraphics

 

286.        Why I get error tcilatex file not found when compiling tex document?

This happens when I create the document using SW and try to compile it using latex from command line.

Just copy the file tcilatex from

           C:\swp50\TCITeX\TeX\LaTeX\Swmacros

To the directory where the tex file is.

 

287.        How do I know which packages needed for which special Math symbols?

see
 
http://www.combinatorics.net/weblib/A.6/a6.html 
 

288.        Why there is no vertical spacing added automatically between paragphs?

Add this command to preremple

\setlength{\parskip}{3pt plus 2pt}

 

289.        How to install Cygwin?

  1. Download setup.exe from cygwin
  2. Use site
  3. Start with DEFAULT setting!, click next, download everything, then install it.
  4. Now run setup.exe again, change to INSTALL instead of default, then click the view 2 times, then click NEXT
  5. After download is completed, start setup.exe again, and install it.

 

290.        How to use latex2html?

See

http://www.uwo.ca/its/doc/manuals/latex2html/

http://www.uwo.ca/its/doc/hdi/web/w3-latex2html.html

The most basic translation command simply takes a Latex file and produces an HTML version of that file in a specified directory. For example, to translate treeman.tex into /usr/lib/www/forestry/treeman/treeman.html with an HTML title of Tree Identification Manual, use the following command:

   latex2html -t "Tree Identification Manual" \
      -dir /usr/lib/www/forestry/treeman treeman.tex
 

This command produces a tree of HTML files in the specified directory where each file is a section of your document and navigation buttons (e.g. Next, Previous) are defined to allow your Web-based readers to move through your document. Note that the -t parameter is required to allow latex2html to produce a valid HTML <TITLE> tag. The URL for this example document would be:

   http://www.uwo.ca/forestry/treeman/treeman.html
 

Additional Command-line Options

There are a number of useful command-line options that allow you to modify the default behaviour of latex2html. A few of the more common ones are described here. See the manual (in More About latex2html below) for a full listing and more detailed explanations.

-split 0

This tells latex2html to leave the file as a single (long) HTML file rather than splitting it by section. This setting turns off the navigation buttons since they are redundant. It is typically used for documents that are article rather than book sized.

-show_section_numbers

This option includes the numbers in the HTML output. By default the Latex section numbers are not included. Note that latex2html has trouble generating section numbers for documents that are made up of multiple files that are included into a main file.

-address "address-string"

This HTML code is added to the bottom of each HTML page produced. The following is a useful example of this command which produces an address line suitable for official UWO Web pages (note that the single quotes in the following line are back quotes):

   -address "Peter Marshall, ITS, UWO \
     &lt;peter@uwo.ca&gt; \
     Last update: `/bin/date +%y-%m-%d\ H:%M` by `whoami`"
  

-contents_in_navigation

Includes an extra ``Contents'' button that allows readers to jump back to the Table of Contents for the document from each HTML page.

291.        How to put things side-by-side in latex?

Side-by-side tables
Normally a tablular environment stretches the entire width of the text area (whether it looks like it should or not!). You can restrict the width with a minipage. This allows you to put two tables side-by-side:

 

  \begin{minipage}{2in}
    \begin{tabular}{c}
      Table1
    \end{tabular}
  \end{minipage}
  \begin{minipage}{2in}
    \begin{tabular}{c}
      Table2
    \end{tabular}
  \end{minipage}

292.        How to make sure VISIO eps output ok for latex?

 

By: Charles B. Cameron - cameroncb
msgRE: Problem with \includegraphics and eps fil  
2005-07-01 10:45 The April 28 message is very good. Let me add a couple of other pointers. 
 
1) In Visio, select just the components you want to convert to a .eps but, when you print them to file, give the file a .ps extension. Make sure you have selected these PostScript options: 
 
PostScript Output Option: Encapsulated PostScript (EPS) 
TrueType Font Download Option: Outline 
 
2) Open the resultant .ps file in GhostView. Convert it to a .eps file using the PS to EPS option under File. The bounding box can be computed automatically because of your having selected only the components you want printed. 
 
An alternative to selecting some components and printing just them is to change the size of the Visio page using File->Page Setup...->Page Size->Size to fit drawing contents. 
 
Adobe has a good generic PostScript printer. The HP Laser Jet 5000 Series PS printer driver also works well. I have had mixed success with other PostScript printer drivers but I've never had trouble with these two. 
 
Charles B. Cameron

 

 

4.VI

293.        VI commands

see http://www.bo.infn.it/alice/alice-doc/mll-doc/linux/vi-ex/

http://www.at.vcu.edu/ucsac/takeouts/vi.html

 
        Vi Quick Reference
 
 
Entering/leaving vi
 
 % vi name           edit name at top
 % vi +n name        ... at line n
 % vi + name         ... at end
 % vi -r             list saved files
 % vi -r name        recover file name
 % vi name ...       edit first; rest via :n
 % vi -t tag         start at tag
 % vi +/pat name     search for pat
 % view name         read only mode
 ZZ                  exit from vi, saving changes
 ^Z                  stop vi for later resumption
The display
 
Last line   Error messages, echoing input  to
            :  /  ? and !, feedback about i/o
            and large changes.
@ lines     On screen only, not in file.
~ lines     Lines past end of file.
^x          Control characters, ^? is delete.
tabs        Expand to spaces, cursor at last.
 
Vi states
 
Command     Normal   and   initial
            state.   Others return
            here.   ESC   (escape)
            cancels  partial  com-
            mand.
Insert      Entered by a i A I o O
            c  C s S R.  Arbitrary
            text  then  terminates
            with ESC character, or
            abnormally with inter-
            rupt.
Last line   Reading input for :  /
            ? or !; terminate with
            ESC or CR to  execute,
            interrupt to cancel.
Counts before vi commands
 
line/column number   z  G  |
scroll amount        ^D  ^U
replicate insert     a  i  A  I
repeat effect        most rest
Simple commands
 
dw                delete a word
de                ... leaving punctuation
dd                delete a line
3dd               ... 3 lines
itextESC          insert text abc
cwnewESC          change word to new
easESC            pluralize word
xp                transpose characters
 
 
 
Interrupting, cancelling
 
 ESC       end insert or incomplete cmd
 ^?        (delete or rubout) interrupts
 ^L        reprint screen if ^? scrambles it
File manipulation
 
 :w            write back changes
 :wq           write and quit
 :q            quit
 :q!           quit, discard changes
 :e name       edit file name
 :e!           reedit, discard changes
 :e + name     edit, starting at end
 :e +n         edit starting at line n
 :e #          edit alternate file ^| ^            synonym for :e #
 :w name       write file name
 :w! name      overwrite file name
 :sh           run shell, then return
 :!cmd         run cmd, then return
 :n            edit next file in arglist
 :n args       specify new arglist
 :f            show current file and line ^G            synonym for :f
 :ta tag       to tag file entry tag
 ^]            :ta, following word is tag
Positioning within file
 
 ^F          forward screenfull
 ^B          backward screenfull
 ^D          scroll down half screen
 ^U          scroll up half screen
 G           goto line (end default)
 /pat        next line matching pat
 ?pat        prev line matching pat
 n           repeat last / or ?
 N           reverse last / or ?
 /pat/+n     n'th line after pat
 ?pat?-n     n'th line before pat
 ]]          next section/function
 [[          previous section/function
 %           find matching ( ) { or }
Adjusting the screen
 
 ^L          clear and redraw
 ^R          retype, eliminate @ lines
 zCR         redraw, current at window top
 z-          ... at bottom
 z.          ... at center
 /pat/z-     pat line at bottom
 zn.         use n line window
 ^E          scroll window down 1 line
 ^Y          scroll window up 1 line
 
Marking and returning
 
 ``      previous context
 ''      ... at first non-white in line
 mx      mark position with letter x
 `x      to mark x
 'x      ... at first non-white in line
Line positioning
 
 H          home window line
 L          last window line
 M          middle window line
 +          next line, at first non-white
 -          previous line, at first non-white
 CR         return, same as +
  or j      next line, same column
 | ^ or k     previous line, same column
Character positioning
 
 | ^           first non white
 0           beginning of line
 $           end of line
 h or ->     forward
 l or <-     backwards
 ^H          same as <-
 space       same as ->
 fx          find x forward
 Fx          f backward
 tx          upto x forward
 Tx          back upto x
 ;           repeat last f F t or T
 ,           inverse of ;
 |           to specified column
 %           find matching ( { ) or }
Words, sentences, paragraphs
 
 w       word forward
 b       back word
 e       end of word
 )       to next sentence
 }       to next paragraph
 (       back sentence
 {       back paragraph
 W       blank delimited word
 B       back W
 E       to end of W
Commands for LISP
 
 )       Forward s-expression
 }       ... but don't stop at atoms
 (       Back s-expression
 {       ... but don't stop at atoms
 
 
 
Corrections during insert
 
 ^H        erase last character
 ^W        erases last word
 erase     your erase, same as ^H
 kill      your kill, erase input this line
 \         escapes ^H, your erase and kill
 ESC       ends insertion, back to command
 ^?        interrupt, terminates insert
 ^D        backtab over autoindent
 | ^^D       kill autoindent, save for next
 0^D       ... but at margin next also
 ^V        quote non-printing character
Insert and replace
 
 a       append after cursor
 i       insert before
 A       append at end of line
 I       insert before first non-blank
 o       open line below
 O       open above
 rx      replace single char with x
 R       replace characters
Operators (double to affect lines)
 
 d       delete
 c       change
 <       left shift
 >       right shift
 !       filter through command
 =       indent for LISP
 y       yank lines to buffer
Miscellaneous operations
 
 C       change rest of line
 D       delete rest of line
 s       substitute chars
 S       substitute lines
 J       join lines
 x       delete characters
 X       ... before cursor
 Y       yank lines
Yank and put
 
 p       put back lines
 P       put before
 "xp     put from buffer x
 "xy     yank to buffer x
 "xd     delete into buffer x
Undo, redo, retrieve
 
 u       undo last change
 U       restore current line
 .       repeat last change
 "dp     retrieve d'th last delete

294.        Another VI reference

 
Basic Useage of vi
 
vi <filename>
 
This will bring the file up in vi for editing.  If the filename specified does 
not exist a new one will be created.
 
Once in vi you will notice one thing...there's no GUI...no menus...even the 
navigation keys you know don't work in here...welcome newbie...welcome to the 
darker side of UNIX  ;)
 
vi is actually quite simple, for simple things.  But when you start with it, 
you'll need a cheat sheet for a while  :)
 
Once the file is open in vi, everything is done using specific keys.  You 
cannot just start typing, nor can you arrow, and just how do you quit?  We'll 
start there.
 
We send vi into a command mode by typing :  If we type :q, we will quit, if 
there are changes we will be prompted.  If we want to quit without prompting, 
type :q!.  If we want to write the file to disk then quit, we type :wq   More 
on writing later.
 
Now for the basic navigation keys (^<key> means hold the control key down and 
the corresponding key once):
 
     ^F forward screen
     ^B backward screen
     ^D scroll down half screen
     ^U scroll up half screen
     nG go to the beginning of the specified line (end default),
     where n is a line number
     /pat next line matching pat
     ?pat previous line matching pat
     n repeat last / or ? command
     N reverse last / or ? command
     /pat/+n nth line after pat
     ?pat?-n nth line before pat
     ]] next section/function
     [[ previous section/function
     ( beginning of sentence
     ) end of sentence
     { beginning of paragraph
     } end of paragraph
     % find matching ( ) { or }
 
Ok, so we know how to move around in a file, what are some of the common 
command we'll use when editing?
 
Common Commands:
 
     x delete a character
     dw delete a word
     dd delete a line
     3dd delete 3 lines
     u undo previous change
     ZZ exit vi, saving changes
     :q!CR quit, discarding changes
     /textCR search for text
     ^U ^D scroll up or down
     :cmdCR any ex or ed command
 
Wait...we got stuck with some commands...how do I stop a command?  Just press 
ESC, that will cancel a command and place you back ready to enter : commands.
 
Ok, on with the quick reference:
 
File manipulation
     ZZ if file modified, write and exit; otherwise, exit
     :wCR write back changes
     :w!CR forced write, if permission originally not valid
     :qCR quit
     :q!CR quit, discard changes
     :e nameCR edit file name
     :e!CR reedit, discard changes
     :e + nameCR edit, starting at end
     :e +nCR edit starting at line n
     :e #CR edit alternate file
     :e! #CR edit alternate file, discard changes
     :w nameCR write file name
     :w! nameCR overwrite file name
     :shCR run shell, then return
     :!cmdCR run cmd, then return
     :nCR edit next file in arglist
     :n argsCR specify new arglist
     ^G show current file and line
     :ta tagCR position cursor to tag
 
     In general, any ex or ed command (such as substitute or glo-
     bal) may be typed, preceded by a colon and followed by a
     carriage return.
 
Positioning within file
     ^F forward screen
     ^B backward screen
     ^D scroll down half screen
     ^U scroll up half screen
     nG go to the beginning of the specified line (end default),
     where n is a line number
     /pat next line matching pat
     ?pat previous line matching pat
     n repeat last / or ? command
     N reverse last / or ? command
     /pat/+n nth line after pat
     ?pat?-n nth line before pat
     ]] next section/function
     [[ previous section/function
     ( beginning of sentence
     ) end of sentence
     { beginning of paragraph
     } end of paragraph
     % find matching ( ) { or }
 
Adjusting the screen
     ^L clear and redraw window
     ^R clear and redraw window if ^L is -> key
     zCR redraw screen with current line at top of window
     z-CR redraw screen with current line at bottom of window
     z.CR redraw screen with current line at center of window
     /pat/z-CR move pat line to bottom of window
     zn.CR use n-line window
     ^E scroll window down 1 line
     ^Y scroll window up 1 line
 
Marking and returning
     `` move cursor to previous context
     '' move cursor to first non-white space in line
     mx mark current position with the ASCII lower-case letter x
     `x move cursor to mark x
     'x move cursor to first non-white space in line marked by x
 
Line positioning
     H top line on screen
     L last line on screen
     M middle line on screen
     + next line, at first non-white
     - previous line, at first non-white
     CR return, same as +
     v or j next line, same column
     ^ or k previous line, same column
 
Character positioning
     ^ first non white-space character
     0 beginning of line
     $ end of line
     l or -> forward
     h or <- backward
     ^H same as <- (backspace)
     space same as -> (space bar)
     fx find next x
     Fx find previous x
     tx move to character prior to next x
     Tx move to character following previous x
     ; repeat last f, F, t, or T
     , repeat inverse of last f, F, t, or T
     n| move to column n
     % find matching ( { ) or }
 
Words, sentences, paragraphs
     w forward a word
     b back a word
     e end of word
     ) to next sentence
     } to next paragraph
     ( back a sentence
     { back a paragraph
     W forward a blank-delimited word
     B back a blank-delimited word
     E end of a blank-delimited word
 
Corrections during insert
     ^H erase last character (backspace)
     ^W erase last word
     erase your erase character, same as ^H (backspace)
     kill your kill character, erase this line of input
     \ quotes your erase and kill characters
     ESC ends insertion, back to command mode
     CTRL-C interrupt, suspends insert mode
     ^D backtab one character; reset left margin of autoindent
     ^^D caret (^) followed by control-d (^D);
     backtab to beginning of line;
     do not reset left margin of autoindent
     0^D backtab to beginning of line; reset left margin of autoindent
     ^V quote non-printable character
 
Insert and replace
     a append after cursor
     A append at end of line
     i insert before cursor
     I insert before first non-blank
     o open line below
     O open above
     rx replace single char with x
     RtextESC replace characters
 
Operators
     Operators are followed by a cursor motion, and affect all
     text that would have been moved over. For example, since w
     moves over a word, dw deletes the word that would be moved
     over. Double the operator, for example, dd to affect whole
     lines.
 
 
     d delete
     c change
     y yank lines to buffer
     < left shift
     > right shift
     ! filter through command
 
Miscellaneous Operations
     C change rest of line (c$)
     D delete rest of line (d$)
     s substitute chars (cl)
     S substitute lines (cc)
     J join lines
     x delete characters (dl)
     X delete characters before cursor (dh)
     Y yank lines (yy)
 
Yank and Put
     Put inserts the text most recently deleted or yanked; how-
     ever, if a buffer is named (using the ASCII lower-case
     letters a - z), the text in that buffer is put instead.
     3yy yank 3 lines
     3yl yank 3 characters
     p put back text after cursor
     P put back text before cursor
     "xp put from buffer x
     "xy yank to buffer x
     "xd delete into buffer x
 
Undo, Redo, Retrieve
     u undo last change
     U restore current line
     . repeat last change
     "dp retrieve d'th last delete

5.MATLAB

295.        How to put single quote in matlab string?

use two quotes

 
        s= 'this is a '' quote';
 
will print as
 
       this is a ' quote

296.        How to print structure field names in matlab (not the values)?

 
function structdisplay(s, indent)
%STRUCTDISPLAY  Display a struct as a tree
%  STRUCTDISPLAY(S, INDENT) displays the struct S using INDENT
%  spaces.  Play with the INDENT value to figure out what it does
 
% Author: Peter Boettcher <boettcher@ll.mit.edu>
% 2001
 
nargchk(2,2,nargin);
 
if(~isa(s, 'struct'))
        error('Input must be a struct');
end
 
f = fieldnames(s);
fm = strvcat(f);
maxwidth = size(fm, 2);
windowwidth = 80;
 
formatstr = sprintf('%%%is: ', indent);
 
for i = 1:length(f)
        fname = sprintf(formatstr, f{i});
%       fname = [ones(1, indent + maxwidth-length(f{i}))*' ' f{i} ': '];
        d = getfield(s, f{i});
        if(isa(d, 'struct'))
               if(length(d) > 1)
                       for j=1:length(d)
                               disp([fname ' [' num2str(j) ']']);
                               structdisplay(d(j), indent+4);
                       end
               else
                       disp([fname ' +']);
                       structdisplay(d, indent+4);
               end
        else
               if(isempty(d))
                       str = '[]';
               elseif(isa(d, 'char'))
                       if(size(d,1) == 1 & length(d) < windowwidth - maxwidth)
                               str = ['''' d ''''];
                       else
                               str = generic(d);
                       end
               elseif(isnumeric(d))
                       sz = size(d);
                       if(length(sz) < 3 & sz(1) == 1 & sz(2) < 10)
                               str = mat2str(d);
                       else
                               str = generic(d);
                       end
               else
                       str = generic(d);
               end
               disp([fname str]);
        end
end
 
function str = generic(in)
 
w = whos('in');
szstr = [];
for i=1:length(w.size)
        szstr = [szstr int2str(w.size(i)) 'x'];
end
szstr(end) = [];
str = sprintf('[%s %s]', szstr, w.class);
 
 
-- 
Peter Boettcher <boettcher@ll.mit.edu>
MIT Lincoln Laboratory
MATLAB FAQ: http://www.mit.edu/~pwb/cssm/

297.        How to close all figures in matlab?

close all

close all hidden

or delete(get(0,'Children'));

298.        How to clear all workspace variables ?

clear all

299.        roundeven?

 
From: Peter J. Acklam (jacklam@math.uio.no)
Subject: Re: MATLAB Doesn't Adhere To IEEE Standard 
Newsgroups: comp.soft-sys.matlab
View this article only 
Date: 2001-05-18 02:42:02 PST 
 
function y = roundeven(x)
%ROUNDEVEN Round towards nearest integer (pick even in .5 cases)
%   ROUNDEVEN(X) rounds the elements of X to the nearest integer.  In
%   cases where the fractional part is .5, the results is rounded to the
%   nearest even integer.
 
%   Author:      Peter J. Acklam
%   Time-stamp:  2001-05-18 11:48:16 +0200
%   E-mail:      jacklam@math.uio.no
%   URL:         http://www.math.uio.no/~jacklam
 
   % do the real part of x
   rx  = real(x);
   arx = abs(rx);
   rrx = round(rx);
   k = (rx - floor(rx)) == 0.5 & rem(rrx, 2);
   rrx(k) = fix(rx(k));
 
   if isreal(x)
 
      % no imaginary part; so assign directly
      y = rrx;
 
   else
 
      % do the imaginary part of x
      ix  = imag(x);
      aix = abs(ix);
      rix = round(ix);
      k = (ix - floor(ix)) == 0.5 & rem(rix, 2);
      rix(k) = fix(ix(k));
 
      % build output
      y = complex(rrx, rix);
 
   end

300.        netlib, where to get?

 
Netlib, which serves some of this software via email. Try mail to
netlib@ORNL.GOV with "send help" in the subject field.
 
For Europe: 
  Internet:       netlib@nac.no
  EARN/BITNET:    netlib%nac.no@norunix.bitnet
  X.400:          s=netlib; o=nac; c=no;
  EUNET/uucp:     nac!netlib
 
For the Pacific, try netlib@draci.cs.uow.edu.au
 
For background about netlib, see Jack J. Dongarra and Eric Grosse,
"Distribution of Mathematical Software Via Electronic Mail,"
Comm. ACM (1987) 30,403--407.
     
A similar collection of statistical software is available from
  statlib@temper.stat.cmu.edu.
 
The symbolic algebra system REDUCE is supported by
  reduce-netlib@rand.org.

301.        speed tricks in matlab?

 
From: Roger Moss (roger.moss@eng.ox.ac.uk)
Subject: Re: Why fortran Not Matlab 
Newsgroups: comp.lang.fortran
View this article only 
Date: 1996/11/05 
 
 
For instance:
tic;a=[];for i=1:10000,a(i)=pi;end;toc
elapsed_time =
   43.6600
tic;a=[];a=pi*ones(10000,1);toc
elapsed_time =
    0.0500
(873 times faster).
 
Multiply out scalars where possible - the Matlab interpreter is 
non-optimising:
a=rand(32768,1);
tic;a=a*2*3*4*5;toc
elapsed_time =
    0.2800
» tic;a=a*(2*3*4*5);toc
elapsed_time =
    0.0600
 
 
As a general rule Matlab is very fast for problems where the size of the 
matrix is large compared to the number of lines of code executed. For 
instance,
a=rand(32768,1);
» tic;b = fft(a);toc
elapsed_time =
    0.9900
(this on a 66MHz 486DX2).

302.        Plotting tricks in matlab?

 
The fplot function plots a mathematical function between a given set 
of axes limits. You can control the x-axis limits only, or both the x- and 
y-axis limits. For example, to plot the humps function over the x-axis 
range [-5 5], use
 
fplot(@humps,[-5 5])
grid on
 
 
 
You can zoom in on the function by selecting y-axis limits of -10 and 25, 
using
 
fplot(@humps,[-5 5 -10 25])
grid on
 
 
You can also pass an inline for fplot to graph, as in
 
fplot(inline('2*sin(x+3)'),[-1 1])
 
two inlines:
 
fplot(inline('[2*sin(x+3), humps(x)]'),[-5 5])
 
 
f= inline('[2*sin(x+3), humps(x)]')

303.        How to pass arguments to matlab from command line?

 
these are my notes on how to compile matlab code and use it from command  line.
 
if you write this in matlab
 
--------- t.m ---------
function t(input)
disp(input);
------------------------
 
from command line line do
 
mcc -m t.m
 
this will generate t.exe
 
now run t.exe, but make sure you pass it one argument.
 
---------------
G:\disk1\nabbasi\data\my_misc_programs\matlab>t nasser
nasser
----------------
 
so the argument is bound to the patameter.
notice if you pass 2 arguments, you'll get a run-time error
 
------------------------------
G:\disk1\nabbasi\data\my_misc_programs\matlab>t nasser abbasi
ERROR: Run-time Error: File: t Line: 1 Column: 0 The function "t" was called with more 
than the declared number of
inputs (1)
 
EXITING
------------------------
 
to pass arguments with space in them as one, put a quote around them:
 
G:\disk1\nabbasi\data\my_misc_programs\matlab>t " nasser abbasi"
 nasser abbasi
 
Notice, that the argument is a matrix also, it has row and column:
 
---------- t.m -----------
function t(input)
[r,c]=size(input);
disp('size of input it row=');
disp(r);
disp('column is');
disp(c);
disp(input);
------------ end----------
 
 
compile and run it:
 
-------------------------------------------------
G:\disk1\nabbasi\data\my_misc_programs\matlab>t nasser
size of input it row=
     1
 
column is
     6

304.        How to generate noise signal in matlab?

 
From: Wes Wang (wang@mathworks.com)
Subject: Re: How do I generate noise? 
Newsgroups: comp.soft-sys.matlab
View this article only 
Date: 1998/01/20 
 
 
Mats Bergsten wrote:
> 
> Is there any function in Matlab to generate AWGN noise and burst error
> noise or do I have to implement them myself?
> 
> Is there any function to calculate bit energy (Eb), noise energy (N0)
> and signal to noise ratio (SNR=Eb/N0)?
> 
> I have Matlab 5.1, Communications Toolbox + Signal Toolbox.
> 
In the Communications Toolbox, there is an example "commgui" for
BER calculation. The graphical user interface of this example may
help you to a quick start. You can use the example to do some
simple system calculation by reconfigurating the parameters provide
in the GUI of this example. The core calculation of this example
is done in the function "commod".
 
You can use MATLAB function "randn" to generate normal (Gaussian)
noise. There is no burst error generator in the MATLAB part of the
Communications Toolbox. You need to write a function yourself. 
There is a "Binary vector noise generator" block in the
"Source" sublibrary of "Commlib", the Simulink block library part
of the Communications Toolbox. The burst error generated by that
block may be your requested burst error.
 
Hope this is helpful.
 
Wes Wang
wang@mathworks.com
Message 3 in thread 
 
 
 
From: Marten Sjostrom (Marten.Sjostrom@epfl.ch)
Subject: Re: How do I generate noise? 
Newsgroups: comp.soft-sys.matlab
View this article only 
Date: 1998/01/22 
 
 
There is also the function IDINPUT in the Identification Toolbox that
generates a number of different kinds of noise.
 
Marten.

305.        Using mean, variance, and standard deviation

The variance is a measure of how spread out a distribution is. It is computed as the average squared deviation of each number from its mean. For example, for the numbers 1, 2, and 3 the mean is 2 and the variance is:

The standard deviation is the square root of the variance, most commonly used measure of spread.

``In a normal distribution, about 68mean and about 95

good reference for statistics is:

http://davidmlane.com/hyperstat/index.html

306.        How to evaluate a polynomial?

 
if P is a vector of the coeffcients of poly, and X is a vector of the X values you
want to evaluate P at, then use 
 
OLYVAL Evaluate polynomial.
    Y = POLYVAL(P,X), when P is a vector of length N+1 whose elements
    are the coefficients of a polynomial
 
This returns Y vector, the value of P at those X values. Then you can plot(x,y) to see how
the poly looks.

307.        How to normalize data?

one way to normalize data is to center it zero mean and scale it to unit stadard deviation:

 
1. find the mean of the data.
2. subtract each data point from the mean.
3. find the standard deviation of the set of points.
4. divide each result in step 2 by standard deviation.
5. the new values are normalized data points
 
from matlab. 
 
>> cdate
 
cdate =
 
        1790
        1800
        1810
        1820
        1830
        1840
        1850
        1860
        1870
        1880
        1890
        1900
        1910
        1920
        1930
        1940
        1950
        1960
        1970
        1980
        1990
 
 
>> std(cdate)
 
ans =
 
   62.0484
 
>> mean(cdate)
 
ans =
 
        1890
 
 
>> cdate-mean(cdate)
 
ans =
 
  -100
   -90
   -80
   -70
   -60
   -50
   -40
   -30
   -20
   -10
     0
    10
    20
    30
    40
    50
    60
    70
    80
    90
   100
 
>> 
 
>> sdate = (cdate - mean(cdate))./std(cdate)
 
sdate =
 
   -1.6116
   -1.4505
   -1.2893
   -1.1282
   -0.9670
   -0.8058
   -0.6447
   -0.4835
   -0.3223
   -0.1612
         0
    0.1612
    0.3223
    0.4835
    0.6447
    0.8058
    0.9670
    1.1282
    1.2893
    1.4505
    1.6116

308.        How to plot using log scale for y axis?

 
SEMILOGY Semi-log scale plot.
    SEMILOGY(...) is the same as PLOT(...), except a
    logarithmic (base 10) scale is used for the Y-axis.

309.        matlab curve fitting

 
for simple polynomial fit, see polyfit and polyval
 
polyfit  function generates a "best fit" polynomial (in the least squares
sense) of a specified order for a given set of data.
 
POLYFIT Fit polynomial to data.
    POLYFIT(X,Y,N) finds the coefficients of a polynomial P(X) of
    degree N that fits the data, P(X(I))~=Y(I), in a least-squares sense.
 
 x=1:10;
 y=sin(x);
 [P,S] = polyfit(x,y,5); 
 yfit= polyval(P,x);
 %Now compare y with yfit
 plot(x,y,x,yfit);

310.        How to use Matlab symbolic math?

By Nasser. add Nov 24, 2001. Learning Matlab...

 
note: by default, sym math uses rational arithmetic operations.
 
 
#First create some symbolic equation
 
> y=sym('exp(-a*t)*C')
 
y =
 
exp(-a*t)*C
 
#Now assign some numeric values to the paramters
 
>> a=980;
>> C=3;
 
#notice, y has not changed
 
>> y
 
y =
 
exp(-a*t)*C
 
#Now, lets evaluate y based on the numeric values assignd above
 
>> subs(y)
 
ans =
 
3*exp(-980*t)
 
>> y
 
#notice that y has not changed still, this is good
 
y =
 
exp(-a*t)*C
 
>> 
 
 
-----------------------------------------
To plot symbolic equations:
 
syms x
k = sym(1/sqrt(2));
f = exp(-(k*x)^2);
ezplot(f)
 
 
-------------------------------------------
To evaluate a symbolic function at number of points.
 
syms x
g = exp(x*sin(x))
 
Now, suppose we want to plot the above for x from 1.0 to 3, at increaments of 0.05, 
how to do this?
 
first, create the xd vector
 
xd=1:0.05:3;
 
Now, use the subs() fucntion, to generate the yd vector
 
yd= subs(g,x,xd);
 
In the above, yd will be a vector, which is the y corrdinates. now plot
 
plot(xd,yd);
 
-----------------------------------------------------
 
You can solve an equation symbolicly, then evalute the numeric result:
 
>> y=x^4-3*x^3+x^2
 
y =
 
x^4-3*x^3+x^2
 
 
#find the roots of y(0)
 
>> solve(y)
 
ans =
 
[               0]
[               0]
[ 3/2+1/2*5^(1/2)]
[ 3/2-1/2*5^(1/2)]
 
>> eval(ans)
 
ans =
 
         0
         0
    2.6180
    0.3820
 
>> 
 
 
----------------------------------------
Notice if a symbolc exist, it is used literally in a matlab expression, as an exaple:
 
>> syms x
>> n=(1:9)'
 
n =
 
     1
     2
     3
     4
     5
     6
     7
     8
     9
 
>> p=x.^n+1
 
p =
 
[   x+1]
[ x^2+1]
[ x^3+1]
[ x^4+1]
[ x^5+1]
[ x^6+1]
[ x^7+1]
[ x^8+1]
[ x^9+1]
 
>> 
symbolic operations such as factor, applies to a whole vector as well:
 
>> p=factor(p)
 
p =
 
[                             x+1]
[                           x^2+1]
[                 (x+1)*(x^2-x+1)]
[                           x^4+1]
[         (x+1)*(x^4-x^3+x^2-x+1)]
[             (x^2+1)*(x^4-x^2+1)]
[ (x+1)*(1-x+x^2-x^3+x^4-x^5+x^6)]
[                           x^8+1]
[     (x+1)*(x^2-x+1)*(x^6-x^3+1)]
 
----------------------------------------------
NOte: important, use sym to convert to use rational arithmetics. for example:
 
>> A=[ 1.100 2.34 3.44
       2.456 4.98 4.56
    ]
 
A =
 
    1.1000    2.3400    3.4400
    2.4560    4.9800    4.5600
 
>> A=sym(A)
 
A =
 
[   11/10,  117/50,   86/25]
[ 307/125,  249/50,  114/25]
 
>> 
 
 
see? A is rational, more accurate. do operations in symbolic, then solve at the end.
 
To covert back to floating point, do
 
A= vpa(A);
 
---------------------------------------------------
 
to convert a floating point to rational
 
>> i=3.4565
 
i =
 
    3.4565
 
>> i=sym(i,'r')
 
i =
 
6913/2000
 
>> 

311.        How to find dimensions of matrix?

 
[m,n]= size(A);
 
Now, m contains number of rows, and n number of columns.

312.        How to find if a variable is integer or not?

 
if ~isequal(round(a),a)
    error('A must be integer')
end

313.        How to find length of a vector?

 
You can use:
 
[m,n]= size(A);
 
for a vector, n=1 always. So, length is m.
 
can also use length(a), which is equivelant to max(size(a));
I like [m,n]=size(A) since it is more clear.

314.        How to look at performance of a function?

 
flops(0)
tic
foo()  <---- the function we are measuring
flops  <----- will give us floating point operations by foo()
toc    <----- will give total time since tic was issued.
 
 
OR
 
started=clock;
foo();
time= etime(clock,started);
 
now, time will have elapsed time.  tic/toc are easier to use.

315.        How to superimpose more than one graph on the same screen?

use the hold command.

316.        How to draw a line in matlab

The following command plots a line through (0,0) and (1,1):
 
 plot([0,1],[0,1])

 

317.        How to draw a circle in matlab

 

From: RAMPRASAD POTLURI (potluri@engr.uky.edu)
Subject: Re: how to draw a circle
Newsgroups:
comp.soft-sys.matlab

Date: 2002-08-23 07:14:56 PST        

 

The following plots a circle with center at (10,-2) and radius of 2 ( in

general, you can replace the "plot" command below with "plot( r*sin(t)+a,
r*cos(t)+b )" ):
 
t = 0:.01:2*pi;
plot(2*sin(t)+10,2*cos(t)-2);
axis('square');
 

From: Steven Huet (steven.huet@gfo.atmel.com)
Subject: Re: how to draw a circle
Newsgroups:
comp.soft-sys.matlab

View this article only

Date: 2002-08-23 06:53:09 PST

to draw a circle, try : 
rectangle('Position',...
          [(yo-r),(xo-r),2*r,2*r],...
          'Curvature',[1,1],...
          'EdgeColor','red');

 

318.        How to fit a vector to a matrix

 

From: Dr W Tych (W.Tych@lancaster.ac.uk)
Subject: Re: Putting a vector into matrix
Newsgroups:
comp.soft-sys.matlab

View: (This is the only article in this thread) | Original Format

Date: 1995/06/06

ics@sirius.tn.rl.ac.uk (Richard Cullen) wrote:
> I have a single long vector, how do I split it into uniform size
> chunks and put that chunk into a matrix? I have periodic data which I
> want to put into rows corresponding to individual 24 hour sections.
 
It is a classic Matlab use and one that I often show to my students when
describing Matlab's advantages over the usual programming languages.
Say, your vector is called y, it is N elements long and it contains
hourly data which you want to convert into a matrix D in which each row
corresponds to an hour and each column to a day. This is then not the
shortest but a clear way to handle the problem:
 
N_round=floor(N/24)*24;   % number of elements of y which can be put
                          % into a rectangular matrix with floor(N/24)
                          % columns
D=reshape(y(1:N_round),24,floor(N/24));
 
 
A one-liner function with T used instead of 24 may then have the
following form:
 
function D=resh(y,T)
% function D=resh(y,T)
D=reshape(y(1:floor(length(y)/T)*T),T,floor(length(y)/T));
 
Note that this function would require some additional effort to cope
with users' capabilities to send wrong arguments to it. This is just a draft.
You can also retrieve the rejected 'tail' of the data as:
  R=y(((floor(length(y)/T)*T)+1):length(y));
and include it as the second retrieved argument of the resh function.
 
From matrix D you can then calculate mean daily profiles of your
measurements as: 
MD = mean(D'); % this will be your average day (24 elements - one for each hour)
DM = mean(D);  % these will be your daily averages (averages for each day)
(the same with other statistics)
 
You can plot these as well to reveal periodicities in the data.
 
Good luck with your data,
 
Wlodek Tych

 

319.        Adding noise signal?

 
Are you talking about like thermal noise which is usually assumed to 
be white gaussian noise (a flat spectrum) ?
For that one: help randn
sigma=.1
signal=sin((1:100)*.01);
noise=randn(1,100)*sigma;
noisy_signal=signal+noise;
 
 
Andy Homes wrote:
> 
> 
> Can some one please give me some ideas on how to simulate
> some noise
> using matlab.
> 
> For example a sine wave, having background noise and may be
> a extra
> signal injected into it.
> 
> Thanks
> 
 

6.Scientifc Word HOWTO

320.        How to make Math fonts larges when exporting to HTML?

-Choose Tag, Appearance

-Select Body Text from the list of Tags

-Under Tag Properties, select Math

-Click Modify

-Click Font

-Check Size under Font Properties Specified

-Uncheck Size under Inherit

-Select a larger Size from the Size list box

-Click OK

-Click Save if you wish to retain this chang

-Click OK

 

321.        How to join AVI files?

sudo apt-get install mencoder

mencoder -oac copy -ovc copy  DSCF2557.AVI DSCF2558.AVI -o complete.avi

7.Virtual box HOW to

322.        How to mount shared folder from linux guest?

assume the user id (uid) on linux us "me", and gid=users then type

 

sudo mount -t vboxsf -o suid,uid=me,gid=users hostshared /shared

 

To update the system, do

 

sudo apt-get update

sudo apt-get upgrade