instruction
stringlengths
0
30k
We have different sites with around 100k users and they all work with normal databases. If most applications can access the db you can use this solution.
If you just want to do it for debugging purposes look into strace, which is built in top of the ptrace(2) system call which allows you to hook up code when a system call is done. See the PTRACE_SYSCALL part of the man page.
It should be noted that generally when creating stream based off another stream the new stream will close the one being passed in. So, to further reduce your example: using (Stream Reader sr = new StreamReader( new BufferedStream( new FileStream("c:\file.txt", FileMode.Open)))) { // all three get d...
I use [google-code-prettify][1]. It is the simplest to set up and works great with all C-style languages. [1]: http://code.google.com/p/google-code-prettify/
Merge multiple xslt stylesheets
|xslt|
I have a xslt stylesheet with multiple `xml:import`'s and I want to merge them all into the one xslt file. Are there any tools out there which can do this?
I have a xslt stylesheet with multiple `xsl:import`s and I want to merge them all into the one xslt file. It is a limitation of the system we are using where it passes around the xsl stylesheet as a xml object stored in memory. This is transmitted to remote machine where it performs the transformation. Since it is n...
I have a xslt stylesheet with multiple `xsl:import`s and I want to merge them all into the one xslt file. It is a limitation of the system we are using where it passes around the xsl stylesheet as a string object stored in memory. This is transmitted to remote machine where it performs the transformation. Since it i...
Generally speaking, you should not put anything into META-INF yourself. Instead, you should rely upon whatever you use to package up your JAR. This is one of the areas where I think Ant really excels: specifying JAR file manifest attributes. It's very easy to say something like: <jar ...> <manifest> ...
[Pygment](http://pygments.org/) is a good Python library to generate HTML, RTF, ANSI (terminal-style) or LaTeX code. It supports a [large range of languages](http://pygments.org/languages/) (C, C++, Lua, Erlang, ...) and you can even write your own output formatter.
compiling gdb
|gdb|
I am trying to build gdb for armv6 architecture. I will be compiling this package on a Fedora Linux-Intel x86 box. I read the process of installing the gdb , like 1.) Download the source pachage 2.) run configure -host 3.) make But i got lost in the process because i was not able to make out what will be t...
Something like ... ? ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=e:\My Documents\dBase;Extended Properties=dBase III" Dim dBaseConnection As New System.Data.OleDb.OleDbConnection(ConnectionString ) dBaseConnection.Open() From: <http://bytes.com/forum/thread112085.ht...
This is one of those questions where you have to look deeper and maybe rethink the original problem; in this case, "Why do you need an external IP address?" The issue is that the computer may not have an external IP address. For example, my laptop has an internal IP address (192.168.x.y) assigned by the router. The ...
This is one of those questions where you have to look deeper and maybe rethink the original problem; in this case, "Why do you need an external IP address?" The issue is that the computer may not have an external IP address. For example, my laptop has an internal IP address (192.168.x.y) assigned by the router. The ...
How should you go about learning ASP.NET after life as a ColdFusion developer?
|asp.net|coldfusion|
As someone who has spent around 10 years programming web applications with Adobe's ColdFusion, I have decided to add ASP.NET as a string to my bow. For someone who has spent so long with CF and the underlying Java, ASP.NET seems a little alien to me. How should I go about getting up to speed with ASP.NET so that I ...
Microsoft has a video called [ASP.NET for ColdFusion developers][1] you may be interested in. Edit, [here's another][2] [1]: http://www.asp.net/Learn/videos/video-27.aspx [2]: http://www.asp.net/learn/videos/video-28.aspx
`-[NSPasteboard types]` will return all the available types for the data on the clipboard, but it should return them ["in the order they were declared."][1] The documentation for `-[NSPasteboard declareTypes:owner:]` says that ["the types should be ordered according to the preference of the source application."][2] ...
I have an example working pretty well so far that fits your model: I Have Charlie and Bravo Tables Having the Foreign Key alpha_id from Alpha. Like your first example, except alpha is not the Primary Key, bravo_id and charlie_id are. I use alpha_id on every table I need to address to those entities, so, to avoid ...
Calling Console.ReadLine() in the delegate is bad because if the user doesn't hit 'enter' then that call will never return. The thread executing the delegate will be blocked until the user hits 'enter', with no way to cancel it. Issuing a sequence of these calls will not behave as you would expect. Consider the fo...
You can control whether the PropertyGrid displays a simple edit box, a drop-down arrow, or an ellipsis control. Look up EditorAttribute, and follow it on from there. I did have a sample somewhere; I'll try to dig it out.
As some people have mentioned, Javascript is the way to go. Bear in mind that the "validation" here is only by file extension, it won't validate that the file is a real excel spreadsheet!
Well I think the only way to for cross-platform reliably with C# is [Microsoft Silverlight][1], but is not really WinForms, and browser-based. Other than that, yes Mono is a chance. [1]: http://www.silverlight.net
Programming Perl (O'Reilly)
Take a look at [http://www.madshi.net/madExceptDescription.htm][1] [1]: http://www.madshi.net/madExceptDescription.htm
Of course, "it depends" on the situation. Sometimes DataSets or DataTables are more suited, like if it really is pretty light business logic, flat hierarchy of entities/records, or featuring some versioning capabilities. Custom object collections shine when you want to implement a *deep hierarchy/graph* of objects t...
There are tons of "tricky" constructs in C++. They go from "simple" implementions of [sealed/final classes][1] using virtual inheritance. And get to pretty "complex" meta programming constructs such as Boost's [MPL][2] ([tutorial][3]). The possibilities for shooting yourself in the foot are endless, but if kept in ch...
Thanks all for your reply, below is a synopsis of what I ended up doing. Now to test to see if the trans actually roll back in event of a fail. sSQL = "BEGIN TRANSACTION;" & _ " Update table set col1 = @col1, col2 = @col2" & _ " where col3 = @col3 and " & _ ...
Thanks all for your reply, below is a synopsis of what I ended up doing. Now to test to see if the trans actually roll back in event of a fail. sSQL = "BEGIN TRANSACTION;" & _ " Update table set col1 = @col1, col2 = @col2" & _ " where col3 = @col3 and " & _ ...
If you add this method to your form class: def get_cleaned_or_initial(self, fieldname): if hasattr(self, 'cleaned_data'): return self.cleaned_data.get(fieldname) else: return self[fieldname].field.initial you could then re-write your code as: ...
Text on a ProgressBar in WPF
|.net|wpf|controls|progress-bar|
This may be a no-brainer for the WPF cognoscenti, but I'd like to know if there's a simple way to put text on the WPF ProgressBar. To me, an empty progress bar looks naked. That's screen real estate that could carry a message about **what** is in progress, or even just add numbers to the representation. Now, WPF is all...
It's not direct answer to your question but if you're interested you might look at [Singularity project][1]. [1]: http://research.microsoft.com/os/Singularity/
The OP question was to ask why this problem occured. This post hopes to answer that while leaving possible solutions to be worked out by others. This is probably an index related issue. For example, lets say the table Posts has a non-clustered index X which contains the ParentID and one (or more) of the field(s) bei...
|drop-down-menu|onchange|autopostback|
I have a dropdownlist with the autopostback set to true. I want the user to be confirm if they really want to change the value, which on post back fires a server side event (selectedindexchanged). I have tried adding an onchange attribute "return confirm('Please click OK to change. Otherwise click CANCEL?';") but ...
|drop-down-menu|onchange|autopostback|asp.net|
I have a dropdownlist with the autopostback set to true. I want the user to confirm if they really want to change the value, which on post back fires a server side event (selectedindexchanged). I have tried adding an onchange attribute "return confirm('Please click OK to change. Otherwise click CANCEL?';") but it ...
|asp.net|drop-down-menu|onchange|autopostback|
I have a dropdownlist with the autopostback set to true. I want the user to confirm if they really want to change the value, which on post back fires a server side event (selectedindexchanged). I have tried adding an onchange attribute "return confirm('Please click OK to change. Otherwise click CANCEL?';") but it ...
Hex -> decimal: Convert.ToInt64(hexValue, 16); Decimal -> Hex string.format("{0:x}", decValue);
To remove the ability to shut down then your best bet is to create a group policy for the user/user group and specify that they can only restart the system. I have done this in the past to ensure that only the administrator account can shut down a computer. it has prevented me from mistakenly shutting down a remote pc ...
I think the best approach here is probably to use build scripts. You can have all your code in one location, and by choosing which files to include, and which not to include, you can choose what version of your code to compile. Note that this may not help if you need finer-grained control than per file.
I'd say get started with Python. It has a higher level of abstraction and it teaches you the importance of indenting and making "pretty" code. Not that "pretty" is very important, but it will make the future maintainer of your code a lot happier :) There's a lot of example code out there, and if you are into Linux t...
Of course, "it depends" on the situation. Sometimes DataSets or DataTables are more suited, like if it really is pretty light business logic, flat hierarchy of entities/records, or featuring some versioning capabilities. Custom object collections shine when you want to implement a *deep hierarchy/graph* of objects t...
The problem was that, for these fonts for some reason, you don't use the standard syntax I tried above: gnuplot> set terminal png font tiny But instead, you drop the word "font" for these five special fonts: gnuplot> set terminal png tiny
The same reference which is included in the Aptana IDE is online... just found this... they're really good: css http://www.aptana.com/reference/html/api/CSS.index.html HTML http://www.aptana.com/reference/html/api/HTML.index.html HTML DOM O http://www.aptana.com/reference/html/api/HTMLDOM0.index-frame.html ...
How to "Add Existing Item" an entire directory structure in Visual Studio
|visual-studio|ide|tips-and-tricks|
I feel ridiculous for asking this because it seems like it should be so simple, however I have been unable to discover an answer to this question. I have a free standing set of files not affiliated with any C# project at all that reside in a complicated nested directory structure. I want to add them in that format t...
You forgot the most important part member-access with pointers uses -> member-access with references uses . `foo.bar` is *clearly* superior to `foo->bar` in the same way that vi is *clearly* superior to emacs :-)
See the link below for a condensed walkthrough: [Cliff's Notes for a Team System Install][1] [1]: http://blogs.vertigosoftware.com/teamsystem/archive/2006/04/04/2512.aspx
Can you not just use something like the following? int numericValue = 0; if(false == int.TryParse(yourInput, out numericValue)) { // handle non-numeric input }
I've used Reporting Services and Crystal fairly extensively, and I'm writing a few reports using Excel(ick) at the moment. Reporting Services is pretty good for simple reports but as soon as you need total control over formatting,complex formulas and charts etc. Crystal is a long way ahead. I also find Crystal to be...
I like to use continue at the beginning of loops for handling simple if conditions. To me it makes the code more readable since there is not extra nesting and you can see that I have explicitly dealt with these cases. Is this the same reason that I would use a goto? Perhaps. I do use them for readability at tim...
Enable "Show All Files" for the specific project (you might need to hit "Refresh" to see them)**. The folders/files that are not part of your project appear slightly "lighter" in the project tree. Right click the folders/files you want to add and click "Include In Project". It will recursively add folders/files to t...
Can I override onbeforeunload for a particular element?
You cannot set secondary caching settings at property level (as far as I know), but you can individually tune cache settings for each entity directly in their XML files. For instance: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class ...
I run M2 (Opera's built-in mail client) and always have it set to "prefer plain text" for mail bodies. I also have "Block external elements" turned on.
/dev/rdsk/c0t0d0s0 means Controller 0, SCSI target (ID) 0, and s means Slice (partition) 0. Typically, by convention, s2 is the entire disk. This partition overlaps with the other partitions. prtvtoc /dev/rdsk/c0t0d0s0 will show you the partition table for the disk, to make sure.
If you use malloc/free instead of new/delete, malloc and free won't care about the type. So if you're using a C-like POD (plain old data, like a build-in type, or a struct), you can malloc some type, and free another. **note that this is poor style even if it works**.
Use log_errors for them to be logged instead of displayed
c0t0d0s0 *is* the entire drive. The breakdown is: /dev/[r]dsk/c **C** t **A** d0s **S** ...where **C** is the controller number, **A** is the SCSI address, and **S** is the "slice". Slice 0 is the whole disk; the other slices are the partition numbers. See [this](http://www.washington.edu/R870/DevicesDrivers.h...
Two steps: Step 1: Extract each set bit with `set_bit= x & -x; x&= x - 1;` Step 2: Subtract 1 and count bits set. MSN
I would too highly recommend IDA for reverse engineering if you want to see the assembly code and how the binaries have been compiled/linked. To simpley see "inside" binary files (exe, dll, sys, ...) try CFF Explorer, its free and its great: http://www.ntcore.com/exsuite.php you can examine the binary files stru...
Windows Presentation Foundation provides sophisticated support for [typography][1]. [1]: http://msdn.microsoft.com/en-us/library/ms742190.aspx
The URLs of your pages denote the identity of the content. In my view, if the content is the same but the presentation varies (i.e RIA vs. HTML), then the URL should be the same and you should use some other mechanism to select between the different presentation forms. Choices of other mechanisms include cookies, conte...
The same reference which is included in the Aptana IDE is online... just found this... it's really good: CSS http://www.aptana.com/reference/html/api/CSS.index.html HTML http://www.aptana.com/reference/html/api/HTML.index.html HTML DOM O http://www.aptana.com/reference/html/api/HTMLDOM0.index-frame.html ...
Auto number column in SharePoint list
|sharepoint|moss|
In a SharePoint list I want an auto number column that as I add to the list get's incremented. How best can I go about this? All the best Kieran
In a SharePoint list I want an auto number column that as I add to the list gets incremented. How best can I go about this? All the best Kieran
I just remembered another trick that I used to find out which static libraries were ill-behaving: 'grep' through the static libraries for the string '21022'. HOWEVER, don't use the 'normal' grep tools like wingrep because they won't show you these strings (they think it's a binary file and look for the raw, non-unicode...
One of my sites was recently hacked through SQL Injection. It added a link to a virus for every text field in the db! The fix was to add some code looking for SQL keywords. Fortunately, I've developed in ColdFiusion, so the code sits in my Application.cfm file which is run at the beginning of every webpage & it look...
Set the 'http_only' option in the hash used to set a cookie e.g. <pre>cookies["user_name"] = { :value => "david", :http_only => true }</pre>
SharePoint Content Query Web Part
|sharepoint|query|moss|list|
I have a content query web part that queries by content type against a site collection. I have grouped it by content type so I have: -- Agenda (Content Type) ----Agenda #1 ----Agenda #2 -- Report (Content Type) ----Report #1 ----Report #2 I would like to show a second grouping for sit...
I believe the only way is to do something similar to what you are doing, but use a fixed font and do your own padding with spaces so that you don't have to worry about tab expansion.
How do you quickly find the URL for a .NET framework method on MSDN?
|.net|productivity|
How to you find the URL that represents the documentation of a .NET framework method on the MSDN website?
How to you find the URL that represents the documentation of a .NET framework method on the MSDN website? For example, I want to embed the URL for the .NET framework method into some comments in some code. The normal "mangled" URL that one get's searching MSDN isn't very friendly looking: [http://msdn.microsoft.com...
|.net|productivity|
How to you find the URL that represents the documentation of a .NET framework method on the MSDN website? For example, I want to embed the URL for the .NET framework method into some comments in some code. The normal "mangled" URL that one gets searching MSDN isn't very friendly looking: [http://msdn.microsoft.com/...
Many of my colleagues are posting work updates on Twitter, being careful not to disclose company confidential information. From those working on open commercial development projects, I've even seen Twitter updates indicating which work item they were working on. Coolness.
When you need something like that on server side, you usually create a table which contains all possible dates between two points in time, and then left join this table with query results. Something like this: create procedure sp1(d1 date, d2 date) declare d datetime; create temporary table f...
[FireFTP][1] is good for grabbing/uploading any necessary files. [1]: http://fireftp.mozdev.org/
.NET CF Game Loop
|c#|game-loop|
Hi i want to write a game with a main game form and lot of other normal forms. What is the best way to manage update-paint cycle in that case? Should the game form paint loop only should be overriden? or should i do an application.do events() in the main method? Please guide me regarding this. i am new to windows...
Fighting with Protected Mode in Vista
|security|windows-vista|activex|mode|protected|
Our application commonly used an ActiveX control to download and install our client on IE (XP and prior), however as our user base has drifted towards more Vista boxes with "Protected Mode" on, we are required to investigate. So going forward, is it worth the headache of trying to use the protected mode API? Is thi...
The two connection limit is a "suggestion" and this [article][1] describes how to get around it where possible. Other Firefox configuration is discussed on this about the [about:config][2] capability in Firefox. Also, if you own the website, you can tweak the performance of the site using suggestions form this [boo...