[SLiM] Execute xrandr commands on startup
Okay, so here's the issue. I've got Nvidia optimus drivers to work. I can successfully get into my session with startx.
But to make it work, I need to put two xrandr commands in my .xinitrc file. Therefore, it doesn't do anything for my login manager.
How can I make this work with my login manager? This is my .xinitrc file:
#!/bin/bash
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
Without these lines, I just get a black screen. I can't find any solution yet.
GloW_on_dub wrote:Can you post you're whole .xinitrc?
#!/bin/bash
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
exec awesome
That's my whole .xinitrc file.
I'm not trying to figure out how to run this when I log in. I'm trying to figure out how to run the xrandr commands when SLiM starts up X to display the log in manager.
Last edited by Slabity (2014-01-23 02:31:33)
Similar Messages
-
Intel Graphics and xrandr commands at startup
Hi all, I am new at Arch. I'm trying to setup a P4 computer as a media player. It is hooked up to 40" LCD panel. The computer has Intel 845 graphics and no open PCI slots, so I am stuck with using the onboard graphics for the resolution I want. I was able to do this with Ubuntu/Gnome by adding these lines to /etc/gdm/init.d/default
xrandr --newmode "1920x1080" 148.5 1920 2008 2052 2200 1080 1089 1095 1125 +hsync +vsync
xrandr --addmode VGA1 1920x1080
xrandr --output VGA1 --mode 1920x1080
That solved the problem, I got a great picture but the OS with Gnome was hogging all my memory. I've tried lighter distros but, if I run this as an executable script after the window manager loads, the screen doesn't render properly. I've only been able to get Gnome or XFCE to work properly. With XFCE, I ran it as a shell script in the autostart applications.
My question is, where is the best place to run these commands in the Arch startup sequence? If I get this to run at the proper time, should I be able to use LXDE or E17?karol wrote:@ thestinger
I think Intel drivers need KMS and KMS doesn't like video= or vga= options in the kernel line.
The video= option is kernel mode setting, you can use it to do stuff like really disable the LCD on a laptop when you're using an external monitor - xrandr only works in Xorg and the connector will probably still be powered on.
You can use video= to use a framebuffer (similar to vga=), and that would probably break any KMS driver because you're trying to use two at once.
Best source a quick google can find (go down to forcing modes):
http://nouveau.freedesktop.org/wiki/KernelModeSetting
Last edited by thestinger (2010-12-13 01:19:49) -
Executing terminal command at startup
What is the easiest way to execute a terminal command when OSX starts up?
OS X has used Launchd to run startup items since Tiger (10.4). Create a .plist for the program
you want to run and putting it in the /Library/launchAgents or the $HOME/Library/LaunchAgents
directory, if you only want it to run at user login. Optionally, for user startup items, you can add
the command to the Account login items, but it has to be in the form of a standalone unix script
or automator app to work correctly as an Account login item.
Here are some background resources on launchd:
http://www.macgeekery.com/tips/allabout_launchd_items_and_how_to_make_oneyourself
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemS tartup/Articles/LaunchOnDemandDaemons.html
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/m an5/launchd.plist.5.html
Here is a Gui app that can help you create launchd items:
http://sourceforge.net/projects/lingon/files/
Here is a thread on using Account login items to launch scripts and automator apps:
http://discussions.apple.com/message.jspa?messageID=11569184#11569184
Now, go start something. -
[Solved] "slim: failed to execute login command" after awesomewm updat
Hi,
i updated some weeks ago via pacman -Syu, where also awesome wm was updated from 3.4.* to 3.5.* so I updated my rc.lua as it is told on their wiki, but i cant login with my rc.lua anymore i got the failed to execute login command error from slime. If i use the shipped efault rc.lua it works fine, can someone help me to figure out whats wrong with my rc.lua?
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
local vicious = require("vicious")
function fullscreens(c)
awful.client.floating.toggle(c)
if awful.client.floating.get(c) then
local clientX = screen[1].workarea.x
local clientY = screen[1].workarea.y
local clientWidth = 0
-- look at http://www.rpm.org/api/4.4.2.2/llimits_8h-source.html
local clientHeight = 2147483640
for s = 1, screen.count() do
clientHeight = math.min(clientHeight, screen[s].workarea.height)
clientWidth = clientWidth + screen[s].workarea.width
end
local t = c:geometry({x = clientX, y = clientY, width = clientWidth, height = clientHeight})
else
--apply the rules to this client so he can return to the right tag if there is a rule for that.
awful.rules.apply(c)
end
-- focus our client
client.focus = c
end
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = err })
in_error = false
end)
end
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
-- beautiful.init("/home/kili/Repositories/awesome-themes/arch/theme.lua")
beautiful.init("/usr/share/awesome/themes/default/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "urxvt"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.floating,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.spiral,
awful.layout.suit.spiral.dwindle,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier
-- {{{ Tags
-- Define a tag table which hold all screen tags.
tags = {}
for s = 1, screen.count() do
-- Each screen has its own tag table.
tags[s] = awful.tag({ 1, 2, 3, 4, 5}, s, layouts[1])
end
-- {{{ Menu
-- Create a laucher widget and a main menu
myawesomemenu = {
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart },
{ "quit", awesome.quit }
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal }
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })
-- {{{ Wibox
-- Create a textclock widget
batwidget = wibox.widget.textbox()
vicious.register(batwidget, vicious.widgets.bat,
function(widget,args)
local formatstring = " Bat: "..args[1]..args[2] .."%".. " "..args[3] .. " "
if args[2] <= 25 and args[1] == "-" then
return "<span color=\"red\">".. formatstring .. "</span>"
end
return formatstring
end, 60, "BAT0")
netwidgetETH = wibox.widget.textbox()
netwidgetWIFI = wibox.widget.textbox()
vicious.register(netwidgetETH, vicious.widgets.net, ' eth0:<span color="#CC9393">${eth0 down_kb}</span> <span color="#7F9F7F">${eth0 up_kb}</span>', 3)
vicious.register(netwidgetWIFI, vicious.widgets.net,' wlan0:<span color="#CC9393">${wlan0 down_kb}</span> <span color="#7F9F7F">${wlan0 up_kb}</span>', 3)
menubar.utils.terminal = terminal
mytextclock = awful.widget.textclock()--{ align = "right" })
-- Create a systray
mysystray = wibox.widget.systray()
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, function(t) awful.tag.viewnext(aweful.tag.getscreen(t)) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(aweful.tag.getscreen(t)) end)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
c.minimized = false
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
-- This will also un-minimize
-- the client, if needed
client.focus = c
c:raise()
end
end),
awful.button({ }, 3, function ()
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ width=250 })
end
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end))
for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt()--{ layout = awful.widget.layout.horizontal.leftright })
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s })
-- Widgets that are aligned to the left
local left_layout = wibox.layout.fixed.horizontal()
left_layout:add(mylauncher)
left_layout:add(mytaglist[s])
left_layout:add(mypromptbox[s])
-- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal()
if s == 1 then right_layout:add(wibox.widget.systray()) end
right_layout:add(netwidgetWIFI)
right_layout:add(netwidgetETH)
right_layout:add(batwidget)
right_layout:add(mytextclock)
right_layout:add(mylayoutbox[s])
-- Now bring it all together (with the tasklist in the middle)
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_middle(mytasklist[s])
layout:set_right(right_layout)
mywibox[s]:set_widget(layout)
-- Add widgets to the wibox - order matters
--mywibox[s].widgets = {
-- mylauncher,
-- mytaglist[s],
-- mypromptbox[s],
--layout = awful.widget.layout.horizontal.leftright
-- mylayoutbox[s],
-- mytextclock,
-- batwidget,
-- netwidgetETH,
-- netwidgetWIFI,
-- s == 1 and mysystray or nil,
-- mytasklist[s],
-- layout = awful.widget.layout.horizontal.rightleft
end
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
awful.key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "k",
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "w", function () mymainmenu:show() end),
-- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
-- Standard program
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit),
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
awful.key({ modkey, "Control" }, "n", awful.client.restore),
-- Prompt
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
awful.key({ modkey }, "x",
function ()
awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen].widget,
awful.util.eval, nil,
awful.util.getdir("cache") .. "/history_eval")
end),
-- Multimedia
awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer -q sset Master 2dB-") end),
awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer -q sset Master 2dB+") end),
awful.key({ }, "XF86AudioNext",function () awful.util.spawn( "mocp -f" ) end),
awful.key({ }, "XF86AudioPrev",function () awful.util.spawn( "mocp -r" ) end),
awful.key({ }, "XF86AudioPlay",function () awful.util.spawn( "mocp -G" ) end),
awful.key({ }, "Print", function () awful.util.spawn("ksnapshot") end),
awful.key({ }, "", function () awful.util.spawn("slimlock") end)
clientkeys = awful.util.table.join(
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
-- awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, }, "n",
function (c)
-- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end),
awful.key({ modkey, }, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical
end),
awful.key({ modkey, "Shift" }, "f", fullscreens)
-- Compute the maximum number of digit we need, limited to 9
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber))
end
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, keynumber do
globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, "#" .. i + 9,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewonly(tags[screen][i])
end
end),
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewtoggle(tags[screen][i])
end
end),
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i])
end
end),
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i])
end
end))
end
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize))
-- Set keys
root.keys(globalkeys)
-- Set Firefox to always map on tags number 2 of screen 1.
-- { rule = { class = "Firefox" },
-- properties = { tag = tags[1][2] } },
-- {{{ Rules
if screen.count() > 1 then
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
-- border_color = beautiful.border_normal,
focus = true,
keys = clientkeys,
buttons = clientbuttons } },
{ rule = { class = "MPlayer" },
properties = { floating = true } },
{ rule = { class = "gimp" },
properties = { floating = true } },
{ rule = { class = "Xdialog" },
properties = { floating = true } },
{ rule = { class = "Firefox" },
properties = { tag = tags[1][1] } },
{ rule = { name = "Thunderbird" },
properties = { tag = tags[1][2] } },
{ rule = { instance = "plugin-container" },
properties = { floating = true } },
{ rule = { class = "Luakit" },
properties = { floating = true } }
else
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
-- border_color = beautiful.border_normal,
focus = true,
keys = clientkeys,
buttons = clientbuttons } },
{ rule = { class = "MPlayer" },
properties = { floating = true } },
{ rule = { class = "gimp" },
properties = { floating = true } },
{ rule = { class = "Firefox" },
properties = { tag = tags[1][2] } },
{ rule = { name = "Thunderbird" },
properties = { tag = tags[1][3] } },
{ rule = { instance = "plugin-container" },
properties = { floating = true, fullscreen = true } },
{ rule = { class = "Dolphin" },
properties = { floating = false, fullscreen = false, tag = tags[1][4] } },
{ rule = { class = "Luakit" },
properties = { floating = true } },
{ rule = { class = "Pidgin" },
properties = { tag = tags[1][5] } }
end
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c, startup)
-- Add a titlebar
-- awful.titlebar.add(c, { modkey = modkey })
-- Enable sloppy focus
c:connect_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end
end)
if not startup then
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c)
-- Put windows in a smart way, only if they does not set an initial position.
if not c.size_hints.user_position and not c.size_hints.program_position then
awful.placement.no_overlap(c)
awful.placement.no_offscreen(c)
end
end
local titlebars_enabled = false
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
-- Widgets that are aligned to the left
local left_layout = wibox.layout.fixed.horizontal()
left_layout:add(awful.titlebar.widget.iconwidget(c))
-- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal()
right_layout:add(awful.titlebar.widget.floatingbutton(c))
right_layout:add(awful.titlebar.widget.maximizedbutton(c))
right_layout:add(awful.titlebar.widget.stickybutton(c))
right_layout:add(awful.titlebar.widget.ontopbutton(c))
right_layout:add(awful.titlebar.widget.closebutton(c))
-- The title goes in the middle
local title = awful.titlebar.widget.titlewidget(c)
title:buttons(awful.util.table.join(
awful.button({ }, 1, function()
client.focus = c
c:raise()
awful.mouse.client.move(c)
end),
awful.button({ }, 3, function()
client.focus = c
c:raise()
awful.mouse.client.resize(c)
end)
-- Now bring it all together
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_right(right_layout)
layout:set_middle(title)
awful.titlebar(c):set_widget(layout)
end
end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
Here is also my slime config and my initrc
ls -lisa .xinitrc
3276814 4 -rwxr-xr-x ...
#!/bin/sh
xrdb -merge ~/.Xresources
wicd-client --tray &
exec awesome #>> ~/.cache/awesome/stdout 2>> ~/.cache/awesome/stderr
# Path, X server and arguments (if needed)
# Note: -xauth $authfile is automatically appended
default_path /bin:/usr/bin:/usr/local/bin
default_xserver /usr/bin/X
xserver_arguments -nolisten tcp vt07
# Commands for halt, login, etc.
halt_cmd /sbin/shutdown -h now
reboot_cmd /sbin/shutdown -r now
console_cmd /usr/bin/xterm -C -fg white -bg black +sb -T "Console login" -e /bin/sh -c "/bin/cat /etc/issue; exec /bin/login"
#suspend_cmd /usr/sbin/suspend
# Full path to the xauth binary
xauth_path /usr/bin/xauth
# Xauth file for server
authfile /var/run/slim.auth
# Activate numlock when slim starts. Valid values: on|off
numlock on
# Hide the mouse cursor (note: does not work with some WMs).
# Valid values: true|false
# hidecursor false
# This command is executed after a succesful login.
# you can place the %session and %theme variables
# to handle launching of specific commands in .xinitrc
# depending of chosen session and slim theme
# NOTE: if your system does not have bash you need
# to adjust the command according to your preferred shell,
# i.e. for freebsd use:
# login_cmd exec /bin/sh - ~/.xinitrc %session
login_cmd exec /bin/bash -login ~/.xinitrc %session
# Commands executed when starting and exiting a session.
# They can be used for registering a X11 session with
# sessreg. You can use the %user variable
# sessionstart_cmd some command
# sessionstop_cmd some command
# Start in daemon mode. Valid values: yes | no
# Note that this can be overriden by the command line
# options "-d" and "-nodaemon"
# daemon yes
# Available sessions (first one is the default).
# The current chosen session name is replaced in the login_cmd
# above, so your login command can handle different sessions.
# see the xinitrc.sample file shipped with slim sources
sessions awesome,xfce4,icewm-session,wmaker,blackbox
# Executed when pressing F11 (requires imagemagick)
screenshot_cmd import -window root /slim.png
# welcome message. Available variables: %host, %domain
welcome_msg Welcome to %host
# Session message. Prepended to the session name when pressing F1
# session_msg Session:
# shutdown / reboot messages
shutdown_msg The system is halting...
reboot_msg The system is rebooting...
# default user, leave blank or remove this line
# for avoid pre-loading the username.
default_user kili
# Focus the password field on start when default_user is set
# Set to "yes" to enable this feature
focus_password yes
# Automatically login the default user (without entering
# the password. Set to "yes" to enable this feature
#auto_login no
# current theme, use comma separated list to specify a set to
# randomly choose from
current_theme archlinux-simplyblack
# Lock file
lockfile /var/lock/slim.lock
# Log file
logfile /var/log/slim.log
Thanks in advance!
Edit:
Besides a lot of other errors the problem was the systray. It was created 2 times, now login works again. I figured that out via enabling logging for awesome in the xinitrc again.
Last edited by stubb (2013-01-08 23:20:05)Hi,
I have the same kind of issue after updated slim from v1.3.4-4 to v1.3.5-1.
see my topic here :
https://bbs.archlinux.org/viewtopic.php?id=156792
Last edited by cedricl (2013-01-24 17:16:42) -
How to execute a Terminal command on startup?
Greetings!
Is it possible to automatically run a Terminal command at startup? (Specifically - a hwprefs command.)
If so, could you please detail the steps involved?
Many thanks!OK, then, that's pretty straight forward. You can write a small AppleScript like so:
set mystring to do shell script "Insert Command String Here" with administrator privileges
If you need to run the command with root permission then insert "sudo" before the command line, i.e., "sudo commandline". You will need to authenticate in this case so add "with adminstrator privileges" after the command string, i.e.,
do shell script "sudo command string" with administrator privileges
Compile the script as a run-only application then add the compiled script to your Login Items (Accounts preference pane.)
Note that your command line will need the fully qualified path to the command. -
Executing shell commands from Java.
I want to execute shell commands in Java using the Runtime.exec( String ) method.
The method works fine under Linux OS, but under Windows '98 the method didn't work at all!
For example the following call: Runtime.exec( "dir" ) throws an exception showing that the command was not completed. If I replace dir with ls under Linux all is good. What is the problem with the Microsoft Windows '98 ? Is there any solution at my problem ?!
thx in advance!hey JSarmis,
You can help me... "ls" doesn't work for me on linux.. using Runtime.exec, some commands work, others don't... you may hold the key to what i need? How did u get "ls" to work? -
How to Execute shell commands in OSB
Team,
My Requirement:
I have two sftp servers name ServerA and ServerB. Need to copy files from ServerA and place it on ServerB and change the file permissions to 777 after placing the files.
The user i am connecting to ServerB has the access to override file permissions.
Steps
1. With help of FTP adapter in OSB I am reading files from ServerA and writing on to ServerB -- Completed and is working.
2. How to override file permissions after placing the file ????? -- Yet to implement.
Please suggest me how can i accomodate 2nd step.
Thanks,
Suman V.If by "execute shell commands" you mean actually
running a shell process (as opposed to just forking
and executing specified programs) then I'd advise
against it. The last thing you want is for the
clients to be running arbitrary commands on the
server. You don't want to make it possible for the
client to run "rm -fr /" on your server.Right.
I was assuming (perhaps with more optimism than is really warranted) that the OP was going to be in complete control of which commands were executed--that there'd be a small, fixed set in response to certain user actions. -
Executing a command using Runtime Class
How to execute a command on a differnet machine with different ipaddress using Runtime Class
My code is
String[] cmd = new String[3];
cmd[0] = "192.1...../c:/WINNT/system32/cmd.exe" ;
cmd[1] = "/C" ;
cmd[2] = args[0];
Runtime rt = Runtime.getRuntime();
System.out.println("Execing " + cmd[0] + " " + cmd[1]
+ " " + cmd[2]);
Process proc = rt.exec(cmd);
// any error???
int exitVal = proc.waitFor();
System.out.println("ExitValue: " + exitVal);
This is not WorkingI have same issue. Actually when I use cmd.exe /c set in java code and if I run the java code in DOS propmt, it retrieves all latest user Environment variable values. But if I run the code in windows batch file, it is not retrieveing the latest user environment values until I reboot my computer, Do you know how to get user environment value with out rebooting machine??????
-
Getting an error while executing ddl commands using dblink
Hi,
i am using Oracle9iR2 Version.
i have created a procedure like below to execute ddl commands on remote database through dblink using dbms_sql.
CREATE OR REPLACE PROCEDURE run_remote_ddl (p_dblink VARCHAR2, qry VARCHAR2)
AS
c_handle NUMBER;
feedback INTEGER;
stat VARCHAR2 (2000);
BEGIN
stat := 'select DBMS_SQL.open_cursor' || p_dblink || ' from dual';
EXECUTE IMMEDIATE stat
INTO c_handle;
stat :=
'begin DBMS_SQL.parse'
|| p_dblink
|| ' ('
|| c_handle
|| ','''
|| qry
|| ''', DBMS_SQL.v7); end;';
EXECUTE IMMEDIATE stat;
stat :=
' select DBMS_SQL.EXECUTE' || p_dblink || '(' || c_handle
|| ') from dual';
EXECUTE IMMEDIATE stat
INTO feedback;
stat :=
'declare x integer; begin x:= :1; DBMS_SQL.close_cursor'
|| p_dblink
|| '(x); end;';
EXECUTE IMMEDIATE stat
USING c_handle;
END;
when i run this procedure like below
begin
run_remote_ddl ('@dblink', 'create table scott.ttt(num number)');
end;
got an error:
ORA-06553: PLS-103: Encountered the symbol ".2" when expecting one of the following:
. ( * @ & = - + ; < / > at in is mod not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like
between ||
The symbol ". was inserted before ".2" to continue.
ORA-06512: at RUN_REMOTE_DDL", line 9
ORA-06512: at line 2
Please tell me how to resolve this.
Thanks in advance.Hi,
>
ORA-06553: PLS-103: Encountered the symbol ".2" when expecting one of the following:
. ( * @ & = - + ; < / > at in is mod not rem
<an exponent (**)> or != or ~= >= <= <> and or like
between
>
Hope you are not typing 2 instead of @ as both are on the same key
Can you run the following and see what is happening
CREATE OR REPLACE PROCEDURE run_remote_ddl (p_dblink VARCHAR2, qry VARCHAR2)
AS
c_handle NUMBER;
feedback INTEGER;
stat VARCHAR2 (2000);
BEGIN
dbms_output.put_line(p_dblink);
stat := 'select DBMS_SQL.open_cursor@dblink from dual';
--stat := 'select DBMS_SQL.open_cursor from dual';
EXECUTE IMMEDIATE stat
INTO c_handle;
END;
exec run_remote_ddl('@dblink', 'create table scott.ttt(num number)');Regards
Edited by: yoonus on Feb 20, 2013 3:47 AM -
Error while executing jdbc commands but getting connection pool
I was not able to make a simple oracle connection and that hurts me.
The program(jsp) is...
<%@ page language="java" import="java.sql.*,java.io.*,
java.util.*,pac1.*,javax.naming.*,javax.sql.*"%>
<html>
<body>
<%
Context ctx= new InitialContext();
DataSource dsindogulf1=(DataSource)ctx.lookup("jnindogulf1");
Connection conn=dsindogulf1.getConnection();
if(conn!=null)
System.out.println(conn.toString());
else
System.out.println("sorry");
Statement st=conn.createStatement();
String string1="CREATE TABLE Authorr(col1 CHAR(10));";
st.executeUpdate(string1);
%>
</body>
</html>
If i delete the
st.executeUpdate(string1); then there is no problem I get the connection pool. That means i am getting the connection. But when i include the
st.executeUpdate(string1); there is an error which i cannot understand.. the error is
Error 500--Internal Server Error
java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-00911: invalid character
at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbc.oracle.OracleImplStatement.execute()V(Optimized Method)
at weblogic.jdbc.base.BaseStatement.commonExecute()V(Optimized Method)
at weblogic.jdbc.base.BaseStatement.executeUpdateInternal()I(Unknown Source)
at weblogic.jdbc.base.BaseStatement.executeUpdate(Ljava.lang.String;)I(Unknown Source)
at weblogic.jdbc.wrapper.Statement.executeUpdate(Ljava.lang.String;)I(Statement.java:360)
at jsp_servlet.__test._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(__test.java:149)
at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Optimized Method)
at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
the steps which i have followed are... I have made a connection pool using weblogic type 4 driver in the administrative console... then i have created the data source using jndi name jnindogulf1..... but although i am getting the connection pool i am receiving error ehice executing jdbc commands
please help
thanksbabuli nayak wrote:
I was not able to make a simple oracle connection and that hurts me.
The program(jsp) is...
<%@ page language="java" import="java.sql.*,java.io.*,
java.util.*,pac1.*,javax.naming.*,javax.sql.*"%>
<html>
<body>
<%
Context ctx= new InitialContext();
DataSource dsindogulf1=(DataSource)ctx.lookup("jnindogulf1");
Connection conn=dsindogulf1.getConnection();
if(conn!=null)
System.out.println(conn.toString());
else
System.out.println("sorry");
Statement st=conn.createStatement();
String string1="CREATE TABLE Authorr(col1 CHAR(10));";
st.executeUpdate(string1);
%>
</body>
</html>
If i delete the
st.executeUpdate(string1); then there is no problem I get the connection pool. That means i am getting the connection. But when i include the
st.executeUpdate(string1); there is an error which i cannot understand.. the error is
Error 500--Internal Server Error
java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-00911: invalid character
at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
at weblogic.jdbc.oracle.OracleImplStatement.execute()V(Optimized Method)
at weblogic.jdbc.base.BaseStatement.commonExecute()V(Optimized Method)
at weblogic.jdbc.base.BaseStatement.executeUpdateInternal()I(Unknown Source)
at weblogic.jdbc.base.BaseStatement.executeUpdate(Ljava.lang.String;)I(Unknown Source)
at weblogic.jdbc.wrapper.Statement.executeUpdate(Ljava.lang.String;)I(Statement.java:360)
at jsp_servlet.__test._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(__test.java:149)
at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(Optimized Method)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Optimized Method)
at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
the steps which i have followed are... I have made a connection pool using weblogic type 4 driver in the administrative console... then i have created the data source using jndi name jnindogulf1..... but although i am getting the connection pool i am receiving error ehice executing jdbc commands
please help
thanks
Hi. Remove the semicolon from your SQL string: stmt.executeUpdate("CREATE TABLE Authorr(col1 CHAR(10))");Joe -
Problem while executing a command using exec()
I'm trying to execute a command on Unix O/S with the help of java program. For this I have used Runtime class available in java.lang. It works fine for some of the basic unix commands like 'ls','cp' but when I tried to execute command "sqlldr userid=<user>/<pwd> control=/u01/dw/snb/log/sp_shd05721_ins_stg_sqlldr.ctl" , then it's not getting executed. Please advise.
You may be having a problem with the command path, which I don't think Runtime.exec() uses. Try specifying the full path
-
How can I connect to a UNIX server to execute a command?
How can I connect to a UNIX server and execute a command using PowerShell? My shell script is sitting on one server, while the UNIX box is on another.
also, I don't like the idea of hardcoding a username/password within the script file in order to do so.
-Nothing to see. Move along.You will need a library to handle SSH connections.
I'm using SSH.NET, you can find info on it here : http://www.powershelladmin.com/wiki/SSH_from_PowerShell_using_the_SSH.NET_library
It has a bit of a learning curve but the web site has some fairly good tutorials. -
Executing UNIX command in Java
I am having problems executing a command in Java. Here's the code I have for executing:
Process p = Runtime.getRuntime().exec(cmd);
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while((display = input.readLine()) != null)
num_1 = Double.parseDouble(display);
percent = (num_1 * 100) / (50000000);
flip = 1;
catch(IOException e)
e.printStackTrace();
System.exit(1);
Now, when I run the script, I receive the following errors:
Exception occurred during event dispatching:
java.security.AccessControlException: access denied (java.io.FilePermission /Netadmin/UCDSNMP/bin/snmpdelta execute)
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(RuntimeException.java:47)
at java.lang.SecurityException.<init>(SecurityException.java:39)
at java.security.AccessControlException.<init>(AccessControlException.java:57)
at java.security.AccessControlContext.checkPermission(Compiled Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkExec(SecurityManager.java:789)
at java.lang.Runtime.exec(Compiled Code)
at java.lang.Runtime.exec(Compiled Code)
at java.lang.Runtime.exec(Runtime.java:152)
at snmp.actionPerformed(Compiled Code)
at java.awt.Button.processActionEvent(Button.java:308)
at java.awt.Button.processEvent(Button.java:281)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Component.dispatchEvent(Compiled Code)
at java.awt.EventQueue.dispatchEvent(Compiled Code)
at java.awt.EventDispatchThread.pumpOneEvent(Compiled Code)
at java.awt.EventDispatchThread.pumpEvents(Compiled Code)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
The user is entering the parameters for the UNIX command from a Java applet. Everything looks right, but I can't seem to run the file? Please help! All is appreciated.
Jason Banks
Northeastern UniversitySorry, this is a bug that I've reported -- see Sun's response and my original report (along with how to get around the problem) shown below:
Hi Vira Van.,
The bug you have reported is a duplicate of Bug ID: 4522533.
Thank you for providing us with additional information
that can be used in the resolution of this bug.
This bug can be monitored via the the Java Developer
Connection Bug Parade at:
http://developer.java.sun.com/developer/bugParade/index.jshtml
The Java Developer Connection is a free channel that is
maintained by staff here at Sun. Access this web page to join:
http://developer.java.sun.com/servlet/RegistrationServlet
The home page for the JDC is:
http://java.sun.com/jdc
Regards,
Girish
----------------- Original Bug Report-------------------
category : java
release : 1.4
subcategory : jar
type : bug
synopsis : signed applet: bad major version number on NN4.79 and ClassNotFound in IE5.5
description : FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION : Windows 98 [Version
4.10.2222]
ADDITIONAL OPERATING SYSTEMS :
BROWSERS: Netscape Navigator 4.79
: Internet Explorer 5.5
EXTRA RELEVANT SYSTEM CONFIGURATION :
Applet failed to start in Netscape, the following error
message appeared in the Java Console:
Netscape Communications Corporation -- Java 1.1.5
Type '?' for options.
Symantec Java! ByteCode Compiler Version 210.065
Copyright (C) 1996-97 Symantec Corporation
# Applet exception: error: java.lang.ClassFormatError: Bad
major version number
java.lang.ClassFormatError: Bad major version number
at java.lang.ClassLoader.defineClass(Compiled Code)
at netscape.applet.AppletClassLoader.findClass(Compiled
Code)
at netscape.applet.AppletClassLoader.loadClass1(Compiled
Code)
* at netscape.applet.AppletClassLoader.loadClass(Compiled
Code)
at netscape.applet.AppletClassLoader.loadClass(Compiled
Code)
at
netscape.applet.DerivedAppletFrame$LoadAppletEvent.dispatch(
Compiled Code)
at
java.awt.EventDispatchThread$EventPump.dispatchEvents(Compil
ed Code)
at java.awt.EventDispatchThread.run(Compiled Code)
at
netscape.applet.DerivedAppletFrame$AppletEventDispatchThread
.run(Compiled Code)
The same applet
A DESCRIPTION OF THE PROBLEM :
Unable to run signed applet with Netscape 4.79 and IE5.5
native JVM.
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.compile program and copy class files to a temp directory
2.sign the applet for Netscape as follows:
signtool -k aok -d \progra~1\netscape\users\viravan -Z
FIO.jar temp
3.sign the applet for Internet Explorer as follows:
cabarc -p n FileIO.cab FileIO*.class
setreg 1 true
makecert -sk aok -n "CN=aok" aok.cer
cert2spc aok.cer aok.spc
signcode -j javasign.dll -jp LOWX -spc aok.spc -k aok
FileIO.cab
Run the applet with the following HTML file:
<html><head><Title>Self-Signed Applet</Title>
<script>
document.layers ? parm=1 : parm=0;
</script>
<body>
This file I/O applet lets you read and write to the user's
local disk.<br>
<br>
<script>
document.writeln('<APPLET CODE = "FileIO" CODEBASE = "."
ARCHIVE = "FIO.jar" WIDTH = 10 HEIGHT = 10 NAME = "JSF">');
document.writeln('<param name="Netscape"
value="'+parm+'">');
document.writeln('<param name="cabbase"
value="FileIO.cab">');
document.writeln('</APPLET>');
</script>
</body>
</html>
EXPECTED VERSUS ACTUAL BEHAVIOR :
A frame with a textarea and some buttons should popup in the
center of the screen.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Applet signed with signtool failed to start in Netscape, the following error
message appeared in the Java Console:
Netscape Communications Corporation -- Java 1.1.5
Type '?' for options.
Symantec Java! ByteCode Compiler Version 210.065
Copyright (C) 1996-97 Symantec Corporation
# Applet exception: error: java.lang.ClassFormatError: Bad major version number
java.lang.ClassFormatError: Bad major version number
at java.lang.ClassLoader.defineClass(Compiled Code)
at netscape.applet.AppletClassLoader.findClass(Compiled Code)
at netscape.applet.AppletClassLoader.loadClass1(Compiled Code)
* at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
at netscape.applet.DerivedAppletFrame$LoadAppletEvent.dispatch(Compiled Code)
at java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)
at netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled
Code)
The same applet signed with signcode failed to start in Internet explorer, the
error message in the Java Console is:
Error loading class: FileIO
java.lang.NoClassDefFoundError
java.lang.ClassNotFoundException: FileIO
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/applet/AppletPanel.securedClassLoad
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class FileIO extends Applet implements ActionListener {
public static void main(String[] args) {
new FileIO();
F.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
public void init() {
String tmp=getParameter("Netscape");
if (tmp!=null) {
if (tmp.equals("1")) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileAccess");
NS=true;
} catch (Throwable exception) {}
new FileIO();
F.setResizable(false);
public void stop() {
F.dispose();
public FileIO() {
newline=System.getProperty("line.separator");
F.setLayout(new BorderLayout(0,0));
String line,inbuf="";
String newline=System.getProperty("line.separator");
text=new TextArea(inbuf,24,80,TextArea.SCROLLBARS_BOTH);
text.setFont(new Font("Courier",Font.PLAIN,12));
text.setBackground(Color.cyan);
text.setForeground(Color.black);
F.add("Center",text);
Panel pan=new Panel();
pan.setLayout(new FlowLayout(1,0,0));
pan.setBackground(Color.yellow);
TF=new TextField(40);
TF.setFont(new Font("Courier",Font.PLAIN,12));
pan.add(TF);
OP=new Button("Open");
OP.addActionListener(this);
pan.add(OP);
FS=new Button("Save");
FS.addActionListener(this);
pan.add(FS);
SA=new Button("Save-As");
SA.addActionListener(this);
pan.add(SA);
reset=new Button("Reset");
reset.addActionListener(this);
pan.add(reset);
F.add("South",pan);
F.pack();
Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();
Dimension size=F.getSize();
int X=(screen.width-size.width)/2;
int Y=(screen.height-size.height)/2;
F.setLocation(X,Y);
F.setVisible(true);
public void actionPerformed(ActionEvent event) {
String tmp="";
String O=text.getText();
StringTokenizer tkn=new StringTokenizer(O,newline);
int ntkn=tkn.countTokens();
Object ev=event.getSource();
if (ev.equals(OP)) {
FileDialog fd=new FileDialog(F,"File to open",FileDialog.LOAD);
fd.setFile("*.java");
fd.show();
tmp=fd.getDirectory();
if (fd.getFile()==null) {text.requestFocus(); return;}
tmp+=fd.getFile();
TF.setText(tmp);
try {
if (NS)
{netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");}
BufferedReader reader=new BufferedReader(new FileReader(tmp));
String line;
String crlf="";
tmp="";
while ((line=reader.readLine())!=null) {
tmp+=crlf+line;
crlf="\n";
reader.close();
text.setText(tmp);
} catch (Throwable e) {
e.printStackTrace();
} else if (ev.equals(FS) || ev.equals(SA)) {
try {
if (ev.equals(SA)) {
FileDialog fd=new FileDialog(F,"File to save",FileDialog.SAVE);
fd.setFile("*.java");
fd.show();
tmp=fd.getDirectory();
tmp+=fd.getFile();
} else {
tmp=TF.getText();
if (tmp.length()==0) {text.requestFocus(); return;}
if (tmp.indexOf(".java")<0) tmp+=".java";
TF.setText(tmp);
if (NS)
{netscape.security.PrivilegeManager.enablePrivilege("UniversalFileWrite");}
FileOutputStream fos=new FileOutputStream(tmp);
BufferedWriter out=new BufferedWriter(new OutputStreamWriter(new
DataOutputStream(fos)));
for (int i=0;i<ntkn;i++) out.write(tkn.nextToken()+newline);
out.flush();
out.close();
if (NS)
{netscape.security.PrivilegeManager.revertPrivilege("UniversalFileWrite");}
System.out.println(tmp+" saved");
} catch (Throwable e) {
e.printStackTrace();
} else if (ev.equals(reset)) {
text.setText("");
TF.setText("");
text.requestFocus();
private String replace(String input, String srch, String repl) {
int i=input.indexOf(srch);
while (i>=0) {
input=input.substring(0,i)+repl+input.substring(i+srch.length());
i=input.indexOf(srch);
return input;
private Button OP,FS,SA,reset,TB;
private boolean newLine,NS=false;
private TextArea text;
private TextField TF;
private final char NL='\n';
private String content,newline;
private static Frame F=new Frame("FileIO");
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
build the signed applet with SDK1.3.1 or make it a signed
applet that uses Java Plugin 1.4.0 (i.e., sign it with jarsigner).
workaround :
suggested_val :
cust_name : Vira Van.
dateCreated : 2002-03-24 19:52:18.4
dateEvaluated : 2002-04-01 18:48:10.858 -
How to execute unix command through odi and store the result in table
I have to reconcile if data is loaded in table from csv file or not . I have to create a oracle data integrator package/interface/procedure to execute unix command to count number of rows in the csv files and store the count result in a table then i have to query the loaded table and count number of rows there and store in the table and have to compare is counts are same or not, Please assist me how to make package/interface/procedure to execute unix command and store result in oracle table.
Thanks in AdvanceUse ODI OS command tool in the ODI package.
create an interface in ODI using LKM File to Sql and the output file generated with the csv file's row count as a source and the db table(where the count needs to be stored) as a target -
How to invoke BASH shell and execute a command in that shell in Windows 98
Hello, I have a problem and if somebody will help me, I will be very glad. Thank you.
I am using BASH shell on Windows 98 OS by means of CYGWIN. And I want to invoke this BASH shell and execute a preprogrammed command in the shell (./scan fileName.txt) from a JAVA program. But so far, I am not sucessful. I can not read or write anything from / to BASH shell. It either blocks and freezes (When I use waitFor( ) ) or appears and disappears without executing scan command (When I do not use waitFor( ) ). My code is like this:
// This method is used for compiling a file.
// It invokes BASH shell and executes "./scan fileName.txt" command
public void compileFileMethod () {
try {
Process proc = ( Runtime.getRuntime() ).exec ("C:\\MyDocuments\\CYGWIN.BAT); //I also tried to add -c ./scan fileName.txt after .BAT );
// I also tried to write "C:\\MyDocuments\\BASH.EXE" but it did not help
OutputStream ostr = proc.getOutputStream();
BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter (ostr) );
InputStream istr = proc.getInputStream();
BufferedReader br = new BufferedReader ( new InputStreamReader (istr) );
InputStream errorStr = proc.getErrorStream();
BufferedReader errorBr = new BufferedReader ( new InputStreamReader (errorStr) );
bw.write("scan case40.10.txt"); /* I am trying to input the scan command to the shell,but it is not working*/
bw.flush();
Vector list = new Vector (1) ;
String str;
while ( (str = br.readLine() ) != null) {
list.addElement(str);
} // End of while
Enumeration enumForList = list.elements();
while ( enumForList.hasMoreElements() ) {
String tempString;
tempString = ( String ) enumForList.nextElement();
System.out.println(tempString); // I am trying to read the outputs of the scan command but it is not reading (I can not see any output)
I tried with and without waitFor( ), it did not work
// wait for command to terminate
proc.waitFor();
// close streams
br.close();
bw.close();
errorBr.close();
} // End of try
catch ( IOException ioe ) {
JOptionPane.showMessageDialog (null, "Input / output error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
} // End of catch
catch ( SecurityException se ) {
JOptionPane.showMessageDialog (null, "Security error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
catch ( InterruptedException ie ) {
JOptionPane.showMessageDialog (null, "Interruption error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
} // End of method compileFileMethod
// Thank you for your helps and time.You cannot invoke BAT files directly, you have to invoke the program that run those files which is your Windows 98 shell. For example (under windows 2000), i would invoke "cmd.exe sricpt.bat some args", rather than "script.bar some args".
Hope this will help you out.
Maybe you are looking for
-
How can i suppress columns in ALV ?? Will reward points.
Hello Gurus, how can i suppress column in ALV when i`m using the transparent table: CALL METHOD grid->set_table_for_first_display EXPORTING i_structure_name = 'ZIANEXE' is_layout = wa_layout is_variant = wa_
-
If I use IE Tab Plus to switch rendering engines to IE the search box works just fine.
-
Is it possible to add the page title to the menu bar?
Does anyone know of any addons that allow you to add the webpage title to the menu bar? I already took a look at the addon Personal Titlebar, which purports to add the menu bar onto the title bar, but had no luck getting it to actually do what it adv
-
Why does latest version of Adobe flash player starts multiple copies
When I go to a page that uses adobe flash player Firefox freezes. When I open up task manager there are up to 10 copies of flash player running and I have to close them manually. What is going on?
-
Constant freezes with 2010 MacBook Pro.
When I was using Snow Leapord it hardly crashed at all. Since I've installed Lion, about every day at least 2-3 freezes which causes it to self-restart (with the restart setting turned on). I've tried switching off the Album Art screen saver (which I