Bits and Pieces

Bits and Pieces

Tools and Code by Avner Shahar-Kashtan

Home Archive Categories Tags Blog Tools & Projects About Me RSS
  • More Tales from the Unmanaged Side - System.String -> char*

    2007-08-28 Avner Shahar-Kashtan Miscellaneous Debris
    Today, I had a very tight deadline to achieve a very simple task: pass a managed .NET string to an API function that expects a null-terminated char*. Trivial, you would expect? Unfortunately it wasn't. My first though was to do the pinning …
  • A C# coder in a C++/CLI world, part 1

    2007-08-28 Avner Shahar-Kashtan Miscellaneous Debris
    Recently I've found myself stumbling around some C++/CLI code. C++ is a language which I learned years ago and never really worked with seriously, so I've been cursing and moaning as I worked. Strange for me to go back to a (partially) …
  • Allowing timeout on long-running operations - possible bug

    2007-08-27 Avner Shahar-Kashtan Miscellaneous Debris
    A while ago, I wrote about a simple pattern to allow us to put a timeout limitation on a long running operations. Simply put, it allows us to replace this: public MyObject GetData() { try { MyObject data = …
  • Waiting for a return value from an asynchronous method

    2007-07-24 Avner Shahar-Kashtan Miscellaneous Debris
    The topic of the post might not make sense, initially. If I invoke a method asynchronously, why would I want to wait for a return value? And if I'm waiting, what's the point of launching it asynchronously? Well, the most common scenario is …
  • Some more glaring omissions in the Sharepoint 2007 SDK and Web Services

    2007-07-18 Avner Shahar-Kashtan Miscellaneous Debris
    I downloaded the new Sharepoint 2007 SDK today, published last week though it's dated from April 2007. There appears to be no change history for this version of the SDK. I was hoping for more information on new Web Service methods available …
  • No Per-item permissions in WSSv3's Web Services?!

    2007-07-02 Avner Shahar-Kashtan Miscellaneous Debris
    How did I miss this until now? It's great that WSSv3 and MOSS give us granular permissions, and it's great that I can access those permissions via an SPListItem's RoleAssignments collection - but is there really no way of getting this …
  • Retrieving all properties for a Sharepoint list

    2007-06-03 Avner Shahar-Kashtan Miscellaneous Debris
    When we call the GetListItems or GetListItemChanges methods in Sharepoint's Lists Web Service, we pass an XmlNode parameter specifying which fields we want to return, in this format: Now, if we leave this field as null, we get a certain set …
  • Yet ANOTHER C# language enhancement - this_method()

    2007-06-03 Avner Shahar-Kashtan Miscellaneous Debris
    This one was suggested by a coworker leery of accidental recursion. Too many people aren't used to thinking in terms of recursion and will miss a recursive call inside a method and accidently start an infinite loop, or miss the meaning of a …
  • Another pointless operator for C#

    2007-06-03 Avner Shahar-Kashtan Miscellaneous Debris
    I remember discovering C#'s null coalescing operator a while ago. I can't say I use it a lot, but it's useful to clean up my code when I do need it. However, there is another similar scenario that it doesn't cover: SearchResult res = …
  • Granting User Rights in C#

    2007-05-10 Avner Shahar-Kashtan Miscellaneous Debris
    As a follow-up to my previous post about changing a Windows Service's user account - there was one think I forgot. In order for a user to run a service, that user must be granted the "Run as Service" right by the operating system. Usually …
  • Setting Windows Service Account - C# and WMI

    2007-05-08 Avner Shahar-Kashtan Miscellaneous Debris
    I've been busting my brains for over two hours trying to accomplish a relatively simple task - changing the username and password of a currently running Windows Service. Should be trivial enough, but the managed ServiceController class …
  • Custom ConfigurationSectionHandlers in InstallerClasses

    2007-05-07 Avner Shahar-Kashtan Miscellaneous Debris
    I'm writing an installer class for an MSI Setup Project, and find myself needing to manipulate my web.config containing a custom ConfigurationSection. This should be trivial seeing as my SectionHandler code is bundled with the rest of the …
  • InstallerClasses and little-known gems.

    2007-05-06 Avner Shahar-Kashtan Miscellaneous Debris
    I'm writing an Installer class for an MSI installer project, and passing a checkbox's value from the MSI UI. I noticed that when I pass the checkbox's linked variable into my code, it's received as a string, and not only a string - the …
  • Preventing Outlook from closing with Alt-F4

    2007-04-14 Avner Shahar-Kashtan Miscellaneous Debris
    I have come to the realization, at some point, that I never want to close Outlook. Really, there's no reason for me to shut it down except when doing something special, like freeing every available byte of memory, or when developing …
  • Customizing MOSS Page Title

    2007-04-11 Avner Shahar-Kashtan Miscellaneous Debris
    Another odd client request that came in a while ago. When we browse our Sharepoint site, IE's title reads "Home - My Site Name - Windows Internet Explorer". We can't find any way to remove the "Home" string, regardless of how we change the …
  • Dependency Injection and a new version of RhinoMocks

    2007-04-05 Avner Shahar-Kashtan Miscellaneous Debris
    I'm a relative latecomer to the unit-testing business, and only got to play with Mocking frameworks in my last project. After testing several frameworks, we opted on RhinoMocks for emulating our classes during testing. This, coupled with a …
  • Reflecting over an Event

    2007-03-29 Avner Shahar-Kashtan Miscellaneous Debris
    A coworker (Hey, Evgeny!) came to me with a puzzler today. He has an object that exposes an event, and he wants to know whether he's already subscribed to that event. Two things immediately came to mind - the first was that he really …
  • Sharepoint Extensions for Visual Studio - released!

    2007-03-28 Avner Shahar-Kashtan Miscellaneous Debris
    Finally, we have a full, RTM version of the Visual Studio extensions! The download page says March 15th, but I haven't seen anyone mention it around yet - could it be just me that missed the boat? I got it from Mark Bower's blog, but …
  • Session Error with Reports Center under MOSS 2007 - Not what you expect

    2007-03-18 Avner Shahar-Kashtan Miscellaneous Debris
     Ran into a problem with a client today. They installed MOSS 2007 and created a publishing portal, but then decided to erase the Reports Center, since they had no use for it. A few days later, of course, they figured they DID want it after …
  • Sharepoint Extensions for Visual Studio 2005

    2007-02-21 Avner Shahar-Kashtan Miscellaneous Debris
    Any news on when a new release of the extensions are due? The state of the current tools is downright abyssmal. Even ignoring the requirement to run VS on the Sharepoint server machine, half the things don't work or are horribly slow. The …
← Newer
3 / 10
Older →

Bits and Pieces — Tools and Code by Avner Shahar-Kashtan