instruction stringlengths 0 30k ⌀ |
|---|
A null-defined macro is a macro which will be replaced by nothing (will be removed) by the preprocessor. It's role is to give a hint about something in code, such as:
<pre>
#define IN
#define OUT
#define INOUT
int myFunction(IN char *name, INOUT char *address, OUT char *phone);
</pre>
This declaration sugges... |
|database|mysql|postgresql|licensing|migrating| |
We are currently using MySQL for a product we are building, and are keen to move to PostgreSQL as soon as possible, primarily for licensing reasons.
Has anyone else done such a move? Our database is the lifeblood of the application and will eventually be storing TBs of data, so I'm keen to hear about experiences of ... |
|database|mysql|postgresql|licensing|migration| |
Building an auditing system; MS Access frontend on SQL Server backend. |
|sql|sql-server|access|trigger|microsoft-access|msaccess| |
So basically I'm building an app for my company and it NEEDS to be built using MS Access and it needs to be built on SQL Server.
I've drawn up most of the plans but am having a hard time figuring out a way to handle the auditing system.
Since it is being used internally only and you won't even be able to touch th... |
|sql-server|sql|access|triggers| |
|sql|sql-server|ms-access|triggers| |
How to filter by 2 fields when loading data into an access database table from an excel spreadsheet |
|vb6|access|databse| |
OK, here is my problem, without being too specific for reasons of being fired for putting company practices on the internet.
There are spreadsheets made. These are uploaded to the database. I need to filter out duplicates from uploading. The only way to do this is by making sure that for each and every entry that tw... |
Use backticks to substitute the result of a command:
ls > `pwd`.txt
As pointed out by [Landon][1], `$(cmd)` is equivalent:
ls > $(pwd).txt
Note that the unprocessed substitution of `pwd` is an absolute path, so the above command creates a file with the same name in the same directory as the working ... |
Use backticks to substitute the result of a command:
ls > "`pwd`.txt"
As pointed out by [Landon][1], `$(cmd)` is equivalent:
ls > "$(pwd).txt"
Note that the unprocessed substitution of `pwd` is an absolute path, so the above command creates a file with the same name in the same directory as the work... |
Use backticks to substitute the result of a command:
ls > "`pwd`.txt"
As pointed out by [Landon][1], `$(cmd)` is equivalent:
ls > "$(pwd).txt"
Note that the unprocessed substitution of `pwd` is an absolute path, so the above command creates a file with the same name in the same directory as the work... |
I think the pro LINQ argument seems to be coming from people who don't have a history with database development (in general).
Especially if using a product like VS DB Pro or Team Suite, many of the arguments made here do not apply, for instance:
Harder to maintain and Test:
VS provides full syntax checking, styl... |
`core.exceptions` is part of django; what version of django do you have installed? The AppEngine comes with the appropriate version for whatever release you've downloaded (in the lib/django directory). It can be installed by going to that directory and running **`python setup.py install`** |
As far as windows goes, the entry point functions are:
- Console: void __cdecl mainCRTStartup( void ) {}
- GUI: void __stdcall WinMainCRTStartup( void ) {}
- DLL: BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL,DWORD fdwReason,void* lpReserved) {}
The only reason to use these over the normal main/Win... |
As far as windows goes, the entry point functions are:
- Console: <code>void __cdecl mainCRTStartup( void ) {}</code>
- GUI: <code>void __stdcall WinMainCRTStartup( void ) {}</code>
- DLL: <code>BOOL __stdcall _DllMainCRTStartup(HINSTANCE hinstDLL,DWORD fdwReason,void* lpReserved) {}</code>
The only reaso... |
Firewall - Build or Buy |
|firewall| |
I have a Linux web server farm with about 5 web servers, web traffic is about 20Mbps.
We currently have a Barracuda 340 Load Balancer (keep away from this device - piece of crap!) that is acting as a firewall. I want to put in a dedicated firewall and I'd like to know what peoples opinions are on building versus buy... |
I have a Linux web server farm with about 5 web servers, web traffic is about 20Mbps.
We currently have a Barracuda 340 Load Balancer (keep away from this device - piece of crap!) that is acting as a firewall. I want to put in a dedicated firewall and I'd like to know what peoples opinions are on building versus buy... |
Graph searching algorithm |
|graph|algorithm| |
I'm looking for a graph algorithm with some unusual properties.
Each edge in the graph is either an "up" edge or a "down" edge.
A valid path can go an indefinite number of "up"'s followed by an indefinite number of "down"'s, or vice versa. However it cannot change direction more than once.
E.g., a valid path m... |
|algorithm|graph| |
|algorithm|graph|graph-theory| |
C# graph traversal - tracking path between any two nodes |
|c#|graph|traversal|bf| |
Looking for a good approach to keep track of a Breadth-First traversal between two nodes, without knowing anything about the graph. Versus Depth-First (where you can throw away the path if it doesn't pan out) you may have quite a few "open" possibilities during the traversal. |
|c#|graph|bf|traversal| |
|c#|graph|graph-theory|bf|traversal| |
CSS / JavaScript Navigation Menu on top of Flash in Firefox |
|flash|dynamic-css| |
My site has a drop-down menu built in CSS and JavaScript that drops down over a Flash animation. In IE (6&7) the drop-down menus drop over the Flash animation, however, in Firefox (2&3) the menus appear underneath the Flash animation. Is there any way to get this dynamic menu to flow OVER the Flash in Firefox?
In ... |
Well, 100% managed could be going the hard route, however, you can use the [Office PIAs](http://www.microsoft.com/downloads/details.aspx?familyid=59DAEBAA-BED4-4282-A28C-B864D8BFA513) from your .NET code. Joel Spolsky has [an article](http://www.joelonsoftware.com/items/2008/02/19.html) discussing your various options. |
If you know JAVA, and have somewhere you can host it (like a tomcat or glassfish container) I would recommend that much more than using Ruby for the back end. The main reason is that then you can share all of your objects, and use the built in RPC mechanism. I've done this for quite a lot of our projects and it's a hug... |
NAnt and dual platform build - best way to build on Windows AND Mono/Linux |
|.net|linux|build-process|mono|nant| |
I'm new to NAnt but have some experience with Ant and CruiseControl.
What I want to do is have my SVN project include all tools needed (like NUnit and Mocks etc) so I can check out onto a fresh machine and build. This strategy is outlined by J.P Boodhoo [here.][1]
So far so good if I only want to run on Windows, ... |
Depends on your definition of safe I suppose. A lot of the security depends on what you pass in and what you are allowed to pass in the context. For instance, if a file is passed in, I can open arbitrary files:
>>> names['f'] = open('foo', 'w+')
>>> safeeval.safeeval("baz = type(f)('baz', 'w+')", names)
... |
I use soapUI, and it's generally pretty good. Be aware that it seems to leak memory, and eventually it will no longer save your project, so save regularly!
This is about the only hassle I have with it (other than the general ugliness that almost every Java application has!), and I can't live without it. |
In C#, isn't the observer pattern already implemented using Events? |
|c#|design-patterns| |
After reading the Head First Design Patterns book and using a number of other design patterns, I'm trying to understand the Observer pattern. Isn't this already implemented using Events in the .NET Framework? |
Another alternative approach you may want to consider could be to have a folder that contains symlinks to each of your projects or frequently-used directories. So you can do something like
<pre>
cd \go\svn-project-1
cd \go\my-douments
</pre>
Symlinks can be made on a NTFS disk using the [Junction][1] tool
... |
Yes, it is. The observer pattern is also called the publish/subscribe pattern, which is exactly what events allow you to do. |
That's right, events are an implementation of the observer pattern. I have read discussions , though, of people who still write their own, to give them either more flexibility, or maybe just to avoid the event-raising syntax.
|
You need to scale sideways and out. Maybe something like a [message queue][1] could be the backend between the frontend and the crunching.
[1]: http://en.wikipedia.org/wiki/Java_Message_Service |
I really don't think so, unless there's some funky reflection that can pull it off. The property decorations are set at compile time and to my knowledge are fixed |
Is it possible to do the Navision 5.0 export to Word/Excel to OpenOffice.org? |
|export|5.0|navision|openoffice.org| |
Navision 5.0 includes a feature to export to Word or Excel. Is it possible to make this work with OpenOffice.org Writer or Calc instead? If so, what has to be done to set it up? |
Navision 5.0 includes a feature to export to Word or Excel. Is it possible to make this work with OpenOffice.org Writer or Calc instead? If so, what has to be done to set it up?
I have been told by my Navision reseller that the feature works best with Office 2007, and export to Excel 2003 works. No mention of Off... |
|export|openoffice.org|navision| |
A good compromise between effort/rework and the convenience of single sign on is to continue to maintain a list of users, privileges, roles etc in the legacy app. Make the changes necessary to automatically log the user into your application based on their user account (usually their Windows or network account).
I'... |
Change Attribute's parameter at runtime |
|c#| |
I am not sure whether is it possible to change attribute's parameter during runtime? For example, inside an assembly I have the following class
public class UserInfo
{
[Category("change me!")]
public int Age
{
get;
set;
}
[Cate... |
|c#|reflection|attributes| |
To see all the tables you have access to
select table_name from all_tables where owner='<SCHEMA>';
To select all tables for the current logged in schema (eg, your tables)
select table_name from user_tables;
|
Just remember that whenever you are writing a static method, you are writing an inflexible method that cannot have it's behavior modified very easily.
You are writing procedural code, so if it makes sense to be procedural, then do it. If not, it should probably be an instance method.
This idea is taken from [an ... |
If you are a beginner, vimtutor would be a good way to start with. (Type vimtutor on your shell and get going).
And once you get hold of the basics of vim, you can look around web and figure out things for yourself.
[This](http://mamchenkov.net/wordpress/2008/05/06/moved-to-gvim/) and [this](http://mamchenkov.net... |
How do you access browser history? |
|browser|history| |
<a href="http://www.semanticator.com/">Semanticator</a> is an e-Marketing tool that chooses which web page to display based on where you were before. That is, if you've been browsing truck sites and then go to Ford.com, your first page would be of the Ford Explorer.
I know you can get the immediate preceding page wi... |
<a href="http://www.semanticator.com/">Semanticator</a> is an e-Marketing tool that claims to choose which web page to display based on where you were before. That is, if you've been browsing truck sites and then go to Ford.com, your first page would be of the Ford Explorer.
I know you can get the immediate precedin... |
Javascript this should get you started: http://www.dicabrio.com/javascript/steal-history.php<br />
There are more nefarius means to: http://ha.ckers.org/blog/20070228/steal-browser-history-without-javascript/ |
Javascript this should get you started: http://www.dicabrio.com/javascript/steal-history.php<br />
There are more nefarius means to: http://ha.ckers.org/blog/20070228/steal-browser-history-without-javascript/ <br />
Edit:I wanted to add that although this works it is a sleazy marketing teqnique and an invasion of pri... |
[Working Effectively with Legacy Code][1] focuses on dealing with existing code-bases that need to evolve to be testable. Many techniques are used in the book to accomplish this, and is an excellent resource for refactoring.
[1]: http://www.amazon.com/Working-Effectively-Legacy-Robert-Martin/dp/0131177052/ref=p... |
The ViewData Model property should only be used for the content that you're viewing/editing on the main section of the UI.
Other parts of the view may need some data present in ViewData, so just add those to the dictionary.
I'd just pass data from the dictionary like this: ViewData["articles"] to the partial. (... |
I have always recreated my dynamic controls in the LoadViewState event. You can store the number of controls needed to be created in the viewstate and then dynamically create that many of them using the LoadControl method inside the LoadViewState event. In this event you have access to the ViewState but it has not be... |
You also may want to go with a web server like [nginx][1]. It can load balance your app against multiple ports of the same app, and is commonly used to load balance Ruby on Rails apps (which are single threaded). The downside is that you need to run multiple copies of your app (one on each port) for this load balancing... |
It seems that the problem was one of sloppiness. Someone had forgotten to delete the auto-generated Content-controls that Visual Studio throws in on all content pages where the master page has a ContentPlaceHolder-control.
If a content page has a Content-control, all controls that are placed in the ContentPlaceHolde... |
This is a strange bug in the VS2005 dependency behavior. To find out one suggestion would be to take the following steps:
1. Go to **Tools** **-> Options ->
Projects and Solutions -> Build and
Run -> MSBuild Project Build output
Verbosity** and select **Detailed**
2. Compile your projec... |
This "[No Shit Guide To Supporting OpenID In Your Applications](http://www.danwebb.net/2007/2/27/the-no-shit-guide-to-supporting-openid-in-your-applications)"
seems to be a step-by-step tutorial for what you want to do. |
You definitly have to declare what to insert. This should be possible by using the [INSERT ... SELECT][1] statement.
INSERT INTO log (date, count)
SELECT DATE() as date, count(id) as count
from foo;
Which should insert a new row into the log table, containing todays date and the number of ... |
The IDisposable pattern was created primarily to be called by the developer, if you have an object that implements IDispose the developer should either implement the `using` keyword around the context of the object or call the Dispose method directly.
The fail safe for the pattern is to implement the finalizer calli... |
Good python library for generating audio files? |
|python|audio|mp3| |
|vb6|access|database| |
|database|ms-access|vb6| |
Remove Quotes and Commas from a String in MySQL |
|msyql|regex|string| |
I'm importing some data from CSV file, and numbers that are larger get turned into "1,100". What's a good way to remove both the quotes and the comma from this so I can put it into an int field? |
|regex|string|msyql| |
I'm importing some data from a CSV file, and numbers that are larger 1000 get turned into "1,100" etc. What's a good way to remove both the quotes and the comma from this so I can put it into an int field?
Edit: The data is actually already in a MySQL table, so I need to be able to this using SQL. Sorry for the mixu... |
|mysql|regex|string| |
I think this approach is cleaner than any of the above. Here's switch.js:
function slide_for_switch(sw) {
slide_id = $(sw).attr('id').substring('switch'.length);
return $('#slide' + slide_id);
}
$(document).ready(function() {
$('#switches li').each(function() {
... |
Here's switch.js (**EDIT**: removed prior version that required explicit IDs to map switches to slides):
$(document).ready(function() {
switches = $('#switches > li');
slides = $('#slides > div');
switches.each(function(idx) {
this.slide = slides[idx];
}).... |
I believe the bottom line argument against continue is that it makes it harder to PROVE that the code is correct. This is prove in the mathematical sense. But it probably doesn't matter to you because no one has the resources to 'prove' a computer program that is significantly complex.
Enter the static-analysis too... |
I have solved a similar problem to this recently, instead of all solutions I was only interested in the shortest.
I used a 'breadth first' iterative search which used a queue of status' each of which held a record containing a current point on the graph and the path taken to get there.
you start with a single rec... |
Believe it or not, you can actually use [java.awt.Robot](http://java.sun.com/javase/6/docs/api/java/awt/Robot.html#createScreenCapture(java.awt.Rectangle)) to "create an image containing pixels read from the screen." You can then write that image to a file on disk.
I just tried it, and the whole thing ends u... |
By default, SQL Server 2005 installation will create a security group called SQLServer2005MSSQLUser$ComputerName$MSSQLSERVER with the correct rights. You just need to create a domain user or local user and make it a member of that group.
More details are available in the SQL Server Books Online: [Reviewing Windows ... |
How do I get the coordinates of a mouse click on a canvas element? |
|javascript|canvas| |
What's the simplest way to add a click event handler to a canvas element that will return the x and y coordinates of the click (relative to the canvas element)?
No legacy browser compatibility required, Safari, Opera and Firefox will do. |
What's the simplest way to add a click event handler to a canvas element that will return the x and y coordinates of the click (relative to the canvas element)?
No legacy browser compatibility required, Safari, Opera and Firefox will do.
**Update**: Thans @Brian, the following is working (in Opera and FF3 at leas... |
Multiple identity storage per application?
Might not be a single sign on solution, but have you try looking into something that is more targetted solution like MS Identity Lifecycle Manager? It will simplify identity synchronization between applications and it's pluggable as well, meaning you can hook up your own cod... |