instruction
stringlengths
0
30k
It's OS dependent. In OS X, there's a frame in the mach header that contains the start address for the EIP (instruction pointer) register. Once the binary is loaded, the OS launches execution from this address: <pre> cristi:test diciu$ otool -l ./a.out | grep -A 10 LC_UNIXTHREAD cmd LC_UNIXTHREAD cm...
Create a new Running Total Field called, for example "RTotal". In "Field to summarize" select "Value", in "Type of summary" select "sum", under "Evaluate" select "For each record". You can then drag this field into your report to use as the "Total" at the bottom of each page. You cannot use this running total field ...
There's an easier way. Just create shortcuts (called linked files in Visual Studio-ese) in your wrapper.dll project that point to the source files in api.dll. That will compile your source directly into wrapper.dll.
I would disagree with the premise that it's better to return an interface. You want to maximize the usefulness of your code. That means accepting more loosely defined values as arguments (ie: _void MyFunc(IEnumerable<T> myParameter)_ ), and returning more strongly defined values (ie: _List<T> MyFunc()_ ) I stand u...
One possibility I can think of is to store the count in a member variable of the class. This of course assumes that the public <code>doIt</code> method is only called by a single thread. Another option is to refactor the public method to call a private helper method. The private method takes the list as a paramete...
I agree with Hershi's suggestion to use a template as the "base class". From what you're describing, it sounds more like a use for templates rather then subclassing. You could create a template as follows ( have not tried to compile this ): <pre> <code> template &lt;typename T&gt; class Object { public: ...
How to benchmark a SQL Sever Query?
|sql-server|database|benchmarking|
I'd like to know the standard way to benchmark a SQL Sever Query, preferibly I'd like to know about the tools that come with SQL Server rather than 3rd Party tools.
In SQL Server 2005, placement of nullable variable length columns has a space impact - placing nullable variable size columns at the end of the definition can result in less space consumption. SQL Server 2008 adds the "SPARSE" column feature which negates this difference. See [here][1]. [1]: http://zine.ne...
I only have experience with Subversion but I can tell you that the merge screen in TortoiseSVN is horribly complicated. Luckily they include a dry run button so that you can see if you are doing it right. The complication is in the configuration of what you want to merge to where. Once you get that set up for the me...
NHaml is my favorite for its terseness. People either love it or hate it, given that it looks very different from a traditional "HTML with inserted code" template system like ASPX or NVelocity.
NHaml is my favorite for its terseness. People either love it or hate it, given that it looks very different from a traditional "HTML with inserted code" template system like ASPX or NVelocity. **Edit:** @Ben, There are other view engines which compile down (NHaml is one), so those do support custom HTML helpe...
I also recommend ffmpeg, but the command line suggested by John Boker has an unintended side effect: it re-encodes the file to the default bitrate (which is 64 kb/s in the version I have here at least). This might give your customers a false impression of the quality of your sound files, and it also takes longer to do....
How can I get the definition (body) of a trigger in SQL Server?
|sql-server|triggers|metadata|
Unable to find a SQL diff tool that meets my needs, I am writing my own. Between the INFORMATION_SCHEMA and sys tables, I have a mostly-complete working version. But one thing I can't find in the metadata is the <em>definition</em> of a trigger, you know, the actual SQL code. Am I overlooking something? Thanks.
Why not have NCover run NUnit? You get the exact same test results. Also, what exactly are you trying to measure when running NCover outside of the tests? There's other ways to find stale or unreferenced code.
One of the biggest culprits for Visual Studio 2005 slowness is Intellisense. This has been brought up on the MSDN forums again and again and again. What I frequently experience is that Intellisense is working nearly non-stop to "re-index" symbols (or whatever you call it). But developers at Microsoft have not been ...
Avoid the [worst CAPTCHAs of all time][1]. >Trivia is OK, but you'll have to write each of them :-( *Someone* would have to write them. You could do trivia questions in the same way ReCaptcha does printed words. It offers two words, one of which it knows the answer to, another which it doesn't - after enoug...
Avoid the [worst CAPTCHAs of all time][1]. >Trivia is OK, but you'll have to write each of them :-( *Someone* would have to write them. You could do trivia questions in the same way ReCaptcha does printed words. It offers two words, one of which it knows the answer to, another which it doesn't - after enoug...
Using .NET CodeDOM to declare and initialize a field in one statement
|codedom|.net|
I want to use CodeDOM to both declare and initialize my static field in one statement. How can I do this? // for example public static int MyField = 5; I can seem to figure out how to declare a static field, and I can set its value later, but I can't seem to get the above effect.
|.net|codedom|
I want to use CodeDOM to both declare and initialize my static field in one statement. How can I do this? // for example public static int MyField = 5; I can seem to figure out how to declare a static field, and I can set its value later, but I can't seem to get the above effect. @lomaxx, Naw, I jus...
Check out this [older post][1]. I have to agree with that post's #1 answer; it's hard to imagine a scenario where this could be a good design. Can't you write a service, or standalone application, which would talk to a table in your database? Then you could implement whatever you want as a trigger on that table. ...
Here's Gary Waters solution Function ConvertNumberToColumnLetter2(ByVal colNum As Long) As String Dim i As Long, x As Long For i = 6 To 0 Step -1 x = (1 - 26 ^ (i + 1)) / (-25) - 1 ‘ Geometric Series formula If colNum > x Then ConvertNumberToColumnLett...
Coupling - A measure of how much a module (package, class, method) relies on other modules. It is desirable to reduce coupling, or reduce the amount that a given module relies on the other modules of a system. Cohesion - A measure of how closely related the members (classes, methods, functionality within a method) o...
Private access by default seems like a reasonable design choice on the part of the C# language specifiers. A good general design principle is to make all access levels as restrictive as possible, to minimize dependencies. You are less likely to end up with the wrong access level if you start as restrictive as possib...
javascript locals()?
|javascript|python|
In python one can get a dictionary of all local and global variables in the current scope with the built-in functions locals() and globals(). Is there some equivalent way of doing this in javascript? For instance, I would like to do something like the following: var foo = function(){ alert('foo'); }; var ...
Javascript does not support multithreading because the javascript interpreter in the browser is a single thread (AFAIK). Even Google Chrome will not let a single web page's Javacript run concurrently because this would cause massive concurrency issues in existing web pages. All Chrome does is separate multiple componen...
I disagree with the premise that it's better to return an interface. My reason is that you want to maximize the usefulness a given block of code exposes. With that in mind, an interface works for accepting an item as an argument. If a function parameter calls for an array or an ArrayList, that's the only thing y...
You could use [Narrative JavaScript][1], a compiler that will transforms your code into a state machine, effectively allowing you to emulate threading. It does so by adding a "yielding" operator (notated as '->') to the language that allows you to write asynchronous code in a single, linear code block. [1]: http:/...
What are you loading the files for - configuration or data (like an input file) or as a resource? - If as a resource, follow the suggestion and example given by [Will and Justin][1] - If configuration, then you can use a [ResourceBundle][2] or [Spring][3] (if your configuration is more complex). - If you ne...
What is the proper virtual directory access permission level required for a SOAP web service?
|soap|web-services|file-permissions|
When setting up a new virtual directory for hosting a SOAP web service in IIS 6.0 on a Server 2003 box I am required to set the access permissions for the virtual directory. The various permissions are to allow/disallow the following: - **Read** - **Run scripts (such as ASP)** - **Execute (such as ISAPI or ...
|web-services|soap|file-permissions|
Change the [error message](http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.validation.errors).
The [Ars Technica tutorial](http://arstechnica.com/guides/other/msh.ars/2) is a bit dated, but very good to get you up-and-running with Powershell. I would also second the suggestion to check out [PowerGUI](http://powergui.org/index.jspa).
The [Ars Technica tutorial](http://arstechnica.com/guides/other/msh.ars/2) is a bit dated, but very good to get you up-and-running with PowerShell. I would also second the suggestion to check out [PowerGUI](http://powergui.org/index.jspa).
Use SQL Profiler. For .NET applications, filter that Application name by '.NET%' and you'll omit other extraneous queries.
set showplan_text on will show you the execution plan (to see it graphically use CTRL + K (sql 2000) or CTRL + M (sql 2005 +) set statistics IO on will show you the reads set statistics time on will show you the elapsed time
The source code for [Spelly][1] is available, it would be pretty easy to update it for vs2008. [1]: http://www.wndtabs.com/
Doesn't using multiple open-id providers sort of undermine the point of open id?
How do you create optional arguments in php?
|php|
In the php manual they describe functions like so: string **date** ( string $format [, int $timestamp ] ) How would this function look when you define it?
function dosomething($var1, $var2, $var3='somevalue'){ .. }
SharePoint List Scalability
|sharepoint|
I am particularly interested in Document Libraries, but in terms of general SharePoint lists, can anyone answer the following...? 1. What is the maximum number of items that a SharePoint list can contain? 1. What is the maximum number of lists that a single SharePoint server can host? 1. When the number of item...
|sharepoint|scalability|
do you have ChildrenAsTriggers="false" on the UpdatePanel? Are there any javascript errors on the page?
[Jrun development has pretty much stopped][1]. You should look into running another application server. [Jboss][2] or [Glassfish][3] are good alternatives. [1]: http://www.adobe.com/products/jrun/productinfo/faq/eod/ [2]: http://www.jboss.org/ [3]: https://glassfish.dev.java.net/
Give the optional argument a default value. function date ($format, $timestamp='') { }
At the end of the object's constructor you could serialize the object to a base 64 string just like the cookie stores it, and store this in a member variable. When you want to check if the cookie needs recreating, re - serialize the object and compare this new base 64 string against the one stored in a member varia...
One of the biggest culprits for Visual Studio 2005 slowness is Intellisense. This has been brought up on the MSDN forums again and again and again. What I frequently experience is that Intellisense is working nearly non-stop to "re-index" symbols (or whatever you call it). But developers at Microsoft have not been ...
I have to give a shout out to [RobotWar][1] which was the first programming "game" that I played way back in the Apple II days. It was written by Silas Warner of Castle Wolfenstein fame. [1]: http://en.wikipedia.org/wiki/RobotWar
I've used NVelocity in the past. For the most part it makes the code really clean and simple to follow; however, it normally ends up just being a few ViewData variables which have been filled up by XSLT files before hand. So I guess really my View Engine would be both XSLT (which is a love/hate thing - Extension Method...
The first part of your question can be solved with just HTML & CSS; you'll need to use Javascript for the second part. ### Getting the Label Near the Radio Button ### I'm not sure what you mean by "next to": on the same line and near, or on separate lines? If you want all of the radio buttons on the same line, ju...
Well, not sure if this helps, but Deep Blue used a single 6-bit number to represent a specific position on the board. This helped it save footprint on-chip in comparison to it's competitor, which used a 64-bit bitboard. This might not be relevant, since chances are, you might have 64 bit registers on your target ha...
"Coupling is a measure of interdependencies between modules, which should be minimized" "cohesion, a quality to be maximized, focuses on the relationships between the activities performed by each module." quoted from this paper: http://steve.vinoski.net/pdf/IEEE-Old_Measures_for_New_Services.pdf
Seconding [Javascript: The Good Parts][1] and Resig's book [Secrets of the Javascript Ninja][2]. Here are some tips for Javascript: * Don't pollute the global namespace (put all functions into objects/closures) * Take a look at [YUI][3], it's a huge codebase with only 2 global objects: YAHOO and YAHOO_config ...
@Hank Gay So something like: 1. ObjectA * ObjectAID * ParentID 2. ObjectB * ObjectBID * ParentID 3. Comments * CommentID * ParentID 4. Parents * ParentID
A quick-and-dirty way to measure coupling is to measure your `import` (or similar) statements.
How are tags made in Subversion?
|svn|
I know how to use tags in subversion. I create a tag every time I get to a release milestone. What I don't quite understand is how they work. Is a tag just a copy, made from what ever revision I specify? Or is a tag more like a reference, where internally subversion just says <code>GO TO /trunk/project/ Revision...
This is long-term positioning for Google; they are clearly trying to build a more stable application platform for web-based development. All of their changes (security, sandboxing, process isolation) are clearly intended to make the browser a better application for hosting complex apps. This is what Microsoft was wo...
I have not seen any serious issues with MSTest. What, specifically, are you talking about? We are, in fact, moving away from NUnit to MSTest. I do not know our reasons for this, though.
*Theoretically*, it's possible. The Java Serialization, like pretty much everything in Javaland, is standardized. So, you *could* implement a deserializer according to that standard in Python. However, the Java Serialization format is not designed for cross-language use, the serialization format is closely tied to the ...
I'd recommend taking a look at <a href="http://www.wxwidgets.org/">wxWidgets</a> to provide some cross platform UI widgets that will work on Solaris and Windows.
On a Mac, this would be easy. The Cocoa API is great when programming in Objective C (which compiles fine with C/C++ files). Otherwise the situation is a bit more grim. As for Rapid prototype, you might want to check the CodeGear (Borland/C++ Builder) tools. I think their VCL library is cross-platform. Otherwise,...
sp_helptext works to get the sql that makes up a trigger. The text column in the syscomments view also contains the sql used for object creation.
Best way to rotate Apache log files
|apache|logging|
I've got an Apache server that has one access log file that is topping 600MB. This makes it really hard to search the file or parse it. What software or modules for Apache are available that will make a daily copy of my access file to make it more manageable?
select convert(int,@value)
For 2005 and 2008 you can use the [OBJECT_DEFINITION()][1] function [1]: http://msdn.microsoft.com/en-us/library/ms176090.aspx
Depending on the shell you are using, you can turn the approach [@Blair](http://stackoverflow.com/questions/44019/an-easy-way-to-diff-log-files-ignoring-the-time-stamps#44028) suggested into a 1-liner diff <(cut -b13- file1) <(cut -b13- file2)
Depending on the shell you are using, you can turn the approach [@Blair](http://stackoverflow.com/questions/44019/an-easy-way-to-diff-log-files-ignoring-the-time-stamps#44028) suggested into a 1-liner diff <(cut -b13- file1) <(cut -b13- file2) (+1 to [@Blair](http://stackoverflow.com/questions/44019/an-easy-w...
This is what the GridView is for. <asp:GridView runat="server" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField HeaderText="Published" DataField="Published" /> <asp:BoundField HeaderText="Author" DataField="Author" /> </Columns> </asp:GridView>
select round(123.456, 2, 1)
Have you looked at [logrotate][1] - this is probably the simplest, most widely available and well undestood method of achieving this. It is highly configurable and will probably do 90% of what you need. [1]: http://www.linuxcommand.org/man_pages/logrotate8.html
I know this was added in release 1.5 but the new *enum type* is a great feature. Not having to use the old "int enum pattern" has greatly helped a bunch of my code. [Check out JLS 8.9][1] for the sweet gravy on your potatoes! [1]: http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9
On the subject of which .NET framework the user has installed, there is also a new option with the Client Profile that’s available with .NET 3.5 SP1. This basically allows you to ship a small (277k) bootstrap program which downloads and installs the required files (A subset od the full .NET framework). For more info...
T-SQL stored procedure that accepts multiple Id values
|sql-server|stored-procedures|t-sql|
Qt 4 is the best tool for this job. If you want to work with other languages, it also has bindings for Java and Python
There are lots of config files with mstest, making it less condusive. Another reason I chose mbunit, is the "rollback" feature of mbunit. This allows you to rollback all database things done in this test, so you can actually do full circuit tests and not worry about the pond being tainted after the test. Also lac...
The [,] operator returns a string back to you, it is a substring operator, where as the [] operator returns the character which ruby treats as a number when printing it out.
I don't know anything about groovy so in a sense I've qualified to answer this... I would want you to: - Tell me why I would want to use Scripting (in general) as opposed to Java-- what does it let me do quicker (as in development time), what does it make more readable. Give tantalising examples of ways I can u...
ORM might be your best solution. Or use a repository type pattern, with a "thingContext" object that is responsible for state persistence. Personally, I use the activeRecord pattern, where save logic is baked into a base class, but I'm leaving it in favor of an nHibernate style repository pattern. The allowance f...
See the [distutils simple example][1]. That's basically what it is like, except real install scripts usually contain a bit more information. I have not seen any that are fundamentally more complicated, though. In essence, you just give it a list of what needs to be installed. Sometimes you need to give it some mapping ...
When setting up a new virtual directory for hosting a SOAP web service in IIS 6.0 on a Server 2003 box I am required to set the access permissions for the virtual directory. The various permissions are to allow/disallow the following: - **Read** - **Run scripts (such as ASP)** - **Execute (such as ISAPI or ...
Source control integration is not supported in the Express editions of Visual Studio. Check out the feature comparison chart at [http://msdn.microsoft.com/en-us/vstudio/products/cc149003.aspx][1] [1]: http://msdn.microsoft.com/en-us/vstudio/products/cc149003.aspx