I have a non transparent, colour bitmap with length 2480 and width 3507.
Using Bitmap.GetPixel(int x, int y) I am able to get the colour information of each pixel in the bitmap.
If I squirt the bitmap into a byte[]:
MemoryStream ms = new MemoryStream();
bmp.Save(ms, ImageFormat.Bmp);
ms.Position = 0;
byte[] bytes = ms.ToArray();
then I'd…
I am using Red Gates ANTS memory profiler to debug a memory leak. It keeps warning me that:
Memory Fragmentation may be causing
.NET to reserver too much free memory.
or
Memory Fragmentation is affecting the size of the largest object that can be allocated
Because I have OCD, this problem must be resolved.
What are some…
hi guys. I'm looking to create a simple app which will send keystrokes from an iphone to a PC.
I understand that I will need to have a program on my PC "listening"... I've been looking in to AsyncSocket and NSStream, but there are no tutorials which really make it clear to understand. Does anyone know if this is right?
I basically…
For the sake of argument, lets say that I've got a basicHttp WCF service. Besides implementing authentication (login/logout methods), what is stopping someone from just cracking open Visual Studio, adding a web reference to my website's service, and then playing playing around with my service? I'm not familiar with a method of…
So...I'm trying to get unit tests set up in my iPhone App but I'm having some issues. I'm trying to test my model classes but they inherit directly from NSManagedObject. I'm sure this is a problem but I don't know how to get around it.
Everything is building and running as expected but I get this error when calling any…
My organisiation uses Sharepoint for its 'intranet'. I have been given the task of creating a site for my department. One of the things I need on there is a procedure guide, which is basically a 150 page document, whereby each page is a separate procedure. Is there an efficient way within sharepoint that these procedures…
I have an ItemsControl that uses a DataTemplate to display properties in my customClass that implements INotifyPropertyChanged...
Pretty straightforward...
Some items in the DataTemplate use CommandBindings (such as buttons), and a few have some code-behind (yuck).
When I empty the ItemsControl and set all instances…
So, we have an existing Rails 2.3.5 app that does not support Internationalization at all. Now, I'm well familiar with Rails I8n stuff, but we have a LOT of output strings inside /javascripts/. I'm not a huge fan of this approach, but unfortunately it is too late to fix it now.
How might we internationalize strings…
Hi.
I'm trying to add some extended error codes to the event log but I get the following error.
The description for Event ID ( 109 )
in Source ( PumpServer ) cannot be
found. The local computer may not have
the necessary registry information or
message DLL files to display messages
from a remote…
I have an object of type Hash that I want to loop over via hash.each do |key, value|. I would like to get the number of times I've been through the loop starting at 1.
Is there a method similar to each that provides this (while still providing the hash key/value data), or do I need to create another counter…
Here's my simple query. If I query a record that doesn't exist then I will get nothing returned. I'd prefer that false (0) is returned in that scenario. Looking for the simplist method to account for no records.
SELECT CASE
WHEN S.Id IS NOT NULL AND S.Status = 1 AND (S.WebUserId = @WebUserId OR…
I have been using an MSI to install a WPF application using the .NET Framework 3.5 SP1. I have set up .NET 3.5 as a prerequisite in the MSI, and what has been happening for ages is that when the user does not have .NET 3.5 SP1, the MSI first has them download and install that before resuming the…
My program downloads a websites source code, modifies it, creates the file, and then reuploads it through the FTP. However, I receive the following error when trying to open the created file:
java.io.FileNotFoundException: misc.html (Access is denied)
at java.io.FileInputStream.open(Native…
I am currently working through the Gregory Brown Ruby Best Practices book. Early on, he is talking about refactoring some functionality from helper methods on a related class, to some methods on module, then had the module extend self.
Hadn't seen that before, after a quick google, found…
i have a bunch of Console.WriteLines in my code that I can observe at runtime. I communicate with a native library that I also wrote.
I'd like to stick some printf's in the native library and observe them too. I don't see them at runtime however.
I've created a convoluted hello world…
For the past 5 years, my typical solution for storing uploaded files (images, videos, documents, etc) was to throw everything into an "upload" folder and give it a unique name.
I'm looking to refine my methods for storing uploaded content and I'm just wondering what other methods are…
I followed the guide here, and when I build my application the ad (or anything for that matter) doesn't show up. Nothing, nada. I followed the guide very carefully. I know that it is trying to retrieve an ad (thanks to little snitch), but it doesn't display.
Has anybody…
Hi Guys,
I was wondering about which way i should do the following. I am using the tiny MCE wysiwyg editor which formats the users data with the right html tags. Now, i need to save this data entered into the editor into a database table.
Should I encode the html tags…
I have a list of tuples that I'm trying to incorporate into a SQL query but I can't figure out how to join them together without adding slashes. My like this:
list = [('val', 'val'), ('val', 'val'), ('val', 'val')]
If I turn each tuple into a string and try to join…
What do I pass as the first parameter "object" to the function setattr(object, name, value), to set variables on the current module?
For example:
setattr(object, "SOME_CONSTANT", 42);
giving the same effect as:
SOME_CONSTANT = 42
within the module containing…
I have a ruby array that looks something like this:
my_array = ['mushroom', 'beef', 'fish', 'chicken', 'tofu', 'lamb']
I want to sort the array so that 'chicken' and 'beef' are the first two items, then the remaining items are sorted alphabetically. How would I…
I just hit something I think is inconsistent, and wanted to see if I'm doing something wrong, if I'm an idiot, or...
MailMessage msg = new MailMessage();
msg.To.Add("person1@domain.com");
msg.To.Add("person2@domain.com");
msg.To.Add("person3@domain.com");…
I've got a method that gets called on an event, which presents me with two variables varA, varB (both strings). This method gets called with new information quite frequently, thus I have created a separate method that takes in the two parameters. I want…