instruction stringlengths 0 30k ⌀ |
|---|
|opengl|wxwidgets| |
I installed the wxWidgets source code, compiled it and am linking the libraries thus obtained with my application code. Now I need to use OpenGL in my wxWidgets application. How do I enable this? |
I think what you're looking for is something like integration with an automatic build script. I have used [CruiseControl][1] to do a similar thing with an ASP.Net application. I don't know your exact requirements but I'd bet you could get it to do what you want.
[1]: http://cruisecontrol.sourceforge.net/ |
(Assume $(WX_WIDGETS_ROOT) is the root directory of your wxWidgets installation.)
1. Open the file $(WX_WIDGETS_ROOT)\include\wx\msw\setup.h
2. Search and find the option wxUSE_GLCANVAS. Change its value from 0 to 1.
3. Recompile the library. |
I just read your blog post and I think you got a bit of misleading advice, Matt. If there is an *actual* memory *leak* here, then that is a bug in the .NET Framework, and not something you can necessarily fix in your code.
What I think you (and the poster on your blog) are actually talking about here is not actuall... |
Post commit scripts are useful for this. Essentially on every commit a script is called after the event, which you can use to perform an svn export to where-ever.
An interesting [article][1] shows how this might be done, and [this][2] shows how hook scripts can be used with subversion
[1]: http://arstechnica.com/... |
You can probably use the SVN "hooks" to do this. Basically, you can configure your server to run scripts before or after every checkin. Here's the direct link to the relevant section of the [online book][1].
[1]: http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html |
It looks like you want to use the Criteria query API built into Hibernate. To do your above query it would look like this:
List<Stock> stocks = session.createCriteria(Stock.class)
.add(Property.forName("id").eq(id))
.list();
If you don't have access to the Hibernate Session yet, you can us... |
It looks like you want to use the Criteria query API built into Hibernate. To do your above query it would look like this:
List<Stock> stocks = session.createCriteria(Stock.class)
.add(Property.forName("id").eq(id))
.list();
If you don't have access to the Hibernate Session yet, you can us... |
Depends on what's reading it. If it's Word, you'll probably have to serialize to a file, but if it's a function or library that can take an IO.Stream then you could wrap a new MemoryStream around the byte array and pass that. |
I'd write a vbscript (WSH) to scan the directories, then send the filenames to a function that breaks up the filenames into their individual letters, then does a SELECT CASE on the Swedish ones and replaces them with the ones you want. Or, instead of doing that the function could just drop it thru a bunch of REPLACE()... |
You create create your own custom keyboard mapping, which could then be used with the keyboard language menu. So when you plug in your keyboard, just switch to your custom layout. OS X has supported this since 10.2, and Apple has documentation on how to produce your own custom maps.
[http://developer.apple.com/techn... |
Highlight parents in xml string |
|xml|algorithm|text| |
Say I have:
<ul>
<li id="x">
<a href="x">x</a>
</li>
<li id="y">
<a href="y">y</a>
<ul>
<li id="z">
<a href="z">z</a>
</li>
</ul>
</li>
</ul>
I want to add a ... |
How to get the changes on a branch in git |
|git|branch| |
What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is:
git log $(git merge-base HEAD branch)..branch
The documentation for [git-diff](http://www.kernel.org/pub/software/scm/git/docs/git-diff.html) indicates that "git diff A...B" ... |
What are some strategies to write python code that works in python, jython and ironpython |
|python|ironpython|jython| |
Having tries to target two of these environments at the same time I can safely say the if you have to use a database etc. you end up having to write unique code for that environment. Have you got a great way to handle this situation? |
What are some strategies to write python code that works in CPython, Jython and Ironpython |
|python|ironpython|jython|cpython| |
What are some strategies to write python code that works in CPython, Jython and IronPython |
You could use this as a rough "ruleset":
**YES**, use persistent connections, if:
* There are only few applications/users accessing the database, i.e. you will not result in 200 open (but probably idle) connections, because there are 200 different users shared on the same host.
* The database is running on anoth... |
**C** - It's not the shortest, but it's recursion-free. It's also not portable: it crashes on Solaris, but some alloca() implementations might return an error here (or call malloc()). The call to printf() is necessary.
#include <stdio.h>
#include <alloca.h>
#include <sys/resource.h>
int main(int a... |
I would start with WPF and doing very simple control familiarizaton samples. You goal should be to learn XAML and Binding. So if you just create some basic WPF window apps will bootstrap your learning speed. Then eventually you can move to silverlight. Yeah as other mentioned here Silverlight is a subset of WPF. |
System.Xml.XmlConvert.ToTimeSpan("P0DT1H0M0S") |
This will convert from xs:duration to TimeSpan:
System.Xml.XmlConvert.ToTimeSpan("P0DT1H0M0S")
See [http://msdn.microsoft.com/en-us/library/system.xml.xmlconvert.totimespan.aspx][1]
[1]: http://msdn.microsoft.com/en-us/library/system.xml.xmlconvert.totimespan.aspx |
innerHTML manipulation in JavaScript |
|html|javascript|dom| |
I am developing a web page code, which fetches dynamically the content from the server and then places this content to container nodes using something like
container.innerHTML = content;
Sometimes I have to overwrite some previous content in this node. This works fine, until it happens that previous content o... |
|javascript|html|dom| |
I am developing a web page code, which fetches dynamically the content from the server and then places this content to container nodes using something like
container.innerHTML = content;
Sometimes I have to overwrite some previous content in this node. This works fine, until it happens that previous content o... |
(Well got nothing major to add but don't have editing prowess yet so here goes..)
**Perfectly Safe. Nothing illegal with implementing interfaces on structs. However you should question why you'd want to do it.**
However **obtaining an interface reference to a struct will BOX** it. So performance penalty and s... |
How is floating point stored? When does it matter? |
|floating-point|rounding-error| |
In follow up to [this question][1], it appears that some numbers cannot be represented by floating point at all, and instead are approximated.
How are floating point numbers stored?
Is there a common standard for the different sizes?
What kind of gotchas do I need to watch out for if I use floating point?
A... |
We've got on really well with [AQTime][1]. The great thing from our point of view is that it does the unmanaged parts of our code too.
[1]: http://www.automatedqa.com/products/aqtime/ |
Race Condition Analysers for .NET |
|.net|static-analysis|racecondition| |
I've seen there are some race condition analysis tools for C++, C and Java. Anyone know of any static analysis tools that do the same for .NET? |
Right Align text in SQL Server |
|sql-server|t-sql| |
We all know T-SQL's string manipulation capabilities sometimes leaves much to be desired...
I have a numeric field that needs to be output in T-SQL as a right-aligned text column. Example:
Value
----------
143.55
3532.13
1.75
How would you go about that? A good solution ought ... |
In OS X 10.5 they allow you to have different keyboard setups for different keyboards. This works most of the time. I've had issues with very old keyboards that are plugged in via a PS2 to USB but otherwise it works fine. |
Our development team has had success with defining the name of a Web User Control in the database. Upon page load it checks too see what controls to dynamically load from the database.
We use Web User Controls instead of Web Forms in order to ensure we can use the control on any page.
You can also dynamically bu... |
Batch renaming of files with international chars on Windows XP |
|windows|international|filenames|batch-file|rename| |
I have a whole bunch of files with filenames using our lovely Swedish letters **å å** and **ö**.
For various reasons I now need to convert these to an [a-zA-Z] range. Just removing anything outside this range is fairly easy. The thing that's causing me trouble is that I'd like to replace **å** with **a**, **ö** with *... |
@Brian Warshaw
That is a really good point you make about not forgetting the users who navigate via the keyboard (uh, me).
Thanks for bringing our attention to that. |
You want to build a script that uses the post commit hook in SubVersion. You can either have the script export from your repository and then FTP to the server, or you can just checkout from your repository into a working directory on your server and call "svn update" on the servers working directory in your post-commit... |
If you have shell access to your sever, and SVN installed on it (or the ability to install SVN), then your best bet may be just to bypass FTP entirely.
How we deploy our apps is (simplified)
* Developers write code and check it into trunk
* Periodically, when trunk is stable, we will take a snapshot of it as a t... |
It's been a while since I've played with SAP, but I always found the SAP Library to be particularly helpful when I got stuck...
I managed to come up with this one for you:
<http://help.sap.com/saphelp_nw04/helpdata/en/47/aa7a18c80a11d3a6f90000e83dd863/frameset.htm>, specifically:
> _When you add new nodes to th... |
I've always found Visual Studio to be outstanding for code editing. I still think it's pretty much the gold standard for code editing (but I'd love to be proven wrong).
Beyond that, I've used [JCreator](http://www.jcreator.com/) for Java editing. Of course, I've used notepad for basic stuff. I've used a lot of o... |
[Textpad][1]
[1]: http://www.textpad.com/ |
[Textpad][1] is what I would use for random text editing (checking out HTML source, quick hackery, scripts and the like).
For actual Java development it's Eclipse all the way, although people tell me the IDEA is the cat's pyjamas.
[1]: http://www.textpad.com/ |
I second Orion's idea. If you've got shell access to the server, it's actually extremely easy to use Subversion itself as the deployment tool. Just make sure you have some web server rules set up so that you don't accidentally expose the .svn directories. |
gvim. I also use Dreamweaver for web stuff. |
I like to break each condition into descriptive variables.
bool isVar1Valid, isVar2Valid, isVar3Valid, isVar4Valid;
isVar1Valid = ( var1 == true )
isVar2Valid = ( var2 == true )
isVar3Valid = ( var3 == true )
isVar4Valid = ( var4 == true )
if ( isVar1Valid && isVar1Valid && isVar1Valid &... |
Check if your code is including the **windows.h** header file and either your code or other third-party headers have their own **min()**/**max()** definitions. If yes, then prepend your **windows.h** inclusion with a definition of **NOMINMAX** like this:
#define NOMINMAX
#include <windows.h> |
You could use this as a rough "ruleset":
**YES**, use persistent connections, if:
* There are only few applications/users accessing the database, i.e. you will not result in 200 open (but probably idle) connections, because there are 200 different users shared on the same host.
* The database is running on anoth... |
As many above have suggested, a good way is to test them via your public interfaces.
If you do this, it's a good idea to use a code coverage tool (like Emma) to see if your private methods are in fact being executed from your tests. |
In the context of a revision list, A...B is how `git-rev-parse` defines it. git-log takes a revision list. `git-diff` does not take a list of revisions - it takes one or two revisions, and has defined the A...B syntax to mean how it's defined in the `git-diff` manpage. If `git-diff` did not explicitly define A...B, the... |
Actually I think that only handles Http methods and not Form methods. Sorry.
Check out the mvccontrib project at http://www.mvccontrib.org.
In the source code a restful implementation has been added and it is current up to Preview 5. Check out the source code here - [http://mvccontrib.googlecode.com/svn/trunk/src/... |
Check out the mvccontrib project at http://www.mvccontrib.org.
In the source code a restful implementation has been added and it is current up to Preview 5. Check out the source code here - [http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/SimplyRestful][1]
[1]: http://mvccontrib.googlecode.com/svn/tr... |
I'd have to strongly second the answer from [Frank Krueger][1].
Whilst you say you need a regular expression to match an IPv6 address, I'm assuming what you really need is to be able to check if a given string is a valid IPv6 address. There is a subtle but important distinction here.
There is more than one way to... |
c# properties with repeated code |
|c#|properties|attributes| |
I have a class with a bunch of properties that look like this:
public string Name
{
get { return _name; }
set { IsDirty = true; _name = value; }
}
It would be a lot easier if I could rely on C# 3.0 to generate the backing store for these, but is there any way to factor out the IsDi... |
|c#|attributes|properties| |
I have a class with a bunch of properties that look like this:
public string Name
{
get { return _name; }
set { IsDirty = true; _name = value; }
}
It would be a lot easier if I could rely on C# 3.0 to generate the backing store for these, but is there any way to factor out the IsDi... |
I find it hard to understand when people flag this as a problem with Python. I took to it immediately and actually find it's one of my favourite 'features' of the language :)
In other languages I have two jobs:
1. Fix the braces so the computer can parse my code
2. Fix the indentation so I can parse my code.
So... |
I can't find any other built-in way of doing case-insensitive comparison: The [python cook-book recipe][1] uses lower().
However you have to be careful when using lower for comparisons because of the [Turkish I problem][2]. Unfortunately Python's handling for Turkish Is is not good. ı is converted to I, but I is not... |
If you're using Oracle 10g and datapump, you can use the REMAP_TABLESPACE clause. example:
REMAP_TABLESPACE=A_TBLSPACE:NEW_TABLESPACE_GOES_HERE
|
XSLT is not going to work for EDI and CSV. If you want a completely generic transformation engine, you might have to shell out some cash. I have used <a href="http://www.symphonia3.com/">Symphonia</a> for dealing with EDI, and it worked, but it is not free.
The thing is the problem you are describing sounds "enterp... |
IMHO i dont think the client machine would store a timestamp of the last time it communicated with AD. This information is stored in active directory itself (ie. on the DC)
Once a user logs into say a Windows machine the credentials are cached. If that machine is disconnected from the network the credentials will l... |
|windows|batch-file|filenames|international|rename| |
I have a whole bunch of files with filenames using our lovely Swedish letters **å å** and **ö**.
For various reasons I now need to convert these to an [a-zA-Z] range. Just removing anything outside this range is fairly easy. The thing that's causing me trouble is that I'd like to replace **å** with **a**, **ö** with *... |
EasyMock: How do I create a mock of a genericized class without a warning? |
|java|generics|mocking|easymock| |
The code
private SomeClass<Integer> someClass;
someClass = EasyMock.createMock(SomeClass.class);
gives me a warning "Type safety: The expression of type SomeClass needs unchecked conversion to conform to SomeClass<Integer>".
|
What I remember is a 32 bit floating point is stored using 24 bits for a actual number, and the remain 8 bits are used as a power of 10, determining where the decimal point is.
I'm a bit rusty on the subject tho... |
I suggest you parse it into a DOM and recurse backwards like you were thinking. Regular expressions don't work very well for nested structures with arbitrary nesting levels. |
I would use XSLT. You can specify to search for nodes that are ancestors of z . |
Interfaces
--
- Defines the contract between 2 modules. Cannot have any implementation.
- Most languages allow you to implement multiple interfaces
- Modifying an interface is a breaking change. All implementations need to be recompiled/modified.
- All members are public. Implementations have to implement a... |
NMBLookup OS X returning inconsistant results |
|macos|smb|finder| |
We're trying to get SMB volume listings in our OS X application, and have been using NMBLookup, as suggested by Apple, to get listings. However, more often than not, we're not able to get a full listing of available SMB volumes using the tool. We've got a good benchmark in that we can see the full listing the Apple Fin... |
But then just do
ends = '20080201..20080229'.split('..').map{|d| Integer(d)}
ends[0]..ends[1]
anyway I don't recommend eval, for security reasons
|
I started programming in Flash.
_"toy language" meh meh meh._
and before that a tiny amount Logo at school
I have no idea about mindstorms, but I imagine it would be good.
I think that, unless there is a real driving urge to learn, then it could get frustrating with just input and output command line driven... |
Get the App.Config of Another Exe |
|c#| |
I have an exe with an App.Config file. Now I want to create a wrapper dll around the exe in order to consume some of the functionalities.
The question is how can I access the app.config property in the exe from the wrapper dll? |
I have an exe with an App.Config file. Now I want to create a wrapper dll around the exe in order to consume some of the functionalities.
The question is how can I access the app.config property in the exe from the wrapper dll?
Maybe I should be a little bit more in my questions, I have the following app.config c... |
How do I compose existing Linq Expressions |
|c#|linq| |
I want to compose the results of two Linq Expressions. They exist in the form
Expression<Func<T, bool>>
So the two that I want to compose are essentially delegates on a parameter (of type T) that both return a boolean. The result I would like composed would be the logical evaluation of the booleans. I would p... |
Possibly my use of abstract base classes is confusing the matter, though I am adding everything into the known types list. |
This seems to do what you want (i found it on http://huddledmasses.org/powershell-find-path/ )
Function Find-Path($Path, [switch]$All=$false, [Microsoft.PowerShell.Commands.TestPathType]$type="Any")
## You could comment out the function stuff and use it as a script instead, with this line:
# param($Pa... |