Search Results

Search found 4 results on 1 pages for 'will vousden'.

Page 1/1 | 1 

  • Setting the viminfo path in gVim for portability (Windows)

    - by Will Vousden
    I'm trying to make my gVim installation as portable as possible, and in doing so I want to put the _viminfo file in the $VIM directory rather than $HOME. I'm pretty new to hacking vimrc configurations, but here's what I've been trying: let viminfopath=$VIM."\\_viminfo" execute "set viminfo='1000,n".escape(viminfopath, ' ') " Some other portability stuff. set nobackup set nowritebackup if has("win32") || has("win64") set directory=$TMP else set directory=~/tmp end This doesn't seem to be working, though; does anyone have any tips? Thanks!

    Read the article

  • Windows Firewall issues

    - by Will Vousden
    I'm not sure whether this is a Windows problem or a .NET problem (i.e. whether it belongs here on on SO), but I've written a small HTTP server program in C# (using the .NET HttpListner class) which works fine for the most part, but Windows Firewall seems to be refusing to let connections through to it from anything other than localhost. I've added exceptions for TCP and UDP in the "Inbound Rules" section of the firewall settings, essentially duplicating existing rules for other HTTP-based services which work fine (e.g. foo_httpcontrol). Specifically, I've added separate rules for TCP and UDP connections covering all ports, specific to the executable I'm running. There's no problem when Windows Firewall is disabled, but if I enable it, the connection simply times out.

    Read the article

  • Colored PS1 string

    - by Will Vousden
    Clarification: I want __foo to be executed each time the PS1 string is presented in the terminal, not when the PS1 string is constructed (hence its being in quotes). __foo contains logic that examines the current directory, so its execution must be deferred. I'm trying to use different colours in my Bash PS1 string from within a Bash function: LIGHTRED="\033[1;31m" LIGHTGREEN="\033[1;32m" RESET="\033[m" __foo () { # Do some stuff and genereate a string to echo in different colours: echo -n '\['$1'\]firstcolour \['$2'\]secondcolour' } PS1='$(__foo '$LIGHTRED' '$LIGHTGREEN')\['$RESET'\] \$' Essentially I want __foo to generate part of the PS1 in a bunch of different colours. My attempt doesn't seem to work, though; it produces the following output: -bash: 31m: command not found -bash: 32m: command not found \[]firstcolour \[\]secondcolour $ What gives, and how can I fix it?

    Read the article

  • Is this a valid pattern for raising events in C#?

    - by Will Vousden
    Update: For the benefit of anyone reading this, since .NET 4, the lock is unnecessary due to changes in synchronization of auto-generated events, so I just use this now: public static void Raise<T>(this EventHandler<T> handler, object sender, T e) where T : EventArgs { if (handler != null) { handlerCopy(sender, e); } } And to raise it: SomeEvent.Raise(this, new FooEventArgs()); Having been reading one of Jon Skeet's articles on multithreading, I've tried to encapsulate the approach he advocates to raising an event in an extension method like so (with a similar generic version): public static void Raise(this EventHandler handler, object @lock, object sender, EventArgs e) { EventHandler handlerCopy; lock (@lock) { handlerCopy = handler; } if (handlerCopy != null) { handlerCopy(sender, e); } } This can then be called like so: protected virtual void OnSomeEvent(EventArgs e) { this.someEvent.Raise(this.eventLock, this, e); } Are there any problems with doing this? Also, I'm a little confused about the necessity of the lock in the first place. As I understand it, the delegate is copied in the example in the article to avoid the possibility of it changing (and becoming null) between the null check and the delegate call. However, I was under the impression that access/assignment of this kind is atomic, so why is the lock necessary? Update: With regards to Mark Simpson's comment below, I threw together a test: static class Program { private static Action foo; private static Action bar; private static Action test; static void Main(string[] args) { foo = () => Console.WriteLine("Foo"); bar = () => Console.WriteLine("Bar"); test += foo; test += bar; test.Test(); Console.ReadKey(true); } public static void Test(this Action action) { action(); test -= foo; Console.WriteLine(); action(); } } This outputs: Foo Bar Foo Bar This illustrates that the delegate parameter to the method (action) does not mirror the argument that was passed into it (test), which is kind of expected, I guess. My question is will this affect the validity of the lock in the context of my Raise extension method? Update: Here is the code I'm now using. It's not quite as elegant as I'd have liked, but it seems to work: public static void Raise<T>(this object sender, ref EventHandler<T> handler, object eventLock, T e) where T : EventArgs { EventHandler<T> copy; lock (eventLock) { copy = handler; } if (copy != null) { copy(sender, e); } }

    Read the article

1