Showing posts with label ruby. Show all posts
Showing posts with label ruby. Show all posts

Monday, June 6, 2011

hidden scheduled task

When running a batch file or ruby script (even .rbw) or anything that does not have a GUI, a cmd window normally pops up. This is surely unwanted when scheduling a task with those kind of programs. Sadly, I don't see any checkbox to hide the window at runtime in the scheduled task wizard.

The best way I found is posted at http://serverfault.com/questions/9038/run-a-bat-file-in-a-scheduled-task-without-a-window.

Schedule a .vbs script containing something like:
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\Scheduled Jobs\mybat.bat" & Chr(34), 0
Set WinScriptHost = Nothing

There are other tools like hstart and cmdow that lets you do pretty much the same thing, but I prefer using built-in tools a lot more.

Sunday, March 27, 2011

SSHFS on Windows

or secure file sharing, a replacement for samba (windows client, accessing files on *nix server).

DokanInstall_0.6.0.exe Dokan library (http://dokan-dev.net/en)
dokan-sshfs-0201226.zip for installer and explorer context menu
dokan-sshfs-0.6.0.zip take DokanNet.dll and DokanSSHFS.exe and replace in 0201226.

Advantages secure, read/write, easy to install.
Drawback easily bottlenecks at a few MBps on slow CPU. Not multi-core. Shows bad size information. Unstable?

Tuesday, October 20, 2009

overloading SEL_KEYPRESS

Or something like that...

The idea is to get some widget to do not only what it's supposed to, but also something else. For example, I would really want to hear the buzzing sound of a fly whenever I press Ctrl-z in some FXText.
  1. require 'fox16'
  2. require 'fox16/responder'
  3. include Fox

  4. class BuzzingText < FXText

  5.   include Responder

  6.   def initialize p
  7.     super p
  8.     FXMAPFUNC(SEL_KEYPRESS, 0, :onKeyPress)
  9.   end

  10.   def onKeyPress sender, sel, event
  11.     super sender, sel, event
  12. if (event.state & CONTROLMASK != 0) and (event.code == KEY_z)
  13.       # buzz
  14. end
  15.   end

  16. end

Thursday, October 8, 2009

require 'that'

$LOAD_PATH.unshift(
  File.join(
    File.expand_path(File.dirname(__FILE__)), 'lib'
  )
)

refs: http://blog.8thlight.com/articles/2007/10/08/micahs-general-guidelines-on-ruby-require, http://stuff.lilleaas.net/load_path