instruction
stringlengths
0
30k
⌀
Okay, it seems that '. is valid syntax for (string->symbol ".") in Guile, whereas MzScheme at least requires |.| for the period as a symbol.
If you're willing to try something a little different, there's the [ICE][1] platform from [ZeroC][2]. It's open source, and is supported on pretty much every OS you can think of, as well as having language support for C++, C#, Java, Ruby, Python and PHP. Finally, it's very easy to drive (the language mappings are tailo...
try/catch/finally does the job admirably. It allows the programmer to handle specific conditions as well as general failures gracefully. All said and done I'm sure that each is as good as any other.
I would change the script to accept an argument. The argument should be a filename. Open the file using whatever scripting language you prefer [perl, python] and traverse the file until you find a match for your version. I would use a regex... something along the lines of /\d\\.\d\\.\d/ . then have it execute the a...
When you create your index, create a field that only contains the words you wish to sort on, then when retrieving, sort on that field but display the full title.
You can check for existence using the && and || operators: <pre> !$/bin/sh version = `cat current_version` cd $version && ./foo || echo "Bad version" </pre> The && operator causes the second statement to only execute if the first one succeeds (exit status 0), and the || operator causes the second statement to...
That looks like a Silverlight bug to me. I've just tried it and what's happening on my end is that the **SelectionChanged** event fires twice when you click the column header and to make matters worse, the index of the selected item doesn't stay synched with the currently selected item. I'd suggest you work your way...
See [svn:externals](http://svnbook.red-bean.com/en/1.0/ch07s03.html)
Any tools to generate an XSD schema from an XML instance document?
|xml|xsd|
I am looking for a tool which will take an XML instance document and output a corresponding XSD schema. I certainly recognize that the generated XSD schema will be limited when compared to creating a schema by hand (it probably won't handle optional or repeating elements, or data constraints), but it could at least ...
Delegating a task in and getting notified when it completes (in C#)
|c#|delegates|notifications|
Conceptually, I would like to accomplish the following but have had trouble understand how to code it properly in C#: <pre><code> SomeMethod { // Member of AClass{} DoSomething; Start WorkerMethod() from BClass in another thread; DoSomethingElse; } </code></pre> Then, when WorkerMethod() is comp...
I've encountered this problem as well. What you can do: in addition to the window's size, save whether it's maximized or not (`QWidget::isMaximized()`). Then next time you start the application, first set the size (`QWidget::resize()`) and then maximize it if appropriate (`QWidget::showMaximized()`). When it's r...
How can I create a command line (unix/linux) instruction that uses variables to execute numerous commands?
In Delphi static variables are implemented as *variable types constants* :) This could be somewhat misleading. procedure TForm1.Button1Click(Sender: TObject) ; const clicks : Integer = 1; //not a true constant begin Form1.Caption := IntToStr(clicks) ; clicks := clicks + 1; ...
string[] splitString = origString.Split(',');
Using the docstring from one method to automatically overwrite that of another method.
|python|metaclass|
The problem: I have a class which contains a template method "execute" which calls another method "_execute". Subclasses are supposed to overwrite "_execute" to implement some specific functionality. This functionality should naturally be documented in the docstring of "_execute". However, a user dealing with such a su...
The problem: I have a class which contains a template method "execute" which calls another method "_execute". Subclasses are supposed to overwrite "_execute" to implement some specific functionality. This functionality should naturally be documented in the docstring of "_execute". However, a user dealing with such a su...
The problem: I have a class which contains a template method "execute" which calls another method "_execute". Subclasses are supposed to overwrite "_execute" to implement some specific functionality. This functionality should naturally be documented in the docstring of "_execute". I also expect users to create their ...
|bash|command-line|shell|
I need to rearrange some content in various directories but it's a bit of a pain. In order to debug the application I'm working on (a ruby app) I need to move my gems into my gem folder one at a time (long story; nutshell: one is broken and I can't figure out which one). So I need to do something like: sudo m...
I think you should take a look at the [svn:externals][1] property [1]: http://svnbook.red-bean.com/en/1.0/ch07s03.html
Try svn:externals http://svnbook.red-bean.com/en/1.0/ch07s03.html
One common real-time scheduling scheme is to use priority-based preemptive multitasking. Each tasks is assigned a different priority level. The highest priority task on the ready queue will be the task that runs. It will run until it either gives up the CPU (i.e. delays, waits on a semaphore, etc...) or a higher...
The best way? Set your terminal to use vi keybindings.
Search for svn:externals property in the documentation http://svnbook.red-bean.com/en/1.0/ch07s03.html Kind regards Kai Edit... wow I was way tooooo slow :-)
@Just in case: I is. But from what i learnt, doing so for a non trivial algorithm is a major pain. I leave that sort of a thing for brainier people. I learnt what i know from Parallel Program Design: A Foundation (1988) by K M Chandy, J Misra
Uninstall Mono from Mac OS X v10.5 Leopard
|mono|osx-leopard|
I installed Mono on my iMac last night and I immidiately had a change of heart! I don't think Mono is ready for prime time. The Mono website says to run the following script to uninstall: #!/bin/sh -x #This script removes Mono from an OS X System. It must be run as root rm -r /Library/Frameworks/M...
I found this the other day when I ran into the same problem: [http://vinayakshrestha.wordpress.com/2007/03/13/uploading-files-using-aspnet-ajax-extensions/][1]. For my implementation, I put the iframe in a modal popup and added a button with style="display:none" to handle the closing of the popup. In the javascript...
Themes in ASP.Net don't provide the ability to choose from "sub-themes". However, you can set SkinIDs in your skin files. For example, in your .skin : <asp:DataList runat="server" SkinID="DataListColor" Width="100%"> <ItemStyle BackColor="Blue" ForeColor="Red" /> </asp:DataList> <asp:DataLi...
Typically I see static inner classes. Static inner classes cannot reference the containing classes wherease non-static classes can. Unless you're running into some package collisions (there already is an interface called Bar in the same package as Foo) I think I'd make it it's own file. It could also be a design decisi...
Is the site precompiled before adding global.asax? Try compiling it again.
The newpki client claims to be able to do that. http://www.newpki.org/
Firefox removed the javascript error indication by default because there are a lot of pages that throw javascript errors. To an average user, the error messages aren't useful - only confusing. If you are a web developer, you should definitely install [Firebug][1]. [1]: http://getfirebug.com/
Check out these other StackOverflow questions... - [Structure of Projects in Version Control][1] - [Best Practice: Collaborative Environment, Bin Directory, SVN][2] [1]: http://stackoverflow.com/questions/16829/structure-of-projects-in-version-control#16915 [2]: http://stackoverflow.com/questions/265/...
We use a very similar layout as covered in JP Boodhoo's blog post titled [Directory Structure For Projects][1]. [1]: http://codebetter.com/blogs/jean-paul_boodhoo/archive/2007/10/01/directory-structure-for-projects.aspx
The module you should be using is [Spreadsheet::WriteExcel][1]. [1]: http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel.pm
Where you process data depends greatly on what you're doing. If you need, for example, to discard data which you don't want in your database, then you would process that in your C# code. However, data to process in the database should generally be data which should be "implementation agnostic". So if someone else wa...
The problem: I have a class which contains a template method "execute" which calls another method "_execute". Subclasses are supposed to overwrite "_execute" to implement some specific functionality. This functionality should naturally be documented in the docstring of "_execute". I also expect users to create their ...
Doxygen (http://www.stack.nl/~dimitri/doxygen/) might fit the bill. EDIT: I may have misread your question, doxygen is a tool to generate documentation and models based off your code and javadoc.
When you are saving, you are calling GetMachineStoreForDomain, but when you are retrieving, you are calling GetMachineStoreForAssembly. GetMachineStoreForAssembly is scoped to the assembly that the code is executing in, while the GetMachineStoreForDomain is scoped to the currently running AppDomain and the assembly ...
Yes it will cause a memory leak. See this except from C++ Gotchas: <a href="http://www.informit.com/articles/article.aspx?p=30642">http://www.informit.com/articles/article.aspx?p=30642</a> for why. Raymond Chen has an explanation of how vector new and delete differ from the scalar versions under the covers for th...
Yes it will cause a memory leak. See this except from C++ Gotchas: <a href="http://www.informit.com/articles/article.aspx?p=30642">http://www.informit.com/articles/article.aspx?p=30642</a> for why. Raymond Chen has an explanation of how vector new and delete differ from the scalar versions under the covers for th...
|language-agnostic|http|
How do I best detect an ASP.NET expired session?
|http|aspnet|session|
I need to detect when a session has expired in my Visuial Basic web application. This is what I'm using... Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If CurrentSession.IsNew AndAlso (Not Page.Request.Headers("Cookie") Is Nothing) AndAlso (Page.Request...
|asp.net|http|session|
|asp.net|https|session|
|asp.net|http|session|
Your two main choice are Silverlight / WPF & Flex / Air. If you're familiar with the .NET framework use the first, if you're more familiar with Flash / ECMA script, use the later. Use the best tool for the job. If both tools are the same, use the one that you are more highly trained in, or could pick up the easie...
BTW the best place to ask Perl/ActiveMQ/Stomp questions is the [ActiveMQ user forum](http://activemq.apache.org/discussion-forums.html) as lots of Perl-Stomp folks hang out there. The trick with STOMP transactions is to make sure each message you send or each acknowledgement you make includes the transaction ID head...
How can I make the browser see CSS and Javascript changes?
|javascript|css|http|caching|
CSS and Javascript files don't change very often, so I want them to be cached by the web browser. But I also want the web browser to see changes made to these files without requiring the user to clear their browser cache. Also want a solution that works well with version control system such as Subversion.
|javascript|css|https|caching|
|javascript|css|http|caching|
A wiki is definitely the way to go. Processes change, sometimes frequently, and in a fast-paced environment like a help desk a tool that allows quick, easy access and management of that type of content is extremely important to allow people to do their jobs effectively. One of the greatest benefits I've found is th...
You can remove this error completely by saving your view state to a database and only cleaning within the duration you need to. This also sygnificantly improves the performance of your pages even shen using relatively small viewstates. At the very least you can inherit from the Page class and add your own ViewStateL...
Get a string[] of all the lines: string[] lines = System.IO.File.ReadAllLines("yourfile.csv"); Then loop through and split those lines (this error prone because it doesn't check for commas in quote-delimited fields): foreach (string line in lines) { string[] items = line.Split({','}}; ...
As with most general programming questions, it depends on your needs. For static text, I would use RESX files. For me, as .Net programmer, they are easy to use and the .Net Framework has good support for them. For any dynamic text, I tend to store such information in the database, especially if the site ma...
api documentation and "value limits": do they match ?
|language-agnostic|documentation|comments|
Do you often see in API documentation (as in 'javadoc of public functions' for example) the description of "value limits" as well as the classic documentation ? Note: I am not talking about [comments within the code][1] By "value limits", I mean: - does a parameter can support a null value (or an empty Strin...
As a starting point, I'd be tempted to add tracing log messages at strategic points within your application. This will allow you to analyse how your threads are interacting with no danger that the act of observing the threads will change their behaviour (as could be the case with step-by-step debugging). My experience...
I remember doing this a few years ago - so I'm talking Office XP or 2003 days, not 2007. Obviously a better solution for automation these days is to use the new XML format that describes docx etc using the System.IO.Packaging namespace. Back then, I used to notice that whenever MSWord had kicked the bucket and ha...
Your best option here may be caching the document in the requested zone the first time it is requested, and pinging the source document's last modified each time the cached document is requested in order to determine if it needs refreshed. In this case you're only requesting a small piece of information (a date) across...
@aib is unfortunately incorrect. Assuming strict mode (the default compiler mode) it is not possible to modify the prototype of non-dynamic class types in ActionScript 3. I'm not even sure that it's possible in non-strict mode. Is wrapping an option? Basically you create a class that takes one of the objects you get...
Can you test it over HTTP as described in the specs in Appendix A? If so, then you can use any web test util. Since you mentioned Java, [JMeter][1] comes to mind. With JMeter, you can create your java code to do validation, etc and re-use it in your test cases. Can you use something other than CMD line, such as a...
If you want to take advantage of any structural or semantic markup, you might want to explore converting the HTML to XML and using XQuery to extract the information in a standard form. Take a look at [this IBM developerWorks article][1] for some typical code, excerpted below (they're outputting HTML, which is, of cours...
At my place of work we have multiple projects, where each project gets its own sub-directory, like so: -proj1 --proj1.csproj -proj2 --proj2.csproj -proj3 --proj3.csproj solutionfile.sln The rest of your setup looks okay, but I think you should figure out how you would incorporate multiple proje...
Your experience with "modular" web sites in Java?
|java|tiles|portlet|modular-web|
I'm building small web site in Java (Spring MVC with JSP views) and am trying to find best solution for making and including few reusable modules (like "latest news" "upcoming events"...). So the question is: Portlets, tiles or some other technology?
I have an old laptop that I remove the wireless card from and sit on a completely quiet room away from distractions. Whatever I can't get done without the internet is just leave until later. My biggest problem is that I gooel to find a solution and end up doing 30 minutes research on something a blogger has mentioned i...
Programatically handling the Vista Sidebar
|c#|windows-vista|sidebar|
Is there an api to bring the vista side bar to the front (Win+Space) programatically and to do the reverse (send it to the back ground).
You'll need to download the platform SDK and muck around with some dependencies to get ATL. There might be some more "unsavory" ways to get MFC ;) if you catch my drift. Also many institutions have educational VS licenses which are free.
I agree with keeping everything in source control and manually scripting all changes. Changes to the schema for a single release go into a script file created specifically for that release. All stored procs, views, etc should go into individual files and treated just like .cs or .aspx as far as source control goes. ...
Here are some articles you might find of interest [Giving STL Iterators a Base Class][1] [Type Erasure for C++ Iterators][2] [any_iterator Class Reference][3] [1]: http://accu.org/index.php/journals/479 [2]: http://thbecker.net/free_software_utilities/type_erasure_for_cpp_iterators/start_page.html ...
There's a command line utility called <code>[isightcapture][1]</code> that does more or less what you want to do. You could probably get the code from the developer (his e-mail address is in the readme you get when you download the utility). [1]: http://www.intergalactic.de/pages/iSight.html
It depends on what you are trying to do, if your goal is to quickly generate sprintf() input, this works. If you are trying to parse data, maybe regular expressions would do too..
Try changing the SelectCommand timeout value: DataAdapter.SelectCommand.CommandTimeout = 120;
If there isn't beer, its not a good enough user group to attend. The open source guys get this. Their user group meetings are funner, and more dynamic because of this. Just make it BYOB and it'll naturally get better in my experience.
This is what I've learned so far from my research. .NET sends in connection settings that are not the same as what you get when you log in to management studio. Here is what you see if you sniff the connection with Sql Profiler: -- network protocol: TCP/IP set quoted_identifier off set arithabort off se...
string sample = "abc" + Environment.NewLine + "def"; string replaced = sample.Replace(Environment.NewLine, ",");
Don't reinvent the wheel - just use myString.Replace(Environment.NewLine, ",")
Like this: string s = "hello\nworld"; s = s.Replace(Environment.NewLine, ",");
why not: <pre> <code> string s = "foobar\ngork"; string v = s.Replace(Environment.NewLine,","); System.Console.WriteLine(v); </code> </pre>
Custom Attribute Binding in Silverlight
|silverlight|
I've got two Silverlight Controls in my project, both have properties TeamId. I would like to bind these together in XAML in the control hosting both user controls similar to: <agChat:UserTeams x:Name="oUserTeams" /> <agChat:OnlineUser x:Name="oOnlineUsers" TeamId="{Binding ElementName=oUse...
<?php $a = array('a' => '1', 'b' => '2'); $b = array('c' => '3', 'b' => '4'); $c = array_merge_recursive($a, $b); print_r($c); ?> outputs: Array ( [a] => 1 [b] => Array ( [0] => 2 [1] => 4 ) ...