Search Results

Search found 17 results on 1 pages for 'roygbiv'.

Page 1/1 | 1 

  • COM Interop - Wait for Excel to Complete Operation

    - by roygbiv
    Hello, I am doing some COM Interop work with Excel and other Office Automation Software. A Co-Worker has mentioned to me that I need to wait for these Automation Servers to become ready after issuing a command to them. I, however, cannot see the purpose of this as don't all calls block until the automation server completes the given task? For example I would normally write: Dim o as AutomationObject = AutomationServer.CreateObject(x, y, z) o.Property ' could throw COM exception!!???? My co-worker says I need to sleep after that call because the the Automation Server could still be working on creating and initializing the object. Dim o as AutomationObject = AutomationServer.CreateObject(x, y, z) Threading.Sleep(5000) ' wait for AutomationServer to "become ready" o.Property ' could still throw COM exception!!???? The problem I have with this is that the AutomationServer calls should block until the AutomationServer finishes or completes what it was working on or at the very least it should be a loop checking if "o" is nothing, but that makes no sense because once the call returns its done! My question is, Is there any benefit to Sleeping after an AutomationServer call? Is there a method to "wait" until the AutomationServer finishes (if it does not in fact block)?

    Read the article

  • Usefulness of Toggle functions

    - by roygbiv
    Is it better to write functions that explicitly do something (i.e. HideForm/ShowForm etc...) or is it better to write 'Toggle' type functions (i.e. ToggleVisibility)? I find Toggle type functions awkard because it's hard to track the state by reading the code. In what situations is a toggle type function useful?

    Read the article

  • Reset or Clear .NET MemoryStream

    - by roygbiv
    The .NET MemoryStream does not appear to have a .Reset or .Clear method. I was thinking of using the following code to accomplish this: ms.Seek(0, IO.SeekOrigin.Begin) ms.SetLength(0) What is the proper way to clear or reset an existing .NET MemoryStream?

    Read the article

  • Simple hardware RNG

    - by roygbiv
    I made a tongue-in-cheek comment to this question about making a hardware RNG. Does anyone know of any simple plans or can anyone descibe a simple hardware based RNG and the software to drive it? Go to Radio Shack. Buy a diode, an NTR resistor, a capacitor and serial cable. Cut off the end of the serial cable that does not fit on your computer. Solder the diode and resistor in series between pins DTR and DSR of the cable. Solder the capacitor between DSR and TXD pins. Write a small C program to do the following: Set DTR to 1. Start Timer. Monitor DSR until it goes to 1. Stop Timer. Calculate resistance from elapsed time. Retreive serveral bits from that value to use as part of random number. Repeat until enough bits have accumulated.

    Read the article

  • Dragging a div along with all of its child divs

    - by roygbiv
    I have the following code: <body> <div id="container" style="position:absolute; left:0px; top:0px; z-index:1;"> <div id="div1" style="background-color:Red; position:absolute; left:0px; top:0px; width:256px; height:256px; z-index:0;" >&nbsp;</div> <div id="div2" style="background-color:Black; position:absolute; left:256px; top:0px; width:256px; height:256px; z-index:0;" >&nbsp;</div> <div id="div3" style="background-color:Green; position:absolute; left:512px; top:0px; width:256px; height:256px; z-index:0;" >&nbsp;</div> <div id="div4" style="background-color:Yellow; position:absolute; left:768px; top:0px; width:256px; height:256px; z-index:0;" >&nbsp;</div> <div id="div5" style="background-color:Blue; position:absolute; left:1024px; top:0px; width:256px; height:256px; z-index:0;" >&nbsp;</div> </div> <script type="text/javascript"> <!-- SET_DHTML("container"); //--> </script> </body> I want to drag the 'container' div such that all child divs are dragged at the same time. I can drag individual divs, but that is not what I want. Can a div drag child divs or do they have to be images? I am using the WalterZorn drag drop API, but am open to using any API, script or whatever.

    Read the article

  • Directly embedding JPEGs in an HTML file

    - by roygbiv
    I can embed a mime encoded JPEG in an html page by saving the page from IE using the File-SaveAs menu and selecting (Web Archive, single file (*.mht)). Renaming this .mht file with .eml enables Outlook to open it and send an HTML email. My questions are: How can I embed JPEG images directly in HTML pages (no external files). Are the images just mime encoded inline in the HTML? It appears that this is IE specific. Do any other browsers support this functionality?

    Read the article

  • Games that are still winable against the computer?

    - by roygbiv
    There's a game on my laptop called 'Chess Titans' which I've been playing one game a day for almost 90 days. With the difficulty on the hardest setting I have not been able to win one game, however, I have come close. What's the fun in playing a chess game if the computer can search all moves and win? Has (or can) anyone beat a modern computer chess AI? What games can't a computer gain an advantage in? (i.e. They would be 'fun' to play.)

    Read the article

  • IO.Directory.Exists always returns true

    - by roygbiv
    I am executing a IO.Directory.Exists on a network share from an ASP.NET application running under a specific Application Pool with a specific user account. The call always returns true. I have tried several variations: \\server\share$\directory \\192.168.0.1\share$\directory H:\directory I have checked that directory and share permissions are available to the account. The path does have spaces in it \\server\share$\directory\name name\test test, which should make no difference, however I have read otherwise. I will continue to check permissions, as it does work from my local machine (with the built in VS web-server and I am an administrator on the network), but when deployed to the IIS 6.0 virtual directory, and run under the Application Pool, it does not work.

    Read the article

  • .NET Rectangle Off By 1

    - by roygbiv
    After working with the .NET GDI+ Rectangle object, I've noticed that if I create a rectangle that is X:0 * Y:0 * Width:100 * Height:100, the Right and Bottom properties are set to 100, 100. Shouldn't this be 99, 99? 0 - 99 is 100 pixels. 0 - 100 is 101 pixels. FWIW, the documentation does say the right is computed by x + width and the bottom is y + height, but is that correct? Perhaps "correct" doesn't matter here as long it's consistent? All I know is that it is somewhat (read... very) annoying!

    Read the article

  • Horizontally Flip a One Bit Bitmap Line

    - by roygbiv
    I'm looking for an algorithm to flip a 1 Bit Bitmap line horizontally. Remember these lines are DWORD aligned! I'm currently unencoding an RLE stream to an 8 bit-per-pixel buffer, then re-encoding to a 1 bit line, however, I would like to try and keep it all in the 1 bit space in an effort to increase its speed. Profiling indicates this portion of the program to be relatively slow compared to the rest. Example line (Before Flip): FF FF FF FF 77 AE F0 00 Example line (After Flip): F7 5E EF FF FF FF F0 00

    Read the article

  • .NET GDI+ image size - file codec limitations

    - by roygbiv
    Is there a limit on the size of image that can be encoded using the image file codecs available from .NET? I'm trying to encode images 4GB in size, but it simply does not work (or does not work properly i.e. writes out an unreadable file) with .bmp, .jpg, .png or the .tif encoders. When I lower the image size to < 2GB it does work with the .jpg but not the .bmp, .tif or .png. My next attempt would be to try libtiff because I know tiff files are meant for large images. What is a good file format for large images? or am I just hitting the file format limitations? Random r = new Random((int)DateTime.Now.Ticks); int width = 64000; int height = 64000; int stride = (width % 4) > 0 ? width + (width % 4) : width; UIntPtr dataSize = new UIntPtr((ulong)stride * (ulong)height); IntPtr p = Program.VirtualAlloc(IntPtr.Zero, dataSize, Program.AllocationType.COMMIT | Program.AllocationType.RESERVE, Program.MemoryProtection.READWRITE); Bitmap bmp = new Bitmap(width, height, stride, PixelFormat.Format8bppIndexed, p); BitmapData bd = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, bmp.PixelFormat); ColorPalette cp = bmp.Palette; for (int i = 0; i < cp.Entries.Length; i++) { cp.Entries[i] = Color.FromArgb(i, i, i); } bmp.Palette = cp; unsafe { for (int y = 0; y < bd.Height; y++) { byte* row = (byte*)bd.Scan0.ToPointer() + (y * bd.Stride); for (int x = 0; x < bd.Width; x++) { *(row + x) = (byte)r.Next(256); } } } bmp.UnlockBits(bd); bmp.Save(@"c:\test.jpg", ImageFormat.Jpeg); bmp.Dispose(); Program.VirtualFree(p, UIntPtr.Zero, 0x8000); I have also tried using a pinned GC memory region, but this is limited to < 2GB. Random r = new Random((int)DateTime.Now.Ticks); int bytesPerPixel = 4; int width = 4000; int height = 4000; int padding = 4 - ((width * bytesPerPixel) % 4); padding = (padding == 4 ? 0 : padding); int stride = (width * bytesPerPixel) + padding; UInt32[] pixels = new UInt32[width * height]; GCHandle gchPixels = GCHandle.Alloc(pixels, GCHandleType.Pinned); using (Bitmap bmp = new Bitmap(width, height, stride, PixelFormat.Format32bppPArgb, gchPixels.AddrOfPinnedObject())) { for (int y = 0; y < height; y++) { int row = (y * width); for (int x = 0; x < width; x++) { pixels[row + x] = (uint)r.Next(); } } bmp.Save(@"c:\test.jpg", ImageFormat.Jpeg); } gchPixels.Free();

    Read the article

  • Why not use GDI+ from ASP.NET

    - by roygbiv
    I've been told that using GDI+ from ASP.NET is dangerous and undefined. Is that because there is no guarantee of a Device Context? Can someone explain? What are some of the alternatives? Here is the source: http://msdn.microsoft.com/en-us/library/system.drawing.aspx

    Read the article

1