instruction stringlengths 0 30k ⌀ |
|---|
|.net|database|transactions|com+| |
I did some tests a while ago and never figured out how to make this work.
The ingredients:
- COM+ transactional object (developed in VB6)
- .Net web application (with transaction) in IIS that...
makes a call to the COM+ component
updates a row in a SQL database
Testing:
Run the .Net application... |
Request.Url will return you the [Uri][1] of the request. Once you have that, you can retrieve pretty much anything you want. To get the protocol, call the [Scheme][2] property.
Sample:
Uri url = Request.Url;
string protocol = url.Scheme;
Hope this helps.
[1]: http://msdn.microsoft.com/en-us/l... |
Why does sqlite3-ruby-1.2.2 not work on OS X? |
|ruby|ruby-on-rails|sqlite|rubyonrails| |
I am running OS X 10.5, Ruby 1.8.6, Rails 2.1, and sqlite3-ruby 1.2.2 and I get the following error when trying to rake db:migrate on an app that works find connected to MySQL.
> rake aborted!
no such file to load -- sqlite3/database |
|ruby|ruby-on-rails|sqlite| |
Textual versus Graphical Programming Languages |
|graphicallanguage|labview|robotics|highschool| |
I am part of a high school robotics team, and there is some debate about which language to use to program our robot. We are choosing between C (or maybe C++) and LabVIEW. There are pros for each language.
C(++):
- Widely used
- Good preparation for the future (most programming positions require text-based ... |
|labview|highschool|robotics|graphical-language| |
I am part of a high school robotics team, and there is some debate about which language to use to program our robot. We are choosing between C (or maybe C++) and LabVIEW. There are pros for each language.
C(++):
- Widely used
- Good preparation for the future (most programming positions require text-based ... |
Audio player on Windows Mobile |
|windows-mobile| |
I'm trying to develop specialized audio player for windows mobile devices (Professional ones). And I've ran into the problem an once.
There no compressed audio APIs on WM or I was unable to found house in documentation. Yes there are WM6 Sound API but it cannot even pause playback or seek to specified position. Ther... |
I don’t know “Avast”, but in Kaspersky if the configuration is set to high almost every installer fires an alarm (iTunes, Windows Update, everything) especially if the installer modify some registry key or open a port.
If avast checks for behavior and your program open a port probably that’s be the cause. |
Rebuild the setup file, check the exact file size.
Check the exact file size of the "suspected" setup file.
If the source code hasn't changed and the two file sizes are different, there's a pretty good chance it got contaminated in transit.
I'd do that as a bit of a sanity check first. |
ILMerge and Web Resources |
|c#|asp.net|ilmerge|webresource| |
We're attemtping to merge our DLL's into one for deployment, thus ILMerge. Almost everything seems to work great. We have a couple web controls that use `ClientScript.RegisterClientScriptResource` and these are 404-ing after the merge (These worked before the merge).
For example one of our controls would look like... |
You could use the Mutex class, but you will soon find out that you will need to implement the code to pass the arguments and such yourself. Well, I learned a trick when programming in WinForms when I read Chris Sell's book. This trick uses logic that is already available to us in the framework. I don't know about yo... |
You could use the Mutex class, but you will soon find out that you will need to implement the code to pass the arguments and such yourself. Well, I learned a trick when programming in WinForms when I read Chris Sell's book. This trick uses logic that is already available to us in the framework. I don't know about yo... |
You could use the Mutex class, but you will soon find out that you will need to implement the code to pass the arguments and such yourself. Well, I learned a trick when programming in WinForms when I read [Chris Sell's book][1]. This trick uses logic that is already available to us in the framework. I don't know abo... |
I was able to do it on using KeyPress event.
Here's the code example:
Private Sub SingleLineTextBox_ KeyPress(ByRef KeyAscii As Integer)
If KeyAscii = 10 _
or KeyAscii = 13 Then
'10 -> Ctrl-Enter. AKA ^J or ctrl-j
'13 -> Enter. AKA ^M or ctrl-m
... |
I'm looking for a way to delete a file which is locked by another process using C#. I suspect the method must be able to find which process is locking the file (perhaps by tracking the handles, although im not sure how to do this in c#) then close that process before been able to complete the file delete using File.Del... |
|c#|filesystems| |
.NET Multi Dimensional Array Printing |
|c#|.net|arrays| |
Let's say I have a .NET Array of n number of dimensions. I would like to foreach through the elements and print out something like:
[0, 0, 0] = 2
[0, 0, 1] = 32
And so on. I could write a loop using some the Rank and dimension functions to come up with the indices. Is there a built in function instead... |
Solving a linear equation |
|math|linear|solving| |
I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++.
Here's an example of the equations:
-44.3940 = a * 50.0 + b * 37.0 + tx
-45.3049 = a * 43.0 + b * 39.0 + tx
-44.9594 = a * 52.0 + b * 41.0 + tx
From this, I'd like to get the best approximation fo... |
|math|system|linear-equation| |
Have you tried calling .SaveOrUpdateCopy()?
Failing that, you may have to identify and .Evict() the existing object before Attaching (.Update()) your "new" object. |
Have you tried calling .SaveOrUpdateCopy()?
It should work in all instances, if there is an entity by the same id in the session or if there is no entity at all. This is basically the catch-all method, as it converts a transient object into a persistent one (Save), updates the object if it is existing (Update) or eve... |
Can I add an event listener to a databinding action in Flex? |
|apache-flex| |
I have a ComboBox that I bind to a standard HTTPService, I would like to add an event listener so that I can run some code after the ComboBox is populated from the data provider.
How can I do this?
|
|apache-flex|data-binding| |
Exception handling: Contract vs Exceptional approach |
|exception| |
I know two approaches to Exception handling, lets have a look at them.
1. Contract approach.
When a method does not do what it says it will do in the method header, it will throw an exception. Thus the method "promises" that it will do the operation, and if it fails for some reason, it will throw an exception.
... |
When setting cookies manually, use the following parameter syntax to the [header()][1] function:
header( "Set-Cookie: name=value; httpOnly" );
However, if you have PHP **5.2.0** or greater, then you can use the [setcookie()][2] and [setrawcookie()][3] functions. Simply set the 7th parameter to true, as per th... |
When setting cookies manually, use the following parameter syntax to the [header()][1] function:
header( "Set-Cookie: name=value; httpOnly" );
However, if you have PHP **5.2.0** or greater, then you can use the [setcookie()][2] and [setrawcookie()][3] functions. Simply set the 7th parameter to true, as per th... |
I agree with Pat. At this point in the game, writing your own code to deal with cross-browser compatibility given the available Javascript frameworks doesn't make a lot of sense. There's a framework for nearly any taste (some really quite tiny) and they've focused on really abstracting out all of the differences betwee... |
ASP.NET is "stateless" but it maintains state using Sessions. You can use them by default just using the Session[] keyword.
Look at [http://msdn.microsoft.com/en-us/library/ms972429.aspx][1] for some details from Microsoft.
[1]: http://msdn.microsoft.com/en-us/library/ms972429.aspx |
Call a RegisterType method with the type, and constrain it using generics. Then, instead of walking assemblies to find ITest implementors, just store them and create from there.
void RegisterType<T>() where T:ITest, new() {
}
|
Communication between between pages |
|asp.net| |
I want to enable an user to be able to communicate with other users through a site. I know that ASP.net is stateless, but what can I use for this synced communication? Java servlets?
Thank you |
Is this a file you created and added to the project or did it mysteriously show up?
You can maybe check your .csproj file and see how it is being referenced (it should be a simple xml file and you can search for CSC97.tmp).
Perhaps post the information you find so we can have more details to help solve your probl... |
If you're using SQL Server 2005, you could use the FOR XML PATH command.
SELECT [VehicleID]
, [Name]
, (SELECT CAST(City + ', ' AS VARCHAR(MAX)) FROM [Location] WHERE (VehicleID = Vehicle.VehicleID) FOR XML PATH ('')) AS Locations
FROM [Vehicle]
It's a lot easier than using a cursor, ... |
As others have stated, the best performance comes from the bottom one since you are just rethrowing an existing object. The middle one is least correct because it looses the stack.
I personally use custom exceptions if I want to decouple certain dependencies in code. For example, I have a method that loads data from... |
As others have stated, the best performance comes from the bottom one since you are just rethrowing an existing object. The middle one is least correct because it looses the stack.
I personally use custom exceptions if I want to decouple certain dependencies in code. For example, I have a method that loads data from... |
You could use the excellent <a href="http://www.codeplex.com/umbrella">Umbrella library</a>:
using nVentive.Umbrella.Extensions.Calendar;
DateTime beginning = DateTime.Now.BeginningOfWeek();
However, they *do* seem to have stored Monday as the first day of the week (see the property `nVentive.Umbrella.Ex... |
+1 Verdana -- agree with pauldoo
A variable width font for coding is probably not to everyone's taste but I really like Verdana's legibility with ClearType. |
What is a good maintainability index using Visual Studio 2008 code analysis? |
|visual-studio|code-analysis| |
My company recently purchased TFS and I have started looking into the code analysis tools to help drive up code quality and noticed a good looking metric "maintainability index". Is anyone using this metric for code reviews/checkins/etc? If so, what is an acceptable index for developers to work toward? |
Parallelize Bash Script |
|bash| |
Lets say I have a loop in bash:
for foo in `some-command`
do
do-something $foo
done
`do-something` is cpu bound and I have a nice shiny 4 core processor. I'd like to be able to run up to 4 `do-something`'s at once.
The naive approach seems to be:
for foo in `some-command`
do
... |
Why not just do all the work in C# instead of using batch files?
I was bored so i wrote this real quick, it's just an outline of how I would do it since I don't know what the command line switches do or the file paths.
using System;
using System.IO;
using System.Text;
using System.Security;
... |
I have made the switch, since you pointed out it will be the preferred way for microsoft shops. The switch was pretty trivial and as Mike pointed out it ships with the webform view engine as the default, but like Mike also said you can still take advantage of the views you wrote in brail and nvelocity with the [MvcCon... |
Read the code of other (good) javascript apps and see how they handle things. But I start out with a file per class. But once its ready for production, I would combine the files into one large file and minify.
The only reason, I would not combine the files, is if I didn't need all the files on all the pages. |
Boxed values are [data structures](http://en.wikipedia.org/wiki/Data_structure) that are minimal wrappers around [primitive types](http://en.wikipedia.org/wiki/Primitive_type)*. Boxed values are typically stored as pointers to objects on [the heap](http://en.wikipedia.org/wiki/Dynamic_memory_allocation).
Thus, boxe... |
Quick followup question - can you use the "runas" command from an MSBuild script? If so, wouldn't you be able to simply impersonate another user with runas /user:dsfsdf /password:dfdf sc.exe ... (or similiar - I haven't researched the command-line options)? |
The best answer I have ever heard about using the provided type aliases in C# comes from Jeffrey Richter in his book [CLR Via C#][1]. Here are his 3 reasons:
> - I've seen a number of developers confused, not knowing whether to use **string** or **String** in their code. Because in C# the string (a keyword) maps exa... |
The best answer I have ever heard about using the provided type aliases in C# comes from Jeffrey Richter in his book [CLR Via C#][1]. Here are his 3 reasons:
> - I've seen a number of developers confused, not knowing whether to use **string** or **String** in their code. Because in C# the string (a keyword) maps exa... |
Best solution is to let IIS do it.
[IIS6 Compression](http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/502ef631-3695-4616-b268-cbe7cf1351ce.mspx?mfr=true) - most likely you need to [specify file types to be compressed](http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/I... |
Has anybody used Google Performance Tools? |
|c++|c|performance|multithreading|malloc| |
Looking for feedback on :
<http://code.google.com/p/google-perftools/wiki/GooglePerformanceTools> |
|performance|multithreading|malloc| |
+1 for TextMate on OSX.
See also answers to [this question][1]. I [recommend][2] trying NetBeans if you're on Windows.
[1]: http://stackoverflow.com/questions/16064/what-ide-to-use-for-developing-in-ruby-on-rails-on-windows#16086
[2]: http://stackoverflow.com/questions/16064/what-ide-to-use-for-developing... |
Understanding Pointers |
|c++|c| |
Why are pointers such a leading factor of confusion for many new, and even old, college level students in the C/C++ language? Are there any tools or thought processes that helped you understand how pointers work at the variable, function, and beyond level?
What are some good practice things that can be done to brin... |
|pointers|schools| |
When I first saw this, I thought "Great question! Neat answer, danb!"
After a little thought, I'm not so sure this is a good idea. It's a little like generating event handlers for all controls in an ASP.NET page, or generating CRUD procedures for all tables in a database. I think it's better to create them as needed... |
use System.Xml.Linq.XElement and SetValue method. This will format the text (assuming a string), but also allows you to set xml as the value. |
Crystal Reports by [Business Objects][1] seems to be a popular choice.
I never wrote any reports in it myself, but other's in my team who did sometimes struggled getting the more complex reports to work.
It also might be a bit pricey, depending on your budget.
[1]: http://businessobjects.com |
Crystal Reports by [Business Objects][1] seems to be a popular choice.
I never wrote any reports in it myself, but others in my team who did sometimes struggled getting the more complex reports to work.
It also might be a bit pricey, depending on your budget.
[1]: http://businessobjects.com |
Is there any chance you could move from ASP to ASP.Net? Or are you looking at keeping it in classic ASP, but just cleaning it up. If at all possible, I would recommend moving as much as possible moving to .Net. It looks like you may be rewriting/reorganizing a lot of code anyway, so moving to .Net may not be a lot of... |
Batch code indenters and beautifiers |
|codingstyle| |
Does anyone here know of good batch file code indenters or beautifiers?
Specifically for PHP, JS and SGML-languages.
Preferably with options as to style. |
|coding-style| |
php: access array value on the fly |
|php|arrays| |
in php, i often need to map a variable using an array ... but i can not seem to be able to do this in a one liner. c.f. example:
// the following results in an error:
echo array('a','b','c')[$key];
// this works, using an unnecessary variable:
$variable = array('a','b','c');
echo $variable[... |
|php|arrays|codingstyle| |
|php|arrays|coding-style| |
Do you name controls on forms using the same convention as a private variable? |
|user-interface|oop|codingstyle| |
For some reason I never see this done. Is there a reason why not? For instance I like _blah for private variables, and at least in Windows Forms controls are by default private member variables, but I can't remember ever seeing them named that way. In the case that I am creating/storing control objects in local vari... |
|user-interface|oop|coding-style| |
Similar to the above, but I think the best version is (slightly modified) from "perldoc -f readdir":
opendir(DIR, $somedir) || die "can't opendir $somedir: $!";
@dots = grep { (!/^\./) && -f "$somedir/$_" } readdir(DIR);
closedir DIR;
|
You can use a file system watcher to check when the file has been changed. It only becomes "changed" after whichever program had the file previously closes the file. I know you asked for C#, but my VB.Net is much better. Hope you or someone else can translate.
It tries to open the file, if it isn't available, it a... |
function declaration isn't a prototype |