Rants and ravings of a semi-autistic developer who has a hard time remembering idiotic nonsense details. Why remember it, when you know where to find it.
Wednesday, November 28, 2012
How do I get the IP external to my local network given by ISP?
So you have a local network on the 192.168.*.* subnet. My router is somewhere on 192.168.1.1 or 192.168.1.254.
Now what am I known as on the internet? What is my IP for the internet, ie what is the dynamic IP that my ISP has given me?
HERE IS THE ANSWER, once you have this you could script things ....
Thursday, November 22, 2012
sqlite: adding a column and verify its added
Adding a column to an existing sqlite database.... and verify your change...
In my case adding an 'ACTIVE' flag to the map table as a boolean where the default value for the column is 1 (TRUE)
First copy my original db to a working copy and altering the work copy (
x.db).
Pro:bin project$ cp vt.db x.db Pro:bin project$ sqlite3 x.db 'alter table territory_map add column ACTIVE BOOLEAN DEFAULT 1'Now validating the structures of the original and copied db by listing them from the sqlite_master
Pro:bin project$ sqlite3 vt.db 'select * from sqlite_master where type="table" and name="TERRITORY_MAP" ' > c1 Pro:bin project$ sqlite3 x.db 'select * from sqlite_master where type="table" and name="TERRITORY_MAP" ' > c2Verify the columns existence and its default value.
Pro:bin project$ diff c1 c2 21c21 < UPDATED_BY TEXT DEFAULT 'IMPORT' NULL, --- > UPDATED_BY TEXT DEFAULT 'IMPORT' NULL, ACTIVE BOOLEAN DEFAULT 1, Pro:bin project$ sqlite3 -header x.db 'select map_id, abbrev, category, active from territory_map' | head MAP_ID|ABBREV|CATEGORY|ACTIVE 1|fnny|REG|1 2|fnny|SC|1 3|clny|REG|1 4|clny|SC|1 5|chvt|SC|1 6|chvt|REG|1
Eclipse: edit locally and automatic rsync as part of the build
So I have this project that I love to edit, but need to build and deploy on a different target system (in my case OSX to Linux)
I also love to edit in Eclipse, and use rsync as the fastest way to get stuff on the target machine. The remote systems explorer just did not cut it... however I ended up flipping between eclipse and terminal (rsync) to get things synced up....
Answer: add a builder launcher that invokes the rsync script as part of the autobuild...
Here the simple rsync script that I placed in root of the maintenance-ui project (chmod it to 755)
rsync -avz --exclude '.svn' --exclude 'target' --delete * myuserid@myhost.com:./projects/maintenance-uiHere the launch file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/maintenance-ui/rsync.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,auto,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/maintenance-ui}"/>
</launchConfiguration>
Now you could and can use the remote systems explorer in Eclipse to run your remote build and you will never have to leave Eclipse and alt tabbing around.
Sunday, November 4, 2012
javax.net ssl debugging java.security plus plus
JSSE extends this facility by consulting the javax.net.debug property for the following options:
all Turn on all options and sub-options. ssl Turn on SSL debugging. This option has the following sub-options (all of which are in force if none are specified): record Print a trace of each SSL record (at the SSL protocol level). handshake Print each handshake message as it is received. keygen Print key generation data for the secret key exchange. session Print SSL session activity. defaultctx Print the default SSL initialization information. sslctx Print information about the SSL context. sessioncache Print information about the SSL session cache. keymanager Print information about calls to the key manager. trustmanager Print information about calls to the trust manager. data For handshake tracing, print out a hex dump of each message. verbose For handshake tracing, print out verbose information. plaintextFor record tracing, print out a hex dump of the record. As you progress through the samples in the book, you can turn various options on in order to see more information about what's going on.
java.security single vs double 'equals' specifying java.policy
Just because I have seen conflicting messages regarding '=' vs '==' as in
-Djava.security.policy==my.policyor
-Djava.security.policy=my.policy. The names of the default policy files When the default implementation of the Policy class reads in permissions, it will read them from the URLs listed as this set of properties:
policy.url.1=file:${java.home}/lib/security/java.policy
policy.url.2=file:${user.home}/.java.policy
You may specify any number of files in this manner, but the list must start at 1 and be numbered consecutively. The set of permissions will be the aggregate of all permissions found in these URLs.
Remember that these URLs contain only global permissions. You may also specify on the command line a file containing policies with the -Djava.security.policy argument. If the name following the -Djava.security.policy argument begins with an equals sign, the URLs listed in the java.security file are ignored:
-Djava.security.policy=/globals/java.policy (NO APPEND)adds the policies in the /globals/java.policy file to the set of policies in force, but:
-Djava.security.policy==/globals/java.policy (APPEND AFTER policy.url's listed in java.security)sets the policy only to the entries contained in the /globals/java.policy file. The -Djava.security.policy argument must be with the -Djava.security.manager; if you want to use only the files listed in the java.security file, specify -Djava.security.manager without -Djava.security.policy. Other implementations of the Policy class may or may not use these properties.
Saturday, November 3, 2012
java.security.debug property syntax logging
A number of Java debugging flags are available to assist you in determining how the security manager is using your security policy file, and what policy files are contributing permissions. Running the VM as follows shows the possible debugging flag settings:
[bin]$ java -Djava.security.debug=help
all turn on all debugging
access print all checkPermission results
combiner SubjectDomainCombiner debugging
configfile JAAS ConfigFile loading
configparser JAAS ConfigFile parsing
gssloginconfig GSS LoginConfigImpl debugging
jar jar verification
logincontext login context results
policy loading and granting
provider security provider debugging
scl permissions SecureClassLoader assigns
The following can be used with access:
stack include stack trace
domain dump all domains in context
failure before throwing exception, dump stack
and domain that didn't have permission
The following can be used with stack and domain:
permission=
only dump output if specified permission
is being checked
codebase=
only dump output if specified codebase
is being checked
Running with -Djava.security.debug=all provides the most output, but the output volume is acutely verbose. This might be a good place to start if you don't understand a given security failure at all. For less verbose output that will still assist with debugging permission failures, use -Djava.security.debug=access,failure.
Thursday, October 18, 2012
Dumping Environment process info before an exit at startup time (JVM)
I have this process that craps out at startup time and I'm not sure what the problem is and what the exact environment settings are at runtime startup. So I need to trap the information from the /proc/[pid]/environ file on linux.
In session one I start the monitoring process that will dump the environment to a file.
In session two I start the actual process..... once the process startsup the session 1 oneliner will trap the information for me.
628 while (true) do PID=`/sbin/pidof studio-tools`;if [ -n "$PID" ]; then cat /proc/$PID/environ | tr \\0 \\n > out; /usr/sbin/lsof -p $PID >> out ; break; fi; done;
Wednesday, October 10, 2012
removing duplicate and empty elements from a perl array
Just another snippet not to remember.... removing the non-unique elements and the empty (null) elements.
sub uniq {
return keys %{{ map { $_ => 1 } @_ }};
}
@my_array = ("one","two","three","two","three");
print join(" ", @my_array), "\n";
print join(" ", uniq(@my_array)), "\n";
Tuesday, October 9, 2012
rpcinfo to process information linux
The trickiness of NFS tracing and locking.... wonderful world...
# find the nfs mount
$ mount
nas0964p:/prod_nas on /nas/images type nfs (rw,nosuid,soft,intr,tcp,addr=10.75.129.131)
$ rpcinfo -p 10.75.129.131
program vers proto port
824395111 1 tcp 49394
824395111 1 udp 52370
100011 1 tcp 60884 rquotad
100011 1 udp 62423 rquotad
536870914 1 udp 4658
536870914 1 tcp 4658
100021 3 udp 58855 nlockmgr
100021 2 udp 58855 nlockmgr
100021 1 udp 58855 nlockmgr
100021 4 udp 58855 nlockmgr
100021 3 tcp 63916 nlockmgr
100021 2 tcp 63916 nlockmgr
100021 1 tcp 63916 nlockmgr
100021 4 tcp 63916 nlockmgr
100024 1 udp 54825 status
100024 1 tcp 54825 status
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
140391 1 udp 31491
100005 3 tcp 1234 mountd
100005 2 tcp 1234 mountd
100005 1 tcp 1234 mountd
100005 3 udp 1234 mountd
100005 2 udp 1234 mountd
100005 1 udp 1234 mountd
536870919 3 tcp 12345
536870919 1 tcp 12345
536870919 3 udp 12345
536870919 1 udp 12345
102660 1 udp 62703
102660 1 tcp 61254
100000 2 udp 111 portmapper
100000 2 tcp 111 portmapper
# what is the program???
$ $ cat /etc/rpc
#ident "@(#)rpc 1.11 95/07/14 SMI" /* SVr4.0 1.2 */
#
# rpc
#
portmapper 100000 portmap sunrpc rpcbind
rstatd 100001 rstat rup perfmeter rstat_svc
rusersd 100002 rusers
nfs 100003 nfsprog
ypserv 100004 ypprog
mountd 100005 mount showmount
ypbind 100007
walld 100008 rwall shutdown
yppasswdd 100009 yppasswd
etherstatd 100010 etherstat
rquotad 100011 rquotaprog quota rquota
sprayd 100012 spray
3270_mapper 100013
rje_mapper 100014
selection_svc 100015 selnsvc
database_svc 100016
rexd 100017 rex
alis 100018
sched 100019
llockmgr 100020
nlockmgr 100021
x25.inr 100022
statmon 100023
status 100024
bootparam 100026
ypupdated 100028 ypupdate
keyserv 100029 keyserver
sunlink_mapper 100033
tfsd 100037
nsed 100038
nsemntd 100039
showfhd 100043 showfh
ioadmd 100055 rpc.ioadmd
NETlicense 100062
sunisamd 100065
debug_svc 100066 dbsrv
ypxfrd 100069 rpc.ypxfrd
bugtraqd 100071
kerbd 100078
event 100101 na.event # SunNet Manager
logger 100102 na.logger # SunNet Manager
sync 100104 na.sync
hostperf 100107 na.hostperf
activity 100109 na.activity # SunNet Manager
hostmem 100112 na.hostmem
sample 100113 na.sample
x25 100114 na.x25
ping 100115 na.ping
rpcnfs 100116 na.rpcnfs
hostif 100117 na.hostif
etherif 100118 na.etherif
iproutes 100120 na.iproutes
layers 100121 na.layers
snmp 100122 na.snmp snmp-cmc snmp-synoptics snmp-unisys snmp-utk
traffic 100123 na.traffic
nfs_acl 100227
sadmind 100232
nisd 100300 rpc.nisd
nispasswd 100303 rpc.nispasswdd
ufsd 100233 ufsd
pcnfsd 150001 pcnfs
amd 300019 amq
sgi_fam 391002 fam
bwnfsd 545580417
fypxfrd 600100069 freebsd-ypxfrd
$
Tuesday, October 2, 2012
using find and report on several lines with grep like functionality
Oneliner for finding a specific release of an artifact in a maven build file and reporting the artifact name and version even though these pieces are in different lines... And using find with the exit to print out only the successful files.
$ find . -name pom.xml -type f -exec perl -ne 'BEGIN {my $l} if (/2.0.1.RELEASE/) { printf "%s%s",$last,$_ ; $l=$last } ; $last=$_; END { exit 1 unless $l; }' {} \; -print
fmon-jms
2.0.1.RELEASE
./master-service/master-service/master-proc/master-proc-core/pom.xml
Tuesday, September 4, 2012
Whats the encoding of my file? Compile complaints....
on Linux use...
file -bi option
[cpcdev@dpcpca01 cpc]$ file -bi ./src/main/java/com/fedex/ground/dispatch/cpcs/actions/OnCallDetailActionHandler.java text/x-java; charset=unknown [cpcdev@dpcpca01 cpc]$Or in Mac OSX
file -I --mime-encoding /prod/PersistanceLayer/src/java/domain/server/toplink/Equipment.java
Class Magic Number And Bytecode compatibility on Linux
Based on the general layout (see item #7)we need the 8th hex number to get the value.
And then match the major version number with the JDK version compatibility.
major version number of the class file format being used. J2SE 7 = 51 (0x33 hex), J2SE 6.0 = 50 (0x32 hex), J2SE 5.0 = 49 (0x31 hex), JDK 1.4 = 48 (0x30 hex), JDK 1.3 = 47 (0x2F hex), JDK 1.2 = 46 (0x2E hex), JDK 1.1 = 45 (0x2D hex).In this case
[me@hostandre]$ xxd -p org/apache/xmlbeans/impl/xsd2inst/SampleXmlUtil.class | head -n 1 | cut -c-16 cafebabe00000030 [me@hostandre]$The answer is: JDK 1.4 compiled and compatible...
Friday, August 17, 2012
Quick Ref
print AdminConfig.attributes('Application')
List Enterprise Applications
print AdminConfig.list('ApplicationDeployment') - EAR level
List Contents in Enterprise Applications
print AdminConfig.list('WebModuleDeployment') - WAR level
Print the first application name
app=AdminControl.queryNames('type=Application,*').split('\n')[0]
obj=AdminControl.completeObjectName(app) - Getting the object
The following commands are available for the AdminConfig object:
* attributes
* checkin
* convertToCluster
* create
* createClusterMember
* createDocument
* createUsingTemplate
* defaults
* deleteDocument
* existsDocument
* extract
* getCrossDocumentValidationEnabled
* getid
* getObjectName
* getSaveMode
* getValidationLevel
* getValidationSeverityResult
* hasChanges
* help
* installResourceAdapter
* list
* listTemplates
* modify
* parents
* queryChanges
* remove
* required
* reset
* save
* setCrossDocumentValidationEnabled
* setSaveMode
* setValidationLevel
* show
* showall
* showAttribute
* types
* uninstallResourceAdapter
* validate
The following commands are available for the AdminApp object:
* deleteUserAndGroupEntries
* edit
* editInteractive
* export
* exportDDL
* getDeployStatus
* help
* install
* installInteractive
* isAppReady
* list
* listModules
* options
* publishWSDL
* searchJNDIReferences
* taskInfo
* uninstall
* update
* updateAccessIDs
* updateInteractive
* view
The following commands are available for the AdminControl object:
* completeObjectName
* getAttribute
* getAttribute_jmx
* getAttributes
* getAttributes_jmx
* getCell
* getConfigId
* getDefaultDomain
* getDomainName
* getHost
* getMBeanCount
* getMBeanInfo_jmx
* getNode
* #rxml_admincontrol__cmd14
* getPort
* getPropertiesForDataSource (Deprecated)
* getType
* help
* invoke
* invoke_jmx
* isRegistered
* isRegistered_jmx
* makeObjectName
* #rxml_admincontrol__cmd24
* queryNames
* queryNames_jmx
* reconnect
* setAttribute
* setAttribute_jmx
* setAttributes
* setAttributes_jmx
* startServer
* stopServer
* testConnection
* trace
The following AdminTask commands are available but do not belong to a group:
* createServerType
* createTCPEndPoint
* getTCPEndPoint
* help
* listSSLRepertoires
* listTCPEndPoints
* listTCPThreadPools
* updateAppOnCluster
List Enterprise Applications
print AdminConfig.list('ApplicationDeployment') - EAR level
List Contents in Enterprise Applications
print AdminConfig.list('WebModuleDeployment') - WAR level
Print the first application name
app=AdminControl.queryNames('type=Application,*').split('\n')[0]
obj=AdminControl.completeObjectName(app) - Getting the object
The following commands are available for the AdminConfig object:
* attributes
* checkin
* convertToCluster
* create
* createClusterMember
* createDocument
* createUsingTemplate
* defaults
* deleteDocument
* existsDocument
* extract
* getCrossDocumentValidationEnabled
* getid
* getObjectName
* getSaveMode
* getValidationLevel
* getValidationSeverityResult
* hasChanges
* help
* installResourceAdapter
* list
* listTemplates
* modify
* parents
* queryChanges
* remove
* required
* reset
* save
* setCrossDocumentValidationEnabled
* setSaveMode
* setValidationLevel
* show
* showall
* showAttribute
* types
* uninstallResourceAdapter
* validate
The following commands are available for the AdminApp object:
* deleteUserAndGroupEntries
* edit
* editInteractive
* export
* exportDDL
* getDeployStatus
* help
* install
* installInteractive
* isAppReady
* list
* listModules
* options
* publishWSDL
* searchJNDIReferences
* taskInfo
* uninstall
* update
* updateAccessIDs
* updateInteractive
* view
The following commands are available for the AdminControl object:
* completeObjectName
* getAttribute
* getAttribute_jmx
* getAttributes
* getAttributes_jmx
* getCell
* getConfigId
* getDefaultDomain
* getDomainName
* getHost
* getMBeanCount
* getMBeanInfo_jmx
* getNode
* #rxml_admincontrol__cmd14
* getPort
* getPropertiesForDataSource (Deprecated)
* getType
* help
* invoke
* invoke_jmx
* isRegistered
* isRegistered_jmx
* makeObjectName
* #rxml_admincontrol__cmd24
* queryNames
* queryNames_jmx
* reconnect
* setAttribute
* setAttribute_jmx
* setAttributes
* setAttributes_jmx
* startServer
* stopServer
* testConnection
* trace
The following AdminTask commands are available but do not belong to a group:
* createServerType
* createTCPEndPoint
* getTCPEndPoint
* help
* listSSLRepertoires
* listTCPEndPoints
* listTCPThreadPools
* updateAppOnCluster
find all the dependencies
usr@host:~/BUILD/foo-bar-root
$ find . -name 'pom.xml' -print -exec perl -ne 'BEGIN {my @k;} if (// ... /<\/plugin>/) { push @k, $_; } else { @k=undef;}; if (@k and grep {/<\/plugin>/} @k and grep {/pmd/} @k ) {print join("",@k);@k=undef} ' {} \; -print
Adding XmlRootElement
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.4</version>
<executions>
<execution>
<id>generate-domain1</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<strict>true</strict>
<schemaDirectory>src/main/schema</schemaDirectory>
<schemaIncludes>
<value>*.xsd</value>
</schemaIncludes>
<bindingIncludes>
<include>bindings.xjb</include>
</bindingIncludes>
<verbose>true</verbose>
<extension>true</extension>
<args>
<arg>-Xannotate</arg>
</args>
<generateDirectory>${project.build.directory}/generated-sources/xjc</generateDirectory>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.0</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.0</version>
</plugin>
</plugins>
</configuration>
</execution>
</executions>
</plugin>
XJC XmlRootElement and SOAPAction, WebServiceTemplate spring-ws
If you want to create client stubs by means of spring-ws and you do not have the notation of the @Endpoint and @Payload definitions it is sometimes problematic getting the right SOAPAction and XmlRootElement defined.
The first try you can generate with the xjc:simple binding
Generating the @XmlRootElement("something")
The first try you can generate with the xjc:simple binding
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
version="2.0" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:annox="http://annox.dev.java.net"
jaxb:extensionBindingPrefixes="xjc annox">
<jaxb:globalBindings>
<xjc:simple />
</jaxb:globalBindings>
<!-- FILE: PickupAudit.xsd -->
<jaxb:bindings schemaLocation="PickupAudit.xsd" node="/xs:schema">
<jaxb:bindings node="xs:complexType[@name='PickupAudit']">
<annox:annotate>
<annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="PickupAudit" />
</annox:annotate>
</jaxb:bindings>
<jaxb:bindings node="xs:complexType[@name='PickupAuditType']">
<annox:annotate>
<annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="PickupAudit" />
</annox:annotate>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
Generating the @XmlRootElement("something")
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.4</version>
<executions>
<execution>
<id>generate-domain1</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<strict>true</strict>
<schemaDirectory>src/main/schema</schemaDirectory>
<schemaIncludes>
<value>*.xsd</value>
</schemaIncludes>
<bindingIncludes>
<include>bindings.xjb</include>
</bindingIncludes>
<verbose>true</verbose>
<extension>true</extension>
<args>
<arg>-Xannotate</arg>
</args>
<generateDirectory>${project.build.directory}/generated-sources/xjc</generateDirectory>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.0</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.0</version>
</plugin>
</plugins>
</configuration>
</execution>
</executions>
</plugin>
Wednesday, August 15, 2012
Zip up my logfiles between 10 and 15 days old from a remote host...
Sledgehammering the logs archiving for perticular days and using zip... Tar always gives me a headache because of the -c vs -u option... why can't it just create the tar... anyway with zip its smoother and "smaller"!!
$ cat list | xargs -i% -t ssh % 'find ./logs/ -mtime +10 -mtime -15 -exec zip -@ /tmp/my.zip "{}" \; -print '
Where list contains
me@host1 me@host2 me@host3
Tuesday, July 31, 2012
Mac OS Grab Screencapture defaults
# Grab File type for screen captures defaults write com.apple.screencapture type -string [png,jpg,pdf...] # Grab Screen capture folder defaults write com.apple.screencapture location [~/Desktop/] # Grab Screenshot file name defaults write com.apple.screencapture name -string # Grab Screenshot file format defaults write com.apple.screencapture type -string # Grab Show shadows on captured windows defaults write com.apple.screencapture disable-shadow -boolean-neg
Example:
#!/bin/bash
defaults write com.apple.screencapture type -string PNG defaults write com.apple.screencapture location ~/Desktop/ScreenShots
# reset the ui server
killall SystemUIServer
Friday, July 27, 2012
awstats nano tutorial... for members only
For my own pleasure... mini-tut...
Signings-MacBook-Pro:tools mememe$ cat x
530 cd tools/
530 perl awstats-configure.pl
[see dialog at the end of the post - and made the link to the access file to a symlink access-current.log]
531 cd wwwroot/cgi-bin/
532 ls -rtl
533 vi awstats.ease-webserver1.conf
[Change the DirData="/Users/mememe/.awstats" location for the database]
538 ln -s /Users/mememe/ease/20120726-was1p-access.log /Users/mememe/ease/access-current.log
539 perl awstats.pl -config=ease-webserver1
541 cd ../..
542 cd tools/
545 perl awstats_buildstaticpages.pl -config=ease-webserver1 -awstatsprog=/Users/mememe/Downloads/awstats-7.0/wwwroot/cgi-bin/awstats.pl
myhost:tools mememe$ pwd
/Users/mememe/Downloads/awstats-7.0/tools
myhost:tools mememe$ perl awstats_configure.pl
----- AWStats awstats_configure 1.0 (build 1.9) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).
-----> Running OS detected: Mac OS
Warning: AWStats standard directory on Mac OS X is '/Library/WebServer/awstats'.
If you want to use standard directory, you should first move all content
of AWStats distribution from current directory:
/Users/mememe/Downloads/awstats-7.0
to standard directory:
/Library/WebServer/awstats
And then, run configure.pl from this location.
Do you want to continue setup from this NON standard directory [yN] ? y
-----> Check for web server install
Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> none
Your web server config file(s) could not be found.
You will need to setup your web server manually to declare AWStats
script as a CGI, if you want to build reports dynamically.
See AWStats setup documentation (file docs/index.html)
-----> Update model config file '/Users/mememe/Downloads/awstats-7.0/wwwroot/cgi-bin/awstats.model.conf'
File awstats.model.conf updated.
-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y
-----> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> ease-webserver1
-----> Create config file '/Users/mememe/Downloads/awstats-7.0/wwwroot/cgi-bin/awstats.ease-webserver1.conf'
Config file /Users/mememe/Downloads/awstats-7.0/wwwroot/cgi-bin/awstats.ease-webserver1.conf created.
-----> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/Users/mememe/Downloads/awstats-7.0/wwwroot/cgi-bin/awstats.pl -update -config=ease-webserver1
Or if you have several config files and prefer having only one command:
/Users/mememe/Downloads/awstats-7.0/tools/awstats_updateall.pl now
Press ENTER to continue...
A SIMPLE config file has been created: /Users/mememe/Downloads/awstats-7.0/wwwroot/cgi-bin/awstats.ease-webserver1.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'ease-webserver1' with command:
> perl awstats.pl -update -config=ease-webserver1
You can also build static report pages for 'ease-webserver1' with command:
> perl awstats.pl -output=pagetype -config=ease-webserver1
Press ENTER to finish...
myhost:tools mememe$
myhost:tools mememe$ perl awstats_buildstaticpages.pl -config=mvndev.ground.fedex.com -awstatsprog=/Users/mememe/Downloads/awstats-7.0/wwwroot/cgi-bin/awstats.pl
For a break down of all the requests per hour of day....
Signings:~ mememe$ cd ~/awstats/wwwroot/cgi-bin/ Signings:cgi-bin mememe$ rm -fr ~/.awstats/* && rm ~/ease/current.log && ln -s ~/ease/access_log.Q112073000 ~/ease/current.log && perl awstats.pl -config=ease-webserver1 -databasebreak=hour -month=all $ rm ~/ease/current.log && ln -s ~/ease/access_log.Q112073100 ~/ease/current.log && perl awstats.pl -config=ease-webserver1 -month=all Signings:~ mememe$ cd ~/awstats/tools/ Signings:tools mememe$ perl awstats_buildstaticpages.pl -config=ease-webserver1 -awstatsprog=/Users/akaan/awstats/wwwroot/cgi-bin/awstats.pl -month=all $ rm awstats.ease-webserver1.* && perl awstats_buildstaticpages.pl -config=ease-webserver1 -awstatsprog=/Users/akaan/awstats/wwwroot/cgi-bin/awstats.pl -month=07
Friday, July 20, 2012
Set a blazingly fast keyboard repeat rate (cursor movement) in Terminal MacOSX
(plagiarized from http://hints.macworld.com/article.php?story=20090823193018149)
Everybody knows that you can get a pretty fast keyboard repeat rate by changing a slider on the Keyboard tab of the Keyboard & Mouse System Preferences panel. But you can make it even faster! In Terminal, run this command:
defaults write NSGlobalDomain KeyRepeat -int 0Then log out and log in again. The fastest setting obtainable via System Preferences is 2 (lower numbers are faster), so you may also want to try a value of 1 if 0 seems too fast. You can always visit the Keyboard & Mouse System Preferences panel to undo your changes. You may find that a few applications don't handle extremely fast keyboard input very well, but most will do just fine with it.
Thursday, July 19, 2012
Capture Contents from Match until the end of the file - in perl
I want the classpath that is set in the manifest.mf
Class-Path: mscorlib.jar Microsoft.VisualBasic.jar rdVbScriptTranslat or.jar js.jar rdsuperscript.jar System.Xml.jar rt.jar System.jar Syst em.Data.jar System.Web.jar rt.jar J2SE.Helpers.jar rt.jar fop.jarThe whole file is
$ cat META-INF/MANIFEST.MF Manifest-Version: 1.0 VMW-Assembly: c%3A%5CReportDev%5CVB%5CrdXslFoTemplate%5Cbin%5CDebug_Ja va%5CrdXslFoTemplate.dll Created-By: MainSoft Inc Version-Date: Mon 02/20/06 15:49:54.479 Assembly-Version: 1.0.0.0 Build-Version: 2.2.0.130 Class-Path: mscorlib.jar Microsoft.VisualBasic.jar rdVbScriptTranslat or.jar js.jar rdsuperscript.jar System.Xml.jar rt.jar System.jar Syst em.Data.jar System.Web.jar rt.jar J2SE.Helpers.jar rt.jar fop.jar $What to do.... make the 3 dot match and make the last match \cD which is code for end of file....
$ find . -name 'rdXsl*.jar' -type f | while read dir; do [ -f META-INF/MANIFEST.MF ] && rm -f META-INF/MANIFEST.MF;unzip -q $dir META-INF/MANIFEST.MF; cat META-INF/MANIFEST.MF | perl -ne 'print if /^Class-Path/ ... /\cD/' ; done;
JDBC Version Driver - Can you tell me?
Some drivers for JDBC have a marvelous mechanisms for telling what the version is.... you can either guess or ask the driver or even decompile....
Ask the driver:
DB2- jt400.jars
$ java -cp ../jt400-7.7.1.jar utilities.AboutToolbox IBM Toolbox for Java: Open Source Software, JTOpen 7.7, codebase 5770-SS1 V7R1M0.07 built=20120531 @FB Supports JDBC version 3.0 Toolbox driver version 9.8
Monday, July 16, 2012
Hidden Chronicles Feed Item Click All
I like Hidden Chronicles however the zygna feed on the right side where you can reap rewards and help others ..... I found it too tedious to go thru the list over and over click click click ... oops missed the button... ie waste of time... so how can I automate this...
I'm using Chrome and used the extension "Script Injector".
Then "Manage Scripts" and "create a new script" insertion with the following (Based on the css and design of July 2012... )
document.getElementById('zui_tab_gameActivity').ondblclick=function() {
alert('starting feed reaping');
var allTags=document.getElementsByClassName('zui_button_zdc'), i=0, e;
while(e=allTags[i++])
{
e.click();
};
};
So it will look like this
AFter that "create a rule" for autoloading.
Now reload the Zynga page and the double click on the red highlighted area called "Game Activity" and all your feeds will be reaped and rewarded. You will be able to do this for both z-Friends and Everybody.... ENJOY.
Friday, July 6, 2012
Converting SHP files to KML with GDAL command line SHP2KML
There is a lot of crappy software around claiming to be able to convert.... but :-( none of it is true... now fasten your seat belts.. I wrestled with it on Mac OSX so please forgive my ignorance to the other OS'
First of all download the GDAL framework, and then let the magic begin
Get your cadestral files from your local gis data provider.. unzip the files and let the transformation begin...
657 /Library/Frameworks/GDAL.framework/Programs/ogr2ogr -f KML VTPARCELS_Westford2008.kml VTPARCELS_Westford2008.shp 658 ls -rlt 659 history 660 ls -rlt 661 cd ../vtparcels_essextown2011 662 /Library/Frameworks/GDAL.framework/Programs/ogr2ogr -f KML VTPARCELS_EssexTown2011.kml VTPARC.shp
Friday, June 15, 2012
pidof and /proc/pid/environ values and ps and ...
All this time and I was not aware
/sbin/pidof java | sed 's/\s/\n/g' cat /proc/%/environ | tr \\0 \\n combined.... /sbin/pidof java | sed 's/\s/\n/g' | xargs -i% cat /proc/%/environ | tr \\0 \\n xargs -i% -t ps -o uid,pid,start_time,ucomm -p % w 2> /dev/null xargs -i% -t ps -o uid,pid,start_time,comm,args -p % wwe ' /sbin/pidof java | sed 's/\s/\n/g' |xargs -i% -t ps -o uid,pid,start_time,comm,args -p % wwe '
Wednesday, June 13, 2012
Where Did My Office Computer Go? Scan IP ranges for a service
So I lost my computer, since the network MAC->IP cache was flushed, however I know the subnet and the machine is on. But its a headless piece, no monitor. Where oh, where did my computer go??!?!?!
Wireshark is more for recording what comes in, other network utils are on a IP basis... but lets curl ourselves out of here... I want to validate the existence of a twiki site:
curl -f -m 2 http://10.10.10.[100-200]/twiki/bin/viewYeah its that easy.... and easy to forget...
Tuesday, June 12, 2012
grab that oneliner for sledgehammering with xargs and remote execute
Finally found the command on one node.... now how to grab that and execute it on milions of hosts (with a passwordless setup)
66 ps auxww| grep Server | grep -v grep | awk '{ print $2 }' | xargs -i{} -t /usr/sbin/lsof -p {} | grep wls10
Here you go
77 history | grep Server | grep -v history | cut -c8- | grep wls10 | head -1 > ~/wls10.txt
78 cat list | xargs -i{} -t ssh {} "$(<wls10.txt)"
xargs and using the stdin reference more than once
Multiple tar extractions in different directories based on the tar name.
computer:x usr$ ls -rtl total 426552 -rw-r--r-- 1 usr usr 73451520 Jun 12 17:59 l01-2.tar -rw-r--r-- 1 usr usr 72622080 Jun 12 17:59 l02-2.tar -rw-r--r-- 1 usr usr 72284160 Jun 12 17:59 l03-2.tarThe only way I was able to do it is to push it into a small script, louzy.... I'll keep you posted on the alternatives.
computer:x usr$ cat test.txt
mkdir $1
cd $1 && tar xfv ../$1.tar && cd ..
computer:x usr$ ls -1 *.tar | sed 's/\.tar//' | xargs -I{} -t /bin/bash test.txt {}
Monday, June 4, 2012
Perl Object Creation, Inheritance, overloading.... in one page?
Keep looking for a small sample with all the bells and whistles that I can shelf for all my object structures in perl. Loads of docs, but I could not find a nice complete one that I could stamp as usable. So here we go.
Example is the object relationships between Vehicle, Vehicle::Car and Vehicle::Car::RaceCar
all vehicles have a maxspeed (number),
car all has wheels (number),
racecar has doortype (winged, standard),
So here we go
run.pl
#!/usr/bin/perl
use strict;
use lib("../lib");
use Vehicle;
use Vehicle::Car;
use Vehicle::Car::RaceCar;
my $v = Vehicle->new(name=>'Ferarri');
printf "The default max speed of any vehicle is %d, %s\n",$v->maxspeed, $v->name;
$v->print;
$v->name('Volvo');
$v->print;
print "----------------------\n";
$v = Vehicle::Car->new(name=>'Beetle', wheels=>4, maxspeed=>100, andre=>43);
$v->print;
$v->wheels(10);
$v->print;
print "----------------------\n";
$v = Vehicle::Car::RaceCar->new(name=>'Ferrari', wheels=>4, maxspeed=>200, doortype=>'Winged');
$v->print;
The following package structure is recommended
Vehicle.pm
package Vehicle;
use strict;
use Carp;
use Data::Dumper;
use vars (qw($VERSION @ISA @EXPORT @EXPORT_OK ));
BEGIN {
# initializer for static variables and methods
use Exporter;
use vars qw ( $VERSION @ISA @EXPORT);
$VERSION = 1.0;
@ISA = qw ( Exporter );
@EXPORT = qw (static_method_string);
}
#constructor
sub new {
my ($class) = shift;
my %x = @_;
my @override = ();
foreach my $var (keys %x) {
my $var_name = $var =~ /^_/ ? $var : sprintf "_%s", $var;
push @override, ($var_name, $x{$var});
}
#print Dumper(\@override, @_);
my $self = {
_maxspeed => 0,
_name => 'N/A',
@override, #override
};
bless $self, $class;
return $self;
}
#accessor method for name
sub name {
my ( $self, $name ) = @_;
$self->{'_name'} = $name if defined($name);
return ( $self->{'_name'} );
}
#accessor method for maxspeed
sub maxspeed {
my ( $self, $maxspeed ) = @_;
$self->{'_maxspeed'} = $maxspeed if defined($maxspeed);
return ( $self->{'_maxspeed'} );
}
sub print {
my ($self) = @_;
printf( "Name:'%-50s' Maxspeed:%s\n", $self->name, $self->maxspeed);
}
sub methodonlyinvehicles {
print static_method_string("in all vehicles");
}
sub static_method_string {
sprintf "%s %s\n", 'method call in ', shift;
}
$|=1;
1;
Vehicle/Car.pm
package Vehicle::Car;
use Vehicle;
use strict 'vars';
our @ISA = qw(Vehicle);
our @EXPORT = qw(wheel);
#constructor
sub new {
my ($class) = shift;
my %x = @_;
my @override = ();
foreach my $var (keys %x) {
my $var_name = $var =~ /^_/ ? $var : sprintf "_%s", $var;
push @override, ($var_name, $x{$var});
}
#call the constructor of the parent class, Car.
my $self = $class->SUPER::new(@override);
bless $self, $class;
return $self;
}
#accessor method for wheels
sub wheels {
my ( $self, $wheels ) = @_;
$self->{'_wheels'} = $wheels if defined($wheels);
return ( $self->{'_wheels'} );
}
sub print {
my ($self) = @_;
# we will call the print method of the parent class
$self->SUPER::print;
printf " has %d wheels\n", $self->wheels;
}
sub methodonlyincars {
print static_method_string('only in vehicles and cars');
}
1;
Vehicle/Car/RaceCar.pm
package Vehicle::Car::RaceCar;
use strict 'vars';
use Vehicle; # to import the static method in the parent class
use vars qw($VERSION @ISA @EXPORT);
our @ISA = qw(Vehicle::Car);
our @EXPORT = qw(doortype);
my $CLASS = __PACKAGE__;
sub new {
my ($class) = shift;
my %x = @_;
my @override = ();
foreach my $var (keys %x) {
my $var_name = $var =~ /^_/ ? $var : sprintf "_%s", $var;
push @override, ($var_name, $x{$var});
}
#call the constructor of the parent class, Car.
my $self = $class->SUPER::new(@override);
bless $self, $class;
return $self;
}
#accessor method for doortype
sub doortype {
my ( $self, $doortype ) = @_;
$self->{'_doortype'} = $doortype if defined($doortype);
return ( $self->{'_doortype'} );
}
sub print {
my ($self) = @_;
# we will call the print method of the parent class
$self->SUPER::print;
printf " has %s doors\n", $self->doortype;
}
sub methodonlyinracecar {
print static_method_string('only in racecar');
}
1;
Adding size Column to Saved Searches
Add Size and other columns to search results ... stolen and plagiarized for my own selfish need.
I was very disappointed that I couldn't add the Size column to the list view in search results. Only Date Created and Date Modified were added as options in 10.6; the others are grayed out.
Fortunately, I found a way to force the Size column to appear, as well as Comments, Version and Label columns. You'll have to edit the com.apple.finder.plist file found in
~/Library/Preferences, using the Property List Editor app (included with Xcode) or PlistEdit Pro. Open the Root node, then navigate down into
SearchViewSettings » ListViewSettings » columns. Then choose the column you want to activate in the column list (ie. Size), and set the visible key to yes. Save the .plist and relaunch the Finder (Option-Control-click on the Finder icon in the Dock). Note: you must have done at least one search, and selected one of the additional columns in the View Options panel for the search results (Date Created, for example), or else your .plist file may not contain the SearchViewSettings node. Warning: Apple probably disabled these columns for a good reason, as there may be some bugs that could cause problems on your system. I didn't have any problems with the size column, but be warned.
Friday, June 1, 2012
Vanguard exports and Google OFX imports
Okay wanted to straighten out my finances and have one overview in Google Finance.... lets export and import. The Vanguard website will allow you to download them in a csv format which contains all the valid data according to OFX.
However they forgot the symbols and put the shorthand description there.... so totally useless.... so lets parse this baby into the correct format... I only had to do 5 different sources .... but feel free to adjust or add...
:Downloads amiga$ cat ofxdownload.csv | perl -pe 's/Total Bond Mkt Index Inst/VBTIX/;s/Windsor Fund Investor/VWNDX/;s/Total Intl Stock Ix Inv/VGTSX/;s/PRIMECAP Fund Investor/VPMCX/;s/500 Index Fund Signal/VFIAX/;'
remote shell qoutes and double qoutes in complex operations
I prefer the sledgehammer when managing multiple servers. but what about quoting and double quoting and double double qouting.... escaping in on thing.... however how about this....
Here a oneliner for printing the statistics on TCP state of a box.
[dswown@pghpviswl01 ~]$ cat cmd.txt
netstat | perl -MData::Dumper -ne 'BEGIN {%h=();} chomp;$_=~s/\s+/ /g;@x=reverse split/[\s+:]/ if /tcp|udp/; if (@x) {$x[2]=~s/\.c?\w?\w?$//g;print Dumper(\@x), $_ if $x[2] eq '8471';$h{count}{$x[0]}++;$h{$x[0]}{$x[2]}++;
} END { print Dumper(\%h)}'
[dsw@pviswl01 ~]$ cat list | xargs -i{} -t ssh {} $(<cmd.txt)
Where the file 'list' contains the following:
user1@hostA user2@hostB
Tuesday, May 29, 2012
Virtual Host or Virtual IP dig digging
cmb@pscmbldl02:~ $ dig axfr my.domain.com | grep dje00197.my.domain.com dje00197.my.domain.com. 21600 IN A 10.76.40.34 djeswk03.my.domain.com. 21600 IN CNAME dje00197.my.domain.com. cmb@pscmbldl02:~ $ dig axfr my.domain.com | grep pscmbldl02 scm.my.domain.com. 21600 IN CNAME pscmbldl02.my.domain.com. scmblog.my.domain.com. 21600 IN CNAME pscmbldl02.my.domain.com. pscmbldl02.my.domain.com. 21600 IN A 10.75.82.3 cmb@pscmbldl02:~ $
Tuesday, May 8, 2012
sed: how do I grep from line X until EOF?
If I have a rolling logfile with multiple lines per log record how do I print from line X until EOF?
computer:~ me$ sed -n "57450,\$p" pf/app/logs/server/trace.log
Wednesday, May 2, 2012
SED: print only lines between x and y...
Print only lines between certain line numbers... I'm sick of looking this up every two seconds... so I plagiarize and put it in my own collection.... which I know how to find :-)
# print section of file based on line numbers (lines 8-12, inclusive) sed -n '8,12p' # method 1 sed '8,12!d' # method 2Example that I needed this for: grepping lines 39000 - 40000 where an error was reported.
computer:tmp user$ ssh user@host 'cd /QIBM/UserData/WebSphere/AppServer/V61/ND/profiles/dmgrapp/logs/dmgr && sed -n '39000,40000p' systemout.log'
Tuesday, May 1, 2012
A poor man's DNS resolving in a perl oneliner
Silly to record this ... but I hate spending more than 60 seconds on figuring out something I already figured out before... so here we go.... my own dns resolver.....
Listing the resolving of the ip range: 10.75.19.80 until 10.75.19.95
$ perl -e 'for (80..95) { open EXEC, "( nslookup 10.75.19.$_ )|" or die $!; @l=;chomp @l; ($x) = grep {/name/} @l if @l; printf "%3d - %s\n", $_, $x }'
Wednesday, April 25, 2012
How do I remove filenames with dashes?
This does not work....
ITASC $ rm '-z'
rm: illegal option -- z
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
Simple: use the /- to depict dashes:
./CustomFunctions/.classpath ./-z tibco@pghdbeengl01:~/build $ rm ./-*
Wednesday, April 18, 2012
Apache Log Regex for simpleminded parsing.
The common log format would be
10.75.80.77 2 - - [17/Apr/2012:08:52:32 -0400] "GET /EASE/admin/login.jsf HTTP/1.1" 302 - "-" "Mozilla/5.0"So here the regex to parse this...
my $expression =
qr/([0-9\.]+)\s+\d*\s?\-\s\-\s\[(\d+)\/(\w{3})\/(\d{4}):(\d+):.*\s[-+]\d+\]\s\"(POST|GET)\s(.+)\sHTTP\/(\d.\d)\"\s(\d{3})\s(\d+|-)\s\"(\S+)\"\s\"(.+)\"/x;
my (
$all, $ip, $dayofmonth, $month, $year,
$hourofday, $reqtype, $req, $protocol, $response,
$size, $ref, $agent
) = @rec = $_ =~ /($expression)/i;
Here an example of yet another parser implementation of apache logs... that greps all the POST and GET's
use Data::Dumper;
use Text::Table;
sub line {
my $x = shift;
$x = $x ? $x : $W;
for ( 1 .. $x ) { print "-"; }
print "\n";
}
BEGIN {
our $W = 70;
%row = ();
print "\n\n";
line($W);
printf "[%-35s]\n", $ARGV[$cc];
line($W);
$cc++;
}
my @rec =();
my $expression =
qr/([0-9\.]+)\s+\d*\s?\-\s\-\s\[(\d+)\/(\w{3})\/(\d{4}):(\d+):.*\s[-+]\d+\]\s\"(POST|GET)\s(.+)\sHTTP\/(\d.\d)\"\s(\d{3})\s(\d+|-)\s\"(\S+)\"\s\"(.+)\"/x;
my (
$all, $ip, $dayofmonth, $month, $year,
$hourofday, $reqtype, $req, $protocol, $response,
$size, $ref, $agent
) = @rec = $_ =~ /($expression)/i;
#print $dayofmonth, "\n";
if ($!) {
my ($approot) = $req =~ m!^\/(\w+)\/.*$!x;
my ($refhost) = $ref =~ m!https?\:\/\/([a-z.]+)\/.+!x;
my $v = sprintf "%s %s, %s", $month, $dayofmonth, $year;
$row{$response}{'byreq'}{$v}{$req}++;
my $hkey = sprintf "%s-%s", $approot, $refhost;
my $dkey = sprintf "%s-%s", $hourofday,$hkey;
#print Dumper(\@rec);
#die "deeeee", $v;
$row{$response}{'byreqref'}{$v}{$req}{$ref}++;
$row{$response}{'byhodreq'}{$v}{$hourofday}++;
$row{$response}{'byipsub'}{$v}{$ip}++;
$row{$response}{'bycontext'}{$v}{$approot}++;
$row{$response}{'byrefhost'}{$v}{$hkey}++;
$row{$response}{'byrefhosthod'}{$v}{$dkey}++;
}
else {
print "skiping $_\n";
}
Wednesday, March 14, 2012
Please Log Everything with a Log4j.xml to my screen....
It's sad to put this down however every time I need it, I forget the syntax... whats the proper syntax to answer my "please log everything to the screen" question...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
<log4j:configuration>
<!--
an appender is an output destination, such as the console or a file;
names of appenders are arbitrarily chosen
-->
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %c (%F:%L) %m%n"/>
</layout>
</appender>
<appender name="stderr" class="org.apache.log4j.ConsoleAppender">
<param name="target" value="System.err"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t][%F:%L] : %m%n" />
</layout>
</appender>
<!-- the root category -->
<!--
all log messages of level "debug" or higher will be logged, unless defined otherwise
all log messages will be logged to the appender "stdout", unless defined otherwise
-->
<root>
<priority value="ALL"/>
<appender-ref ref="stdout" />
<appender-ref ref="stderr" />
</root>
</log4j:configuration>
Friday, February 3, 2012
Mac OSX - running xterm and X11 xhost: unable to open display
So alright you have Mac OSX. Yay I
I have a VPN to the office. Yay II (ip vpn adapter: 172.18.146.250)
I have oodles of linux boxes! Yay III
The problem:
One odd ball process on my linux will throw a X11 Graphics error so how to get around that....
Try 1: Do the standard export and xhost + trick
open Terminal.app and run:
computer:~ ~$ export DISPLAY=172.18.146.250:0 computer:~ ~$ xhost + xhost: unable to open display "172.18.146.250:0" computer:~ ~$Thats not right... lets start the Xserver in background (X Server startcmd is 'X').... and do this again...
computer:~ ~$ X &
launch_msg("CheckIn") IPC failure: Operation not permitted
Xquartz: Unable to locate waiting server: org.x.X11
Xquartz: X11.app = /Applications/Utilities/X11.app/Contents/MacOS/X11
Xquartz: Starting X server: /Applications/Utilities/X11.app/Contents/MacOS/X11 --listenonly
..SCM BUILD BOX profile been setup..
================================================
X11.app: main(): argc=2
argv[0] = /Applications/Utilities/X11.app/Contents/MacOS/X11.bin
argv[1] = --listenonly
Waiting for startup parameters via Mach IPC.
X11.app: No launchd socket handed off, unsetting DISPLAY
X11.app: do_start_x11_server(): argc=1
argv[0] = X
Xquartz starting:
X.Org X Server 1.4.2-apple56
Build Date: 20100624
(EE) XKB: Couldn't open rules file /usr/X11/share/X11/xkb/rules/base
(EE) XKB: Couldn't open rules file /usr/X11/share/X11/xkb/rules/base
computer:~ ~$
Try 2:
Now open the xterm under the X11 Application that has been started...
bash-3.2$ export DISPLAY=172.18.146.250:0 bash-3.2$ xhost + access control disabled, clients can connect from any host bash-3.2$
Friday, January 20, 2012
Where Are My Open Files Go? lsof++
So where are my IO handles (open files) are being spend... here a oneliner
First get the PID and ram everything of lsof thru the parser....
[wev@wad03 logs]$ /usr/sbin/lsof -p 21336 | perl -MData::Dumper -ne 'BEGIN { my %x=();} {@s=split /\s+/;$x{$s[4]}++;} END { print Dumper(\%x); }'
$VAR1 = {
'IPv6' => 3,
'unix' => 1,
'DIR' => 2,
'TYPE' => 1,
'CHR' => 4,
'0000' => 1,
'REG' => 463,
'sock' => 1
};
[wev@wad03 logs]$
Labels:
linux,
lsof,
oneliner,
open files
Subscribe to:
Comments (Atom)



