Saving any file to in the database, just convert it to a byte array?
Is converting a file to a byte array the best way to save ANY file format to disk or database var binary column? So if someone wants to save a .gif or .doc/.docx or .pdf file, can I just convert it t...
SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)
I followed the official docs on https setup located here: [https://help.ubuntu.com/6.06/ubuntu/serverguide/C/httpd.html#https-configuration](https://help.ubuntu.com/6.06/ubuntu/serverguide/C/httpd.htm...
Tips for optimizing C#/.NET programs
It seems like optimization is a lost art these days. Wasn't there a time when all programmers squeezed every ounce of efficiency from their code? Often doing so while walking five miles in the snow? ...
- Modified
- 5 Sep at 10:13
Insert multiple values using INSERT INTO (SQL Server 2005)
In SQL Server 2005, I'm trying to figure out why I'm not able to insert multiple fields into a table. The following query, which inserts one record, works fine: ``` INSERT INTO [MyDB].[dbo].[MyTable...
- Modified
- 17 Mar at 13:31
Struct with template variables in C++
I'm playing around with templates. I'm not trying to reinvent the std::vector, I'm trying to get a grasp of templateting in C++. Can I do the following? ``` template <typename T> typedef struct{ s...
Returning JSON object from an ASP.NET page
In my particular situation, I have a couple of solutions to my problem. I want to find out which one is more feasible. In this case, I can also achieve my goal by returning a JSON object from my serve...
SQL server 2008 backup error - Operating system error 5(failed to retrieve text for this error. Reason: 15105)
Can anyone help me, I'm trying to backup a database located on localhost\SQLEXPRESS but i keep getting the following error: ``` Backup failed for Server 'localhost\SqlExpress'. (Microsoft.SqlServer....
- Modified
- 16 Oct at 01:58
Any good implementation of Actors for C#?
Is there any good implementation of [actors concurrency model](http://en.wikipedia.org/wiki/Actor_model) for .net/c#? I have to optimize a c# routine and i think that actors model fits perfectly as ...
- Modified
- 15 Apr at 22:44
How to calculate modulus of large numbers?
How to calculate modulus of 5^55 modulus 221 without much use of calculator? I guess there are some simple principles in number theory in cryptography to calculate such things.
Creating a Plot Window of a Particular Size
How can I create a new on-screen R plot window with a particular width and height (in pixels, etc.)?
C# Cast Entire Array?
I see this `Array.ConvertAll` method, but it requires a `Converter` as an argument. I don't see why I need a converter, when I've already defined an implicit one in my class: ``` public static implic...
How can you add a Certificate to WebClient (C#)?
I know it is pretty simple to add a certificate to a HttpWebRequest. However, I have not found a way to do the equivalent using WebClient. Basically, I want to send out a POST with a specific certific...
- Modified
- 17 Aug at 19:7
No overflow exception for int in C#?
I had this weird experience with problem number 10 on [Project Euler](http://projecteuler.net/) (great site by the way). The assignment was to calculate the sum of all the prime numbers below two mill...
- Modified
- 9 Jan at 04:40
String.Split only on first separator in C#?
String.Split is convenient for splitting a string with in multiple part on a delimiter. How should I go on splitting a string only on the first delimiter. E.g. I've a String ``` "Time: 10:12:12\r\n"...
What does '&' do in a C++ declaration?
I am a C guy and I'm trying to understand some C++ code. I have the following function declaration: ``` int foo(const string &myname) { cout << "called foo for: " << myname << endl; return 0; } `...
Test for equality to the default value
The following doesn't compile: ``` public void MyMethod<T>(T value) { if (value == default(T)) { // do stuff } } ``` `Operator '==' cannot be applied to operands of type 'T' and...
Generic List<T> as parameter on method
How can I use a `List<T>` as a parameter on a method, I try this syntax : ``` void Export(List<T> data, params string[] parameters){ } ``` I got compilation error: > The type or namespace name '...
So what IS the right direction of the path's slash (/ or \) under Windows?
It seems Windows insists on writing a backslash `\` in file paths, whereas .NET's URI class writes them with a slash `/`. Is there any right way, that is accepted even in the most primitive systems? ...
Can I loop through a table variable in T-SQL?
Is there anyway to loop through a table variable in T-SQL? ``` DECLARE @table1 TABLE ( col1 int ) INSERT into @table1 SELECT col1 FROM table2 ``` I use cursors as well, but cursors seem less flex...
- Modified
- 22 Dec at 19:34
How can I change the file location programmatically?
I am totally new to Log4net. I have managed to get something going by adding a config file and simple logging. I have hardcoded the value to be `"C:\temp\log.txt"` but this is not good enough. Th...
Magento - Retrieve products with a specific attribute value
In my block code I am trying to programmatically retrieve a list of products that have a attribute with a specific value. Alternately if that is not possible how would one retrieve all products then ...
- Modified
- 30 Dec at 10:39
How does Entity Framework work with recursive hierarchies? Include() seems not to work with it
I have an `Item`. `Item` has a `Category`. `Category` has `ID`, `Name`, `Parent` and `Children`. `Parent` and `Children` are of `Category` too. When I do a LINQ to Entities query for a specific `Ite...
- Modified
- 2 Nov at 23:38
Casting vs Converting an object toString, when object really is a string
This isn't really an issue, however I am curious. When I save a string in lets say an DataRow, it is cast to Object. When I want to use it, I have to cast it ToString. As far as I know there are sever...
Variable declaration in a header file
In case I have a variable that may be used in several sources - is it a good practice to declare it in a header? or is it better to declare it in a `.c` file and use `extern` in other files?
Method-Chaining in C#
I have actually no idea of what this is called in C#. But i want to add the functionallity to my class to add multiple items at the same time. ``` myObj.AddItem(mItem).AddItem(mItem2).AddItem(mItem3)...
- Modified
- 5 Dec at 15:10