instruction
stringlengths
0
30k
You can do this with any data type. Simply make it a double pointer: typedef struct { int myint; char* mystring; } data; data** array; But don't forget you still have to malloc the variable, and it does get a bit complex: //initialize int x,y,w,h; w = 10; //width of ...
You can do this with any data type. Simply make it a double pointer: typedef struct { int myint; char* mystring; } data; data** array; But don't forget you still have to malloc the variable, and it does get a bit complex: //initialize int x,y,w,h; w = 10; //width of ...
I joined an Open Source project over at CodePlex, recently. They use TFS for their source control and I have to say that it's absolutely magnificent. I'm incredibly impressed with it, so far. I'm a huge fan of the IDE integration and how easy it is to branch and tag your code. Adding a solution to source control is som...
Sometimes you can't choose your environment or architecture, so you're stuck working within constraints like not being able to use frameworks...
You could use **mocking frameworks** to abstract out the database engine. I don't know if PHP/Python got some but for typed languages (C#, Java etc.) there are plenty of choices It also depends on how you designed those database access code, because some design are easier to unit test than other.
You could use **mocking frameworks** to abstract out the database engine. I don't know if PHP/Python got some but for typed languages (C#, Java etc.) there are plenty of choices It also depends on how you designed those database access code, because some design are easier to unit test than other like the earlier pos...
Avoiding a framework altogether will leave you with lots of code and a bunch of tedious browser-testing. If you would consider a framework I'd suggest jQuery with the [jqDnR][1] plugin. I think it will solve your problem. [1]: http://dev.iceburg.net/jquery/jqDnR/
Avoiding a framework altogether will leave you with lots of code and a bunch of tedious browser-testing. If you would consider a framework I'd suggest jQuery with the [jqDnR][1] plugin. I think it will solve your problem or perhaps you could combine the functionality of the [jQuery draggables][2] with the [jQuery re...
The book [xUnit Test Patterns](http://www.amazon.com/xUnit-Test-Patterns-Refactoring-Addison-Wesley/dp/0131495054) describes some ways to handle unit-testing code that hits a database. I agree with the other people who are saying that you don't want to do this because it's slow, but you gotta do it sometime, IMO. Moc...
Unit testing your database access is easy enough if your project has high cohesion and loose coupling throughout. This way you can test only the things that each particular class does without having to test everything at once. For example, if you unit test your user interface class the tests you write should only...
When you change an asp.net website's config file, it restarts the application to reflect the changes... When you do an IIS Reset, that restarts all applications running on that IIS instance.
IISReset stops and restarts the entire web server (including non-ASP.NET apps) Recycling an app pool will only affect applications running in that app pool. Editing the web.config in a web application only affects that web application (recycles just that app). Editing the machine.config on the machine will rec...
Application Pool recycling restarts the w3wp.exe Process *for that application pool*, hence it will only affect and Web sites running in that application pool. iisreset restarts ALL w3wp.exe Processes and any other IIS Related service, i.e. the NNTP or FTP Service. I think changing web.config or /bin does not rec...
You find the Lat/Lon of the city, then use a distance estimation algorithm for Lat/Lon coordinates.
How can I create virtual machines as part of a build process using MSBuild and MS Virtual Server?
|msbuild|virtualization|microsoft|
What I would like to do is create a clean virtual machine image as the output of a build of an application. So a new virtual machine would be created (from a template is fine, with the OS installed, and some base software installed) --- a new web site would be created in IIS, and the web app build output copied to a...
|microsoft|msbuild|virtualization|
What I would like to do is create a clean virtual machine image as the output of a build of an application. So a new virtual machine would be created (from a template is fine, with the OS installed, and some base software installed) --- a new web site would be created in IIS, and the web app build output copied to a...
How can I create virtual machines as part of a build process using MSBuild and MS Virtual Server and/or Hyper-V Server Virtualization?
I know that if you use a paging repeater or gridview with the linqdatasource it will automatically optimize the number of results returned, but I'm also pretty sure in the datasource wizard you can go to advanced options and limit it to SELECT TOP 3 FROM which should allow you to do what you need
Might want to check out [Drupal](http://drupal.org/). Here are the details of the [technology stack](http://drupal.org/node/176052) that it uses. I have never used it so I can't vouch for the quality etc but definitely worth a look.
Dylan, Don't use the application config file for this purpose, use a SQL DB (SQLite, MySQL, MSSQL, whatever) because you'll have to worry less about concurrency issues during reads and writes to the config file. You'll also have better flexibility in the type of data you want to store. The appSettings section is...
I appreciate the desire to find free software. However, in this case, I would strongly recommend looking at all options, including commercial products. I tried to play with nProf (which is at version 0.1 I think) and didn't have much luck. Even so, performance profiling an application is a subtle business and is best a...
The DataGrid was originally in .NET 1.0. The GridView was introduced (and replaced the DataGrid) in .NET 2.0. They provide nearly identical functionality.
DataGrid was an ASP.NET 1.1 control, still supported. GridView arrived in 2.0, made certain tasks simpler added different databinding features: This link has a comparison of DataGrid and GridView features - [http://msdn.microsoft.com/en-gb/magazine/cc163933.aspx][1] [1]: http://msdn.microsoft.com/en-gb/mag...
Drawing a custom label on a pie chart in Yahoo's Flash Library ASTRA
|flash|actionscript-3|datatipfunction|
Has anyone looked at [Yahoo's ASTRA][1]? It's fairly nifty, but I had some issues creating a custom label for a pie chart. They have an example for a line chart, which overrides an axis's series's label renderer. My solution was to override the `myPieChart.dataTipFunction`. For data that looks like: [ { categor...
|actionscript-3|flash|datatipfunction|
|flash|actionscript-3|datatipfunction|
Has anyone looked at [Yahoo's ASTRA][1]? It's fairly nifty, but I had some issues creating a custom label for a pie chart. They have an example for a line chart, which overrides an axis's series's label renderer. My solution was to override the `myPieChart.dataTipFunction`. For data that looks like: myPieChart....
@Toran: What I'm testing is the programmatic mapping from data returned from the database to quote-unquote domain model. Hence I want to mock out the database connection. For the other kind of test, I'd go for all-out integration testing. @Dale: I guess you nailed it pretty well there, and I was afraid that might be...
The source code seemed to be geared for an executable, you might need to rewire stuffs a bit so it would build as a DLL instead. I don't have much experience with Visual C++ but I think it shouldn't be too hard. I guess someone might have had made a library version already, you should try Google. Once you have tesse...
The source code seemed to be geared for an executable, you might need to rewire stuffs a bit so it would build as a DLL instead. I don't have much experience with Visual C++ but I think it shouldn't be too hard with some research. My guess is that someone might have had made a library version already, you should try Go...
[JQuery][1] would be a good way to go. And with the [Jquery UI][2] plugins (such as [draggable][3]), it's a breeze.. (there's a [demo][4] here). Not using a framework, to keep it 'pure', seems just a waste of time to me. There's good stuff, that will save you tremendous amounts of time, time better spent in making y...
@wilhelmtell The compiler can elide the temporary. Verbatim from the other thread: The C++ compiler is allowed to eliminate stack based temporaries even if doing so changes program behavior. MSDN link for VC 8: http://msdn.microsoft.com/en-us/library/ms364057(VS.80).aspx MSN
You should probably avoid creating your own collection for that purpose. It's pretty common to want to change the type of data structure a few times during refactorings or when adding new features. With your approach, you would wind up with a separate class for BusinessObjectList, BusinessObjectDictionary, BusinessOb...
[Tim Pope](http://www.tpope.net/) has some kickass plugins. I love his [surround](http://git.tpope.net/vim-surround.git) plugin.
It's [recommended](http://blogs.msdn.com/fxcop/archive/2006/04/27/faq-why-does-donotexposegenericlists-recommend-that-i-expose-collection-lt-t-gt-instead-of-list-lt-t-gt-david-kean.aspx) that in public API's not to use List<T>, but to use Collection<T> If you are inheriting from it though, you should be ...
I do the exact same thing as you Jonathan... just inherit from `List<T>`. You get the best of both worlds.
I do the exact same thing as you Jonathan... just inherit from `List<T>`. You get the best of both worlds. But I generally only do it when there is some value to add, like adding a `LoadAll()` method or whatever.
Writing to the Program Files folder is a really bad idea, you should assume that this location is "read only" once installed. Saving user settings in Program Files causes problems if more than two people use the computer at once (eg. Terminal Services) who's settings should be saved, do you want other users to know...
If you want to create MSI files, try the [WiX: Windows Installer XML (WiX) toolset][1]. It's an addon to Visual Studio 2005 and above, is open-source, Microsoft endorsed, developed by employees at Microsoft. You can use XML to specify and create MSI files. [1]: http://wix.sourceforge.net/
If you want to create MSI files, try [WiX: Windows Installer XML (WiX) toolset][1]. It's an addon to Visual Studio 2005 and 2008, is open-source, and Microsoft developed. You can use XML to specify and create MSI files. There is a [wealth][2] [of][3] [resources][4] available on it, and WiX 3.0 is, although in beta...
Languages other than SQL in postgres
|postgresql|sql|trusted-vs-untrusted|
I've been using PostgreSQL a little bit lately, and one of the things that I think is cool is that you can use languages other than SQL for scripting functions and whatnot. But when is this actually useful? For example, the documentation says that the main use for PL/Perl is that it's pretty good at text manipulati...
|sql|database|postgresql|trusted-vs-untrusted|
make sure the user that is running the cron job has the permissions needed to encrypt the file.
This is what I ended up doing There is no domain controller in this scenario, we are only a couple of users. If I were to do it all over I would consider changing our environement to use a active directory domain. - Host Server running Windows Server 2008 with 8GB RAM and quad processor - Fresh install of Wi...
This is my recipe for installing TFS 2008 SP1. There is no domain controller in this scenario, we are only a couple of users. If I was to do it again, I would consider changing our environement to use a active directory domain. - Host Server running Windows Server 2008 with 8GB RAM and quad processor - Fre...
I've used this with great success: http://sqlite.phxsoftware.com/ Free with no restrictions. --Bruce
One thing nobody seems to have mentioned is how auto-properties are unfortunately not useful for immutable objects (usually immutable structs). Because for that you really should do: private readonly string title; public string Title { get { return this.title; } } (where the field is i...
1.6 comes with git gui that works pretty well on my mac.
When must I set a variable to "Nothing" in VB6?
|vb6|memory-leaks|
In one of my VB6 forms, I create several other Form objects and store them in member variables. Private m_frm1 as MyForm Private m_frm2 as MyForm // Later... Set m_frm1 = New MyForm Set m_frm2 = New MyForm I notice that I'm leaking memory whenever this (parent) form is created and destro...
In one of my VB6 forms, I create several other Form objects and store them in member variables. Private m_frm1 as MyForm Private m_frm2 as MyForm // Later... Set m_frm1 = New MyForm Set m_frm2 = New MyForm I notice that I'm leaking memory whenever this (parent) form is created and destro...
Is version control (ie. Subversion) applicable in document tracking?
|version-control|tracking|
I am in charge of about 100+ documents (word document, not source code) that needs revision by different people in my department. Currently all the documents are in a shared folder where they will retrieve, revise and save back into the folder. What I am doing now is looking up the "date modified" in the shared fol...
I am in charge of about 100+ documents (word document, not source code) that needs revision by different people in my department. Currently all the documents are in a shared folder where they will retrieve, revise and save back into the folder. What I am doing now is looking up the "date modified" in the shared fol...
Woo, another Debian nut! I think you need to be a bit more specific here, Forum != CMS. Is this for internal company or external customer use? What language(s) do you know/prefer? There's no point in recommending a Perl or PHP framework if your language of choice is Ruby. Do you need to plan for scalability? Wha...
The appSettings isn't really meant for what you are trying to do. When your .NET application starts, it reads in the app.config file, and caches its contents in memory. For that reason, after you write to the app.config file, you'll have to somehow force the runtime to re-parse the app.config file so it can cache th...
The Difference Between a DataGrid and a GridView in ASP.NET?
|asp.net|
I've been doing ASP.NET development for a little while now, and I've used both the GridView and the DataGrid controls before for various things, but I never could find a really good reason to use one or the other. I'd like to know: What is the difference between these 2 ASP.NET controls? What are the advantages or d...
I've been doing ASP.NET development for a little while now, and I've used both the GridView and the DataGrid controls before for various things, but I never could find a really good reason to use one or the other. I'd like to know: What is the difference between these 2 ASP.NET controls? What are the advantages or d...
I don't know if this would work because I'm pretty sure that the keys aren't stored in the order they are added, but you could cast the KeysCollection to a List<KeyCollection> and then get the last key in the list... but it would be worth having a look. The only other thing I can think of is to store the keys in a l...
Has anyone looked at [Yahoo's ASTRA][1]? It's fairly nifty, but I had some issues creating a custom label for a pie chart. They have an example for a line chart, which overrides an axis's series's label renderer. My solution was to override the `myPieChart.dataTipFunction`. For data that looks like: myPieChart....
I'm not positive but I believe it's QT.
I don't know the specific solution, but HtmlForm.set_Action() is a function the compiler creates that acts as the setter for a property called Action. When you do: public String Action { set { DoStuff(); } } The **set** code actually becomes a function called **set_Action**. I know it's not the best ans...
Google Talk's Graphics Toolkit ?
|toolkits|
What graphics toolkit is used for the Window's Google Talk application?
|windows|gui|toolkits|
Some really good re-usable code is in [Ayende][1] Rahien's [Rhino Tools][2]. Take a peek at not only how he implements various common code, but how it is organized. [1]: http://www.ayende.com/about-me.aspx [2]: http://sourceforge.net/projects/rhino-tools/
What exactly are you having problems with? I assume you've been able to hook the pins of the encoder to your PIC as per the technical specifications linked on the Farnell page you gave, so is the problem with reading the data? Do you not get any data from the encoder? Do you not know how to interpret the data you're ge...
[http://blogs.msdn.com/sharepoint/archive/2007/07/25/scaling-large-lists.aspx][1] [1]: http://http://blogs.msdn.com/sharepoint/archive/2007/07/25/scaling-large-lists.aspx
A good place to start would be this tutorial: <http://www.c-sharpcorner.com/UploadFile/mgold/AddIns11292005015631AM/AddIns.aspx>
I develop on Linux also, which is one reason I came up with the solution I have. I was wondering how the SourceGear options work in this respect? I have used Vault before, which in my experience wasn't too bad, but I know it is mostly Windows based. I think I read at one point that they have a client that can work o...
I develop on Linux also, which is one reason I came up with the solution I have. I was wondering how the SourceGear options work in this respect? I have used Vault before, which in my experience wasn't too bad, but I know it is mostly Windows based. I think I read at one point that they have a client that can work o...
DevExpress has a *free* plug-in called [**DXCore**][1] which provides some nice abstractions upon which to then build other plug-ins...you might look into that. [1]: http://www.devexpress.com/Products/Visual_Studio_Add-in/DXCore/
> **[ALassek][1]** wrote: > > &hellip;generate the table in code&hellip; I like the look of that! It seems MUCH less likely to produce a run-time exception due to a typo or field name change. [1]: http://stackoverflow.com/users/1249/alassek
Do you really want to do it in unmanaged code? DevExpress has a nice free library to develop visual studio plugins but it's managed. This is what they use to develop Refactor and coderush http://www.devexpress.com/Products/Visual_Studio_Add-in/DXCore/ It seems the underlying API is kind of messy. As far as I know...
@Gorgapor: I guess I need to take questions a little less literally sometimes. :-) I figured you were locked down to requiring some sort of index. I think you'll find though that as you use jQuery more, you usually don't need to do that sort of thing.
Interesting question. For the type of temporary table you're creating, I think it's when the stored procedure is executed. Tables created with the # prefix are accessible to the SQL Server session they're created in. Once the session ends, they're dropped. This url: http://www.sql-server-performance.com/tips/qu...
It sounds to me like you need to begin implementing what is known as "separation of concerns" across your application generally. The examples folks give about templating, in response to your specific complaint about page editors breaking your code, are important, but represent just one example of this tactic. As your p...
If you want to create MSI files, try [WiX: Windows Installer XML (WiX) toolset][1]. It's an addon to Visual Studio 2005 and 2008, is open-source, and Microsoft developed. You can use XML to specify and create MSI files. There is a [wealth][2] [of][3] [resources][4] available on it, and WiX 3.0 is, although in beta...
How about the about the [FlagsAttribute][1] on an enumeration. It allows you to perform bitwise operations... took me forever to find out how to do bitwise operations in .NET nicely. [1]: http://msdn.microsoft.com/en-us/library/system.flagsattribute.aspx
How to use BITS to download from a UNC path?
|vb.net|bit|
Whats the best way to distribute files to users in remote offices, using [BITS][1] with a UNC path or BITS with HTTP? I have a VB.NET project which downloads from a HTTP path currently but there is added complexity involved (having a web server, etc). Or is there a better way to do this? Low bandwith usage is more ...
A very nice grep replacement for GVim is [Ack][1]. A search plugin written in Perl that beats Vim's internal grep implementation and externally invoked greps, too. It also by default skips any CVS directories in the project directory, e.g. '.svn'. [This][2] blog shows a way to integrate Ack with vim. [1]: http:/...
Sure..it's pretty easy. Here's a fun app I threw together. I'm assuming you have Visual C++. Save to test.cpp and compile: cl.exe /EHsc test.cpp To test with your OCX you'll need to either #import the typelib and use it's CLSID (or just hard-code the CLSID) in the CoCreateInstance call. Using #import will also he...
You could always do this: string[] temp = new string[mydict.count]; mydict.Keys.CopyTo(temp, 0) int LastCount = mydict[temp[mydict.count - 1]] But I wouldn't recommend it. There's no guarantee that the last inserted key will be at the end of the array. The ordering for Keys [on MSDN][1] is unspecifi...
You could always do this: string[] temp = new string[mydict.count]; mydict.Keys.CopyTo(temp, 0) int LastCount = mydict[temp[mydict.count - 1]] But I wouldn't recommend it. There's no guarantee that the last inserted key will be at the end of the array. The ordering for Keys [on MSDN][1] is unspecifi...
I think you can do something like this, the syntax might be wrong, havent used C# in a while To get the last item Dictionary<string, int>.KeyCollection keys = mydict.keys; string lastKey = keys.Last(); or use Max instead of Last to get the max value, I dont know which one fits your code better.
Maybe you want to consider using <a href="http://www.donationcoder.com/Software/Mouser/proctamer/index.html">ProcessTamer</a> that "automatize" the process of downgrading or upgrading process priority based in your settings. I've been using it for two years. It's very simple but really effective!