Archive for November, 2007

SQLPLUS stuff

Set Line width (number of columns)

SQL> set lin 250

Spooling to a file then viewing it

SQL> spool “test.txt”
SQL> select * from user_users;

USERNAME                         ……… deleted

SQL> spool off

SQL> ed test.txt
Shelling out to the host

SQL> host

In Windows launches a new DOS session.  In Unix launches the shell

Formatting output from an SQL query
- useful for generating DQL  on the back of an oracle query:

select ‘Name ‘ || object_name from dm_sysobject_s

Most importantly …

SQL>help set

Lists all the commands available to make presentation of information more pleasing to the eye.

Get tablespace sizes

select file_name,  tablespace_name, bytes from dba_data_files;

Leave a Comment

Java and Python side by side

Interesting link

http://www.ferg.org/projects/python_java_side-by-side.html

Leave a Comment

Variations of … for Solaris, HPuX and AIX

HPUX

ps -efx | grep something

Solaris (one variation)

/usr/ucb/ps -auxww | grep init_file

Of course, not all sites have the man pages and access to the internet is not always provided so better to remember this.

AIX

ps

Software listing…

HPUX

swlist (variations of and gui available if software is installed)

AIX

lslpp -L

e.g. lslpp -L|grep xlC
gives the c++ runtime info

Leave a Comment

Leave a Comment

Server log – strange errors, resolved

The following errors were appearing in the server log. Apart from some fairly critical things not working, the docbase seemed to be ok.
The problem was that something had got corrupted in the TCIP/IP  stack/ network interface.  It was not required to reinstall the tcpip software.

[DM_SESSION_E_RPC_ERROR]error:  “Server communication failure”

java.nio.channels.UnresolvedAddressException

Thu Oct 18 23:47:00 2007 [FATAL ERROR] [AGENTEXEC 4568] Detected during program initialization: Command Failed: connect,xxxxxx.xxxxxx,xxxxxx.xxxxxx,”,,,try_native_first, status: 0, with error message .
The dm_agent_exec utility is exiting due to a fatal error.
Thu Oct 18 23:47:53 2007 025000 [DM_SESSION_W_RESTART_AGENT_EXEC]warning:  “The agent exec program has stopped running.  It will be restarted.”

[DM_SESSION_E_RPC_ERROR]error:  “Server communication failure”

java.nio.channels.UnresolvedAddressException

IAPI32 and IDQL32 would not run and dmqdocbroker -c getdocbasemap would not run either.
Taking it to the next level I  determined that while remote servers could be pinged the local host could not. Once that was fixed it was all ok again.

Solution to the IP probem:

http://kevinyeandel.wordpress.com/2007/11/22/cant-ping-own-pc/

Leave a Comment

Cant ping own pc

Happened on a Dell PC where I couldn’t ping said machine despite ruling out all the daft stuff. I could ping Google and even the router – thus NIC is ok. I have a static IP
Obviously firewall was tested as part of the diagnosis.
For what it is worth, the hosts file was also checked to be correct.

1. view tcp/ip properties and capture all settings. Including gateway and DNS servers (which should be in your router, if you can remember the password to it).

2. tracert google.com, see whats happening.

3. delete ip from any tables: e.g. arp -d 192.168.n.n

4. clear any arp cache: netsh interface ip delete arpcache

5. netsh int ip reset reset.log

6. reset your settings in the TCP/IP propertues

6. reboot (well, it is Windohs and it is required)

7. enjoy being able to run your TCP/IP enabled apps and ping yourself like mad but don’t complain to me if it still doesn’t work! This is about as deep as I go.

Leave a Comment

Blender code to make a cube into red tinted glass

I wanted a glass floor between two datacentres so I could see the servers in the room below also. I put a slight red tint in the glass for effect. The greens sphere and blue cube are sticking out from behind the slice of glass. Theres a rock thing in front of the glass. A lamp shines from above which is casting a shadow on a screen behind.

glassdemo.jpg

Warning to newbies:

Make sure to show the outliner and refresh when you have run the code. Can be a pain in the backside trying to apply materials etc. to objects. The outliner shows whats going on.

import Blender
import math
from math import *
import Blender

from Blender import NMesh, Material

myCube = Blender.Object.Get(‘Cube’) #default cube, might as well use it. I resized it to make it more like a pain of glass

me=NMesh.GetRaw(‘Cube’)

“”"
diffuseColor 0.9324847 0.94625 0.9620039
ambientIntensity 0.1666667
specularColor 1.2298402 1.2298402 1.2298402
emissiveColor 0.0 0.0 0.0
shininess 0.7050781
transparency 0.8981037

“”"
#Set up materials
me.materials = [] # remove any exisiting materials (just for clarification)

mat_glassfloors=Material.New(‘glass’)
mat_glassfloors.setRGBCol(0.46,0,0) # dash of red
mat_glassfloors.setAlpha(0.3) # mat.alpha = 0.3 — almost transparent
mat_glassfloors.mode |= Material.Modes.ZTRANSP
me.addMaterial(mat_glassfloors)

me.update()
Blender.Redraw()

Leave a Comment

Handling Tuples in Python

Where farm1 is a Blender object , a tuple is like an array of typed data

WLH = farm1.getSize()
print “WLH = ” , WLH  # here we can see the list of reals
print “X is ” , XYZ[0]   # which are returned in order x,y,z
x = – WLH[0] / 0.2
y = – WLH[1] / 0.2

Leave a Comment

Making an object a parent in Blender and Python

Where farm1 is an instance of a blender object and the object name begins with the string ’seso’, farm1 is made the parent of all the objects

obs = [ob for ob in scn.objects if ob.name[0:4] == ’seso’]
scn.objects.selected = obs
for ob in obs:

print ob.name
farm1.makeParent(obs)

Leave a Comment

Creating a new lamp and camera

Two basic functions to create a camera and lamp

def newCamera():

cam = Blender.Camera.New(‘ortho’) # make ortho camera data object
ob = scn.objects.new(cam) # make a new object in this scene using the camera data
ob.setLocation (0.0, -5.0, 10.0) # position the object in the scene

def newLamp():

lamp = Blender.Lamp.New(‘Spot’)
ob = scn.objects.new(lamp)
ob.setLocation (0.0,-4.0,15)

Leave a Comment

Older Posts »