instruction stringlengths 0 30k ⌀ |
|---|
|vba|vb6|sqlite| |
Has anybody attempted to pass a VBA (or VB6) function (via AddressOf ?) to the SQLite create a UDF function (http://www.sqlite.org/c3ref/create_function.html).
How would the resulting callback arguments be handled by VBA?
The function to be called would have the following signature...
void (*xFunc)(sqlite3_c... |
[Here's an article][1] that compares kBPM, OpenWFE, and Enhydra Shark that looks like it has some good, thorough info.
[1]: http://eprints.qut.edu.au/archive/00014320/ |
For prettier buttons, etc., if you aren't already doing it, [embed an application manifest][1] so that your program is linked to version 6 of the common controls library. Doing so will get you the Windows XP- or Vista-styled versions of the standard Windows controls.
If you want types of controls beyond what Window... |
"[Extension methods in JavaScript][1]" via the prototype property.
>`Array.prototype.contains = function(value) {
for (var i = 0; i < this.length; i++) {
if (this[i] == value) return true;
}
return false;
}`
This will add a `contains` method to all `Array` objects.
[1]: htt... |
"[Extension methods in JavaScript][1]" via the prototype property.
Array.prototype.contains = function(value) {
for (var i = 0; i < this.length; i++) {
if (this[i] == value) return true;
}
return false;
}
This will add a `contains` method to all `Array` o... |
Not really an answer, but it may be interesting to know that one of the reasons svn is so I/O-heavy is the fact that it stores one extra copy of each file in the .svn/text-base directory. This makes local diff operations fast, but eats lot's of harddisk space and I/O.
http://subversion.tigris.org/issues/show_bug.cgi... |
Convert a .doc or .pdf to an image and display a thumbnail in Ruby? |
|ruby|pdf|doc| |
Does anyone know how to generate document thumbnails in Ruby (or C, python...) |
\>>> l=['a', 1, 'b', 2]
\>>>print str(l)[1:-1]
"'a', 1, 'b', 2"
|
You're definitely between a rock and a hard place with legacy code with large dependencies. You've got a long hard slog ahead to sort it all out.
From what you say, it seems you are trying to keep the source code intact for each module in turn, placing it in a test harness with external dependencies mocked out. My... |
I like to construct commands with **echo** and pipe them to the shell:
$ find dir -name \*~ | xargs echo rm
...
$ find dir -name \*~ | xargs echo rm | ksh -s
Why? Because it allows me to look at what's going to be done before I do it. That way if I have a horrible error (like removing my home dire... |
How do you configure the Apache server which ships Mac OS X? |
|macos|apache| |
Mac OS X ships with apache pre-installed, but the files are in non-standard locations. This question is a place to collect information about where configuration files live, and how to tweak the apache installation to do things like serve php pages. |
Could you give a little more clarification as to what exactly it is you're asking?
I have a slight idea, and if my idea is right then this answer should suffice as my answer. I believe you're talking about this from the perspective of someone who's creating a language, in which case you can look at a language like A... |
For a more complete reference, see the [Wikipedia *printf* article, section "printf format placeholders"][1] and [a good example on the same page][2].
[1]: http://en.wikipedia.org/wiki/Printf#printf_format_placeholders
[2]: http://en.wikipedia.org/wiki/Printf#1970s:_C.2C_Lisp |
I assume that the .Net-way of processing XML builds on ´som version of MSXML and it that case I assume that using for example minidom would make you feel somewhat at home. However, if it is simple processing you are doing any library will probably do.
Me too prefers working with ElementTree when dealing with xml in... |
I just used a standard editor (vim which then gave me syntax highlighting).
/Allan |
Take care - the output of sprintf will vary via C locale. This may or may not be what you want. See LC_NUMERIC in the locale docs/man pages. |
I assume you are regression-testing a web application?
There are some tools in this [kb article from Microsoft][1]
And if I remember correctly, certain editions of Visual Studio also offer its own flavor of regression testing tools as well.
But if you just want a unit testing framework, the xUnit family does i... |
Look at the permissions in the [Andrew File System][1]. It allows users to create and administer groups of their own, while selectively assigning admin rights and ACLs. You might find that many of the pesky details are already worked out for you in their model.
**Edit:** here's a better link to AFS documentation:
... |
[Asido][1] works great with [some modifications][2] ;)
It supports most features that I need (resizing, framing, watermark), has drivers for both Imagemagick and GD, nice simple API, and organized codebase.
[1]: http://asido.info
[2]: http://singletonio.blogspot.com/2008/09/asido-php-thumbnailer-resizer-clas... |
[Asido][1] works great with [some modifications][2] ;)
It supports most features that I need (resizing, framing, watermark), has drivers for both GD and Imagemagick, nice simple API, and organized codebase.
[1]: http://asido.info
[2]: http://singletonio.blogspot.com/2008/09/asido-php-thumbnailer-resizer-clas... |
[Asido][1] works great with [some modifications][2] ;)
It supports most features that I need (resizing, framing), has drivers for both GD and Imagemagick, nice simple API, and organized codebase.
[1]: http://asido.info
[2]: http://singletonio.blogspot.com/2008/09/asido-php-thumbnailer-resizer-class.html |
The open-source ETL tool Talend (http://wwww.talend.com) will generate Java or Perl code and package such code with the necessary 3rd party libraries.
Talend should be able to handle all versions of Excel and output the result set in any format you require (including loading it directly into a database if need be)... |
WPF UserControl Design Time Size |
|wpf| |
When creating a UserControl in WPF, I find it convenient to give it some arbitrary Height and Width values so that I can view my changes in the Visual Studio designer. When I run the control, however, I want the Height and Width to be undefined, so that the control will expand to fill whatever container I place it in. ... |
I am wondering what directory structure are commonly used in development projects. I mean with the idea of facilitating builds, deploys release, and etc.
I recently used a [Maven structure][1] for a java project, but I am not sure it's the best structure for a non-maven driven project.
So, I have two questions: ... |
|directory-structure| |
I am wondering what directory structure are commonly used in development projects. I mean with the idea of facilitating builds, deploys release, and etc.
I recently used a [Maven structure][1] for a java project, but I am not sure it's the best structure for a non-maven driven project.
So, I have two questions: ... |
I think something like this is intergral for PHP to move forward. Being mainly a .Net programmer, I find PHP painful to work in with it's 1 million and 1 global functions. It's nice that PHP 6 will have namespaces, but it doesn't help things much when their own libraries aren't even object oriented, let alone employ ... |
Java profiler for IBM JVM 1.4.2 (WebSphere 6.0.2) |
|java|websphere|profiler| |
I'm looking for a Java profiler that works well with the JVM coming with WebSphere 6.0.2 (IBM JVM 1.4.2). I use yourkit for my usual profiling needs, but it specifically refuses to work with this old jvm (I'm sure the authors had their reasons...).
Can anybody point to a decent profiler that can do the job? Not inte... |
I'm not sure this will help with the PDO drivers specifically, but you might look into [BitNami's MAPPStack][1].
I had a ton of trouble with Postgres, PHP, and Apache on my Mac, some of it having to do with 64- vs 32-bit versions of some or all of them. So far, the BitNami MAPPStack install is working nicely in gen... |
If you are using a filesystem that supports copy-on-write snapshots, you could set up the database to the state that you want. Then shut down everything and take a filesystem snapshot. Then go about your testing and when you're ready to start over you could roll back the snapshot. This might be simpler than other op... |
A git-clone is supposed to copy the entire repository. Try cloning it, and then run "git-branch" with no arguments. It should list all the branches. If then you want to switch to branch "foo" instead of "master, use "git-checkout foo". |
I need an algorithm for deciding whether a passed in amount can be built additively from a set of numbers. |
|algorithm| |
I need a **non recursive** algorithm for deciding whether a passed in amount can be built additively from a set of numbers. In my case I'm determining whether a certain currency amount (such as $40) can be met by adding up some combination of a set of bills (such as $5, $10 and $20 bills). That is a simple example, b... |
|algorithm|homework| |
|algorithm|homework|send-me-teh-codez| |
|algorithm|homework|puzzle| |
What is a good non-recursive algorithm for deciding whether a passed in amount can be built additively from a set of numbers? |
|algorithm|puzzle| |
What is a **non recursive** algorithm for deciding whether a passed in amount can be built additively from a set of numbers. In my case I'm determining whether a certain currency amount (such as $40) can be met by adding up some combination of a set of bills (such as $5, $10 and $20 bills). That is a simple example, ... |
|algorithm|homework|puzzle| |
An HTTPS, or Secure Sockets Layer (SSL) certificate is served for a site, and is typically signed by a Certificate Authority (CA), which is effectively a trusted 3rd party that verifies some basic details about your site, and certifies it for use in browsers. If your browser trusts the CA, then it trusts any certificat... |
Do you mean load or import?
You can manipulate the sys.path list specify the path to your module, then import your module. For example, given a module at:
/foo/bar.py
You could do:
import sys
sys.path[0:0] = '/foo' # puts the /foo directory at the start of your path
import foo
|
Recursive function for an xml file (hierarchial data). |
|xml|recursion| |
I want to recursively traverse an XML file, and need a little help with the C# code.
My XML file looks like:
<pre>
@categories@
@category id="1"@
@/category@
@category id="2"@
@category id="3"@ @/category@
@category id="4"@ @category id="5"# #/category# #/category#
@/category@
@/cate... |
I want to recursively traverse an XML file, and need a little help with the C# code.
My XML file looks like:
<pre>
<categories>
<category id="1">
</category>
<category id="2">
<category id="3">
</category>
<category id="4">
... |
How do you prevent SQL injection in LAMP applications? |
|php|sql|mysql|lamp| |
Here are a few possibilities to get the conversation started:
1. Escape all input upon initialization.
2. Escape each value, preferably when generating the SQL.
The first solution is suboptimal, because you then need to unescape each value if you want to use it in anything other than SQL, like outputting it on a... |
From your example above, I would attack it like this (I speak in general terms because I do not know C#):
Break it apart by **LIKE '...'**, put the **...** pieces into an array.
Replace unescaped **%** signs by **.***, underscores by ., and in this case the **[C-P]arsen** translates directly into regex.
Join the... |
Best way in asp.net to force https for an entire site? |
|c#|asp.net|vb.net|webforms|https| |
About 6 months ago I rolled out a site where every request needed to be over https. The only way at the time I could find to ensure that every request to a page was over https was to check it in the page load event. If the request was not over http I would response.redirect("https://mysite.com")
Is there a better ... |
Here's your free psychological analysis:
What you have here is a deep-rooted desire to fix your legacy code so that it's not legacy anymore. When you hide it away, you're just repressing that desire, trying to avoid it because it's an uncomfortable feeling. If you leave it out in the open, one of two things will h... |
Interestingly, you can also use the using/IDisposable pattern for other interesting things (such as the other point of the way that Rhino Mocks uses it). Basically, you can take advantage of the fact that the compiler will **always** call .Dispose on the "used" object. If you have something that needs to happen after... |
The object-oriented approach would be a set of rules. Assign a weight to each rule and iterate through them. In psuedo-code:
abstract class Rule {
float weight;
float calculateScore( string password );
}
Calculating the total score:
float getPasswordStrength( string passw... |
Best way to convert pdf files to tiff files |
|pdf|image|tiff| |
I have around 1000 pdf filesand I need to convert them to 300 dpi tiff files. What is the best way to do this? If there is an SDK or something or a tool that can be scripted that would be ideal. |
The first letter of AJAX stands for "asynchronous". This means that the AJAX call is performed in the background, i.e. the AJAX request call *immediately returns*. This means that the code immediately after it is normally actually executed *before* the onSuccess handler gets called (and before the AJAX request has even... |
The first letter of AJAX stands for "asynchronous". This means that the AJAX call is performed in the background, i.e. the AJAX request call *immediately returns*. This means that the code immediately after it is normally actually executed *before* the onSuccess handler gets called (and before the AJAX request has even... |
I know in Java they're actually thinking about making this standard behaviour for void methods. If you do that you don't need the extra syntactic sugar.
The only downside I can think of is performance. But that's easilly measured. I'll get back to you with the results in a few minutes :-)
Edit:
Returning a ref... |
Find Missing Javascript Includes in Website |
|javascript|include| |
Say I have several JavaScript includes in a page:
<script type="text/javascript" src="/js/script0.js"></script>
<script type="text/javascript" src="/js/script1.js"></script>
<script type="text/javascript" src="/js/script2.js"></script>
<script type="text/javascript" src="/js/script3.js"></script>
<script ty... |
In my opinion, you should ship with what your app needs. Otherwise you are making your install longer for no reason and as you noted using your customer's HD space again essentially for no reason. |
I appreciate the new language features in .NET 3.5 but until you're making use of them I would avoid upgrading to the latest runtime as it is a larger file / install that your users may have to deal with. |
Finding missing emails in SQL Server |
|sql|join|anti-join| |
I am trying to do something I've done a million times and it's not working, can anyone tell me why?
I have a table for people who sent in resumes, and it has their email address in it...
I want to find out if any of these people have NOT signed up on the web site. The aspnet_Membership table has all the people wh... |
If you get the [Firebug][1] firefox plugin and enable the consoles it should tell you when there are errors retrieving resources in the console.
[1]: https://addons.mozilla.org/en-US/firefox/addon/1843 "Firebug" |
I don't use other browsers enough to know where to find a similar feature in them, but Safari has an *Activity* window that displays all of the included files for a given web page and which ones were unable to be retrieved. |
How about a custom FxCop rule that flags undesirable usage of MyClass<>? |
In my own experience, it is always better to store files as files. The reason is that the filesystem is optimised for file storeage, whereas a database is not. Of course, there are some exceptions (e.g. the much heralded next-gen MS filesystem is supposed to be built on top of SQL server), but in general that's my ru... |
Primitives appear to be specified in the TypeCode enumeration:
[http://msdn.microsoft.com/en-us/library/system.typecode.aspx][1]
Perhaps there is a way to find out if an object contains the TypeCode enum without having to cast it to an specific object or call GetType() or typeof()?
**Update** It was right unde... |
If you have to ask yourself if you should learn lisp, you probably don't need to. |
public class MyClass<GenericType> where GenericType: BaseType |
Seems like the where clause needs a class or interface.
You need an ugly switch..
(And yeah, I answered this one way too fast..) |
public class Class1<GenericType> where GenericType : struct
{
}
This one seemed to do the job.. |
Have a look at this thread:
[http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay#3756][1]
Essentially, the space and performance hit can be quite big, depending on the number of users. Also, keep in mind that Web Servers are cheap and you can easily add more to balance the load, whereas the da... |
What's the question here?
Modern DBMS SQL2008 have a variety of ways of dealing with BLOBs which aren't just sticking in them in a table. There are pros and cons, of course, and you might need to think about it a little deeper.
This is an interesting paper, by the late (?) Jim Gray
http://research.microsoft.c... |
This should do the trick - a quickie module that uses the [hook_nodeapi][1] to insert the JS/CSS when the node is viewed.
function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
// the node ID of the node you want to modify
$node_to_modify = 6;
// do it!
if($op == 'vi... |
This should do the trick - a quickie module that uses the [hook_nodeapi][1] to insert the JS/CSS when the node is viewed.
function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
// the node ID of the node you want to modify
$node_to_modify = 6;
// do it!
if($op == 'vi... |
Take a look at this PECL package: [PDO_PGSQL][1]
I haven't tried it myself, but I've been interested in playing with Postgres as an alternative to MySQL. If I have a chance to try it soon, I'll throw my results up here in case it helps.
[1]: http://pecl.php.net/package/PDO_PGSQL |
In GCC, there's more to it than that. In the instruction, you have to tell the compiler what changed, so that its optimizer doesn't screw up. I'm no expert, but sometimes it looks something like this:
asm ("lock; xaddl %0,%2" : "=r" (result) : "0" (1), "m" (*atom) : "memory");
|
In GCC, there's more to it than that. In the instruction, you have to tell the compiler what changed, so that its optimizer doesn't screw up. I'm no expert, but sometimes it looks something like this:
asm ("lock; xaddl %0,%2" : "=r" (result) : "0" (1), "m" (*atom) : "memory");
It's a good idea to write ... |
ASP.NET MVC ViewData (using indices) Question |
|asp.net-mvc| |
I had a working solution using ASP.NET MVC Preview 3 (was upgraded from a Preview 2 solution) that uses an untyped ViewMasterPage like so:
public partial class Home : ViewMasterPage
On Home.Master there is a display statement like this:
<%= ((GenericViewData)ViewData["Generic"]).Skin %>
However, a d... |
I am not sure that I want to see the code for this unit... after all, the error occurs at line 6939 ... Maybe some internal compiler table have been exceeded? |