instruction
stringlengths
0
30k
How do you get a list of all the installed fonts?
|.net|fonts|
Specifically in .NET, but I'm leaving it open.
I would always keep my vector of spans sorted. That makes implementing algorithms a LOT easier -- and possible to do in linear time. OK, so I'd sort the spans based on: - span minimum in increasing order - then span maximum in decreasing order You need to create a function to do that. Then I'd use std...
If you consider a single line string to be a sequence of [x,y] points (or [x,y,z] points), then you could compute the similarity between each pair of line strings using the [Needleman-Wunsch][1] algorithm. As described in the referenced Wikipedia article, the Needleman-Wunsch algorithm requires a "similarity matrix" wh...
There are several date functions in VBA - check this [site][1] DateSerial(YEAR, MONTH, DAY) [1]: http://www.classanytime.com/mis333k/sjdatetime.html
MSDN: [Enumerating Installed Fonts][1] [1]: http://msdn.microsoft.com/en-us/library/0yf5t4e8(VS.71).aspx
http://msdn.microsoft.com/en-us/library/0yf5t4e8.aspx This should help.
DateSerial(YEAR, MONTH, DAY) would be what you are looking for. `DateSerial(2008, 8, 19)` returns `8/19/2008`
As you may or may not know, the URLs are being re-written with Apache's **mod_rewrite** module. As mentioned here, Wordpress is, in the background, assigning a slug after sanitizing the title or post name. But, to answer your question, what you're describing is Wordpress' "Pretty Permalinks" feature and you can lear...
Here's a nice extension method for HtmlHelper: public static class JavaScriptExtensions { public static string JavaScript(this HtmlHelper html, string source) { TagBuilder tagBuilder = new TagBuilder("script"); tagBuilder.Attributes.Add("type", "text/javascript");...
This sounds like some conversion issue. It may be that a %s conversion never ends or you specify a character which is never input or something like this. I suggest the following: a. Try something like: int a=0; int b=0; scanf("%d", &a); scanf("%d", &b); printf("a=%d, b=%d\n", a, b); If this...
Best way to make events asynchronous in C#
|c#|events|asynchronous|
Events are synchronous in C#. I have this application where my main form starts a thread with a loop in it that listens to a stream. When something comes along on the stream an event is fired from the loop to the main form. If the main form is slow or shows a messagebox or something the loop will be suspended. What...
Since you've tagged ksh & bash I'm going to assume Linux. Most of the problem is that if the user can read the script and locate the method you used to hide / encrypt the file then they will also be able to do the same thing manually. A better way may be do the following: 1. Make your script so it can only be ...
== compares the values of variables for equality, type casting as necessary. === checks if the two variables are of the same type AND have the same value. A full explanation of the differences are available in the [PHP manual](http://au.php.net/manual/en/language.operators.comparison.php). Here's a table I put t...
|desktop|virtualization|system-administration|remote-desktop|vdi|
***Background:*** I'm running a full-time job and a part-time job in the weekends, and both my employers have supplied a laptop for me to work on. Of course I also have my powerful workstation at home to work from, and sometimes when I'm at the office at my weekend job (it's in another city) I'm working from yet anot...
Probably using SetWindowPos you can change it to be placed the top / bottom of the z-order or even as the top-most window. You would need to find the handle to the sidebar using FindWindow or an application like WinSpy. But after that something like. Sets the window on top, but not top most. SetWindowPos(s...
Getting Emacs fill-paragraph to play nice with javadoc-like comments
|emacs|elisp|
I'm writing an Emacs major mode for an APL dialect I use at work. I've gotten basic font locking to work, and after setting comment-start and comment-start-skip, comment/uncomment region and fill paragraph also work. However, comment blocks often contain javadoc style comments and i would like fill-paragraph to ...
Stepping away from frameworks would be a step backwards and I think and hope that this won't happen.
I still believe that XSLT can be useful but it is an ugly language and can lead to an awful unreadable, unmaintainable mess. Partly because XML is not human readable enough to make up a "language" and partly because XSLT is stuck somewhere between being declarative and procedural. Having said that, and I think a comp...
I still believe that XSLT can be useful but it is an ugly language and can lead to an awful unreadable, unmaintainable mess. Partly because XML is not human readable enough to make up a "language" and partly because XSLT is stuck somewhere between being declarative and procedural. Having said that, and I think a comp...
If there is selective pressure to make apps faster, I think that people will become better at writing frameworks that encapsulate functionality without slowing down the system too much. The Boost::Gil framework that handles pixels is a nice template-based system that boils down to many inlined functions - the compil...
I do this all the time. Simply set the width and height values to "auto" where you instantiate your control, and this will override the design-time values for that UserControl. ie: `<loc:UserControl1 Width="auto" Height="auto" />` Another option is to set a combination of MinWidth and MinHeight to a size that al...
Are you trying to find new primes? This may sound stupid, but you might be able to load up some sort of a data structure with known primes. I am sure someone out there has a list. It might be a much easier problem to find existing numbers that calculate new ones. You might also look at Microsofts [Parallel FX Lib...
C# has a few more features than Java. Take delegates for example: Many very simple C# applications use delegates, while the Java folks figures that the observer pattern was sufficient. So, in order for a tool to convert a C# application which uses delegates it would have to translate the structure from using delegate...
|c++|outlook|exchange-server|mapi|
There is a [Microsoft knowledge base article][1] with sample code to open all mailboxes in a given information store. It works so far (requires a bit of [copy & pasting][2] on compilers newer than VC++ 6.0). At one point it calls IExchangeManageStore::GetMailboxTable with the distinguished name of the information st...
If you are a maven user, typically the assembly plugin do what you want.
If you are a maven user, typically the assembly plugin do what you want, or potentially the shade plugin, and in some cases a combination. With the assembly plugin you put a manifest file in your project with any necessary settings, although the defaults are usually quite good. Building is then done with mvn asse...
This is an example that could work for you if what you need is not exactly the path, but a reference to the file working offline. <http://www.ab-d.fr/date/2008-07-12/> It is in french, but the code is javascript :) This are the references the article points to: <http://developer.mozilla.org/en/nsIDOMFile> ...
In Bash, these are bound to ESC-b and ESC-f. Bash has many, many more keyboard shortcuts; have a look at the output of `bind -p` to see what they are.
http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx If you're not using .net 3.5.
Eclipse 3.4 JDT's Runnable JAR export wizard
Safe feature-based way for detecting Google Chrome with Javascript?
|javascript|
As the title states, I'd be interested to find a safe feature-based (that is, without using navigator.appName or navigator.appVersion) way to detect Google Chrome. By feature-based I mean, for example: if(window.ActiveXObject) { // internet explorer! }
|javascript|browser|
You want [DateSerial][1]: Dim someDate As Date = DateSerial(year, month, day) [1]: http://msdn.microsoft.com/en-us/library/bbx05d0c(VS.80).aspx
Also, you might try running the 32-bit version of MMC. IIRC, MMC can only load extensions that are the same bit-ness as itself, and the .Net 2.0 extension is 32-bit only. That said, the tool you linked in your question is very useful for working around this issue as well.
There is [an example on Laurent Schneider's blog][1] of using the DBMS_XA package inside Oracle to permit multiple sessions to work in the same transaction. So it would be possible to have Java and C++ sessions participating in the same transaction without needing any sort of additional coordinator. On the other ...
There is [an example on Laurent Schneider's blog][1] of using the DBMS_XA package inside Oracle to permit multiple sessions to work in the same transaction. So it would be possible to have Java and C++ sessions participating in the same transaction without needing any sort of additional coordinator. Alternately, ...
It's easy to say "Of course". Here's the reason why, though: In real software, you have layer upon layer of components. It's easy to say your tiny little pojos at the bottom of the stack are too small to have real errors, but when you experience unexpected results in the software, and you add up all the code involve...
How do I register a custom URL protocol in Windows?
|windows|url|protocols|
How do I register a custom protocol with Windows so that when clicking a link in an email or on a web page my application is opened and the parameters from the URL are passed to it?
Overhead is not an issue, namespaces have some advantages though - You can reopen a namespace in another header, grouping things more logically while keeping compile dependencies low - You can use namespace aliasing to your advantage (debug/release, platform specific helpers, ....) e.g. I've d...
In UNIX, I always make these scripts setuid and store the user and password info in a file that's heavily protected (the entire directory tree is non-readable/searchable by regular users and the file itself is readable only by the owner of the script).
How to program call divert settings on Windows Mobile?
|windows-mobile|
Does anyone know how to get/set the call divert settings in codes running on Windows mobile 5/6? I am new to windows mobile development and wonder if there is anyway to do it using C# and .NET CF?
Unsure as to whether you want to do this programatically or not. Edit: Ah, I posted that before the Edit. Don't I look like an idiot now! ;) If you just want to merge two files together, IBM have an [XML Diff and Merge Tool][1], and there's also Altova's [DiffDog][2]. [1]: http://www.alphaworks.ibm.com/te...
makefiles CFLAGS
|makefile|
In the process of learning tinyos i have discovered that I am totally clueless about makefiles. there are many optional compile time features that can be used by way of declaring preprocessor variables to use them you have to do things like CFLAGS="-DPACKET_LINK" this enables a certain feature. an...
Going off on a ledge here, but if your up to it Sun's MDB is great, especially if you use lots of templates and threaded code. It beats GDB hands down if that's your situation. On the other hand its not that great if all you need are breakpoints, I'd stick with GDB in that case.
I use the one here as filters to get to the content I am most interested in. I may have a question about something here and want to research the topic more before asking the question. Or I may be knowledgeable in an area and want to look through questions to see if I can help. At work we use something similar to t...
Can't test it right now, but something like: echo "INSERT INTO foo (b,a,r) VALUES (1,2,3);" | mysql -u user -psecret -h host database in a shell script should work. Don't know about getting Data out of it though
You could use an HTTPHandler instead of an HTTPModule. Handlers let you specify a path when you declare them in Web.Config. <add verb="*" path="/validate/*.aspx" type="Handler,Assembly"/> If you must use an HTTPModule, you could just check the path of the request and if it's one to be excluded, bypass the ...
How to display the progress of a server script in jQuery?
|jquery|ajax|
With this code I can show an animated gif while the server script is running: <pre><code>function calculateTotals() { $('#results').load('getResults.php', null, showStatusFinished); showLoadStatus(); } function showLoadStatus() { $('#status').html('<img src="loading.gif"/>'); } function showStatusFin...
With this code I can show an animated gif while the server script is running: <pre><code>function calculateTotals() { $('#results').load('getResults.php', null, showStatusFinished); showLoadStatus(); } function showLoadStatus() { $('#status').html('<img src="loading.gif"/>'); } function showStatusFin...
Classes represent classes loaded by a class loader, which are raw types. To represent a parameterized type, use java.lang.reflect.ParameterizedType.
The single most useful piece of time-management advice I could give is just get on and do it. If something is going to take less than 5 minutes to do, do it now.
If you want to continue with awk, then the mktime and strftime functions are useful: <pre><code> BEGIN { dateinit } { newdate=daysadd(OldDate,DaysToAdd)} # daynum: convert DD-MON-YYYY to day count #----------------------------------------- function daynum(date, d,m,y,i,n) { y=substr(date,8,4...
When creating a RTP via rtpSpawn(), you can specify an environment variable which controls how the heap behaves. There are 3 environment variables: <pre> HEAP_INITIAL_SIZE - How much heap to allocate initially (defaults to 64K) HEAP_MAX_SIZE - Maximum heap to allocate (defaults to no limit) HEAP_INCR_SIZE ...
I believe what you are looking for is InstalledFontCollection. (What were the chances that the ONE piece of code that required .net would be relevant to anything here! It boggles the mind!)
use a regex and see if it matches! ([a-z][A-Z][0-9]\_\-)*
How do I create a new signal in pygtk
|python|gobject|gtk+|
I've created a python object, but I want to send signals on it. I made it inherit from gobject.GObject, but there doesn't seem to be any way to create a new signal on my object.
|python|gobject|gtk|
|python|gtk|pygtk|gobject|
Well it seems like the first bullet point allows for multi-threaded (or single threaded if you screw up) applications to not need to lock the collection for concurrency violations. In .NET for example you cannot enumerate and modify a collection (or list or any IEnumerable) at the same time without locking or inheriti...
In python how to I verify that a string only contains letters, numbers, underscores and dashes?
|python|
I know how to do this if I iterate through all of the characters in the string but I am looking for a more elegant method. Thanks
|python|regex|
|python|regex|string|
A regular expression will do the trick with very little code: import re ... if re.match("^[A-Za-z0-9_-]*$", my_little_string): # do something here
Also, keep in mind that laws vary from country to country, and since most software is distributed anywhere in the world over the web... well, it's a huge headache. It's unfortunate because the threat of lawsuit has a chilling effect on interesting, innovative work.
What is a Privileged instruction?
|debugging|c|winapi|odbc|
I have added some code which compiles cleanly and have just received this Windows error: --------------------------- (MonTel Administrator) 2.12.7: MtAdmin.exe - Application Error --------------------------- The exception Privileged instruction. (0xc0000096) occurred in the application at location 0x00486752....
I may not understand correctly either, but [PEX][1] may be of use to you. [1]: http://www.codeplex.com/Pex
This is the perfect chance to use recursion! Pseudo-code: nodeList = {} enumerateNodes(rootNode, nodeList); function enumerateNodes(node, nodeList) { nodeList += node; foreach ( childnode in node.children ) { enumerateNodes(childnode, nodeList); } }
This is the perfect chance to use recursion! Pseudo-code: nodeList = {} enumerateNodes(rootNode, nodeList); function enumerateNodes(node, nodeList) { nodeList += node; foreach ( childnode in node.children ) { enumerateNodes(childnode, nodeList); } } Edit...
Adjacent list models are very difficult to deal with. The company I am with now uses them for hierarchies and it causes great headaches. I have successfully used Celko's nested set models for prior employers and they work great for creating, maintaining and using hierarchies (trees). I found this link which desc...
Adjacent list models are very difficult to deal with. The company I am with now uses them for hierarchies and it causes great headaches. I have successfully used Celko's nested set models for prior employers and they work great for creating, maintaining and using hierarchies (trees). I found this link which desc...
For me "Memory as a programming concept in C and C++" really opened my eyes to how memory management really works. If you're a C or C++ developer I consider it a must read. You will defiantly learn something or remember things you might have forgotten along the way. http://www.amazon.com/Memory-Programming-Concept...
Frameworks simplify coding as the cost of speed and obfuscation of the OS. With the passing of Moore's law do you thing that there might be a shift away from Frameworks?
|c|winapi|.net|future|
Frameworks simplify coding as the cost of speed and obfuscation of the OS. With the passing of Moore's law do you thing that there might be a shift away from Frameworks? I suspect that one of the reasons for Vista not being an outstanding success was that it ran much slower than XP, and, because computers had not ...
In our application, we receive text files (.txt, .csv, etc.) from diverse sources. When reading these files sometimes contain garbage, because the codepage these files where created in a different/unknown codepage. Is there a way to (automatically) detect the codepage of a text file? (I use .Net / C#). The de...
|c#|.net|text|globalization|