instruction
stringlengths
0
30k
Bash scripts found in the page aren't good solution. It works only on simple project. In fact, in large project, like discribe in header page, C-preprocessor (#if, #else, ...) are often used. Only good software more complex, like [makedepend][1] or [scons][2] can give good informations. gcc -E can help, but, on large p...
a reference is nearly always going to be slower then the thing it's refering to. Think of it this way - let's say you want to print the result of adding 1 + 1. Which makes more sense: alert(1 + 1); or a = 1; b = 1; alert(a + b); I realize that's a really simplistic way to look at it, but i...
I hope this would help. I saw a colleague of mine using this code to send complicated data types and to me this is pretty simple. This was used with basicHttpBinding and it works pretty well with MOSS BDC as well as other applications which use the basic binding. 1. Create a data contract based on a generic class ...
I hope this would help. I saw a colleague of mine using this code to send complicated data types and to me this is pretty simple. This was used with basicHttpBinding and it works pretty well with MOSS BDC as well as other applications which use the basic binding. 1. Create a data contract based on a generic class ...
|c++|windows|events|tablet-pc|stylus|
I am working on a legacy project in VC++/Win32/MFC. Recently it became a requirement that the application work on a **tablet pc**, and this ushered in a host of new issues: > 1. the software keyboard has to use a "toggle" mode for shift and control > keys because the stylus cannot "press" > control and "C" at the...
I am working on a legacy project in VC++/Win32/MFC. Recently it became a requirement that the application work on a **tablet pc**, and this ushered in a host of new issues: > 1. the software keyboard has to use a "toggle" mode for shift and control > keys because the stylus cannot "press" > control and "C" at the...
There's also [mySQLgame][1], I found it pretty amusing (shortly after finding out I suck). [Here's what Casual Gameplay has to say about it.][2] [1]: http://mysqlgame.appspot.com/ [2]: http://jayisgames.com/archives/2008/08/mysqlgame.php
Try: <?php $firstElement = reset(functionThatReturnsAnArray()); If you're just looking for the first element of the array.
Working with USB devices in .NET
|.net|communication|usb|
Using .Net (C#), how can you work with USB devices? How can you detect USB events (connections/disconnections) and how do you communicate with devices (read/write). Is there a native .Net solution to do this?
Right now I'm leaning towards using Spring AOP (using the "@AspectJ" style) to advise the business operations that are exposed to the web layer.
Some generic code that has pretty poor performance O(n^2) str[] = { "Toby", "Tiny", "Tory", "Tily" }; result = null; largestString = str.getLargestString(); // Made up function str.remove(largestString) for (i = 0; i < largestString.length; i++) { hits = 0; foreach (str as val...
If you want to extract the content from the the HTML markup, you should use some type of HTML parser. To that end there are plenty out there and here are two that might suite your needs: [http://jtidy.sourceforge.net/][1]<br /> [http://htmlparser.sourceforge.net/][2] [1]: http://jtidy.sourceforge.net/ [2]...
JNI has a GetStringChars() function as well. The return type is const jchar*, jchar is 16-bit on win32 so in a way that would be compatible with wchar_t. Not sure if it's real UTF-16 or something else...
Try an [Aspect Oriented](http://en.wikipedia.org/wiki/Aspect-oriented_programming) programming framework. From Wikipedia "Aspect-oriented programming (AOP) is a programming paradigm that increases modularity by allowing the separation of cross-cutting concerns".
This MSDN document may be useful to you as you upgrade your application, it contains lists of breaking changes between 1.1 and 2.0: [Breaking Changes in .NET Framework 2.0][1] [1]: http://msdn.microsoft.com/en-us/netframework/aa570326.aspx
This MSDN document may be useful to you as you upgrade your application, it contains lists of breaking changes between 1.1 and 2.0, and work arounds for resolving them: [Breaking Changes in .NET Framework 2.0][1] [1]: http://msdn.microsoft.com/en-us/netframework/aa570326.aspx
I've written something like this in Perl. On Win32 it runs dumpbin /exports, on POSIX it runs nm -gP. Then, since it's Perl, the results are interpreted using regular expressions: / _(\S+)@\d+/ for Win32 (cdecl functions) and /^(\S+) T/ for POSIX.
I often need to find another file in the "current directory", ie. the directory of the file I'm editing. To quickly open this directory in diredit, I use: > C-x C-f C-j
How to retrieve stored procedure return values from a TableAdapter
|asp.net|sql-server|
I cannot find an elegant way to get the return value from a stored procedure when using TableAdapters. It appears the TableAdapter does not support SQL stored procedure return values when using a non-scalar stored procedure call. You'd expect the return value from the auto-generated function would be the return valu...
How to setup access control in SVN?
|svn|tortoisesvn|
I have setup a repository using SVN and uploaded projects. There are multiple users working on these projects. But, not everyone is working on all projects and require access. I want to setup permissioning for each of the projects with users. How to achieve this?
Quoted from [defaultCharset()](http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/Charset.html) > The default charset is determined > during virtual-machine startup and > typically depends upon the locale and > charset of the underlying operating > system. In most OSes you can set the charset using a en...
You need to change the locale before launching the JVM; see: [Java, bug ID 4163515][1] Some places seem to imply you can do this by setting the file.encoding variable when launching the JVM, such as java -Dfile.encoding=UTF-8 ... ...but I haven't tried this myself. The safest way is to set an environme...
> kristof: >> so you do not have data to build you dynamic query. With null parameters my dynamic query was a pure string literal, independent of data. Changing it to a static query solved the problem.
There's a &lt;code&gt; html element you can use. Otherwise you could try the [Textile][1] or [Markdown][2] syntaxes (I'm not sure if WordPress.com uses them). Try it out and use the preview function in WordPress to see when you get it right. [1]: http://hobix.com/textile/ [2]: http://daringfireball.net/projec...
I've got a hackneyed fix for the junk spaces from the image. I added a `:after_update_element => "trimSelectedItem"` to the options hash of the `model_auto_completer` (that's the first hash of the three given). My `trimSelectedItem` then finds the appropriate sub-element and uses the contents of that for the element va...
Create a script move.sh which contains this: #!/bin/sh mv $4 ../newdirectory/ Make it executable and then do this in the folder: ls *.jpg | xargs -n 4 ./move.sh This takes the list of filenames, passes four at a time into move.sh, which then ignores the first three and moves the fourth into a n...
Determine the size of a pipe without calling read()
|c++|c|linux|unix|
I need a function called SizeOfPipe() which should return the size of a pipe- I only want to know how much data is in the pipe and not actually read data off the pipe itself. I thought the following code would work fseek (pPipe, 0 , SEEK_END); *pBytes = ftell (pPipe); rewind (pPipe); but fseek d...
I've used RapidSQL by Embarcadero on several different DB platforms, and it's awesome. It has an integrated step debugger, too. I haven't actually used it with Oracle, but I know it's supported.
Depends on the programming language. FoR C/C++ and anything .net Visual Studio is the way to go. The Express edition is free.
The best response, sadly, depends on what you're trying to accomplish with your soft deletions and the database you are implementing this within. In SQL Server, the best solution would be to use a deleted\_on/deleted\_at column with a type of SMALLDATETIME or DATETIME (depending on the necessary granularity) and to ...
I appreciated knox's and david's answers. My answer will be somewhere between theirs: just make ***forms that do not need to be debugged***! I think that forms should be exclusively used as what they are basically, meaning graphic interface ***only***, meaning here that they do not have to be debugged! The debugging...
I am working on a legacy project in VC++/Win32/MFC. Recently it became a requirement that the application work on a **tablet pc**, and this ushered in a host of new issues. I have been able to work with, and around these issues, **but am left with one wherein I could use some expert suggestions.** I have a particul...
ywPx will do what you describe. ywPxw will also advance the cursor to the next word. -- bmb
If it is on Unix: if (fork()) printf ("Hello"); else printf("World"); Ofcoures that doesn't guarantee the order 0f the prints
Getting actual file name (with proper casing) on Windows
|windows|winapi|
Windows file system is case insensitive. How, given a file/folder name (e.g. "somefile"), I get the *actual* name of that file/folder (e.g. it should return "SomeFile" if Explorer displays it so)? Some ways I know, all of which seem quite backwards: 1. Given the full path, search for each folder on the path (via...
|windows|winapi|c|c++|
Windows file system is case insensitive. How, given a file/folder name (e.g. "somefile"), I get the *actual* name of that file/folder (e.g. it should return "SomeFile" if Explorer displays it so)? Some ways I know, all of which seem quite backwards: 1. Given the full path, search for each folder on the path (via...
|c|winapi|odbc|debugging|
I have added some code which compiles cleanly and have just received this Windows error: <pre> --------------------------- (MonTel Administrator) 2.12.7: MtAdmin.exe - Application Error --------------------------- The exception Privileged instruction. (0xc0000096) occurred in the application at location 0x0048...
It may be possible to define a custom template for the DIP and deploy that to the site, setting the content type to link to that template.
An interesting paper discussing the pro's and con's of using iterators: [http://www.sei.cmu.edu/pacc/CBSE5/Sridhar-cbse5-final.pdf][1] [1]: http://www.sei.cmu.edu/pacc/CBSE5/Sridhar-cbse5-final.pdf
Use a second site, and hotswap as needed.
If there's truly no good time from the users' perspective, then I'd suggest doing it when your team has the most time to recover from any build-related disaster.
This can be done through the use of the HEAP_MAX_SIZE environment variable. If it is set, it limits the ability of the heap to grow beyond that size. It does not, however, limit the initial heap size. [See page 31][1] [1]: http://www.slac.stanford.edu/grp/cd/soft/vxworks/doc/6.6/vxworks_application_api_refere...
Something like this? foreach (ParentType parentType in collectionOfRelatedObjects) { if (!(parentType is ISomethingable)) { } }
What kind of an application is it? Most sites that I use tend to update around 2AM or 3AM.
I think I'm either going to use simple AR finders or [Searchgasm][1]. [1]: http://www.binarylogic.com/2008/9/1/searchgasm-released
I think it is just good OO practice. You can have code that deals with all kinds of iterators, and even gives you the opportunity to create your own data structures or just generic classes that implement the iterator interface. You don't have to worry about what kind of implementation is behind it.
pat = re.compile ('[^\w-]') def onlyallowed(s): return not pat.search (s)
The issue with hot-swapping, is database would still be shared, and breaking changes would bring stand in down as well.
I guess you have to ask your clients. In any case, there's the wee hours of the morning. If you're talking about a locally available website, I do not think users will mind if they get an "under maintenance" notice at 2 am in their time zone.
Frameworks simplify coding at 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?
|.net|c|winapi|future|
Frameworks simplify coding at 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 ...
Frameworks simplify coding at 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 ...
Hope this is helpful: public static TValue ParseEnum<TValue>(string value, TValue defaultValue) where TValue : struct // enum { try { if (String.IsNullOrEmpty(value)) ...
I've written something like this in Perl. On Win32 it runs dumpbin /exports, on POSIX it runs nm -gP. Then, since it's Perl, the results are interpreted using regular expressions: / _(\S+)@\d+/ for Win32 (stdcall functions) and /^(\S+) T/ for POSIX.
I'm not sure how that relates to the spreadsheet conundrum. Do you expect, in the future, to use phones to dial account numbers? To use phone numbers on calculators? Your example of "future requirements preparedness" is not very good... Plus, you use the verb "dial". Sure, I could imagine "dialing" an account number...
I got myself addicted to [uplink][1] a few months ago. It's not really coding based, more hacking. It's still fun and super geeky. [1]: http://www.introversion.co.uk/uplink/
How can you tell if viewstate in an ASP.Net application has been tampered with?
|asp.net|viewstate|
During a discussion about security, a developer on my team asked if there was a way to tell if viewstate has been tampered with. I'm embarrassed to say that I didnt know the answer. I told him I would find out, but thought I would give someone on here a chance to answer first. I know there is some automatic validation,...
EnableViewStateMac page directive
I don't have VS installed on my current machine, but I think the syntax would be: namespace System.Web.Mvc { public static class ViewPageExtensions { public static string GetDefaultPageTitle<T>(this ViewPage<T> v) { return ""; } ...
Best way to open a socket in Python
|python|networking|tcp|
I want to open a TCP client socket in Python. Do I have to go through all the low-level BSD create-socket-handle / connect-socket stuff or is there a simpler one-line way ? What I'm looking for is something similar to fsockopen in PHP.
Note: if you use the zoom funtionality in your browser, a fixed layout squashes the text, whereas a fluid layout allows it to take up the whole screen. Maybe this is just a browser problem, but it's definately an argument in favor of fluid
If you're building a Flex application, you should use Flex's native Effect classes. They're probably already compiled into your app, since the core components use them, and you won't increase your SWF size with duplicate functionality like you would if you used another library. For simple animations, either mx.effects....
|c++|windows|c|winapi|
Windows file system is case insensitive. How, given a file/folder name (e.g. "somefile"), I get the *actual* name of that file/folder (e.g. it should return "SomeFile" if Explorer displays it so)? Some ways I know, all of which seem quite backwards: 1. Given the full path, search for each folder on the path (via...
What is the difference between <C-C> and <C-[> in vim?
|vim|
One of the best tips for using vim that I have learned so far has been that one can press &lt;C-C&gt; (i.e. CTRL+C) or &lt;C-[&gt; (ie. CTRL+[) instead of the ESC(ape) key. However I use a dvorak keyboard so &lt;C-[&gt; is a little out of reach for me as well so I mostly use &lt;C-C&gt;. Now I've read somewhere that th...
What is the difference between `<C-C`> and `<C-[`> in vim?
What is the difference between <C-C> and <C-[> in vim?
Hmmm, I've used different scenarios that depended on what I needed at the time. I believe the BeginInvoke would probably be the easiest to code since you're almost there. Either way you should be using Invoke already, so just changing to BeginInvoke. Using a callback on a separate thread will accomplish the same thi...
[Boost.Fusion](http://www.boost.org/doc/libs/release/libs/fusion/doc/html/index.html) is worth a look. It can 'iterate' over `std::pair`, `boost::tuple`, some other containers and its own tuple types, although I don't think it supports `std::tuple` yet.
Events are just [delegates][1], so use BeginInvoke. (see [Making Asynchronous Method Calls in the .NET Environment][2]) [1]: http://msdn.microsoft.com/en-us/library/system.eventhandler.aspx [2]: http://msdn.microsoft.com/en-us/magazine/cc301332.aspx
Somewhere in the makefile the CFLAG will be used in compilation line like this: `$(CC) $(CFLAGS) $(C_INCLUDES) $<` and eventually in the execution will be translated to : `gcc -DPACKET_LINK -DLOW_POWER -c filename.c -o filename.o` This define will be passed to the source code as it was define in the header...
C++ gdb GUI
|gdb|c++|linux|debugging|
Briefly: Does anyone know of a GUI for gdb that brings it on par or close to the feature set you get in the more recent version of Visual C++? In detail: As someone who has spent a lot of time programming in Windows, one of the larger stumbling blocks I've found whenever I have to code C++ in Linux is that debuggin...
|c++|linux|debugging|gdb|
Briefly: Does anyone know of a GUI for gdb that brings it on par or close to the feature set you get in the more recent version of Visual C++? In detail: As someone who has spent a lot of time programming in Windows, one of the larger stumbling blocks I've found whenever I have to code C++ in Linux is that debuggin...
Have a look at the open source [7Zip](http://www.7-zip.org/) compression format. For your specific needs, you can use it in an "Archive" mode, zero compression but very fast. It provides a powerful SDK, LZMA, from the site: "LZMA is the default and general compression method of 7z format in the 7-Zip program. LZ...
I appreciated knox's and david's answers. My answer will be somewhere between theirs: just make ***forms that do not need to be debugged***! I think that forms should be exclusively used as what they are basically, meaning graphic interface ***only***, meaning here that they do not have to be debugged! The debugging...
You've got a couple of issues here. **Firstly**, the different versions of Oracle you're using is the reason for the table statistics error - I had the same issue when some of our Oracle 10g Databases got upgraded to Release 2, and some were still on Release 1 and I was swapping .DMP files between them. The solut...
There's an entry here from a DataGridView Program Manager [here][1] that should be a good place to start. [1]: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=60290&SiteID=1