System.capabilities.language always returns en on OS X Leopard
Hello everyone!
I am having some trouble with the Flash (ActionScript 2.0) on
an Intel MAC running OS X Leopard. It seems that no matter how i
change the OS language (via System Preferences or at installation)
the System.capabilies.language call always returns "en". More
bothering is that apparently, on non-intel macs running Leopard,
some languages are detected and shown correctly (German and
Italian)...
I looked al over the Internet for a hint but i could not find
any. So ... please help... is this an OS problem, a Flash problem
or do i need a "native french" (or any other language) Leopard
installation disk ?
Thanks!
Hello,
Here's information for Resolving Kernel Panics
You've done a great job so far of trouble shooting...
-did the apple hardware test
-tested the RAM for any defects
-recently did an ARCHIVE and INSTALL
Before you go to the link above, have you tried checked the boot disk for errors? If not..;.
Restart your Mac while holding down the C key, pressing the power button and inserting your restore disk all at the same time. An Installer window will open, but do not proceed with any installations. Instead, from the Menu Bar, select Utilities > Disk Utility. In the Disk Utility window click First Aid, and then click Verify. If Disk Utility reports errors, click Repair. When Disk Utility is finished, from the Menu Bar, select Utilities/Startup Disk. Select MacintoshHD 10.x.x and click Restart.
Try disconnecting any peripherals, iPod's, mice, keyboards, cameras....
(I know you have a MacBook, but many people use the peripherals anyway).
Reboot and see if that makes a difference.
Get Leopard Cache Cleaner available here:
http://www.apple.com/downloads/macosx/systemdiskutilities/leopardcachecleaner.html
"Leopard Cache Cleaner lets you create bootable Emergency Disks that include system repair utilities and LCC’s powerful cache cleaning functions. If disaster strikes, the power of Leopard Cache Cleaner is available at the command prompt in Single User Mode"
If none of the above help, then go to the link above for kernel panics.
Carolyn
Similar Messages
-
My iphone 4 is stuck in the setup phase with a white background. It tells me hello in several diffrent languages and tells me to slide to set up. I have already backed it up on itunes several times but it always returns to the hello screen with the white back ground. Can anyone please help me with this? All of this happened after i updated it for the 1st time. Help pLease?
EdwardHello Edward
Follow the prompts on your iPhone and you will get either at your home screen like normal or get to a point of restoring from back up. The article below will give step by step for restoring from back up.
iOS: How to back up and restore your content
http://support.apple.com/kb/HT1766
Thanks for using Apple Support Communities.
Regards,
-Norm G. -
System Image Utility always fails, why?
Hi everyone,
on my clean and fresh install of 10.7.4 Server the System Image Utility always fails to create an image. I want to create a NetInstall image and have put the OS X Lion Installer in /Applications. I can select it in SIU and choose to create a NetInstall image. It asks for the admin pw and always presents an error at the very end: Image creation failed. An unknown error has occured.
If I select to create a NetBoot image instead it fails directly after clicking on the Create button with this slightly different message: Image creation failed. An error has occured. At least it’s no unknown error…
Any ideas what might be causing this? I have succesfully created NetInstall images with 10.6 Server and 10.8 Server, but 10.7 Server somehow won’t play nice.
Thanks
BjörnHi Brian,
I first deleted the Installer and redownloaded it from the App Store, just to make sure there was no problem with it. Even though I now have the 10.7.4 Installer (had 10.7.0 before) nothing has changed. I then went on to set the log level as suggested. I now get different errors based on the chosen log level.
Log level set to debug:
Image creation failed.
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
Log level set to verbose:
Image creation failed.
An unknown error has occurred.
I did not see anything helpful in the logs unfortunately. The only noticeable thing mentioned was: Failed to create image from installer media.
Any additional ideas? I will attach both logs here, just in case.
VERBOSE LOG:
Starting image creation.
Workflow Started (2012-09-08 14:08:00 +0200)
Mac OS X Server 10.7.4 (11E53), System Image Utility 10.7.3 (543)
Starting action: Define Image Source (1.3)
Finished running action: Define Image Source
Starting action: Create Image (1.6.2)
Starting image creation process...
Create NetInstall Image
Initiating NetInstall from Installer media.
Creating working path at /Users/vm/Desktop/NetInstall of Install Mac OS X Lion
Creating disk image (Size: 4062 MB)
Finalizing disk image.
created: /Users/vm/Desktop/NetInstall of Install Mac OS X Lion/NetInstall.dmg
Attaching disk image
Copying /Volumes/Mac OS X Install ESD
Preparing the kernel and boot loader for the boot image
/Users/vm/Desktop/NetInstall of Install Mac OS X Lion/i386
/Users/vm/Desktop/NetInstall of Install Mac OS X Lion/i386/x86_64
Copying /Volumes/Mac OS X Install ESD/boot.efi
Copying /Volumes/Mac OS X Install ESD/System/Library/CoreServices/PlatformSupport.plist
Performing post install cleanup
Detaching disk image
"disk4" unmounted.
"disk4" ejected.
Correcting permissions. 501:20 /Users/vm/Desktop/NetInstall of Install Mac OS X Lion
Script is done.
Failed to create image from installer media.
An unknown error has occurred.
NetInstall creation failed.
Image creation process finished...
Stopping image creation.
Image creation failed.
DEBUG LOG:
Starting image creation.
Workflow Started (2012-09-08 13:59:22 +0200)
Mac OS X Server 10.7.4 (11E53), System Image Utility 10.7.3 (543)
Starting action: Define Image Source (1.3)
Finished running action: Define Image Source
Starting action: Create Image (1.6.2)
Starting image creation process...
Create NetInstall Image
Initiating NetInstall from Installer media.
progressPrefix="_progress"
++ progressPrefix=_progress
scriptsDebugKey="DEBUG"
++ scriptsDebugKey=DEBUG
imageIsUDIFKey="1"
++ imageIsUDIFKey=1
mountPoint=""
++ mountPoint=
ownershipInfoKey="501:20"
++ ownershipInfoKey=501:20
destVolFSType="HFS+"
++ destVolFSType=HFS+
installSource="/Volumes/Mac OS X Install ESD"
++ installSource='/Volumes/Mac OS X Install ESD'
dmgTarget="NetInstall"
++ dmgTarget=NetInstall
destPath="/Users/vm/Desktop/NetInstall of Install Mac OS X Lion"
++ destPath='/Users/vm/Desktop/NetInstall of Install Mac OS X Lion'
dmgVolName="NetInstall"
++ dmgVolName=NetInstall
. "${1}/createCommon.sh"
+ . /tmp/niutemp.Yv8Z6Mqx/createCommon.sh
# createCommon.sh
# Common functionality for the Image creation process.
# sourced in by the various SIU scripts
# Copyright © 2007-2011 Apple Inc. All rights reserved.
# Using dscl, create a user account
AddLocalUser()
# $1 volume whose local node database to modify
# $2 long name
# $3 short name
# $4 isAdminUser key
# $5 password data
# $6 password hint
# $7 user picture path
# $8 Language string
local databasePath="/Local/Default/Users/${3}"
local targetVol="${1}"
# Find a free UID between 501 and 599
for ((i=501; i<600; i++)); do
output=`/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -search /Local/Default/Users UniqueID $i`
# If there is already an account dscl returns it, so we're looking for an empty return value.
if [ "$output" == "" ]; then
break
fi
done
# Create the user record
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -create $databasePath
if [ $? != 0 ]; then
echo "Failed to create '${databasePath}'."
return 1
fi
# Add long name
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath RealName "${2}"
if [ $? != 0 ]; then
echo "Failed to set the RealName."
return 1
fi
# Add PrimaryGroupID
if [ "${4}" == 1 ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 80
else
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath PrimaryGroupID 20
fi
if [ $? != 0 ]; then
echo "Failed to set the PrimaryGroupID."
return 1
fi
# Add UniqueID
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UniqueID ${i}
if [ $? != 0 ]; then
echo "Failed to set the UniqueID."
return 1
fi
# Add Home Directory entry
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath NFSHomeDirectory /Users/${3}
if [ $? != 0 ]; then
echo "Failed to set the NFSHomeDirectory."
fi
if [ "${6}" != "" ]; then
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath AuthenticationHint "${6}"
if [ $? != 0 ]; then
echo "Failed to set the AuthenticationHint."
return 1
fi
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath picture "${7}"
if [ $? != 0 ]; then
echo "Failed to set the picture."
return 1
fi
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -passwd $databasePath "${5}"
if [ $? != 0 ]; then
echo "Failed to set the passwd."
return 1
fi
# Add shell
/usr/bin/dscl -f "${targetVol}/var/db/dslocal/nodes/Default" localonly -append $databasePath UserShell "/bin/bash"
if [ $? != 0 ]; then
echo "Failed to set the UserShell."
return 1
fi
# Create Home directory
if [ -e "/System/Library/User Template/${8}.lproj/" ]; then
/usr/bin/ditto "/System/Library/User Template/${8}.lproj/" "${targetVol}/Users/${3}"
else
/usr/bin/ditto "/System/Library/User Template/English.lproj/" "${targetVol}/Users/${3}"
fi
if [ $? != 0 ]; then
echo "Failed to copy the User Template."
return 1
fi
/usr/sbin/chown -R $i:$i "${targetVol}/Users/${3}"
if [ $? != 0 ]; then
echo "Failed to set ownership on the User folder."
return 1
fi
# Copies a list of files (full paths contained in the file at $1) from source to the path specified in $2
CopyEntriesFromFileToPath()
local theFile="$1"
local theDest="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
/usr/bin/ditto $opt "${FILE}" "${theDest}/${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Copies a list of packages (full path, destination pairs contained in the file at $1) from source to .../System/Installation/Packages/
CopyPackagesWithDestinationsFromFile()
local theFile="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
local leafName=`basename "${FILE}"`
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Copying ${FILE}."
fi
read SUB_PATH
/usr/bin/ditto $opt "${FILE}" "${mountPoint}/Packages/${SUB_PATH}${leafName}" || return 1
fi
done < "${theFile}"
return 0
# Create an installer package in ${1} wrapping the supplied script ${2}
CreateInstallPackageForScript()
local tempDir="$1"
local scriptPath="$2"
local scriptName=`basename "${scriptPath}"`
local entryDir=`pwd`
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Create installer for script ${scriptName}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# shouldn't exist on entry...
if [ -e "${tempDir}/emptyDir" ]; then
/bin/rm -rf "${tempDir}/emptyDir"
fi
# make some directories to work in
/bin/mkdir $opt -p "${tempDir}/${scriptName}.pkg/Contents/Resources" || return 1
/bin/mkdir $opt "${tempDir}/emptyDir" || return 1
# Create Archive.pax.gz
cd "${tempDir}/emptyDir"
/bin/pax -w -x cpio -f "${tempDir}/${scriptName}.pkg/Contents/Archive.pax" .
/usr/bin/gzip "${tempDir}/${scriptName}.pkg/Contents/Archive.pax"
cd "${entryDir}"
# Create the Archive.bom file
/usr/bin/mkbom "${tempDir}/emptyDir/" "${tempDir}/${scriptName}.pkg/Contents/Archive.bom" || return 1
# Create the Info.plist
/bin/cat > "${tempDir}/${scriptName}.pkg/Contents/Info.plist" << END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.server.SystemImageUtility.${scriptName}</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>IFMajorVersion</key>
<integer>1</integer>
<key>IFMinorVersion</key>
<integer>0</integer>
<key>IFPkgFlagDefaultLocation</key>
<string>/tmp</string>
<key>IFPkgFlagInstallFat</key>
<false/>
<key>IFPkgFlagIsRequired</key>
<false/>
<key>IFPkgFormatVersion</key>
<real>0.10000000149011612</real>
</dict>
</plist>
END
echo "pkmkrpkg1" > "${tempDir}/${scriptName}.pkg/Contents/PkgInfo"
echo "major: 1\nminor: 0" > "${tempDir}/${scriptName}.pkg/Contents/Resources/package_version"
# Copy the script
/bin/cp "$scriptPath" "${tempDir}/${scriptName}.pkg/Contents/Resources/postflight"
# clean up
/bin/rm -r "${tempDir}/emptyDir"
return 0
# Validate or create the requested directory
CreateOrValidatePath()
local targetDir="$1"
if [ ! -d "${targetDir}" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Creating working path at ${targetDir}"
fi
/bin/mkdir -p "${targetDir}" || return 1
fi
# If any exist, apply any user accounts
CreateUserAccounts()
# $1 volume whose local node database to modify
local count="${#userFullName[*]}"
local targetVol="${1}"
if [ $count -gt 0 ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding $count user account(s) to the image"
fi
for ((index=0; index<$count; index++)); do
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Adding user ${userFullName[$index]}"
fi
#lay down user here
AddLocalUser "${targetVol}" "${userFullName[$index]}" "${userUnixName[$index]}" "${userIsAdmin[$index]}" "${userPassword[$index]}" "${userPassHint[$index]}" "${userImagePath[$index]}" "${userLanguage[$index]}"
if [ $? != 0 ]; then
echo "Failed to create the User '${userUnixName[$index]}'."
return 1
fi
done
# "touch"
/usr/bin/touch "${targetVol}/private/var/db/.AppleSetupDone"
/usr/bin/touch "${targetVol}/Library/Receipts/.SetupRegComplete"
fi
# retry the hdiutil detach until we either time out or it succeeds
retry_hdiutil_detach()
local mount_point="${1}"
local tries=0
local forceAt=0
local limit=24
local opt=""
forceAt=$(($limit - 1))
while [ $tries -lt $limit ]; do
tries=$(( tries + 1 ))
/bin/sleep 5
echo "Attempting to detach the disk image again..."
/usr/bin/hdiutil detach "${mount_point}" $opt
if [ $? -ne 0 ]; then
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${mount_point}"
fi
if [ $tries -eq $forceAt ]; then
echo "Failed to detach disk image at '${mount_point}' normally, adding -force."
opt="-force"
fi
if [ $tries -eq $limit ]; then
echo "Failed to detach disk image at '${mount_point}'."
exit 1
fi
else
tries=$limit
fi
done
# Create the dyld shared cache files
DetachAndRemoveMount()
local theMount="${1}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Detaching disk image"
# Dump a list of any still open files on the mountPoint
if [ "${scriptsDebugKey}" == "DEBUG" ]; then
/usr/sbin/lsof +fg "${theMount}"
fi
fi
# Finally detach the image and dispose the mountPoint directory
/usr/bin/hdiutil detach "${theMount}" || retry_hdiutil_detach "${theMount}" || return 1
/bin/rmdir "${theMount}" || return 1
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexec/PlistBuddy -c "Delete :com.apple.NetBootClientHelper" "${targetVol}/var/db/launchd.db/com.apple.launchd/overrides.plist" > /dev/null 2>&1
fi
return 0
# If any exist, install configuration profiles to the install image
InstallConfigurationProfiles()
local tempDir="${1}"
local targetVol="${2}"
local profilesDir="${targetVol}/var/db/ConfigurationProfiles"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/configProfiles.txt" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Configuration Profiles"
fi
/bin/mkdir -p "${profilesDir}/Setup" || return 1
# Make sure the perms are correct
/usr/sbin/chown root:wheel "${profilesDir}"
/bin/chmod 755 "${profilesDir}"
/usr/sbin/chown root:wheel "${profilesDir}/Setup"
/bin/chmod 755 "${profilesDir}/Setup"
/usr/bin/touch "${profilesDir}/.profilesAreInstalled"
CopyEntriesFromFileToPath "${tempDir}/configProfiles.txt" "${profilesDir}/Setup" || return 1
# Enable MCX debugging
if [ 1 == 1 ]; then
if [ -e "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" ]; then
/usr/libexec/PlistBuddy -c "Delete :debugOutput" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Delete :collateLogs" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
/usr/libexec/PlistBuddy -c "Add :debugOutput string -2" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add :collateLogs string 1" "${targetVol}/Library/Preferences/com.apple.MCXDebug.plist" > /dev/null 2>&1
fi
fi
# Converts a list of scripts (full paths contained in the file at $1) into packages in $3
InstallScriptsFromFile()
local tempDir="${1}"
local theFile="${2}"
local targetDir="${3}"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Converting scripts into install packages"
fi
while read FILE
do
if [ -e "${FILE}" ]; then
# make an installer package out of the script
CreateInstallPackageForScript "$tempDir" "${FILE}" || return 1
# copy the resulting package to the Packages directory
local leafName=`basename "${FILE}"`
/usr/bin/ditto $opt "${tempDir}/${leafName}.pkg" "${targetDir}/${leafName}.pkg" || return 1
# clean up
/bin/rm -r "${tempDir}/${leafName}.pkg"
fi
done < "${theFile}"
return 0
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PostFlightDestination()
local tempDir="${1}"
local destDir="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Performing post install cleanup"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
# delete the DS indices to force reindexing...
if [ -e "${mountPoint}/var/db/dslocal/indices/Default/index" ]; then
/bin/rm $opt "${mountPoint}/var/db/dslocal/indices/Default/index"
fi
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
if [ $? != 0 ]; then
echo "Failed to detach and clean up the mount at '${mountPoint}'."
return 1
fi
echo "Correcting permissions. ${ownershipInfoKey} $destDir"
/usr/sbin/chown -R "${ownershipInfoKey}" "$destDir"
# Prepare the source by deleting stuff we don't want to copy if sourcing a volume
PreCleanSource()
local srcVol="$1"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
opt="-v"
fi
fi
if [ -e "$srcVol/private/var/vm/swapfile*" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Removing swapfiles on $1"
fi
/bin/rm $opt "$srcVol/private/var/vm/swapfile*"
fi
if [ -d "$srcVol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for t /bin/rmdir "${theMount}" || return 1
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > "${mountPoint}/etc/sshd_config" << END
HostKey /private/var/tmp/ssh_host_key
HostKey /private/var/tmp/ssh_host_rsa_key
HostKey /private/var/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libexmountPoint=`mktemp -d "/tmp/mnt.XXXXXXXX"`
errExit()
echo "Execution of '`basename ${0}`' failed. Cleaning up."
# detach the disk and remove the mount folder
DetachAndRemoveMount "${mountPoint}"
/bin/rm -r "${destPath}"
exit 1
# Set up for script debugging
debug_opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
debug_opt="-v"
fi
# Prepare the destination
CreateOrValidatePath "$destPath" || errExit
# update progress information
echo "${progressPrefix}_creatingImage_"
if [ -e "${installSource}/BaseSystem.dmg" ]; then
size=$2
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Creating disk image (Size: $size MB)"
fi
/usr/bin/hdiutil create "$destPath/$dmgTarget" -megabytes $size -volname "${dmgVolName}" -uid 0 -gid 80 -mode 1775 -layout "SPUD" -fs "$destVolFSType" -stretch 500g -ov -puppetstrings || errExit
echo "${progressPrefix}_copyingSource_"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Attaching disk image"
fi
/usr/bin/hdiutil attach "${destPath}/${dmgTarget}.dmg" -owners on -nobrowse -noautoopen -mountpoint "${mountPoint}" -quiet || errExit
# Copy source Volume base system to
/usr/bin/ditto $debug_opt "${installSource}" "${mountPoint}" || errExit
else
echo "This does not appear to be a Mac OS X Install DVD."
errExit
fi
# If adding any additional packages or scripts
if [ -e "${1}/OSInstall.collection" ]; then
/usr/bin/ditto $debug_opt "${1}/OSInstall.collection" "${mountPoint}/Packages/OSInstall.collection" || errExit
/usr/sbin/chown root:wheel "${mountPoint}/Packages/OSInstall.collection"
# If adding any additional packages
if [ -e "${1}/additionalPackages.txt" ]; then
CopyPackagesWithDestinationsFromFile "${1}/additionalPackages.txt" || errExit
fi
# If adding any scripts
if [ -e "${1}/additionalScripts.txt" ]; then
InstallScriptsFromFile "${1}" "${1}/additionalScripts.txt" "${mountPoint}/Packages" || errExit
fi
fi
# If it exists, install the partition data onto the install image
ProcessAutoPartition "${1}" || errExit
# If it exists, install minstallconfig.xml (AutoInstall data) onto the install image
ProcessMinInstall "${1}" || errExit
# update progress information
echo "${progressPrefix}_buildingBooter_"
# Copy kernel and boot loader
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and boot loader for the boot image"
fi
# make sure this doesn't exist
if [ -e "${destPath}/i386" ]; then
/bin/rm -rf "${destPath}/i386"
fi
/bin/mkdir -p $debug_opt "${destPath}/i386/x86_64" || errExit
# copy these directly off the install media
/usr/bin/ditto $debug_opt "${installSource}/boot.efi" "${destPath}/i386/booter" || errExit
/usr/bin/chflags nohidden "${destPath}/i386/booter"
# Grab the relevant portion of the com.apple.Boot.plist
kernelFlags=`/usr/libexec/PlistBuddy -c "print :'Kernel Flags'" "${installSource}/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"`
/usr/libexec/PlistBuddy -c "add :'Kernel Flags' string ${kernelFlags}" "${destPath}/i386/com.apple.Boot.plist" > /dev/null 2>&1
/usr/bin/ditto $debug_opt "${installSource}/System/Library/CoreServices/PlatformSupport.plist" "${destPath}/i386/PlatformSupport.plist" || errExit
# extract the kernel & kernelcache for the boot shell
/usr/bin/lipo -extract i386 "${mountPoint}/kernelcache" -output "${destPath}/i386/kernelcache" || errExit
/usr/bin/lipo -extract x86_64 "${mountPoint}/kernelcache" -output "${destPath}/i386/x86_64/kernelcache" || errExit
# Apply choice changes, if any
if [ -e "${1}/MacOSXInstaller.choiceChanges" ]; then
echo "Copy over package choice selection."
/usr/bin/ditto $debug_opt "${1}/MacOSXInstaller.choiceChanges" "${mountPoint}/Packages/Extras/MacOSXInstaller.choiceChanges"
fi
# update progress information
echo "${progressPrefix}_finishingUp_"
# perform the final cleanup
PostFlightDestination "${1}" "$destPath" || errExit
errExit
Vol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and kext cache for tPERCENT:0.000000
PERCENT:4.332841
PERCENT:8.985722
PERCENT:12.358444
PERCENT:14.524864
PERCENT:16.617430
PERCENT:19.522402
PERCENT:21.614967
PERCENT:23.535204
PERCENT:26.070902
PERCENT:29.271296
PERCENT:33.111767
PERCENT:38.847858
PERCENT:42.343674
PERCENT:44.707043
PERCENT:46.578041
PERCENT:49.138355
PERCENT:51.772526
PERCENT:55.563763
PERCENT:58.567207
PERCENT:62.210735
PERCENT:64.795670
PERCENT:69.719353
PERCENT:74.741508
PERCENT:77.055641
PERCENT:79.591331
PERCENT:83.013290
PERCENT:85.548988
PERCENT:88.010834
PERCENT:91.728210
PERCENT:97.710487
PERCENT:100.000000
PERCENT:-1.000000
Finalizing disk image.
created: /Users/vm/Desktop/NetInstall of Install Mac OS X Lion/NetInstall.dmg
/bin/rmdir "${theMount}" || return 1
return 0
# If the pieces exist, enable remote access for the shell image
EnableRemoteAccess()
local srcVol="${1}"
local opt=""
if [ -e "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Enabling shell image remote access support"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
fi
# install some things (again which aren't part of BaseSystem) needed for remote ASR installs
/usr/bin/ditto $opt "${srcVol}/usr/lib/pam/pam_serialnumber.so.2" "${mountPoint}/usr/lib/pam/pam_serialnumber.so.2" || return 1
if [ -e "${srcVol}/usr/sbin/installer" ]; then
/usr/bin/ditto $opt "${srcVol}/usr/sbin/installer" "${mountPoint}/usr/sbin/installer" || return 1
fi
# copy the sshd config and add our keys to the end of it
if [ -e "${srcVol}/etc/sshd_config" ]; then
/bin/cat "${srcVol}/etc/sshd_config" - > Creating working path at /Users/vm/Desktop/NetInstall of Install Mac OS X Lion
Creating disk image (Size: 4062 MB)
/tmp/ssh_host_dsa_key
END
fi
fi
return 0
# If it exists, install the sharing names and/or directory binding support to the install image
HandleNetBootClientHelper()
local tempDir="${1}"
local targetVol="${2}"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
opt="-v"
fi
if [ -e "${tempDir}/bindingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Directory Service binding information"
fi
/usr/bin/ditto $opt "${tempDir}/bindingNames.plist" "${targetVol}/etc/bindingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/bindingNames.plist"
/bin/chmod 644 "${targetVol}/etc/bindingNames.plist"
fi
if [ -e "${tempDir}/sharingNames.plist" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Installing Sharing Names support"
fi
/usr/bin/ditto $opt "${tempDir}/sharingNames.plist" "${targetVol}/etc/sharingNames.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/etc/sharingNames.plist"
/bin/chmod 644 "${targetVol}/etc/sharingNames.plist"
fi
if [ -e "${tempDir}/NetBootClientHelper" ]; then
/usr/bin/ditto $opt "${tempDir}/NetBootClientHelper" "${targetVol}/usr/sbin/NetBootClientHelper" || return 1
/usr/sbin/chown root:wheel "${targetVol}/usr/sbin/NetBootClientHelper"
/bin/chmod 555 "${targetVol}/usr/sbin/NetBootClientHelper"
/usr/bin/ditto $opt "${tempDir}/com.apple.NetBootClientHelper.plist" "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist" || return 1
/usr/sbin/chown root:wheel "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
/bin/chmod 644 "${targetVol}/System/Library/LaunchDaemons/com.apple.NetBootClientHelper.plist"
# finally, make sure it isn't disabled...
/usr/libex
# update progress information
echo "${progressPrefix}_creatingImage_"
if [ -e "${installSource}/BaseSystem.dmg" ]; then
size=$2
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Creating disk image (Size: $size MB)"
fi
/usr/bin/hdiutil create "$destPath/$dmgTarget" -megabytes $size -volname "${dmgVolName}" -uid 0 -gid 80 -mode 1775 -layout "SPUD" -fs "$destVolFSType" -stretch 500g -ov -puppetstrings || errExit
echo "${progressPrefix}_copyingSource_"
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ] ; then
echo "Attaching disk image"
fi
/usr/bin/hdiutil attach "${destPath}/${dmgTarget}.dmg" -owners on -nobrowse -noautoopen -mountpoint "${mountPoint}" -quiet || errExit
# Copy source Volume base system to
/usr/bin/ditto $debug_opt "${installSource}" "${mountPoint}" || errExit
else
echo "This does not appear to be a Mac OS X Install DVD."
errExit
fi
# If adding any additional packages or scripts
if [ -e "${1}/OSInstall.collection" ]; then
/usr/bin/ditto $debug_opt "${1}/OSInstall.collection" "${mountPoint}/Packages/OSInstall.collection" || errExit
/usr/sbin/chown root:wheel "${mountPoint}/Packages/OSInstall.collection"
# If adding any additional packages
if [ -e "${1}/additionalPackages.txt" ]; then
CopyPackagesWithDestinationsFromFile "${1}/additionalPackages.txt" || errExit
fi
# If adding any scripts
if [ -e "${1}/additionalScripts.txt" ]; then
InstallScriptsFromFile "${1}" "${1}/additionalScripts.txt" "${mountPoint}/Packages" || errExit
fi
fi
# If it exists, install the partition data onto the install image
ProcessAutoPartition "${1}" || errExit
# If it exists, install minstallconfig.xml (AutoInstall data) onto the install image
ProcessMinInstall "${1}" || errExit
# update progress information
echo "${progressPrefix}_buildingBooter_"
# Copy kernel and boot loader
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Preparing the kernel and boot loader for the boot image"
fi
# make sure this doesn't exist
if [ -e "${destPath}/i386" ]; then
/bin/rm -rf "${destPath}/i386"
fi
/bin/mkdir -p $debug_opt "${destPath}/i386/x86_64" || errExit
# copy these directly off the install media
/usr/bin/ditto $debug_opt "${installSource}/boot.efi" "${destPath}/i386/booter" || errExit
/usr/bin/chflags nohidden "${destPath}/i386/booter"
# Grab the relevant portion of the com.apple.Boot.plist
kernelFlags=`/usr/libexec/PlistBuddy -c "print :'Kernel Flags'" "${installSource}/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"`
/usr/libexec/PlistBuddy -c "add :'Kernel Flags' string ${kernelFlags}" "${destPath}/i386/com.apple.Boot.plist" > /dev/null 2>&1
/usr/bin/ditto $debug_opt "${installSource}/System/Library/CoreServices/PlatformSupport.plist" "${destPath}/i386/PlatformSupport.plist" || errExit
# extract the kernel & kernelcache for the boot shell
/usr/bin/lipo -extract i386 "${mountPoint}/kernelcache" -output "${destPath}/i386/kernelcache" || errExit
/usr/bin/lipo -extract x86_64 "${mountPoint}/kernelcache" -output "${destPath}/i386/x86_64/kernelcache" || errExit
# Apply choice changes, if any
if [ -e "${1}/MacOSXInstaller.choiceChanges" ]; then
echo "Copy over package choice selection."
/usr/bin/ditto $debug_opt "${1}/MacOSXInstaller.choiceChanges" "${mountPoint}/Packages/Extras/MacOSXInstaller.choiceChanges"
fi
# update progress information
echo "${progressPrefix}_finishingUp_"
# perform the final cleanup
PostFlightDestination "${1}" "$destPath" || errExit
rrExit
# Apply choice changes, if any
if [ -e "${1}/MacOSXInstaller.choiceChanges" ]; then
echo "Copy over package choice selection."
/usr/bin/ditto $debug_opt "${1}/MacOSXInstaller.choiceChanges" "${mountPoint}/Packages/Extras/MacOSXInstaller.choiceChanges"
fi
# update progress information
echo "${progressPrefix}_finishingUp_"
# perform the final cleanup
PostFlightDestination "${1}" "$destPath" || errExit
tDestination "${1}" "$destPath" || errExit
errExit
Vol/private/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/tmp/*"
fi
if [ -d "$srcVol/private/var/tmp" ]; then
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out /private/var/tmp on $1"
fi
/bin/rm -r $opt "$srcVol/private/var/tmp/*"
fi
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
echo "Cleaning out devices and volumes on $1"
fi
if [ -d "$srcVol/Volumes" ]; then
/bin/rm -r $opt "$srcVol/Volumes/*"
fi
if [ -d "$srcVol/dev" ]; then
/bin/rm $opt "$srcVol/dev/*"
fi
if [ -d "$srcVol/private/var/run" ]; then
/bin/rm -r $opt "$srcVol/private/var/run/*"
fi
# Copy kernel and build the kext cache on the boot image
PrepareKernelAndKextCache()
local srcDir="$1"
local destDir="$2"
local opt=""
if [ "${scriptsDebugKey}" == "VERBOSE" -o "${scriptsDebugKey}" == "DEBUG" ]; then
Stopping image creation.
Terminating script!
Image creation failed. -
Java always returns 15 minutes greater than the current time.
Hi,
I am using Microsoft Windows Server 2003R2,Standard X64 edition with Service Pack 2 and jdk1.6.0-03.
Java always returns time 15 minutes greater than the current system time.
eg:
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("Now time: "+simpleDateFormat.format(new Date()));
System.out.println("Now time: "+new Date());The output of the program is :
Now time: 2008-12-22 18:47:04
Now time: Mon Dec 22 18:47:04 NPT 2008
When my actual system time is 6:32 PM or (18:32)
I have checked the current time with other programming languages like python and it always returns the actual date and time.
Note: To my observation java is always utilizing a time which is 15 minutes greater than the current time even for its log.
Thanks,
Rajeswari (Msys)I think a more practical time machine would be one that actually travels back in time rather than forward (by 15 minutes). Sounds like it needs some more work.
Anyway, I suggest changing the system time on your computer to some other value (say, 2 hours ahead), then running the program again. If its off by 2 hours and 15 minutes, its getting the time from your computer. However, if its still off by only 15 minutes (from your wristwatch's time), then its getting the time form somehere other than the computer clock. -
According to the documentation, Capabilities.language has a fixed list of possible values, as shown here:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Capabiliti es.html#language
For Portuguese there's only one entry: "pt"
So will Capabilites.language return the same "pt" value for people from Portugal and from Brazil?
How can I tell the difference? How can i get the "pt-br" or "pt-pt" strings?
Thanks!Check out the difference between Capabilities.language and Capabilities.languages
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Capabiliti es.html#language
vs.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Capabiliti es.html#languages
roymeo -
Request.getParameter() always returns null
I have a html file and am trying to retrieve the values from a formin my servlet.
here is the html code:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<h1><b>Add DVD</b></h1>
</head>
<body>
<form action="add_dvd.do" method="POST">
Title:<input type="text" name="title" />
Year:<input type="text" name="year" />
Genre: <select name='gselected'>
<option value='Sci-Fi'>Sci-Fi</option>
</select>
or enter new genre:<input type="text" name='gentered' value="" />
<input type="submit" value="Add DVD" />
</form>
</body>
</html>
and here is the servlet code:
public class AddDVDServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// System.out.println("in AddDVDServlet post method");
List errorMsgs = new LinkedList();
//retrieve form parameters
try{
String title = request.getParameter("title").trim();
String year = request.getParameter("year").trim();
*String gentered = request.getParameter("gentered");
String gselected = request.getParameter("gselected");
String genre="";
if("".equals(gentered))
genre = gselected;
else
genre = gentered;
// System.out.println("parameter retrieved");
if(!year.matches("\\d\\d\\d\\d"))
// System.out.println("year not 4 digit long");
errorMsgs.add("Year must be four digit long");
if("".equals(title))
// System.out.println("title not entered");
errorMsgs.add("Please enter the title of the dvd");
if("".equals(genre))
// System.out.println("genre not valid");zdf
errorMsgs.add("Enter genre.");
if(! errorMsgs.isEmpty())
//System.out.println("errors in entry ");
request.setAttribute("errors",errorMsgs);
// System.out.println("error attribute set in request");
RequestDispatcher rd = request.getRequestDispatcher("error.view");
rd.forward(request, response);
return;
//create DVDItem instance
DVDItem dvd = new DVDItem(title,year,genre);
request.setAttribute("dvdItem",dvd);
RequestDispatcher rd = request.getRequestDispatcher("success.view");
rd.forward(request, response);
catch(Exception e){
errorMsgs.add(e.getMessage());
request.setAttribute("errors",errorMsgs);
RequestDispatcher rd = request.getRequestDispatcher("error.view");
rd.forward(request, response);
e.printStackTrace();
System.out.println("exception:"+e);
why does getParameter always return null??? whats wrong?I don't know. However, I suspect that because you have a tag with the same name as 'title', its causing a name conflict. Chnage the name to something else. If it works, then that's the likely explaination.
-
Global Temp Table, always return zero records
I call the procedure which uses glbal temp Table, after executing the Proc which populates the Global temp table, i then run select query retrieve the result, but it alway return zero record. I am using transaction in order to avoid deletion of records in global temp table.
whereas if i do the same thing in SQL navigator, it works
Cn.ConnectionString = Constr
Cn.Open()
If FGC Is Nothing Then
Multiple = True
'Search by desc
'packaging.pkg_msds.processavfg(null, ActiveInActive, BrandCode, Desc, Itemtype)
SQL = "BEGIN packaging.pkg_msds.processavfg(null,'" & _
ActiveInActive & "','" & _
BrandCode & "','" & _
Desc & "','" & _
Itemtype & "'); end;"
'Here it will return multiple FGC
'need to combine them
Else
'search by FGC
SQL = "BEGIN packaging.pkg_msds.processavfg('" & FGC & "','" & _
ActiveInActive & "','" & _
BrandCode & "',null,null); end;"
'will alway return one FGC
End If
' SQL = " DECLARE BEGIN rguo.pkg_msds.processAvedaFG('" & FGC & "'); end;"
Stepp = 1
Cmd.Connection = Cn
Cmd.CommandType = Data.CommandType.Text
Cmd.CommandText = SQL
Dim Trans As System.Data.OracleClient.OracleTransaction
Trans = Cn.BeginTransaction()
Cmd.Transaction = Trans
Dim Cnt As Integer
Cnt = Cmd.ExecuteNonQuery
'SQL = "SELECT rguo.pkg_msds.getPDSFGMass FROM dual"
SQL = "select * from packaging.aveda_mass_XML"
Cmd.CommandType = Data.CommandType.Text
Cmd.CommandText = SQL
Adp.SelectCommand = Cmd
Stepp = 2
Adp.Fill(Ds)
If Ds.Tables(0).Rows.Count = 0 Then
blError = True
BlComposeXml = True
Throw New Exception("No Record found for FGC(Finished Good Code=)" & FGC)
End If
'First Row, First Column contains Data as XML
Stepp = 0
Trans.Commit()Hi,
This forum is for Oracle's Data Provider and you're using Microsoft's, but I was curious so I went ahead and tried it. It works fine for me. Here's the complete code I used, could you point out what are you doing differently?
Cheers,
Greg
create global temporary table abc_tab(col1 varchar2(10));
create or replace procedure ins_abc_tab(v1 varchar2) as
begin
insert into abc_tab values(v1);
end;
using System;
using System.Data;
using System.Data.OracleClient;
class Program
static void Main(string[] args)
OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger");
con.Open();
OracleTransaction txn = con.BeginTransaction();
OracleCommand cmd = new OracleCommand("begin ins_abc_tab('foo');end;", con);
cmd.Transaction = txn;
cmd.ExecuteNonQuery();
cmd.CommandText = "select * from abc_tab";
OracleDataAdapter da = new OracleDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
Console.WriteLine("rows found: {0}", ds.Tables[0].Rows.Count);
// commit, cleanup, etc ommitted for clarity
} -
Call thirty party java web service but always return null
hi
I call a java web service in my application visual studio 2008 c#, but always return NULL.
I used Tool Fiddler to monitor the traffic between my client and the web service server, it showed the return is not Null.
Here is my code, please see if anything I do wrong.
namespace CanOfficer_THQ_vs_IHQ.TestWebReferenceAppointment {
using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="AppointmentServiceSoapBinding", Namespace="http://service.ips.salvationarmy.org/")]
public partial class AppointmentService : Microsoft.Web.Services3.WebServicesClientProtocol {
private System.Threading.SendOrPostCallback deleteAppOperationCompleted;
private System.Threading.SendOrPostCallback importAppOperationCompleted;
private System.Threading.SendOrPostCallback editAppOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>
public AppointmentService() {
this.Url = global::CanOfficer_THQ_vs_IHQ.Properties.Settings.Default.CanOfficer_THQ_vs_IHQ_TestWebReferenceAppointment_AppointmentService;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
else {
this.useDefaultCredentialsSetExplicitly = true;
public new string Url {
get {
return base.Url;
set {
if ((((this.IsLocalFileSystemWebService(base.Url) == true)
&& (this.useDefaultCredentialsSetExplicitly == false))
&& (this.IsLocalFileSystemWebService(value) == false))) {
base.UseDefaultCredentials = false;
base.Url = value;
public new bool UseDefaultCredentials {
get {
return base.UseDefaultCredentials;
set {
base.UseDefaultCredentials = value;
this.useDefaultCredentialsSetExplicitly = true;
/// <remarks/>
public event deleteAppCompletedEventHandler deleteAppCompleted;
/// <remarks/>
public event importAppCompletedEventHandler importAppCompleted;
/// <remarks/>
public event editAppCompletedEventHandler editAppCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute(
RequestNamespace="http://service.ips.salvationarmy.org/",
ResponseNamespace="http://service.ips.salvationarmy.org/",
Use=System.Web.Services.Description.SoapBindingUse.Encoded,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string deleteApp([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] int id) {
object[] results = this.Invoke("deleteApp", new object[] {
id});
return ((string)(results[0]));
/// <remarks/>
public void deleteAppAsync(int id) {
this.deleteAppAsync(id, null);
/// <remarks/>
public void deleteAppAsync(int id, object userState) {
if ((this.deleteAppOperationCompleted == null)) {
this.deleteAppOperationCompleted = new System.Threading.SendOrPostCallback(this.OndeleteAppOperationCompleted);
this.InvokeAsync("deleteApp", new object[] {
id}, this.deleteAppOperationCompleted, userState);
private void OndeleteAppOperationCompleted(object arg) {
if ((this.deleteAppCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.deleteAppCompleted(this, new deleteAppCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute(
RequestNamespace="http://service.ips.salvationarmy.org/",
ResponseNamespace="http://service.ips.salvationarmy.org/",
Use=System.Web.Services.Description.SoapBindingUse.Encoded,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string importApp(
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] int person,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string name,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string territory,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string location,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] bool primary,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> start,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> end,
[System.Xml.Serialization.XmlElementAttribute("categories", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string[] categories) {
object[] results = this.Invoke("importApp", new object[] {
person,
name,
territory,
location,
primary,
start,
end,
categories});
return ((string)(results[0]));
/// <remarks/>
public void importAppAsync(int person, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories) {
this.importAppAsync(person, name, territory, location, primary, start, end, categories, null);
/// <remarks/>
public void importAppAsync(int person, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories, object userState) {
if ((this.importAppOperationCompleted == null)) {
this.importAppOperationCompleted = new System.Threading.SendOrPostCallback(this.OnimportAppOperationCompleted);
this.InvokeAsync("importApp", new object[] {
person,
name,
territory,
location,
primary,
start,
end,
categories}, this.importAppOperationCompleted, userState);
private void OnimportAppOperationCompleted(object arg) {
if ((this.importAppCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.importAppCompleted(this, new importAppCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute(
RequestNamespace="http://service.ips.salvationarmy.org/",
ResponseNamespace="http://service.ips.salvationarmy.org/",
Use=System.Web.Services.Description.SoapBindingUse.Encoded,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string editApp(
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] int id,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string name,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string territory,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string location,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] bool primary,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> start,
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] Nullable<System.DateTime> end,
[System.Xml.Serialization.XmlElementAttribute("categories", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] string[] categories) {
object[] results = this.Invoke("editApp", new object[] {
id,
name,
territory,
location,
primary,
start,
end,
categories});
return ((string)(results[0]));
/// <remarks/>
public void editAppAsync(int id, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories) {
this.editAppAsync(id, name, territory, location, primary, start, end, categories, null);
/// <remarks/>
public void editAppAsync(int id, string name, string territory, string location, bool primary, Nullable<System.DateTime> start, Nullable<System.DateTime> end, string[] categories, object userState) {
if ((this.editAppOperationCompleted == null)) {
this.editAppOperationCompleted = new System.Threading.SendOrPostCallback(this.OneditAppOperationCompleted);
this.InvokeAsync("editApp", new object[] {
id,
name,
territory,
location,
primary,
start,
end,
categories}, this.editAppOperationCompleted, userState);
private void OneditAppOperationCompleted(object arg) {
if ((this.editAppCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.editAppCompleted(this, new editAppCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
private bool IsLocalFileSystemWebService(string url) {
if (((url == null)
|| (url == string.Empty))) {
return false;
System.Uri wsUri = new System.Uri(url);
if (((wsUri.Port >= 1024)
&& (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
return true;
return false;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
public delegate void deleteAppCompletedEventHandler(object sender, deleteAppCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class deleteAppCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal deleteAppCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
public delegate void importAppCompletedEventHandler(object sender, importAppCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class importAppCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal importAppCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
public delegate void editAppCompletedEventHandler(object sender, editAppCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.5483")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class editAppCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal editAppCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));Hi;
I used Fiddler to monitor the process, and it showed the request sent thru web service worked and returned a value, but in my .Net application the return captured as NULL. Could you please look into the code above and the result from Filddler and see if
you can help.
thank you.
REQUEST:
POST https://159.253.140.178/services/AppointmentService HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.4252)
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Host: 159.253.140.178
Content-Length: 1589
Expect: 100-continue
Connection: Keep-Alive
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://service.ips.salvationarmy.org/" xmlns:types="http://service.ips.salvationarmy.org/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<soap:Header>
<wsse:Security mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>
[email protected]
</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
tpi4IPSws!
</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<tns:importApp>
<person xsi:type="xsd:int">
169275
</person>
<name xsi:type="xsd:string">
Corps Officer (Cahul-Russia) Test12
</name>
<territory xsi:type="xsd:string">
CAN
</territory>
<location xsi:type="xsd:string">
TEST LOCATION 12
</location>
<primary xsi:type="xsd:boolean">
true
</primary>
<start xsi:type="xsd:dateTime">
2013-05-30T00:00:00
</start>
<end xsi:type="xsd:dateTime">
2014-06-04T00:00:00
</end>
<categories href="#id1" />
</tns:importApp>
<soapenc:Array id="id1" soapenc:arrayType="xsd:string[1]">
<Item>
vpsCat1
</Item>
</soapenc:Array>
</soap:Body>
</soap:Envelope>
RESPONSE:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=UTF-8
Content-Length: 232
Date: Fri, 05 Sep 2014 19:45:22 GMT
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:importAppResponse xmlns:ns2="http://service.ips.salvationarmy.org/">
<return>
OK_572463
</return>
</ns2:importAppResponse>
</soap:Body>
</soap:Envelope> -
Execute oracle stored procedure from C# always returns null
Hi,
I'm trying to execute a stored procedure on oracle 9i. I'm using .Net OracleClient provider.
Apparently, I can execute the stored procedure, but it always returns null as a result (actually all the sp's I have there returns null)! I can execute any text statement against the database successfully, and also I can execute the stored procedure using Toad.
This is not the first time for me to call an oracle stored procedure, but this really is giving me a hard time! Can anyone help please?
Below are the SP, and the code used from .Net to call it, if that can help.
Oracle SP:
CREATE OR REPLACE PROCEDURE APIECARE.CHECK_EXISTENCE(l_number IN NUMBER) AS
v_status VARCHAR2(5) := NULL;
BEGIN
BEGIN
SELECT CHECK_NO_EXISTENCE(to_char(l_number))
INTO v_status
FROM DUAL;
EXCEPTION WHEN OTHERS THEN
v_status := NULL;
END;
DBMS_OUTPUT.PUT_LINE(v_status);
END CHECK_CONTRNO_EXISTENCE;
C# Code:
string connStr = "Data Source=datasource;Persist Security Info=True;User ID=user;Password=pass;Unicode=True";
OracleConnection conn = new OracleConnection(connStr);
OracleParameter param1 = new OracleParameter();
param1.ParameterName = "v_status";
param1.OracleType = OracleType.VarChar;
param1.Size = 5;
param1.Direction = ParameterDirection.Input;
OracleParameter param2 = new OracleParameter();
param2.ParameterName = "l_number";
param2.OracleType = OracleType.Number;
param2.Direction = ParameterDirection.Input;
param2.Value = 006550249;
OracleParameter[] oraParams = new OracleParameter[] { param1, param2 };
OracleCommand cmd = new OracleCommand("CHECK_EXISTENCE", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddRange(oraParams);
conn.Open();
object result = cmd.ExecuteScalar();
conn.Close();Hi,
Does that actually execute? You're passing two parameters to a procedure that only takews 1 and get no error?
Your stored procedure doesnt return anything and has no output parameters, what are you expecting to be returned exactly?
If you're trying to access V_STATUS you'll need to declare that as either an output parameter of the procedure, or return value of the function, and also access it via accessing Param.Value, not as the result of ExecuteScalar.
See if this helps.
Cheers,
Greg
create or replace function myfunc(myinvar in varchar2, myoutvar out varchar2) return varchar2
is
retval varchar2(50);
begin
myoutvar := myinvar;
retval := 'the return value';
return retval;
end;
using System;
using System.Data;
using Oracle.DataAccess.Client;
public class odpfuncparams
public static void Main()
OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
con.Open();
OracleCommand cmd = new OracleCommand("myfunc", con);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter retval = new OracleParameter("retval",OracleDbType.Varchar2,50);
retval.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(retval);
OracleParameter inval = new OracleParameter("inval",OracleDbType.Varchar2);
inval.Direction = ParameterDirection.Input;
inval.Value="hello world";
cmd.Parameters.Add(inval);
OracleParameter outval = new OracleParameter("outval",OracleDbType.Varchar2,50);
outval.Direction = ParameterDirection.Output;
cmd.Parameters.Add(outval);
cmd.ExecuteNonQuery();
Console.WriteLine("return value is {0}, out value is {1}",retval.Value,outval.Value);
con.Close();
} -
How does the AS3 property flash.system.Capabilities.hasTLS get set?
There is a setting called "flash.system.Capabilities.hasTLS" that determines whether or not the Flash Player can make native SSL/TLS-based connections. The definition of this property says " Specifies whether the system supports native SSL sockets through NetConnection (true) or does not (false)."
How does Flash determine whether this property is true or false? Is the value passed to the Flash player by the browser? Does Flash figure it out from the environment? If so, how?I, too, am trying to work out how to use extractors. The documentation is sparse.
I have found that if you replace your:
arrayList.get(0).nameProperty().set("Hi");
with:
list.remove(0);
your Callback is called, but you pretty quickly get a NullPointerException after it returns. -
Output parameters always return null when ExecuteNonQuery - No RefCursor
I am trying to call a procedure through ODP that passes in one input parameter and returns two (non-RefCursor) VARCHAR2 output parameters. I am calling the procedure using ExecuteNonQuery(); however, my parameters always return null. When I run the procedure outside of ODP, such as with SQLPlus or SQL Navigator, the output parameters are populated correctly. For some reason, there appears to be a disconnect inside of ODP. Is there a way to resolve this?
Anyone have this problem?
Here is the basic code:
===========================================================
// External call of the class below
DBNonCursorParameterTest Tester = new DBNonCursorParameterTest();
===========================================================
// The class and constructor that calls the procedure and prints the results.
public class DBNonCursorParameterTest
public DBNonCursorParameterTest()
// The test procedure I used is a procedure that takes a recordID (Int32) and then returns a
// general Name (Varchar2) and a Legal Name (Varchar2) from one table with those three fields.
string strProcName = "MyTestProc;
OracleConnection conn = new OracleConnection(DBConnection.ConnectionString);
OracleCommand cmd = new OracleCommand(strProcName,conn);
cmd.CommandType = CommandType.StoredProcedure;
// Create the input parameter and the output cursor parameter to retrieve data; assign a value to the input parameter;
// then create the parameter collection and add the parameters.
OracleParameter pBPID = new OracleParameter("p_bpid", OracleDbType.Int32, ParameterDirection.Input);
OracleParameter pBPName = new OracleParameter("p_Name", OracleDbType.Varchar2, ParameterDirection.Output);
OracleParameter pBPLegalName = new OracleParameter("p_LegalName", OracleDbType.Varchar2, ParameterDirection.Output);
pBPID.Value = 1;
// Open connection and run stored procedure.
try
conn.Open();
cmd.Parameters.Add(pBPID);
cmd.Parameters.Add(pBPName);
cmd.Parameters.Add(pBPLegalName);
cmd.ExecuteNonQuery();
Console.Write("\n" + cmd.CommandText + "\n\n");
//for (int i = 0; i < cmd.Parameters.Count; i++)
// Console.WriteLine("Parameter: " + cmd.Parameters.ParameterName + " Direction = " + cmd.Parameters[i].Direction.ToString());
// Console.WriteLine("Parameter: " + cmd.Parameters[i].ParameterName + " Status = " + cmd.Parameters[i].Status.ToString());
// Console.WriteLine("Parameter: " + cmd.Parameters[i].ParameterName + " Value = " + cmd.Parameters[i].Value.ToString() + "\n");
foreach (OracleParameter orap in cmd.Parameters)
Console.WriteLine("Parameter: " + orap.ParameterName + " Direction = " + orap.Direction.ToString() + " Value = " + orap.Value.ToString());
Console.WriteLine("Parameter: " + orap.ParameterName + " Status = " + orap.Status.ToString());
Console.WriteLine("Parameter: " + orap.ParameterName + " Value = " + orap.Value.ToString() + "\n");
// End Test code.
catch (Exception ex)
throw new Exception("ExecuteQuery() failed: " + ex.Message);
finally
this.Close();
public void Close()
if (conn.State != ConnectionState.Closed)
conn.Close();
=========================================================
Other things to note:
I have no problems with returning RefCursors; they work fine. I just don't want to use RefCursors when they are not efficient, and I want to have the ability to return output parameters when I only want to return single values and/or a value from an insert/update/delete.
Thanks for any help you can provide.Hello,
Here's a short test using multiple out parameters and a stored procedure. Does this work as expected in your environment?
Database:
/* simple procedure to return multiple out parameters */
create or replace procedure out_test (p_text in varchar2,
p_upper out varchar2,
p_initcap out varchar2)
as
begin
select upper(p_text) into p_upper from dual;
select initcap(p_text) into p_initcap from dual;
end;
/C# source:
using System;
using System.Data;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace Miscellaneous
class Program
static void Main(string[] args)
// change connection string as appropriate
const string constr = "User Id=orademo; " +
"Password=oracle; " +
"Data Source=orademo; " +
"Enlist=false; " +
"Pooling=false";
// the stored procedure to execute
const string sql = "out_test";
// simple input parameter for the stored procedure
string text = "hello!";
// create and open connection
OracleConnection con = new OracleConnection(constr);
con.Open();
// create and setup connection object
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = sql;
cmd.CommandType = CommandType.StoredProcedure;
// the input paramater
OracleParameter p_text = new OracleParameter("p_text",
OracleDbType.Varchar2,
text.Length,
text,
ParameterDirection.Input);
// first output parameter
OracleParameter p_upper = new OracleParameter("p_upper",
OracleDbType.Varchar2,
text.Length,
null,
ParameterDirection.Output);
// second output parameter
OracleParameter p_initcap = new OracleParameter("p_initcap",
OracleDbType.Varchar2,
text.Length,
null,
ParameterDirection.Output);
// add parameters to collection
cmd.Parameters.Add(p_text);
cmd.Parameters.Add(p_upper);
cmd.Parameters.Add(p_initcap);
// execute the stored procedure
cmd.ExecuteNonQuery();
// write results to console
Console.WriteLine(" p_text = {0}", text);
Console.WriteLine(" p_upper = {0}", p_upper.Value.ToString());
Console.WriteLine("p_initcap = {0}", p_initcap.Value.ToString());
Console.WriteLine();
// keep console from closing when run in debug mode from IDE
Console.WriteLine("ENTER to continue...");
Console.ReadLine();
}Output:
p_text = hello!
p_upper = HELLO!
p_initcap = Hello!
ENTER to continue...- Mark -
Default hostnameverifier always returns false ...
Hi,
I am trying to run wsdl2java by supplying an https URL. The JVM args that I am using are:
javax.net.ssl.trustStore=E:/Romil/projects/AirDeccanPlugin/localhost.ks
java.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol
On running wsdl2java, I end up getting the following exception:
java.io.IOException: wrong hostname : should be <...>
I've verified that the hostname (IP address) in the URL exactly matches the CN (IP address) in the server certificate .
When I look at the JSSE code, it seems like the default HostnameVerifier always returns "false".
I also couldnt figure out a non-programatical way of supplying my own
HostnameVerfier to JSSE that returns a "true"
Any solutions/thoughts ?
Thanks and regards,
Romiltry this code before creating a connection
com.sun.net.ssl.HostnameVerifier hv=new com.sun.net.ssl.HostnameVerifier() {
public boolean verify(String urlHostname, String certHostname) {
System.out.println("Warning: Hostname is not matched for cert: "+urlHostname+ certHostname);
return true;
com.sun.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(hv);
this should solve your problem
cheers -
GetUsageData is always returning Null
Let me first start out by stating that I know there are many questions on this issue, and I have read them all. However, none of the suggestions that I have read have seemed to help my situation. Therefore, I figure I would supply my code with the hopes
that someone can solve the issue that is mentioned in the title. Let me first supply a little bit of background.
My goal in this code is to determine what are the most visited sites in our SharePoint 2010 farm. To do this, I figured I would cycle through all of the webs in the farm, and then obtain the amount of page views within each site using the GetUsageData function.
Just to test if the GetUsageData was supplying the correct data, I coded the web part in such a way where if GetUsageData returned "Null", it would print it for every site, and "Not Null" if otherwise. In every case I have tested this web part, it has always
returned Null for evey site it has checked.
I am fairly new to programming web parts in C#, so a lot of this code is derived from what I have read when researching the subject. If anyone can assist me to see where I could fix my issue, I would greatly appreciate it.
Thank you.
Below is my Code:
using System;
using System.Data;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.WebControls;
//This code has been derived from the following link: http://blog.rafelo.com/2008/07/22/iterating-through-sharepoint-web-applications-site-collections-and-sites-webs/
namespace WebAnalyticsTest.Test
[ToolboxItemAttribute(false)]
public class Test : WebPart
//For testing purposes. More is explained further in the code.
int test;
ArrayList totalHitsArray = new ArrayList();
int totalHits;
DataGrid grid = null;
public void BeginProcess()
// Get references to the farm and farm WebService objects
// the SPWebService object contains the SPWebApplications
SPFarm thisFarm = SPFarm.Local;
SPWebService service = thisFarm.Services.GetValue<SPWebService>("");
foreach (SPWebApplication webApp in service.WebApplications)
//Execute any logic you need to against the web application
//Iterate through each site collection
foreach (SPSite siteCollection in webApp.Sites)
//do not let SharePoint handle the access denied
//exceptions. If one occurs you will be redirected
//in the middle of the process. Handle the AccessDenied
//exception yourself in a try-catch block
siteCollection.CatchAccessDeniedException = false;
try
//Execute any logic you need to against the site collection
//Call the recursive method to get all of the sites(webs)
GetWebs(siteCollection.AllWebs);
catch (Exception webE)
//You should log the error for reference
//reset the CatchAccessDeniedException property of the site
//collection to true
siteCollection.CatchAccessDeniedException = true;
public void GetWebs(SPWebCollection allWebs)
//iterate through each site(web)
foreach (SPWeb web in allWebs)
if(web.Exists)
//For every site the program finds, the count will increase by one. If this code is executed by a user who does not have
//full control, then the count will be inaccurate as it will only return the number of sites the user can access.
test += 1;
DataTable table = web.GetUsageData(Microsoft.SharePoint.Administration.SPUsageReportType.browser, Microsoft.SharePoint.Administration.SPUsagePeriodType.lastMonth);
if (table == null)
HttpContext.Current.Response.Write("Null");
else
HttpContext.Current.Response.Write("Not Null");
protected override void CreateChildControls()
BeginProcess();Hi, Shiladitya.
Sorry I haven't replied until now. I'll paste the current code I am using, but my solution is not yet complete. What it does as of right now is it creates a data table with all of the webs located in your farm, as well as the total amount of page views for
each web. What I noticed though is that when I compare these stats with the web analytics for the specific web, they don't match. I put the project on hold for this reason, and I might start it back up again soon. Feel free to use the code, and perhaps you
maybe can shed some light on my issue.
using System;
using System.Data;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.WebControls;
//This code has been derived from the following link: http://blog.rafelo.com/2008/07/22/iterating-through-sharepoint-web-applications-site-collections-and-sites-webs/
namespace WebAnalyticsTest.Test
[ToolboxItemAttribute(false)]
public class Test : WebPart
//For the total amount of hits for a single web
int totalHits;
//The final data table that will be added to.
DataTable final = new DataTable();
//Size of the data table
int finalSize = 0;
//The grid that will be displayed
DataGrid grid = new DataGrid();
public void BeginProcess()
//To allow users with lower permissions to view the proper content, the code must be used with RunWithElevatedPrivileges.
SPSecurity.RunWithElevatedPrivileges(delegate()
// Get references to the farm and farm WebService objects
// the SPWebService object contains the SPWebApplications
SPFarm thisFarm = SPFarm.Local;
SPWebService service = thisFarm.Services.GetValue<SPWebService>("");
foreach (SPWebApplication webApp in service.WebApplications)
//Execute any logic you need to against the web application
//Iterate through each site collection
foreach (SPSite siteCollection in webApp.Sites)
//do not let SharePoint handle the access denied
//exceptions. If one occurs you will be redirected
//in the middle of the process. Handle the AccessDenied
//exception yourself in a try-catch block
siteCollection.CatchAccessDeniedException = false;
try
//Execute any logic you need to against the site collection
//Call the recursive method to get all of the sites(webs)
GetWebs(siteCollection.AllWebs);
catch (Exception webE)
//Place any error logic here
//reset the CatchAccessDeniedException property of the site
//collection to true
siteCollection.CatchAccessDeniedException = true;
public void GetWebs(SPWebCollection allWebs)
//iterate through each site(web)
foreach (SPWeb web in allWebs)
if (web.Exists)
DataTable table = web.GetUsageData(SPUsageReportType.url, SPUsagePeriodType.lastMonth);
if (table != null)
//Determines the total amount of hits for a single web
foreach (DataRow row in table.Rows)
int num = System.Convert.ToInt32(row["Total Hits"]);
totalHits = totalHits + num;
//Temporarily stores the total hits with the associated web.
DataTable temp = new DataTable();
temp.Columns.Add("Site", typeof(string));
temp.Columns.Add("Total Views", typeof(int));
temp.Rows.Add(web.Title, totalHits);
//Merges the data table "temp" to the data table "final"
final.Merge(temp);
//Data table size increases by one.
finalSize += 1;
//Resets the total hit counter
totalHits = 0;
protected override void CreateChildControls()
BeginProcess();
//Sorts the data table bases on the total hits
final.DefaultView.Sort = "Total Views DESC";
//The total amount of pages to show is 10. Therefore, only execute this If statement if the final's size > 10.
if (finalSize > 10)
//Data table of the top ten most viewed pages. This data table will be used in the data grid "grid"
DataTable topTen = final.Clone();
for (int i = 0; i < 10; i++)
topTen.ImportRow(final.Rows[i]);
grid.DataSource = topTen;
else
grid.DataSource = final;
grid.DataBind();
this.Controls.Add(grid);
ListBox list = new ListBox(); -
Every time I turn my mac off, the desktop background changes. It always returns to the same picture, which was the second or third thing I changed my desktop to after getting my mac. I have background switching unchecked in my preferences, and I have never selected it as an option. Also, when I go to my preferences, it will show the icon of the picture I changed it to, even though the desktop itself has switched back.
I would start with some basic troubleshooting.
REPAIRING DISK PERMISSIONS -
NOTE: refer to article "About Disk Utility's Repair Disk Permissions feature" found here http://support.apple.com/kb/ht1452 - for the actual apple article on these step. ----
- click finder in the bottom dock, and in the window that opens, select applications in the left column - scroll through until you see the 'Utilities' folder and double click to open it. Then double click on 'Disk Utility'
- When prompted to select a disk volume or image, select the 'Macintosh HD' in the left column
- ensure the the "first aid" tab is highlighted blue in the middle of the screen
- click the button at the bottom that says 'Repair Disk Permissions'
- this process will take a few minutes to run. It will indicate it's done, by scrolling to the bottom of the "details area" displaying 'Permissions repair complete'
Dan Frankes has written an excellent article for Macworld on "Permissions" and the need to repair them - see - http://www.macworld.com/article/52220/2006/08/repairpermissions.html. Another good web site is - http://www.thexlab.com/faqs/durepairfns.html.
REPAIRING DISK - About OS X Recovery - http://support.apple.com/kb/HT4718.
- restart your computer hold down command + R keys on the keyboard to boot you into Lion / Mountain Lion Recovery mode
- select english as your main language then the continue arrow
- select "Disk Utility" on the resulting screen then 'Disk Utility' ---
- When prompted to select a disk volume or image, select the 'Macintosh HD' in the left column
- ensure the the "first aid" tab is highlighted blue in the middle of the screen
- click the button at the bottom that says 'REPAIR DISK' .......NOT "Repair disk permissions"
- this process will take a few minutes to run. It will indicate it's done, by scrolling to the bottom of the "details area" displaying "The Macintosh HD appears OK"
If you get any other message OTHER than "The Macintosh HD appears OK", like "the Macintosh HD was repaired successfully" run the "Disk Repair" again, until it displays "The Macintosh HD appears OK".
Once done, restart the computer as normal -
ServletAuthentication.weak() makes isUserInRole() always return false
I have a problem with SSO and authentification. If I authenticate with the weak()
method(have tried alle of them) authentication works fine and it seem to be single
signed-on, but
if we call the isUserInRole() method it always return false.
If I try to "call" pages from the client the declerativ security-constraints also
works fine preventing the user from accessing the pages. It is only when we use
the forward() method that we also use isUserInRole() to check if the user is permitted
to be forwarded(). WLS 6.1 sp2 tells us that the user is never in Role, no matter
what, if we use the weak() method to authenticate.
If I switch to using a j_sec_check form to authenticate the isUserInRole() works
fine. I can't use j_sec_check as a permanent solution though, because I need to
do a lot of pre- and post- processing in the login/authenication process.
Have any of you figured out a solution to this problem? Shouldn't isUserInRole()
work the same way regardless of if you logged in using SA.weak() or a j_security_check
form?Hi ,
If I switch to using a j_sec_check form to authenticate the isUserInRole()works
fine. I can't use j_sec_check as a permanent solution though, because Ineed to
do a lot of pre- and post- processing in the login/authenication process.You can use the j_security_check and still do the pre and post processing as
you want.
You have to following code,
package examples.servlets;
import java.io.PrintStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import weblogic.servlet.security.AuthFilter;
public class AuthFilterImpl extends AuthFilter
public AuthFilterImpl()
System.out.println("New AuthFilterImpl has been created.");
public void doPreAuth(ServletRequest servletrequest, ServletResponse
servletresponse)
System.out.println("AuthFilterImpl.doPreAuth has been called.");
System.out.println("Password is " +
servletrequest.getParameter("j_password"));
public boolean doSuccessAuth(ServletRequest servletrequest,
ServletResponse servletresponse)
System.out.println("AuthFilterImpl.doSuccessAuth has been called.");
return true;
public void doFailAuth(ServletRequest servletrequest, ServletResponse
servletresponse)
System.out.println("AuthFilterImpl.doFailAuth has been called.");
In your weblogic.xml have this entry,
<weblogic-web-app>
<auth-filter>
examples.servlets.AuthFilterImpl
</auth-filter>
</weblogic-web-app>
I am not sure about problem with SA.weak().
-utpal
"Morten" <[email protected]> wrote in message
news:[email protected]...
>
I have a problem with SSO and authentification. If I authenticate with theweak()
method(have tried alle of them) authentication works fine and it seem tobe single
signed-on, but
if we call the isUserInRole() method it always return false.
If I try to "call" pages from the client the declerativsecurity-constraints also
works fine preventing the user from accessing the pages. It is only whenwe use
the forward() method that we also use isUserInRole() to check if the useris permitted
to be forwarded(). WLS 6.1 sp2 tells us that the user is never in Role, nomatter
what, if we use the weak() method to authenticate.
If I switch to using a j_sec_check form to authenticate the isUserInRole()works
fine. I can't use j_sec_check as a permanent solution though, because Ineed to
do a lot of pre- and post- processing in the login/authenication process.
Have any of you figured out a solution to this problem? Shouldn'tisUserInRole()
work the same way regardless of if you logged in using SA.weak() or aj_security_check
form?
Maybe you are looking for
-
Error while creating the sales order with billing reference
hi alll i am getting error while creating the sales order with billing reference.The line items are coming in grey.I am not able to change the items as well as the quantity field.Can u guide me cheers shalsa007........
-
I can't print on my HP 3700. I've disconnected all cables, re-booted and nothing. I tried to remove and re-add the printer from 'Print & Fax' in System Preferences. I send something to print (from any application) and then in the print queue says "wa
-
How to compensate Cyan color with other colors with using profile
Hi Guys, I am using Adobe Illustrator CS3. Mac OS 10.4.11. I need a help regarding color compensate. let me explain clearly. I am doing a project in that i need to delete Cyan color and need to compensate with MYK colors. Is there any short way to ge
-
Adobe Reader/Professional or Browser
Hi, My application can open a pdf document, developed in ADOBE Livecycle Designer, either in ADOBE Reader/Acrobat Professional or a browser having the pdf plug-in installed. I need to capture the 2 scenarios in some way and do some operation bas
-
47ZV650U - Screen Visible on the top only
I have a 47ZV650U and there is a horizontal line that separates the top 1/8 of the screen from the bottom. Above the 1/8 portion, the screen is active and working properly. On the bottom of the horizontal line, the screen is gray (black or blank) wit