instruction stringlengths 0 30k ⌀ |
|---|
[Ice][1] from ZeroC is a really high performance "enterprisey" interop layer that supports Java and .net amongst others. I think of it as an updated Corba - it even has its own object oriented interface definition language called [Slice][2] (like Corba's IDL, but actually quite readable).
The feature set is extensi... |
Usually you know where you are having problems, so you can set a breakpoint in your javascript code by placing the keyword "debugger;" on a line in your javascript code (obviously without the quotes) to set a breakpoint.
When you get to it in IE, it will ask you if you want to debug and prompt you to choose a deb... |
This one not only calculates n!, it is also O(n!). It may have problems if you want to calculate anything "big" though.
long f(long n)
{
long r=1;
for (long i=1; i<n; i++)
r=r*i;
return r;
}
long factorial(long n)
{
// iterative implement... |
The best way to get back into C++ is to jump in. You can't learn a real language without spending any serious time in a country where they speak it. I wouldn't try to learn a programming language without spending time coding in it either.
I wouldn't recommend learning C first though. That's a good way to pick up ... |
I haven't tried it myself but have heard from people and sources I trust that "Accelerated C++" by Koenig and Moo is a good book for people who want to pick up C++ quickly. Compared to the more traditional route of learning C first then C++ as a kind of C with classes the K+M approach helps you become productive quickl... |
iPhone App Minus App Store? |
|iphone| |
I've been looking into iPhone development, but I've been having problems coming up with the answer to a certain question.
If I create an application on my Mac, is there any way I can get it to run on an iPhone without going through the app store?
It doesn't matter if the iPhone has to be jailbroken, as long as I ... |
@jjnguy: `-Xms` sets the *initial* size of the heap. Changing this will have no effect on `java.lang.OutOfMemory` errors. The option to use is `-Xmx` which sets the *maximum* size of the heap. [See here for details.][1]
[1]: http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html#nonstandard |
**Nesting Using Statements**
Usually we do it like this:
StringBuilder sb = new StringBuilder();
using (StringWriter sw = new StringWriter()) {
using (IndentedTextWriter itw = new IndentedTextWriter(sw)) {
...
}
}
But we can do it this way:
StringBuilder sb ... |
One way is to throw an exception in Page Load, but don't catch it. At the bottom of the page, you'll see the version number. |
If you can profile, just Do it and profile. Datasets are heavier then a simple `Collection<T>`
DataReaders are faster then using Adapters...
Changing behavior in an objects is much easier than massaging a dataset
Anyway: Just Do It, ask for forgiveness not permission.
|
Yes, Once you have joined the iPhone Developer Program,and paid Apple $99, you can transfer your application to up to 100 iPhones or iPod touches. |
The Subversion book has [an appendix][1] that details important differences from CVS, which may help you make your decision. The two approaches are more or less the same idea but SVN was specifically designed to fix long standing flaws in CVS so, in theory at least, SVN will always be the better choice.
[1]:... |
CVS only tracks modification file by file while SVN tracks a whole commit as a new revision, which means that it is easier to follow the history of your project. Add the fact that all modern source control software use the concept of revision so it is far easier to migrate from SVN than it is from CVS.
There is also... |
When I needed to write an application with a client-server model where the clients could leave and enter whenever they want, (I assume that's also the case for your application as you use mobile devices) I made sure that the clients send an *online* message to the server, indicating they were connected and ready to do ... |
How big can a MySQL database get before performance starts to degrade. |
|database|mysql| |
At what point does a MySQL database start to loose performance?
- Does physical database size matter?
- Do number of records matter?
- Is any performance degradation linear or exponential?
Ive got (what I believe to be) a large database, almost 2GB and about 15M records. Should I be cleaning this out, or ... |
SVN has 3 main advantages over CVS
- it's faster
- supports versioning of binary files
- and adds transactional commit (all or nothing) |
You can use the artifact directory variable inside the MSBuild script itself. Here's an example of how I'm running FxCop right now from my CC.Net MSBuild script (this script is what CC.Net points to - there is also a "Build" target in the script that includes an MSBuild task against the SLN to do the actual compilatio... |
To get rid of the _AFXDLL error, have you tried changing to the settings to use MFC as a static lib instead of a DLL? This is similar to what you're already doing in changing the runtime libs to static instead of DLL. |
It depends on your requirements.
For instance, if you don't care about the searcher's properties (e.g. searcher strength, vision, etc.), then I would say haystack.find(needle) would be the cleanest solution.
But, if you do care about the searcher's properties (or any other properties for that matter), I would inj... |
If you are using Hibernate, take a look at [JBoss Envers][1]. From the project homepage:
> The Envers project aims to enable easy versioning of persistent JPA classes. All that you have to do is annotate your persistent class or some of its properties, that you want to version, with @Versioned. For each versioned en... |
Try [Real World Haskell][1]. It's free online.
[1]: http://book.realworldhaskell.org/beta/index.html |
You can define multiple autoloading functions with spl\_autoload\_register:
spl_autoload_register('load_controllers');
spl_autoload_register('load_models');
function load_models($class){
if( !file_exists("models/$class.php") )
return false;
include "models/$class.php";
... |
Evidently the performance hit of anonymous delegates is pretty significant.
Test code:
static void Main(string[] args)
{
for (int kk = 0; kk < 10; kk++)
{
List<int> tmp = new List<int>();
for (int i = 0; i < 100; i++)
... |
> HTTPS requests are not cached so sending an If-Modified-Since doesn't make any sense. The not caching is a security precaution.
The not caching **on disk** is a security pre-caution, but it seems it indeed affects the **If-Modified-Since** behavior (glancing over the code).
Try setting the Firefox preference (i... |
> HTTPS requests are not cached so sending an If-Modified-Since doesn't make any sense. The not caching is a security precaution.
The not caching **on disk** is a security pre-caution, but it seems it indeed affects the **If-Modified-Since** behavior (glancing over the code).
Try setting the Firefox preference (i... |
That used to be a problem in SQL 2000, but I thought that was fixed in 2005. |
PHPs htmlspecialcharacters equivalent in .NET? |
|c#|.net|asp.net|php| |
PHP has a great function called [htmlspecialcharacters()][1] where you pass it a string and it replaces all of HTML's special characters with their safe equivalents, it's *almost* a one stop shop for sanitizing input. Very nice right?
Well is there an equivalent in any of the .NET libraries?
If not, can anyone li... |
8094 bytes.
If you list some more information about what you are doing it might help us to figure out the actual cause. |
System.Web.HttpUtility.HtmlEncode(string) |
Try this.
var encodedHtml = HttpContext.Current.Server.HtmlEncode(...); |
Enterprise Reporting Solutions |
|sql|reporting-services|reporting| |
What options are there in the industry for enterprise reporting? I'm currently using SSRS 2005, and know that there is another version coming out with the new release of MSSQL.
But, it seems like it might also be a good time to investigate the market to see what else is out there.
What have you encountered? Do ... |
In SQL 2000, the row limit is 8K bytes, which is the same size as a page in memory.
[Edit]
In 2005, the page size is the same (8K), but the database uses pointers on the row in the page to point to other pages that contain larger fields. This allows 2005 to overcome the 8K row size limitation. |
Don't know if there's an exact replacement, but there is a method HtmlUtility.HtmlEncode that replaces special characters with their HTML equivalents. A close cousin is HtmlUtility.UrlEncode for rendering URL's. You could also use validator controls like RegularExpressionValidator, RangeValidator, and System.Text.Regul... |
Books by E.F. Codd and C.J. Date are the most obvious answers. I have not read this particular book but I am familiar with the authors, it is likely quite good.
[Applied Mathmatics for Database Professionals][1] by Lexx de Haan and Toon Koppelaars.
[1]: http://www.amazon.com/Applied-Mathematics-Database-Profe... |
If you want a colon delimited value converter then there is a 3rd party open source called [FileHelpers][1]. I'm not sure about what open-source license it is under, but it has helped me quite a lot.
[1]: http://filehelpers.sourceforge.net/ |
It depends on what you actually want to do with the data. Given a large text file like that you typically only want a smaller subset of the data at any one time, so don't overlook tools like 'grep' for pulling out the pieces you want to look for and work with. |
One point missed here:
A List has a Count property, it internally keeps track of how many elements are in it.
An IEnumerable DOES NOT.
If you program to the interface IEnumerable and use the count extention method it will enumerate just to count the elements.
A moot point though since in the IEnumerable y... |
I've got a lot faster developing SharePoint-Solutions in general (not only Workflows) when i started using [WSPBuilder][1]. WSPBuilder has a Visual Studio Addin called WSPBuilder Extensions and in my opinion the WSPBuilder Extensions do a better job than the infamous [Windows SharePoint Services 3.0 Tools: Visual Studi... |
Some image formats have headers where you can store arbitrary information as well.
For example, the [PNG specification][1] has a chunk where you can store text data. This is similar to the answers above, but without adding random data to the image data itself.
[1]: http://en.wikipedia.org/wiki/Portable_Netwo... |
Actually, I think the rule of thumb is typically to use a natural key rather than a surrogate whenever possible...
So if I have, for instance, an Invoice table and an InvoiceDetail table, we can probably use InvoiceNumber as our primary key on the first one. It already exists in our data and (I assume?) would be uni... |
preferred way to implement visitor pattern in dynamic languages? |
|c#|ruby|design-patterns|dynamic-languages| |
As an exercise for myself, I was translating a sample program into various languages. Starting in C#, I had a visitor-pattern interface like so:
interface Visitor
{
void Accept(Bedroom x);
void Accept(Bathroom x);
void Accept(Kitchen x);
void Accep... |
What happens if two cycles overlap? Which one has its longest edge removed first? Does it matter if the longest edge of each is shared between the two cycles or not?
For example:
V = { a, b, c, d }
E = { (a,b,1), (b,c,2), (c,a,4), (b,d,9), (d,a,3) }
There's an a -> b -> c -> a cycle, and an a -> b -... |
How to Determine the Installed ASP.NET Version of Host from a Web Page |
|asp.net| |
I have a site running in a Windows shared hosting environment. In their control panel for the shared hosting account I have it set to use ASP.NET version 3.0 but it doesn't say 3.5 SP1 specifically.
How can I view the installed version running on the server where my website is hosted in an asp.net page? |
|.net|asp.net| |
It sounds like a GUI is not really what you were after, but maybe [HeidiSQL](http://en.wikipedia.org/wiki/HeidiSQL) would be worth a look. It's a GUI frontend for MySQL which I wouldn't say I quite _enjoyed_ using, but I've certainly come across worse ways to talk with a database. |
Calculate Video Duration |
|math|video|calculate|duration| |
I suck at math. I need to figure out how to calculate a video duration with only a few examples of values. For example, a value of 70966 is displayed as 1:10 minutes. A value of 30533 displays as 30 seconds. A value of 7007 displays as 7 seconds. |
Looks like the numbers are in milliseconds. So to convert to seconds, divide by 1000, then divide by 60 to find minutes etc. |
Filter out HTML tags and resolve entities in python |
|python|html| |
Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python. |
I would **strongly** advise against putting unrelated data in a given
Git repository. The overhead of creating new repositories is quite
low, and that is a *feature* that makes it possible to keep
different lineages completely separate.
Fighting that idea means ending up with unnecessarily tangled history,
whic... |
After some experimentation, I've overcome my mental block. In retrospect, it's all obvious, but in the spirit of Stack Overflow, here's what I learned.
As Sebastjan said, you first have to sort your data. This is important.
The part I didn't get is that in the example construction
groups = []
unique... |
From [wikipedia][1]:
> Turing completeness, named after Alan
> Turing, is significant in that every
> plausible design for a computing
> device so far advanced can be emulated
> by a universal Turing machine — an
> observation that has become known as
> the Church-Turing thesis. Thus, a
> machine that can act... |
It's generally considered bad practice to rely on linebreaks, since it's a fragile way to differentiate data. While most XML processors will preserve any whitespace you put in your XML, it's not guaranteed.
The real problem is that most applications that output your XML into a readable format consider all whitesp... |
One issue to consider is do you want a "makefile" creator or a replacement build system? The problem with replacement build systems is that you typically don't get good IDE integration for platforms whose users expect this (Visual C++).
If you do want a makefile creator instead of a replacement build system, take a l... |
Firstly, you *really* want to be using sqlite.
In my experience Access itself is a pile of [redacted], but the Jet database engine it uses is actually pretty fast and can handle some pretty complex SQL queries. If you can find a rails adapter that actually works I'd say you'll be fine. Just don't open the DB with th... |
For loop and While loops are entry condition loops. They evaluate condition first, so the statement block associated with the loop won't run even once if the condition fails to meet
The statements inside this for loop block will run 10 times, the value of $i will be 0 to 9;
for ($i = 0; $i < 10; $i++)
{... |
I used to use it a lot. This designer worked good for stubbing out prototype projects, but ultimately I found myself wasting a lot of time moving the mouse around when I could be typing. It seemed like an awesome idea to be able to print out the class diagrams to show APIs to other developers while I was prototyping,... |
I am with Brad on this one. The more I work on immensely complex systems, the more I see the need to truly decouple objects. He's right. It's obvious that a needle shouldn't know anything about haystack, so 1 is definitely out. But, a haystack should know nothing about a needle.
If I were modeling a haystack, ... |
When to use lambda, when to use Proc.new? |
|ruby| |
In Ruby 1.8, there are subtle differences between proc/lambda on the one hand, and Proc.new on the other.
- What are those differences?
- Can you give guidelines on how to decide which one to choose?
- In Ruby 1.9, proc and lambda are different. What's the deal? |
In Ruby 1.8, there are subtle differences between proc/lambda on the one hand, and Proc.new on the other.
- What are those differences?
- Can you give guidelines on how to decide which one to choose?
- In Ruby 1.9, proc and lambda are different. What's the deal?
**Edit**
@Mike Stone: there's no difference b... |
Wine is actually using gettimeofday() to implement QueryPerformanceCounter() and it is known to make many Windows games work on Linux and Mac.
Starts <http://source.winehq.org/source/dlls/kernel32/cpu.c#L312>
leads to <http://source.winehq.org/source/dlls/ntdll/time.c#L448> |
Limit size of Queue<T> in .NET? |
|.net|collections|queue| |
I have a Queue<T> object that I have initialised to a capacity of 2, but obviously that is just the capacity and it keeps expanding as I add items. Is there already an object that automatically dequeues an item when the limit is reached, or is the best solution to create my own inherited class? |
You should create your own class, a ringbuffer would probably fit your needs.
The data structures in .NET that allows you to specify capacity, except for array, uses this to build the internal data structure used to hold the internal data.
For instance, for a list, capacity is used to size an internal array. When... |
I've knocked up a basic version of what I'm looking for, it's not perfect but it'll do the job until something better comes along.
public class LimitedQueue<T> : Queue<T>
{
private int limit = -1;
public int Limit
{
get { return limit; }
set { limit = v... |
Why wouldn't you just use an array with a size of 2? A Queue is supped to be able to dynamically grow and shrink. |
Why wouldn't you just use an array with a size of 2? A Queue is supped to be able to dynamically grow and shrink.
Or create a wrapper class around an instance of Queue<T> instance and each time one enqueues a <T> object, check the size of the queue. If larger than 2, dequeue the first item. |
Unit testing with network-reliant code |
|unit-testing|testing|wmi| |
I'm trying to be better about unit testing my code, but right now I'm writing a lot of code that deals with remote systems. SNMP, WMI, that sort of thing. With most classes I can mock up objects to test them, but how do you deal with unit testing a real system? For example, if my class goes out and gets the Win32_Lo... |
Really good feedback is extremely important. Even simple things like making it obvious what can and cannot be clicked can be overlooked or too subtle. Feedback when something might happen in the background is great. In gmail, it's great that there's a status ribbon appearing at the top that let's you know if something ... |
So from the way you worded the question I'm inferring that you want to have an event handler which is invoked whenever focus switches between windows. You want to be notified, rather than having to poll.
I actually don't think calling GetFocus from OnIdle is that much of a hack - sure it's polling, but it's low-over... |
You could monitor messages for the WM_[ACTIVATE][1] event.
[ref][2]
[1]: http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputmessages/wm_activate.asp?frame=true
[2]: http://blogs.msdn.com/jfoscoding/archive/2006/08/02/686141.a... |
I would probably do something like this in your document class
for(var i:int=0; i<numChildren; i++){
trace(getChildAt(i),"This is the child at position "+i);
}
I do this because I still code in the flash IDE and its debugger is so very painful to get working most of the time it's easier to just ... |
Error viewing csproj property pages in VisualStudio2005 |
|visual-studio| |
When I goto view the property page for my CSharp test application I get the following error.
"An error occurred trying to load the page. COM object that has been seperated from its underlying RCW cannot be used."
The only thing that seems to fix it is rebooting my PC! |
We use FinalBuilder to automate a bunch of post build / pre build tasks. There's also a web interface so you can kick off builds (or push websites) by logging in to the web site and clicking a button.
http://www.finalbuilder.com/ |
I found [Factor CSS][1] - complete with source code, but I think it does way more than I'd need. I really just want to combine CSS blocks that have the same selectors. I'll check out the source code and see if it can be converted to something usable as a TextMate bundle. That is, unless someone else manages to get to i... |
I found [Factor CSS][1] - complete with source code, but I think it does way more than I'd need. I really just want to combine CSS blocks that have the same selectors. I'll check out the source code and see if it can be converted to something usable as a TextMate bundle. That is, unless someone else manages to get to i... |
This is usually caused by a 'rogue' add-in.
Try disabling them all, and then re-enabling them checking for the error - so that you can narrow down the culprit. |
Can't you edit the Web Deployment project's MSBuild file for it to do what you want? |