instruction stringlengths 0 30k ⌀ |
|---|
|c|compiler-construction|gcc| |
I have a library I created,
mylib.c:
#include <mylib.h>
int
testlib() {
printf("Hello world\n");
return (0);
}
mylib.h:
#include <stdio.h>
extern int testlib();
In my program, I've attempted to call this library function:
myprogram.c:
#include <myli... |
C++ Compiler Error C2371 - Redefinition of WCHAR |
|c++|compiler-construction| |
I am getting C++ Compiler error C2371 when I include a header file that itself includes odbcss.h. My project is set to MBCS.
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\odbcss.h(430) : error C2371: 'WCHAR' : redefinition; different basic types
1> C:\Program Files\Microsoft SDKs\Windows\v6.0A\includ... |
Can you use the 3.5 framework? Linq to XML is fantastic, and simple. |
Try:
extern int testlib(void); |
Math is your friend:
import static java.lang.Long.toString;
import static java.lang.Math.round;
import static java.lang.Math.random;
import static java.lang.Math.pow;
import static java.lang.Math.abs;
import static java.lang.Math.min;
public class RandomAlphaNum() {
public ... |
Math is your friend:
import static java.lang.Math.round;
import static java.lang.Math.random;
import static java.lang.Math.pow;
import static java.lang.Math.abs;
import static java.lang.Math.min;
public class RandomAlphaNum {
public static String gen(int length) {
S... |
import static java.lang.Math.round;
import static java.lang.Math.random;
import static java.lang.Math.pow;
import static java.lang.Math.abs;
import static java.lang.Math.min;
import static org.apache.commons.lang.StringUtils.leftPad
public class RandomAlphaNum {
public sta... |
Is there a reason that you want it in Flash? If a plain, old PNG will work, try the [Google Chart API](http://code.google.com/apis/chart/). |
Epoch is pretty large and available in US and EU:
[http://www.epoch.com/en/index.html][1]
I have no idea about their conditions though.
[1]: http://www.epoch.com/en/index.html |
I have worked for a company that developed a system for distributing media content to dedicated "players". It was web based and used ASP.NET technology and have tried almost every possible media format you can think of and your choice really comes down to asking yourself:
does it needs to play directly out of the bo... |
I'd have to go with paypal. I've used it in the past, and its really quite painless. All you need to do is create an account, and it's automatically available to you. |
<http://www.authorize.net/> works well. This type of solution would allow your customer to enter his/her credit card directly. |
<http://teethgrinder.co.uk/open-flash-chart/> seems really sweet. I suggest you give it a look. |
I can vouch that I've had good experiences with [PHP/SWF charts][1] (and by extension, the XML/SWF charts too). It's easy to create really subtle chart effects. Pie charts fading in one slice at a time looks fairly professional without being annoying.
[1]: http://www.maani.us/charts/index.php |
I can vouch that I've had good experiences with [PHP/SWF charts][1] (and by extension, the XML/SWF charts too). It's easy to create really subtle chart effects. Pie charts fading in one slice at a time looks fairly professional without being annoying.
Edit: Scratch that, [Open-Flash-Chart][2] looks WAY better. I rec... |
Appropriate pagefile size for SQL Server |
|windows|sql-server| |
Does any know a good rule of thumb for the appropriate pagefile size for a Windows 2003 server running SQL Server? |
I'm no expert on Agile development, but I would imagine that integrating some basic automated pen-test software into your build cycle would be a good start. I have seen several software packages out there that will do basic testing and are well suited for automation. |
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... |
**Python** uses pass-by-value, but since all such values are object references, the net effect is something akin to pass-by-reference. However, Python programmers think more about whether an object type is *mutable* or *immutable*. Mutable objects can be changed in-place (e.g., dictionaries, lists, user-defined objects... |
Here it is in Java:
import static java.lang.Math.round;
import static java.lang.Math.random;
import static java.lang.Math.pow;
import static java.lang.Math.abs;
import static java.lang.Math.min;
import static org.apache.commons.lang.StringUtils.leftPad
public class RandomAlpha... |
This error happens when you redeclare a variable of the same name as a variable that has already been declared. Have you looked to see if odbcss.h has declared a variable you already have? |
You can use Reflection to set <code>myClassImpl</code> by calling <code>instantiateMyClass()</code> again. You can look at [this answer][1] to see example patterns for playing around with private methods and variables.
[1]: http://stackoverflow.com/questions/34571/whats-the-best-way-of-unit-testing-private-metho... |
You can use Reflection to set <code>myClassImpl</code> by calling <code>instantiateMyClass()</code> again. Take a look at [this answer][1] to see example patterns for playing around with private methods and variables.
[1]: http://stackoverflow.com/questions/34571/whats-the-best-way-of-unit-testing-private-method... |
right now i don't have crystal reports installed on my machine but if i remember correctly you can select as the source of your report an xml file.
i believe that you can also select the xsd with the data definition for your xml file.
in my case, since i was working with a dataset i would run my application and s... |
What are the best ways to determine what port an application is using? |
|sql-server|port|msde| |
This is an adapted version of a question from someone in my office. She's trying to determine how to tell what ports MSDE is running on for an application we have in the field.
Answers to that narrower question would be greatly appreciated. I'm also interested in a broader answer that could be applied to any netwo... |
Download currports from [here][1].
It will show you which ports are open and which processes are associated with each port.
Scroll down to:
Download CurrPorts
[1]: http://www.nirsoft.net/utils/cports.html |
If you use an XmlTextReader class it will technically be faster than using an XmlDocument, which parses the entire file and builds a DOM for you. But you must also consider that fact that with an XmlTextReader, you are just reading one node at a time, so there is the additional overhead of making sense of the data as ... |
**Python** uses pass-by-value, but since all such values are object references, the net effect is something akin to pass-by-reference. However, Python programmers think more about whether an object type is *mutable* or *immutable*. Mutable objects can be changed in-place (e.g., dictionaries, lists, user-defined objects... |
How to make junior programmers write tests? |
|testing|bestpractices|unittesting| |
We have a junior programmer that simply doesn't write enough tests.
I have to nag him every two hours, "have you written tests?".
We've tried:
- Showing that the design becomes simpler
- Showing it prevents defects
- Making it an ego thing saying only bad programmers don't
- This weekend 2 team memb... |
|unittesting|bestpractices|testing| |
We have a junior programmer that simply doesn't write enough tests.
I have to nag him every two hours, "have you written tests?".
We've tried:
- Showing that the design becomes simpler
- Showing it prevents defects
- Making it an ego thing saying only bad programmers don't
- This weekend 2 team memb... |
Does the parent div have a defined width either pixel or percentage? Not 100% sure but I think in IE7, the parent div needs a defined width for child percentage divs to work correctly. |
`Math.Floor` rounds down, `Math.Ceiling` rounds up, and `Math.Truncate` rounds towards zero. Thus, `Math.Truncate` is like `Math.Floor` for positive numbers, and like `Math.Ceiling` for negative numbers. Here's the [reference](http://msdn.microsoft.com/en-us/library/system.math.truncate.aspx).
For completeness, `Mat... |
Unloading a ByteArray in Actionscript 3. |
|apache-flex|actionscript-3| |
Does anyone know how to forcefully unload a ByteArray from memory in AS3?
I have tried (without success):
<pre><code>
byteArray.length = 0;
byteArray = new ByteArray();
and
for ( var i:int=0; i<byteArray.length; i++ ) {
byteArray[i] = null;
}
</code></pre>
Any ideas? |
Consider using a [ManualResetEvent][1] to block the main thread at the end of its processing, and call Reset() on it once the timer's processing has finished. If this is something that needs to run constantly, consider moving this into a service process instead of a console app.
[1]: http://msdn.microsoft.com/e... |
Here is one hack that might work. Isn't clean, but it looks like it might work:
http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/
Essentially you just try to update a column that doesn't exist. |
Why don't you want to use triggers. They are a good thing if you use them correctly. If you use them as a way to enforce referential integrity that is when they go from good to bad. But if you use them for monitoring, they are not really considered taboo. |
Have a look at this article
<http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html>
IANA actionscript programmer, however the feeling I'm getting is that, because the garbage collector might not run when you want it to.
Hence
<http://www.craftymind.com/2008/04/09/kick-starting-the-garbage-collect... |
(I'm not positive about this, but...)
AS3 uses a non-deterministic garbage collection. Which means that unreferenced memory will be freed up whenever the runtime feels like it (typically not unless there's a reason to run, since it's an expensive operation to execute). This is the same approach used by most modern g... |
You can do it Asynchronously using .NET Ajax PageMethods.
See [here](http://www.singingeels.com/Articles/Using_Page_Methods_in_ASPNET_AJAX.aspx) or [here](http://weblogs.asp.net/sohailsayed/archive/2008/02/23/calling-methods-in-a-codebehind-function-pagemethods-from-client-side-using-ajax-net.aspx). |
Toad for SQL Server does this nicely, if you're considering a commercial product. |
I'm not at work so this is off the top of my head, but: If you get a reference to the Site, can you try to create a new SPSite with the SYSTEM-UserToken?
SPUserToken sut = thisSite.RootWeb.AllUsers["SHAREPOINT\SYSTEM"].UserToken;
using (SPSite syssite = new SPSite(thisSite.Url,sut){
// Do what you h... |
I agree with [Leac][1]. I actually play with [Scratch][2] sometimes if I'm bored. It's a pretty fun visual way of looking at code.
How it works is, they give you a bunch of "blocks" (these look like legos) which you can stack. And by stacking these blocks, and interacting with the canvas (where you put your sprit... |
Can you access the windows registry from Adobe Air? |
|air|apache-flex|actionscript-3| |
(y/N) |
|apache-flex|actionscript-3|air| |
(y/N)
Edit: Read-only access is fine. |
Check out the open source project [LMMS][1]. It's a music studio for Linux that includes the ability to use MIDI keyboards with software instruments. If you dig around in [source files][2] with 'midi' in the name, you'll probably find what you're looking for.
[1]: http://lmms.sourceforge.net/
[2]: http://lmms... |
The [Microsoft AJAX library][1] will accomplish this. You could also create your own solution that involves using AJAX to call your own aspx (as basically) script files to run .NET functions.
I suggest the Microsoft AJAX library. Once installed and referenced, you just add a line in your page load or init:
Aj... |
I would personally store the large data outside of the database.
Pros: Stores everything in one please, easy access to data files, easy baskup
Cons: Decreases database performance, many page splits, possible database coruption |
Choosing a new development machine |
|cpu| |
I'm not sure how this question will be recieved here but lets give it a shot...
It's time for me to get a new dev PC. What's the best choice these days?
I typically have 2-3 Visual Studios open along with mail and all that stuff. Ideally I would imagine 2+ GB of RAM would be nice as my current XP box is dying. =)... |
echo $'\002\003' > ./myfile |
Ctrl-V escapes the next keystoke. That's how you can get a Ctrl-C out: Ctrl-V Ctrl-C |
People are probably going to yell at me...but I've found that Vista 64 is mostly worth it. The main reason for me though is that I'm always maxing out my memory and having a 64bit OS allows me to go past the <4GB limit of 32bit.
But even if you don't get 64bit, just buy 2 2GB RAM cards anyways....you will be able t... |
There are some additional questions that would make our answers more complete.
- Are you going to want to travel with
it?
- How important is screen real estate
to you?
- Will you be doing interpreted or
compiled?
- Is it web based development, or
client based?
I've seen some great... |
I'm not expecting anything like this to exist. The tool would have to first implement everything that the SQL parser in your database implements, and then it would have to do a data model analysis to predict "bad" queries.
Your best bet might be to write a plugin for a text editor that did some basic checking for s... |
Not looking to travel. I'd rather get a powerful desktop for my dollar. I have a nice big panel here so problem with that. The majority of my development is ASP.NET stuff with some winforms projects. |
I think that like many events in VB, it can't be switched off.
Just set a boolean flag as you've suggested.
|
1. You should translate your requirements into a Product Backlog. This backlog is what you use to decide what Sprint Backlog items are chosen for each Sprint iteration. Management decides what is on the Product Backlog, but the team needs to agree to what they can produce in the Sprint (this is a negotiation that occur... |
6/2002/2003/2005/2008, I believe, can all coexist.
Though just this weekend I purged 'em all except 2008 as it went totally mad and stopped showing the build output. Plus my splash screen wasn't right. Now it is.
|
Setting an attribute on an object won't give a compile-time or a run-time error, it will just do nothing useful if the object doesn't access it (i.e. "`node.noSuchAttr = 'bar'`" would also not give an error).
Unless you need a specific feature of `minidom`, I would look at `ElementTree`:
import sys
from ... |
The ability to express real-world scenarios in code.
foreach(House house in location.Houses)
{
foreach(Deliverable mail in new Mailbag(new Deliverable[]
{
GetLetters(),
GetPackages(),
GetAdvertisingJunk()
... |
**Archetype**
The ability to express real-world scenarios in code.
foreach(House house in location.Houses)
{
foreach(Deliverable mail in new Mailbag(new Deliverable[]
{
GetLetters(),
GetPackages(),
GetAdvertisingJunk()
... |
I ultimately ended up finding the <a href="http://groups.google.com/group/borland.public.delphi.winapi/browse_frm/thread/36b3d5a199be91f4/7de8dab437f6aa1e?lnk=st&q=delphi+main+form+modal+dialog+z-order#7de8dab437f6aa1e">answer</a> using Google Groups. In a nutshell, all the modal dialogs need to have the following adde... |
I did it this way (ZF 1.5):
$name = new Zend_Form_Element_Text('name');
$name->setLabel('Full Name: ')
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator($MyNotEmpty);
so, the addValidator() is the interesting part. The Message is... |
> Is it better to go all the way and log everything across multiple attempts/days, or log only what you need to (given hdd is cheap).
The fact harddrives are cheap really isn't a good reason to verbosely log everything possible, for a few reasons.. For one, with a very busy application, you really don't want to slow... |
Even if you create a voronoi diagram, that still means you need to compare your x, y coordinates to all 15 thousand created areas. To make that easier, the first thing that popped into my mind though was to create some sort of grid over the possible values, so that you can easily place and x/y coordinate into one of th... |
Do webtests need VS tester edition on the build server? |
|tfs|build-process| |
I have some webtests I'd like to run as part of a build. Can webtests be run on the TFS build server without VS 2008 team system tester edition installed? |
I have some webtests I'd like to run as part of a build. Can webtests be run on the TFS build server without VS 2008 team system tester edition installed?
Webtests can only be recorded using the tester edtion of visual studio. Here's a [post][1] from Jeff while he was at Vertigo.
My question is in order to ... |
Give your submit buttons same name like this:
<input type="submit" name="submitButton" value="Previous Page" />
<input type="submit" name="submitButton" value="Next Page" />
When the user presses enter and the *Request* goes to server, you can check the value for **submitButton** on your server-side code... |
Would it be possible for you to change the previous button type int a button like this:
<input type="button" name="prev" value="Previous Page" />
Now the Next button would be the default, plus you could also add the default attribute to it so that your browser will highlight it like so:
<input type="... |
Unfortunately when it comes to memory management in Flash/actionscript there isn't a whole lot you can do. ActionScript was designed to be easy to use (so they didn't want people to have to worry about memory management)
The following is a workaround, instead of creating a ByteArray variable try this.
var byt... |
This is the method I am currently using on one of my websites. This only returns a relative day, hour, time. And then the user has to slap on "ago" in the output.
public static string ToLongString(this TimeSpan time)
{
string output = String.Empty;
if (time.Days > 0)
output += time.Days + " days ";
... |
@jeff
IMHO yours seems a little long. However it does seem a little more robust with support for "yesterday" and "years". But in my experience when this is used the person is most likely to view the content in the first 30 days. It is only the really hardcore people that come after that. So that is why I usually... |
According to Mark Russo (http://introducinglinq.com/blogs/marcorusso/archive/2008/07/20/use-of-distinct-and-orderby-in-linq.aspx)
> "The problem is that the Distinct
> operator does not grant that it will
> maintain the original order of
> values."
So your query will need to work like this
var names = ... |
|bestpractices|unittesting|testing| |
We have a junior programmer that simply doesn't write enough tests.
I have to nag him every two hours, "have you written tests?"
We've tried:
- Showing that the design becomes simpler
- Showing it prevents defects
- Making it an ego thing saying only bad programmers don't
- This weekend 2 team membe... |
|unit-testing|testing| |
IE 7+ Favorites |
|internet-explorer|bookmarks|favorites| |
Is it possible to develop a plug-in for Internet Explorer that can replace the existing favorites functionality? |
If you are looking for a good text on F#
[Expert F#][1] is co-written by Don Syme. Creator of F#. He worked on generics in .NET specifically so he could create F#.
F# is modeled after OCaml so any OCaml text would help you learn F# as well.
[1]: http://www.apress.com/book/view/9781590598504 |
Is UML practical ? |
|uml|project-management|diagram|bestpractices| |