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 cmdsize 80 flavor i386_THREAD_STATE count i386_THREAD_STATE_COUNT [..] ss 0x00000000 eflags 0x00000000 eip 0x00001f8c cs 0x00000000 [..] </pre> The address is the address of the "start" function from the binary: <pre> cristi:test diciu$ nm ./a.out 0000200c D _NXArgc 00002008 D _NXArgv 00002000 D ___progname 00001fe0 t __dyld_func_lookup 00001000 A __mh_execute_header [..] 00001f8c T start </pre> In Mac OS X, it's the "start" function that gets called first, even before the "main" function: <pre> (gdb) b start Breakpoint 1 at 0x1f90 (gdb) b main Breakpoint 2 at 0x1ff4 (gdb) r Starting program: /Users/diciu/Programming/test/a.out Reading symbols for shared libraries ++. done Breakpoint 1, 0x00001f90 in start () </pre>
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 in the page header too, however, because Crystal will add the value in the first row on the page to it first (so in your example it would show 9 rather than 4 at the top of page 2). To work around this, create a formula field which subtracts the current value of the Value field from the running total (e.g. {#RTotal}-{TableName.Value}), and put this formula field in your page header.
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 united with those advising you to get away from the ArrayList, though. Generics are _so much better._
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 parameter and returns the count. For example: public List<Thing> doIt(String aString) { List<Thing> list = new ArrayList<Thing>(); int count = doItHelper(aString, list, 0); // ... return list; } private int doItHelper(String aString, List<Thing> list, int count) { // ... // do something that updates count count = doItHelper(aString, list, count); // ... return count; } This assumes that you can do the error handling in the public <code>doIt</code> method, since the <code>count</code> variable isn't actually passed back to the caller. If you need to do that, you could of course throw an exception: public List<Thing> doIt(String aString) throws SomeCustomException { List<Thing> list = new ArrayList<Thing>(); int count = doItHelper(aString, list, 0); // ... if (someErrorOccurred) { throw new SomeCustomException("Error occurred at chracter index " + count, count); } return list; } It's difficult to know whether that will help without knowing more about how your algorithm actually works.
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: Object( const T& newObject ) : yourObject(newObject) {} ; T GetObject() const { return yourObject } ; void SetObject( const T& newObject ) { yourObject = newObject } ; protected: const T yourObject ; } ; class SomeClassOne { public: SomeClassOne( const std::vector<int>& someData ) { yourData.SetObject( someData ) ; } private: Object&lt;std::vector&lt;int&gt;&gt; yourData ; } ; </code> </pre> This will let you use the template class methods to modify the data as needed from within your custom classes that use the data and share the various aspects of the template class. If you're intent on using inheritance, then you might have to resort to the "joys" of using a void* pointer in your BaseClass and dealing with casting, etc. However, based on your explanation, it seems like you need templates and not inheritance.
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.net.pl/blogs/sqlgeek/archive/2008/06/06/en-column-order-does-it-matter.aspx
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 merge the merge generally goes fine. Then you need to resolve any and all conflicts and then commit your merged in working copy to the repository. If Mercurial can make the configuration of the merge easier then I can say that would make merging 100% easier then Subversion.
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 helpers. I wouldn't be surprised to see the currently interpreted view engines all eventually end up with a compilation model eventually.
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. Here's a command line that will slice to 30 seconds without transcoding: ffmpeg -t 30 -acodec copy -i inputfile.mp3 outputfile.mp3 The -acodec switch tells ffmpeg to use the special "copy" codec which does not transcode. It is lightning fast.
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 deaf to the complaints and some outgoing folks there have come up with some workarounds that have helped me and might help you: Check out this link to get a better understanding of Intellisense: > [Intellisense Info][1] Then check out this link for some macros that I've had a lot of success with: > [Intellisense Macros][2] [1]: http://blogs.msdn.com/yash/archive/2007/09/19/intellisense-issues-in-visual-c-2005.aspx [2]: http://blogs.msdn.com/vcblog/archive/2007/11/19/controlling-intellisense-through-macros.aspx
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 enough answers on the second, it now knows the answer to that too. Ask two trivia questions: A woman needs a man like a fish needs a? Orange orange orange. Type green. Of course, this may need to be coupled with other techniques, such as timers or computed secrets. Questions would need to be rotated/retired, so to keep the supply of questions up you could ad-hoc add: Enter your obvious question: You don't even need an answer; other humans will figure that out for you. You may have to allow flagging questions as "too hard", like this one: "asdf ejflf asl;jf ei;fil;asfas". [1]: http://www.docstoc.com/docs/1048763/Worst-Captchas-of-All-Time
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 enough answers on the second, it now knows the answer to that too. Ask two trivia questions: A woman needs a man like a fish needs a? Orange orange orange. Type green. Of course, this may need to be coupled with other techniques, such as timers or computed secrets. Questions would need to be rotated/retired, so to keep the supply of questions up you could ad-hoc add: Enter your obvious question: You don't even need an answer; other humans will figure that out for you. You may have to allow flagging questions as "too hard", like this one: "asdf ejflf asl;jf ei;fil;asfas". Now, to slow someone who's running a StackOverflow gaming bot, you'd rotate the questions by IP address - so the same IP address doesn't get the same question until *all* the questions are exhausted. This slows building a dictionary of known questions, forcing the human owner of the bots to answer all of your trivia questions. [1]: http://www.docstoc.com/docs/1048763/Worst-Captchas-of-All-Time
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 just want static. I don't want const. This value can change. I just wanted the simplicity of declaring and init'ing in one fell swoop. As if anything in the codedom world is simple. Every type name is 20+ characters long and you end up building these huge expression trees. Makes my eyes bug out. I'm only alive today thanks to resharper's reformatting.
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. [1]: http://stackoverflow.com/questions/33449/can-you-call-a-webservice-from-tsql-code
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 ConvertNumberToColumnLetter2 = ConvertNumberToColumnLetter2 & Chr(((colNum - x - 1)\ 26 ^ i) Mod 26 + 65) End If Next i End Function via http://www.dailydoseofexcel.com/archives/2004/05/21/column-numbers-to-letters/
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) of a module are to the other members of the same module. It is desirable to increase cohesion as that indicates that a module has a very specific task and does only that task.
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 possible and make the developer take some action to make a class or member more visible. If something is less public than you need, then that is apparent immediately when you get a compilation error, but it is not nearly as easy to spot something that is more visible than it should be.
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 bar = function(){ alert('bar'); }; var s = 'foo'; locals()[s](); // alerts 'foo' Is this at all possible, or should I just be using a local object for the lookup?
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 components (different tabs, plugins, etcetera) into separate processes, but I can't imagine a single page having more than one Javacript thread. You can however use, as was suggested, use setTimeout to allow some sort of scheduling and 'fake' concurrency. This causes the browser to regain control of the rendering thread, and start the Javascript code supplied to setTimeout after the given number of milliseconds. This is very useful if you want to allow the viewport (what you see) to refresh while performing operations on it. Just looping through e.g. coordinates and updating an element accordingly will just let you see the start and end positions, and nothing in between. We use an abstraction library in Javascript that allows us to create processes and threads which are all managed by the same Javascript interpreter. This allows us to run actions in the following manner: * Process A, Thread 1 * Process A, Thread 2 * Process B, Thread 1 * Process A, Thread 3 * Process A, Thread 4 * Process B, Thread 2 * Pause Process A * Process B, Thread 3 * Process B, Thread 4 * Process B, Thread 5 * Start Process A * Process A, Thread 5 This allows some form of scheduling and fakes parallelism, starting and stopping of threads, etcetera, but it will not be true multithreading. I don't think it will ever be implemented in the language itself, since true multithreading is only useful if the browser can run a single page multithreaded (or even more than one core), and the difficulties there are way larger than the extra possibilities. For the future of Javascript, check this out: http://developer.mozilla.org/presentations/xtech2006/javascript/
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 you can pass to it. If a function parameter calls for an IEnumerable it will accept either, as well as a number of other objects. It's more useful The return value, however, works opposite. When you return an IEnumerable<T>, the only thing you can do is enumerate it. If you have a List<T> handy and return that then code that calls your function can also easily do a number of other things, like get a count. I stand united with those advising you to get away from the ArrayList, though. Generics are _so much better._
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://www.neilmix.com/narrativejs/doc/
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 need to read a file in order to process the data inside, this code snippet may help `BufferedReader file = new BufferedReader(new FileReader(filename))` and then read each line of the file using `file.readLine();` Don't forget to close the file. [1]: http://stackoverflow.com/questions/6639/how-should-i-load-files-into-my-java-application#6640 [2]: http://java.sun.com/j2se/1.4.2/docs/api/java/util/ResourceBundle.html [3]: http://www.springframework.org/
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 CGI)** - **Write** - **Browse** The SOAP web service is being published through the SOAP3.0 ISAPI server with the extensions set to "Allowed" in the Web Service Extensions pane of the IIS Manager. Since I'll be hosting the .wsdl definition file from this virtual directory, I know I'll need **Read** permissions to be set, and since I don't want to expose the contents of this directory to the web I know **Browse** is not desirable. But, I *don't* know if I need to have the **Run scripts**, **Execute**, and **Write** permissions enabled to properly publish this web service. The web service is being used to send and receive XML data sets between the server and remote clients. **What is the correct level of access permission for my SOAP web service's virtual directory?**
|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 items in the list approaches the maximum, does filtering slow down, and if so, what can be done to improve it?
|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 variable. If it has changed, reset the cookie with the new value. Watch out for the gotcha - don't include the member variable storing the base 64 serialization in the serialization itself. I presume your language uses something like a sleep() function (is how PHP does it) to serialize itself, so just make sure the member is not included in that function. This will always work because you are comparing the exact value you'd be saving in the cookie, and wouldn't need to override GetHashCode() which sounds like it could have nasty consequences. All that said I'd probably just drop the test and always reset the cookie, can't be that much overhead in it when compared to doing the change check, and far less likelyhood of bugs.
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 deaf to the complaints and some outgoing folks there have come up with some workarounds that have helped me and might help you: Check out this link to get a better understanding of Intellisense: > [Intellisense Info][1] Then check out this link for some macros that I've had a lot of success with: > [Intellisense Macros][2] With those macros, you can turn off intellisense (without renaming any DLLs), restart it, delete the ncb file (which you can do manually, but this is a convenience) and it can give you the status of Intellisense. [1]: http://blogs.msdn.com/yash/archive/2007/09/19/intellisense-issues-in-visual-c-2005.aspx [2]: http://blogs.msdn.com/vcblog/archive/2007/11/19/controlling-intellisense-through-macros.aspx
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 Methods make it really useful) and NVelocity.
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, just use margins to push them apart. If you want each of them on their own line, you have two options (unless you want to venture into <code>float:</code> territory): - Use <code>&lt;br /&gt;s </code> to split the options apart and some CSS to vertically align them: <div><!-- For some reason I need this un-code'ed div to make markdown not eat the div tags below --></div> <style type='text/css'> .input input { width: 20px; } </style> <div class="input radio"> <fieldset> <legend>What color is the sky?</legend> <input type="hidden" name="data[Submit][question]" value="" id="SubmitQuestion" /> <input type="radio" name="data[Submit][question]" id="SubmitQuestion1" value="1" /> <label for="SubmitQuestion1">A strange radient green.</label> <br /> <input type="radio" name="data[Submit][question]" id="SubmitQuestion2" value="2" /> <label for="SubmitQuestion2">A dark gloomy orange</label> <br /> <input type="radio" name="data[Submit][question]" id="SubmitQuestion3" value="3" /> <label for="SubmitQuestion3">A perfect glittering blue</label> </fieldset> </div> - Follow *A List Apart*'s article: [Prettier Accessible Forms][1] ### Applying a Style to the Currently Selected Label + Radio Button### Styling the <code>&lt;label&gt;</code> is why you'll need to resort to Javascript. A library like [jQuery][2] is perfect for this: <style type='text/css'> .input label.focused { background-color: #EEEEEE; font-style: italic; } </style> <script type='text/javascript' src='jquery.js'></script> <script type='text/javascript'> $(document).ready(function() { $('.input :radio').focus(updateSelectedStyle); $('.input :radio').blur(updateSelectedStyle); $('.input :radio').change(updateSelectedStyle); }) function updateSelectedStyle() { $('.input :radio').removeClass('focused').next().removeClass('focused'); $('.input :radio:checked').addClass('focused').next().addClass('focused'); } </script> The <code>focus</code> and <code>blur</code> hooks are needed to make this work in IE. [1]: http://www.alistapart.com/articles/prettyaccessibleforms [2]: http://jquery.com
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 hardware, already.
"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 * Use the Module pattern for singletons ([http://yuiblog.com/blog/2007/06/12/module-pattern/][4]) * Make your JS as reusable as possible (jQuery plugins, YUI modules, basic JS objects.) Don't write tons of global functions. * Don't forget to var your variables * Use JSlint : http://www.jslint.com/ * If you need to save state, it's probably best to use objects instead of the DOM. [1]: http://oreilly.com/catalog/9780596517748/ [2]: http://jsninja.com/ [3]: http://developer.yahoo.com/yui/ [4]: http://yuiblog.com/blog/2007/06/12/module-pattern/
@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 5</code> or whatever. The command to create a tag (<code>svn copy</code>) seems to imply that it's a copy, but I've seen other people write that subversion doesn't really copy anything. Say I dump just the HEAD revision of a repository. I don't care about any history except the tags. Are those tags dumped along with the rest of the Head revision? Finally, is all this just programming magic that I don't really want to know.
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 worried about with netscape, and why they broke antitrust rules to "cut off their air supply". It's going to be interesting to see how MS responds. It's also interesting to see how the mozilla / firefox team deals with this- Google is pretty much funding firefox now, so it's going to be a potential conflict of interest for these folks down the road. In a nutshell, things are going to get more complex, require more testing, and will (hopefully) force recalcitrant vendors like Microsoft to become more standards-compliant.
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 way objects are represented inside the JVM. While implementing a JVM in Python is surely a fun exercise, it's probably not what you're looking for (-: There are other (data) serialization formats that are specifically designed to be language agnostic. They usually work by stripping the data formats down to the bare minimum (number, string, sequence, dictionary and that's it) and thus requiring a bit of work on both ends to represent a rich object as a graph of dumb data structures (and vice versa). Two examples are [JSON (JavaScript Object Notation)][1] and [YAML (YAML Ain't Markup Language)][2]. [ASN.1 (Abstract Syntax Notation One)][3] is another data serialization format. Instead of dumbing the format down to a point where it can be easily understood, ASN.1 is self-describing, meaning all the information needed to decode a stream is encoded within the stream itself. And, of course, [XML (eXtensible Markup Language)][4], will work too, provided that it is not just used to provide textual representation of a "memory dump" of a Java object, but an actual abstract, language-agnostic encoding. So, to make a long story short: your best bet is to either try to coerce log4j into logging in one of the above-mentioned formats, replace log4j with something that does that or try to somehow intercept the objects before they are sent over the wire and convert them before leaving Javaland. Libraries that implement JSON, YAML, ASN.1 and XML are available for both Java and Python (and pretty much every programming language known to man). [1]: http://JSON.Org/ "JSON (JavaScript Object Notation)" [2]: http://YAML.Org/ "YAML (YAML Ain't Markup Language)" [3]: http://ASN1.Elibel.Tm.Fr/en/ "ASN.1 (Abstract Syntax Notation One)" [4]: http://W3.Org/XML/ "XML (eXtensible Markup Language)"
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, you could interface with a scripting language like Ruby and use fantastic front end libraries like Shoes. Python also interfaces with [wxWidgets](http://www.wxwidgets.org/) to make writing cross-platform front ends easy. Keep in mind that this all requires taking time to make sure your C/C++ code can talk to the scripting language. This is not trivial, and the amount of effort required depends upon the style of your code base. (Oh my God.) Lastly, you could just use wxWidgets itself. This might be your best bet since it requires no additional overhead than coding the UI itself. That said, C++ is not the greatest language for designing UIs. And super lastly, consider writing a code generator that converts from say Shoes to whatever wxWidgets code is needed to generate the same Shoes app. That way you can do easier UI design but still get C++ code in the end. Likewise, you could code gen off of the Python/wxWidgets code. Then sell such a code generator. :-)
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-way-to-diff-log-files-ignoring-the-time-stamps#44028) for the original suggestion :-)
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 information, and general tips on creating a small .NET installation, see this great [blog entry by Scott Hanselman][1]. [1]: http://www.hanselman.com/blog/SmallestDotNetOnTheSizeOfTheNETFramework.aspx
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 lack of RowTest facilities in mstest. I suggest just running mbunit as a dependency inside the build process, its easy enough to just float it with your bin, and reference, no installation required.
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 use chunks of scripting in my mostly Java app. You want to make this relevant to Java devs moreso than tech-junkies. - With that out of the way, why Groovy? Why not Ruby, Python or whatever (which are all runnable on the JVM). - Don't show me syntax that Java can already do (if statements, loops etc) or if you do make it quick. It's as boring as hell to watch someone walk through language syntax 101 for 20min. - For syntax that has a comparible feature in Java maybe show them side by side quickly. - For syntax that is not in Java (closures etc) you can talk to them in a bit more detail. - Remember those examples from the first point. Show me one, fully working (or at least looking like it is). - At the end have question time. That is **crazy** important, and with that comes a burden on you to be a psuedo-guru :P. I'm not sure about how the Java6 scripting support works but I'm fairly sure it can be made secure. I remember something about defining the API the script can use before it's run. If this is the case then an example you could show would be some thick-client application (e.g. a music player) where users can write their own scripts with an API you provide them in Groovy which allows them to script their app in interesting and secure ways (e.g. creating custom columns in the playlist)
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 for DDD and testing things without a db is very nice to have in a framework type situation, where my business logic is now gaining traction for a new UI.
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 dicts since the source and installed trees might not be the same. Here is a real-life (anonymized) example: #!/usr/bin/python from distutils.core import setup setup (name = 'Initech Package 3', description = "Services and libraries ABC, DEF", author = "That Guy, Initech Ltd", author_email = "that.guy@initech.com", version = '1.0.5', package_dir = {'Package3' : 'site-packages/Package3'}, packages = ['Package3', 'Package3.Queries'], data_files = [ ('/etc/Package3', ['etc/Package3/ExternalResources.conf']) ]) [1]: http://docs.python.org/dist/simple-example.html
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 CGI)** - **Write** - **Browse** The SOAP web service is being published through the SOAP3.0 ISAPI server with the extensions set to "Allowed" in the Web Service Extensions pane of the IIS Manager. Since I don't want to expose the contents of this directory to the web I know **Browse** is not desirable. But, I *don't* know if I need to have the **Run scripts**, **Execute**, and **Write** permissions enabled to properly publish this web service. The web service is being used to send and receive XML data sets between the server and remote clients. **What is the correct level of access permission for my SOAP web service's virtual directory?**
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