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'