instruction
stringlengths
0
30k
There's also [RestfulOpenIDAuthentication][1] if you want OpenID support in addition to password support. [1]: http://github.com/ReinH/restful_open_id_authentication/tree/master
Checkout [Powershell Management library for Hyper-V on CodePlex][1]. Some features: > Finding a VM > Connecting to a VM > Discovering and manipulating Machine states > Backing up, exporting and snapshotting VMs > Adding and removing VMs, configuring motherboard settings. > Manipulating Disk controlle...
What does ** and * do for python parameters?
|python|
In the following method, what does the * and ** do for param2? I'm new to Python...I assume it's a reference or pointer. Answers? def foo(param1, *param2): def bar(param1, **param2):
From the Python documentation: > If there are more positional arguments than there are formal parameter slots, a TypeError exception is raised, unless a formal parameter using the syntax "*identifier" is present; in this case, that formal parameter receives a tuple containing the excess positional arguments (or an e...
I haven't tried nesting git repositories yet because I haven't run into a situation where I need to. As I've heard on the #git channel, git gets confused by nesting the repositories and the only way to manage it is to use git submodules. As for that backup responsibility you're describing I say **delegate** it... Fo...
What is the fastest way to swap values in C?
|c|performance|
I want to swap two integers, and I want to know which of these two implementations will be faster: The obvious way with a temp variable: void swap(int* a, int* b) { int temp = *a; *a = *b; *b = temp; } Or the xor version that I'm sure most people have seen: void sw...
If the mandate of the new lead is to put the house in order, they current situation should likely be simplified as much as possible prior. If I had to bring things to order, I wouldn't want to have to manage an ongoing language conversion project on top of everything else, or at least I'd like some choice when initiat...
If the mandate of the new lead is to put the house in order, the current situation should likely be simplified as much as possible prior. If I had to bring things to order, I wouldn't want to have to manage an ongoing language conversion project on top of everything else, or at least I'd like some choice when initiati...
Take a look at this [toolkit][1] that describes how to create dialogs without resource files. It's in WTL, however I'm sure you can pick apart the internals to achieve the same thing using win32 API directly. [1]: http://www.codeproject.com/KB/wtl/resourcelessdialogtoolkit.aspx
You can use your host Mac's (or any other Mac on the network) 'local' name: http://macname.local:3000/ where macname is the network name of your host (or other desired) Mac.
See [Google code pretify][1]. See this question for the [edit control that stackoverflow][2] uses. [1]: http://code.google.com/p/google-code-prettify/ [2]: http://stackoverflow.com/questions/51808/edit-control-on-stack-overflow
"Beautifying" an OS X disk image
|macos|diskimage|skype|icon|
When I downloaded Skype, I noticed that, in place of a normal "disk image" icon, there was a custom icon, and when I double clicked on the icon, the window used a colorful image as the background, prompting me to drag the skype icon into the applications folder. How can I do that with my applications? Thanks, Ja...
|macos|icons|diskimage|skype|
I have had no issues with running NHibernate based apps on WebHost4Life, although I don't like them. Getting NHibernate to run on medium trust is possible. A full description on how this can be done is found here: http://blechie.com/WPierce/archive/2008/02/17/Lazy-Loading-with-nHibernate-Under-Medium-Trust.aspx
Just for fun, a solution using the jsr166y fork-join framework that should in JDK7. import java.util.concurrent.forkjoin.*; private final ForkJoinExecutor executor = new ForkJoinPool(); ... List<Integer> ints = ...; List<String> strs = ParallelArray.create(ints.size(), Integer.clas...
Generator Expressions vs. List Comprehension
|python|
When should you use generator expressions vs. list comprehensions in Python and vice-versa? # Generator expression (x*2 for x in range(256)) # List comprehension [x*2 for x in range(256)]
|python|generator|list-comprehension|
Think about the 2 types of testing and treat them differently - functional testing and performance testing. Use different inputs and metrics for each. You may need to use different software for each type of test.
Here is a really interesting article about how to write one: (Even better, he gives the full source to a JavaScript formatter and colorizer.) [Implementing a syntax-higlighting JavaScript editor in JavaScript](http://marijn.haverbeke.nl/codemirror/story.html) or A brutal odyssey to the dark side of the DOM tree ...
I'm probably going to be flamed for this, but if you aren't out for a free product MS Team Foundation Server is worth a look. Unlike other MS products that will remain nameless the source control is solid and fully functional. Combine that with the IDE integration, automated build / test engine and work management func...
I would use pure ruby (Matz Ruby Interpreter (MRI)) to start off. My understanding is that iron ruby is not quite ready yet. If you are looking for a good book my current favorite (over pickaxe) is http://www.amazon.com/gp/product/0596516177 by matz and flanagan, the book is very concise well written paragraphs and...
Use XStream(http://xstream.codehaus.org/). You can even control which properties you can ignore through annotations or explicitly specifying the property name to XStream class. Moreover you do not need to implement clonable interface.
function ReadCookie(cookieName) { var theCookie=""+document.cookie; var ind=theCookie.indexOf(cookieName); if (ind==-1 || cookieName=="") return ""; var ind1=theCookie.indexOf(';',ind); if (ind1==-1) ind1=theCookie.length; return unescape(theCookie.substring(ind+cookieName.length+1,ind1)); }
[Perforce][1] is an excellent tool, but beyond 2 users it will cost you as it's aimed at professionals. [1]: http://www.perforce.com
[Perforce][1] is an excellent tool, but beyond 2 users it will cost you as it's aimed at professionals. We use it with a pretty heavy branching scheme (1 branch per feature during main development) and it works well. Kind of like the "Spider web" branching used by Microsoft (which used a modified older version of Per...
What is a good alternative to subversion that has excellent branching and merging support?
|branch|merge|version-control|svn|
I'm sick and tired of manually tracking my branches and merges across my repository! It's too error prone. In a world where everyone seems to get the idea of reducing duplication and automating everything, subversion branching/merging feels like it's left over from the 80's. What is a good alternative to subversion tha...
What is a good, non-distributed, alternative to subversion that has excellent branching and merging support?
|version-control|branch|merge|svn|
I'm sick and tired of manually tracking my branches and merges across my repository! It's too error prone. In a world where everyone seems to get the idea of reducing duplication and automating everything, subversion branching/merging feels like it's left over from the 80's. What is a good alternative to subversion tha...
Intellsense is problematic. Very problematic. When it works, it's great, but more often than not it will cause more problems than it's worth. It will hang up, it will parse through files while you are trying to compile code and will generally make VC 2005 sometimes run like a dog. As a previous poster suggested, di...
You could use a regular expression validator on the upload control: <asp:RegularExpressionValidator id="FileUpLoadValidator" runat="server" ErrorMessage="Upload Excel files only." ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.xls|.XLS|.xlsx|.XLSX)$" ControlToValidate="fileUplo...
You could use a regular expression validator on the upload control: <asp:RegularExpressionValidator id="FileUpLoadValidator" runat="server" ErrorMessage="Upload Excel files only." ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.xls|.XLS|.xlsx|.XLSX)$" ControlToValidate="fileUpload"> </asp:Reg...
The Vermont HighTest: http://www.vtsoft.com/vcsproducts/index.html The 30 day trial looked pretty good!
I found that setting height=0 width=0 worked the same as hidden=true and solved the problem
I've used both NHibernate and LINQ to SQL. From my point of view it depends on the project, if I need something quick, I would choose L2S, it's so simple to create the dbml mapping and start using it. If I'm developing a more highlevel enterprise solution I would go for the tried and trusted ORM - NHibernate, I find t...
The two “overloads” aren't in the same scope. By default, the compiler only considers the smallest possible name scope until it finds a name match. Argument matching is done *afterwards*. In your case this means that the compiler sees `B::DoSomething`. It then tries to match the argument list, which fails. One solut...
Overload resolution is one of the ugliest parts of C++ Basically the compiler finds a name match "DoSomething(int)" in the scope of B, sees the parameters don't match, and stops with an error. It can be overcome by using the A::DoSomething in class B class A { public: int DoSomet...
Why is access denied when installing SSL cert on IIS 5?
|ssl|permissions|iis-5|windows-server-2000|
I'm working with a support person who is supposed to be able to install SSL certs on a web server he maintains. He has local admin rights to the server via a domain security group. He also has permissions on our internal CA running Windows 2003 Server Certificate Authority: "Request cert" and "Issue and Manage certs"...
There's just no reason to *build* your app using Mono; the whole point of the .Net CLR is that the compiled output is cross-platform. So you can simply build it using your favourite IDE (and if you like IDEs, Microsoft's is the best one to use) and then *test* it on Mono. Even if you get Mono working on Windows, it...
Not that I know of, unless you select from INFORMATION_SCHEMA, as others have mentioned. However, the SHOW command is pretty flexible, e.g.: SHOW tables like '%s%'
You bring up *Template Explorer* using Ctrl+Alt+T or trough *View > Template Explorer*. Then you can right click tree nodes to add new Templates or new folders to organize your new templates.
Rails, Restful Authentication & RSpec - How to test new models that require authentication
|ruby-on-rails|rspec|restful-authentication|testing|
I've created a learning application using [Bort][1], which is a base app that includes Restful Authentication and RSpec. I've got it up and running and added a new object that requires users to be logged in before they can do anything(`before_filter :login_required` in the controller). I've created the new model/co...
I have a basic cs-major understanding of multi-threading but have never had to do anything beyond simple timers in an application. Does anyone know of a good resource that will give me a tour how to work with multi-threaded applications, explaining the basics and maybe posing some of the more difficult stuff? Since ...
You can use Excel with pivot tables for that, no need to write any queries at all, they can drill down to all the data they need
xslt: apply-templates in reverse order
|xslt|sorting|
say i have this given xml file <root> <node>x</node> <node>y</node> <node>a</node> </root> and i want the following to be displayed ayx using something similar to <xsl:template match="/"> <xsl:apply-templates select="root/node"/> </xsl:template> ...
Joseph, JP, and CodingTheWheel all provided valuable help. For my simple case, the most straight-forward approach seemed to be based on [CodingTheWheel's answer](http://stackoverflow.com/questions/45286/how-can-i-overwrite-the-same-portion-of-the-console-in-a-windows-native-c-conso#45316): // before entering ...
@Gulzar Thank you for this piece of info : It needs to be created and run from the UI thread for thread switching to happen properly. One thing to watch for when using a background worker that I have found is exception handlings. If an exception is thrown on the async process it will not throw an exception to the...
Easy! <xsl:template match="/"> <xsl:apply-templates select="root/node"> <xsl:sort select="position()" data-type="number" order="descending"/> </xsl:apply-templates> </xsl:template> <xsl:template match="node"> <xsl:value-of select="."/> </xsl:template>
I think there are different ways to do this. Since im not familiar with asp i can only give you some hints to check for a specific filetype: 1) the safe way: get more informations about the header of the filetype you wish to pass. parse the uploaded file and compare the headers 2) the quick way: split the name o...
The previously mentioned JNI approach will likely work. You can use JNA which is basically a wrapper around JNI to make it easier to use. An added bonus is that it (in my opinion at least) generally is faster and more maintainable than raw JNI. You can find JNA at https://jna.dev.java.net/ If you're just star...
Pretty much all cards since DX7-level technology (GeForce 2 / Radeon 7000) can do it. Most notable exceptions are Intel cards (Intel 945 aka GMA 950 and earlier can't do it; I think Intel 965 aka GMA X3100 can't do it either). Older cards (GeForce 2 / 4MX, Radeon 7000-9250) were using supersampling (render everythin...
When you define a function in a derived class then it hides all the functions with that name in the base class. If the base class function is virtual and has a compatible signature then the derived class function also overrides the base class function. However, that doesn't affect the visibility. You can make the ba...
When searching up the inheritance tree for the function to use, C++ uses the name without arguments, once it has found any definition it stops, then examines the arguments. In the example given, it stops in class B. In order to be able to do what you are after, class B should be defined like this: class B : publ...
If you wrote the applet and have source, then you could try to migrate the Java Applet to a J# Browser control and stuff that in your .net application. Here is a link - http://msdn.microsoft.com/en-us/library/aa290083(VS.71).aspx
The function is hidden by the function with the same name in the subclass (but with a different signature). You can unhide it by using the using statement, as in using A::DoSomething();
The problem may be cause by VB.NET & C# projects using different naming conventions for project assemblies and how the project namespace is used. At least that's were I would start looking.
That depends a bit on what you want to do. First, check out libraries that provide connectivity to more than on DBMS platform. For example, Qt makes it very easy to connect to MySQL, MS SQL Server and a bunch of others, and change the database driver (connection type) at runtime - with just a few lines of code. M...
Programming a simple IRC (Internet-Relay-Chat) Client.
|ruby|shoes|irc-protocol|irc|
I started using IRC at a young age, and I have always been fascinated with it. As a language exercise, I was thinking about programming a simple IRC client in Ruby with [Shoes][1] as a graphical front-end. My question to you, kind-sirs, what do I need to become familiar with to start on this great adventure (besides ...
|irc-protocol|irc|language-agnostic|
I started using IRC at a young age, and I have always been fascinated with it. As a language exercise, I was thinking about programming a simple IRC client in Ruby with [Shoes][1] as a graphical front-end. My question to you, kind-sirs, what do I need to become familiar with to start on this great adventure (besides ...
|ruby|language-agnostic|irc|shoes|irc-protocol|
Iterator objects in python conform to the iterator protocol, which basically means they provide two methods: __iter__() and next(). The __iter__ returns the iterator object and is implicitly called at the start of loops. The next() method returns the next value and is implicitly called at each loop increment. next...
The following entry in `/etc/fstab` will do what you want, even on 10.5 (Leopard): LABEL=VolumeName none ntfs noauto If the file is not already there, just create it. Do not use `/etc/fstab.hd`! No reloading of `diskarbitrationd` needed. If this still doesn't work for you, maybe you can find a hint ...
Number 2 is often quoted as being the "clever" way of doing it. It is in fact most likely slower as it obscures the explicit aim of the programmer - swapping two variables. This means that a compiler can't optimize it to use the actual assembler ops to swap. It also assumes the ability to do a bitwsie xor on the object...
The single * means that there can be any number of extra positional arguments. `foo()` can be invoked like `foo(1,2,3,4,5)`. In the body of foo() param2 is a sequence containing 2-5. The double ** means there can be any number of extra named parameters. `bar()` can be invoked like `bar(1, a=2, b=3)`. In the body of ...
When setting cookies manually, use the following parameter syntax to the [header()][1] function: header("Set-Cookie: name=value; httpOnly"); If you have PHP 5.2.0 you can also use the [setcookie()][2] and [setrawcookie()][3] functions. Simply set the 7th parameter to true, as per the syntax bool setcoo...
When setting cookies manually, use the following parameter syntax to the [header()][1] function: header("Set-Cookie: name=value; httpOnly"); However, if you have PHP **5.2.0** or greater, then you can use the [setcookie()][2] and [setrawcookie()][3] functions. Simply set the 7th parameter to true, as per the ...
Using a library like jQuery will save you countless hours of browsers inconsistencies. In this case with jQuery you can just $(document).ready ( function () { //your code here }); If you are curious you can take a look at the source to see how it is done, but is this day and age I don't think...
|ruby-on-rails|testing|rspec|restful-authentication|
I've created a learning application using [Bort][1], which is a base app that includes Restful Authentication and RSpec. I've got it up and running and added a new object that requires users to be logged in before they can do anything(`before_filter :login_required` in the controller). [edit: I should also mention th...
The alternative I'm not seeing here is a "Branch on Change" philosophy. Instead of having your trunk the "Wild West", what if the trunk is the "Current Release"? This works well when there is only one version of the application released at a time - such as a web site. When a new feature or bug fix is necessary a b...
Another little nugget that I think will help people developing and being more productive in there database development. I am a fan of stored procedures and functions when I develop software solutions. I like my actual CRUD methods to be implemented at the database level. It allows me to balance out my work between t...
[Here][1] is the only solution that works for me. [1]: http://stackoverflow.com/questions/39474/how-to-get-intellisense-to-reliably-work-in-visual-studio-2008
Dev C++,It uses GCC,<br> The line is:<br> Stone *stone[48];<br> and it says:"expected constructor, destructor, or type conversion before '*' token ".
Dev C++,It uses GCC, The line is: Stone *stone[48]; and it says: "expected constructor, destructor, or type conversion before '*' token ".
How to implement "DOM Ready" event in a GreaseMonkey script?
|javascript|firefox|greasemonkey|
I'm trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but this event never fires. I'm using FireFox 2.0.0.16 / GreaseMonkey 0.8.20080609 [This](http://stackoverflow.com/questions/59205/enhancing-stackoverflow-user-experience) is the full script that I'm trying to mod...
Thanks to Simon Murphy for the answer:- [Smurf on Spreadsheets][1] //It is necessary to select the cell to apply the formatting to Excel4 (xlcSelect, 0, 1, &xRef); //Then we apply the formatting Excel4( xlcFormatNumber, 0, 1, &xFormat); [1]: http://smurfonspreadsheets.wordpress.com/2008/...
Check that all the code writing files on disk properly close every handle using the proper .Close() in the finally clause or trough the "using" clause of C# <br/><br/> byte[] asciiBytes = getPdf(...);<br/> try{<br/> BinaryWriter bw = new BinaryWriter(File.Create(filename));<br/> bw.Write(pdfBytes);<br/> }<br/> f...
1. This sounds like a client-side error. Do you get the same message when running through SQL Management Studio? 2. Have you confirmed that there isn't another procedure with the same name that's owned by a different schema/user?
asp:Panel has a property named DefaultButton. You just need to encapsulate your markup portions with appropriate panels and set the default buttons for each.