instruction
stringlengths
0
30k
I'd use this code... (Basically what Lars said) dialog := TDialogForm.Create( parentForm ); dialog.PopupParent := parentForm; dialog.PopupMode := pmExplicit; dialog.ShowModal();
I found [TinyMCE][1] pretty easy to implement. And it's light on bandwidth usage too. [1]: http://tinymce.moxiecode.com
If it is just an internal application, then you can avoid printing from the browser, and send a printout directly from the server to the nearest printer to the user.
Switch branch names in git
|git|branch|
There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Practically this works fine, I just now have a ...
There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Practically this works fine, I just now have a ...
Not sure if it helps, but there's also a utility called [Microsoft LogParser](http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx) that you can supposedly use to parse text-based log files and use them as if they were a database. From the website: > Log parser is a powerful, versatile > tool ...
Here's a good "How Do I" video that demonstrates data binding: <http://windowsclient.net/learn/video.aspx?v=52579>
Set ASP.net executionTimeout in code / "refresh" request
|c#|asp.net|
i'll have an ASP.net page that creates some Excel Sheets and sends them to the user. The problem is, sometimes I get Http timeouts, presumably because the Request runs longer than executionTimeout (110 Seconds per default). I just wonder what my options are to prevent this, without wanting to generally increase the ...
I've not really had to face this issue to much yet myself, so please keep that in mind.. Is there not anyway you can run the process async and specify a callback method to occur once complete, and then keep the page in a "we are processing your request.." loop cycle.. You could then open this up to add some nice UI ...
I've actually done this (set up my own server using phpMyID). It's very easy and works quite well. One thing that annoys me to no end is the use of HTML redirects instead of HTTP. I changed that manually, based on some information gotten in the [phpMyID forum][1]. However, I have switched to [myOpenId][2] in the mea...
As Chris Karcher said, you should probably use a user control. This will allow easy, VS-supported/-integrated reuse without having to manually fiddle with designer code.
Have a look at the standard module [shlex][1] and modify one copy of it to match the syntax you use for your shell, it is a good starting point If you want all the power of a complete solution for lexing/parsing, [ANTLR][2] can generate python too. [1]: http://docs.python.org/lib/module-shlex.html [2]: htt...
FWIW, the real problem was that I had included a semicolon at the end of my \set command: > \set owner_password 'thepassword'; The semicolon was interpreted as an actual character in the variable: > \echo :owner_password > thepassword; So when I tried to use it: > CREATE ROLE myrole LOGIN UNENCRYPTED PA...
An important point is that tail recursion is essentially equivalent to looping. It's not just a matter of compiler optimization, but a fundamental fact about expressiveness. This goes both ways: you can take any loop of the form while(E) { S }; return Q where `E` and `Q` are expressions and `S` is a sequence ...
I've always done it exactly the way you're describing. I'm curious to see if there's a more accepted approach.
> *is there a more standard pattern for doing stuff like this?* No, it sounds like you're using the right approach. If the dialog returns DialogResult.OK, assume that all the necessary properties in the dialog are valid.
One final word on PSQL variables: 1. They don't expand if you enclose them in single quotes in the SQL statement. Thus this doesn't work: > SELECT * FROM FOO WHERE BAR = ':myvariable' 2. To expand to a string literal in a SQL statement, you have to include the quotes in the variable set. However, the variab...
- [Gendarme][1] is an open source rules based static analyzer (similar to FXCop, but finds a lot of different problems). - [Clone Detective][2] is a nice plug-in for Visual Studio that finds duplicate code. - Also speaking of Mono, I find the act of compiling with the Mono compiler (if your code is platform indepen...
> How can I display the tile of the page > that contains the keyword in that > dialog? You can't. The Location column in the Topics Found dialog always contains the name of the source chm file of the topic. The only way to get around this is to use modular help, which comes with it's own share of problems and over...
Wny not use a table? Just have the first job update the table with it's status. The second job can use the table to check the status. That should do the trick if I am reading the question correctly. The table would (should) only have one row so it won't kill performance and shouldn't cause any deadlocking (of cours...
Why not use a table? Just have the first job update the table with it's status. The second job can use the table to check the status. That should do the trick if I am reading the question correctly. The table would (should) only have one row so it won't kill performance and shouldn't cause any deadlocking (of cours...
I believe anything non-trival you'll have to create a [Context Menu Handler][1]. http://msdn.microsoft.com/en-us/library/cc144171(VS.85).aspx You'll have to create a COM object that will create the menus and carry out the commands as they're clicked. [1]: http://msdn.microsoft.com/en-us/library/bb776881(...
I believe anything non-trival you'll have to create a [Context Menu Handler][1]. You'll have to create a COM object that will create the menus and carry out the commands as they're clicked. I've only done this using C++ and COM. I'm not sure if there are easier ways to do this. [1]: http://msdn.microsoft.com/...
Best Practices for AS3 XML Parsing
|xml|actionscript-3|flash|rss|fileparse|
I've been having some trouble parsing various types of XML within flash (specifically FeedBurner RSS files and YouTube Data API responses). I'm using a `URLLoader` to load a XML file, and upon `Event.COMPLETE` creating a new XML object. 75% of the time this work fine, and every now and again I get this type of exceptio...
|puzzle|algorithm|off-topic|
|puzzle|algorithm|
|algorithm|puzzle|
100 (or some even number 2N :-) ) prisoners are in a room A. They are numbered from 1 to 100. One by one (from prisoner #1 to prisoner #100, in order), they will be let into a room B in which 100 boxes (numbered from 1 to 100) await them. Inside the (closed) boxes are numbers from 1 to 100 (the numbers inside the bo...
100 (or some even number 2N :-) ) prisoners are in a room A. They are numbered from 1 to 100. One by one (from prisoner #1 to prisoner #100, in order), they will be let into a room B in which 100 boxes (numbered from 1 to 100) await them. Inside the (closed) boxes are numbers from 1 to 100 (the numbers inside the bo...
How to aggregate data from SQL Server 2005
|sql-server|ssas|reporting-services|
I have about 150 000 rows of data written to a database everyday. These row represent outgoing articles for example. Now I need to **show a graph using [SSRS][1] that show the average number of articles per day over time**. **I also need to have a information about the actual number of articles from yesterday**. The...
I have about 150 000 rows of data written to a database everyday. These row represent outgoing articles for example. Now I need to **show a graph using [SSRS][1] that show the average number of articles per day over time**. **I also need to have a information about the actual number of articles from yesterday**. The...
|sql-server|reporting-services|ssas|
I have about 150 000 rows of data written to a database everyday. These row represent outgoing articles for example. Now I need to **show a graph using [SSRS][1] that show the average number of articles per day over time**. **I also need to have a information about the actual number of articles from yesterday**. The...
How do you use script variables in PostgreSQL?
|postgresql|variables|sql|
In MS SQL Server, create my scripts to use customizable variables: declare @somevariable int select @somevariable = -1 insert into foo values ( @somevariable ) I'll then change the value of @somevariable at runtime, depending on the value that I want the particular situation. Since it's at the top of the sc...
|sql|postgresql|variables|
In MS SQL Server, create my scripts to use customizable variables: declare @somevariable int select @somevariable = -1 insert into foo values ( @somevariable ) I'll then change the value of @somevariable at runtime, depending on the value that I want the particular situation. Since it's at the top of the sc...
I don't think this is a good idea just like reading files or accessing the database in unit tests isn't a good idea. Your tests will become dependent on the state of an external piece of software. Or you will have a lot of setup and teardown code. If you write tests this way you can expect you'll spend a lot of extra t...
I would say exposing properties on your custom dialog is the idiomatic way to go because that is how standard dialogs (like the Select/OpenFileDialog) do it. Someone could argue it is more explicit and intention revealing to have a ShowBirthdayDialog() method that returns the result you're looking for, but following th...
The trick here is to not become a zealot. One thing to note here is that no one in the pro file system camp has listed a particular file system. Does this mean that everything from FAT16 to ZFS handily beats every database? No. The truth is that many databases beat many files systems, even when we're only ta...
ASP.NET MVC: Structuring Controllers
|asp.net-mvc|
So I'm embarking on an ASP.NET MVC project and while the experience has been a good one overall, I'm not quite as pleased with the spaghetti mess that my controllers have become. I've looked around online (CodeCampServer, etc...) and they all seem to suffer the same issue wherein controller methods violate SRP (single ...
@[Curt Hagenlocher](#12394) - that's back to front. I've no idea why so many have voted it up when it's wrong. `IDisposable` is for *managed* resources. Finalisers are for *unmanaged* resources. As long as you only use managed resources both @[Jon Limjap](#12375) and [myself](#12380) are entirely correct. F...
@[Curt Hagenlocher](#12394) - that's back to front. I've no idea why so many have voted it up when it's wrong. `IDisposable` is for *managed* resources. Finalisers are for *unmanaged* resources. As long as you only use managed resources both @[Jon Limjap](#12375) and [myself](#12380) are entirely correct. F...
> Is Visual Studio prompting you for the > path to the source file? No. > If it isn't then it doesn't think it has symbols > for the callstack. Setting the source > path should work without having to map > the exact original location. Symbols are loaded successfully. It shows the callstack, but double cl...
Looks like they've added controller.UpdateModel to address this issue, signature is: UpdateModel(object model, string[] keys) I haven't upgraded my app personally, so I'm not sure of the actual usage. I'll be interested to find out about this myself, as I'm using controller.ReadFromRequest as well.
100 (or some even number 2N :-) ) prisoners are in a room A. They are numbered from 1 to 100. One by one (from prisoner #1 to prisoner #100, in order), they will be let into a room B in which 100 boxes (numbered from 1 to 100) await them. Inside the (closed) boxes are numbers from 1 to 100 (the numbers inside the bo...
100 (or some even number 2N :-) ) prisoners are in a room A. They are numbered from 1 to 100. One by one (from prisoner #1 to prisoner #100, in order), they will be let into a room B in which 100 boxes (numbered from 1 to 100) await them. Inside the (closed) boxes are numbers from 1 to 100 (the numbers inside the bo...
I think what you're talking about is "obfuscation". There are lots of articles about it on the net: http://en.wikipedia.org/wiki/Obfuscation The "standard" tool for obfuscation on .NET is by Preemptive Solutions: http://www.preemptive.com/obfuscator.html They have a community edition that ships with Visual...
How do you stop the Designer generating code for public properties on a User Control?
|c#|winforms|
How do you stop the designer from auto generating code that sets the value for public properties on a user control?
I would say this.. "How do we normally deal with differences between components?" **Encapsulate what varies**.. You need to create an abstraction layer within you data access layer to get it to the point where it _doesn't care_ whether or not the database is MySQL or MS SQL..
Consolas for Visual Studio. It is the first thing I change when getting a new install setup. The second is inverting the main colors, white text on black background is much easier to stare at for hours in my opinion. ![Black text on white background][1] Versus ![White text on black background][2] The se...
How do I deal with quotes ' in SQL
|sql|oracle-database|
I have a database with names in it such as John Doe etc. Unfortunately some of these names contain quotes like Keiran O'Keefe. Now when I try and search for such names as follows: SELECT * FROM PEOPLE WHERE SURNAME='O'Keefe' I (understandably) get an error. How do I prevent this error from occurring. I am using ...
I would buy a book - the Adam Nathan WPF book is good. http://www.amazon.com/Windows-Presentation-Foundation-Unleashed-WPF/dp/0672328917
Found in under 30s on Google... [Oracle SQL FAQ](http://www.orafaq.com/wiki/SQL_FAQ#How_does_one_escape_special_characters_when_writing_SQL_queries.3F)
SSAS is an [ETL][1] tool. Basically you get data from somewhere (your outgoing articles), do something to it (aggregate), and put it somewhere else (your aggregates table, data warehouse, etc). Check the link for details. You probably won't be keeping all of the rows in the DB indefinitely and if you want to be abl...
I've been having some trouble parsing various types of XML within flash (specifically FeedBurner RSS files and YouTube Data API responses). I'm using a `URLLoader` to load a XML file, and upon `Event.COMPLETE` creating a new XML object. 75% of the time this work fine, and every now and again I get this type of exceptio...
|xml|flash|actionscript-3|rss|fileparse|
I've been having some trouble parsing various types of XML within flash (specifically FeedBurner RSS files and YouTube Data API responses). I'm using a `URLLoader` to load a XML file, and upon `Event.COMPLETE` creating a new XML object. 75% of the time this work fine, and every now and again I get this type of exceptio...
I've been having some trouble parsing various types of XML within flash (specifically FeedBurner RSS files and YouTube Data API responses). I'm using a `URLLoader` to load a XML file, and upon `Event.COMPLETE` creating a new XML object. 75% of the time this work fine, and every now and again I get this type of exceptio...
The answer to this was found by [shog9][1]. The postData parameter needs to be a nsIMIMEInputStream object as detailed in [http://developer.mozilla.org/index.php?title=En/Code_snippets/Post_data_to_window][2] [1]: http://stackoverflow.com/questions/36958/stackoverflow-ubiquity-command#36962 [2]: http://de...
If you want results you can rely on you need to make the testing scenario as realistic as possible, which makes option 1 by far your best bet. As you point out if you get results that aren't good enough with the other options you won't be sure that it wasn't due to the different database behaviour. How you generate...
I'd move to lists and solve it this way:<br/> 1. Sort both lists by id ascending using custom [Comparator](http://java.sun.com/j2se/1.5.0/docs/api/index.html?java/util/Comparator.html) if objects in lists aren't [Comparable](http://java.sun.com/j2se/1.5.0/docs/api/index.html?java/lang/Comparable.html) 2. Iterate ov...
Best practices for versioning your services with WCF?
100 (or some even number 2N :-) ) prisoners are in a room A. They are numbered from 1 to 100. One by one (from prisoner #1 to prisoner #100, in order), they will be let into a room B in which 100 boxes (numbered from 1 to 100) await them. Inside the (closed) boxes are numbers from 1 to 100 (the numbers inside the bo...
100 (or some even number 2N :-) ) prisoners are in a room A. They are numbered from 1 to 100. One by one (from prisoner #1 to prisoner #100, in order), they will be let into a room B in which 100 boxes (numbered from 1 to 100) await them. Inside the (closed) boxes are numbers from 1 to 100 (the numbers inside the bo...
|wcf|
I'm starting to work with my model almost exclusively in WCF and wanted to get some practical approaches to versioning these services over time. Can anyone point me in the right direction?
How to Throw an exception in a using block with .NET 2.0?
|ado.net|
I'm trying to leverage the using block more and more these days when I have an object that implements IDisposable but one thing I have not figured out is how to throw and exception as I would in a normal try/catch ... any code samples to point me in the right direction?
|ado.net|.net-2.0|exception|error-handling|
How to Catch an exception in a using block with .NET 2.0?
I'm trying to leverage the using block more and more these days when I have an object that implements IDisposable but one thing I have not figured out is how to catch an exception as I would in a normal try/catch/finally ... any code samples to point me in the right direction?
|exception|.net-2.0|ado.net|error-handling|
I'm trying to leverage the using block more and more these days when I have an object that implements IDisposable but one thing I have not figured out is how to catch an exception as I would in a normal try/catch/finally ... any code samples to point me in the right direction? Edit: The question was modified after r...
This does what you want in VBA Function GetNthExcelColName(n As Integer) As String Dim s As String s = Cells(1, n).Address GetNthExcelColName = Mid(s, 2, InStr(2, s, "$") - 2) End Function
The data is typically CRM-like, i.e. contacts, projects, etc. It would be fine to simply duplicate the data (e.g., if I only have 20,000 rows, I'll copy them five times to get my desired 100,000 rows). Merging, on the other hand, would only work if we never deploy the benchmarking tool publicly, for obvious privacy rea...
@pek<br/> Chained invocation is one of proposals for Java 7. It says that if a method return type is void, it should implicitly return **this**. If you're interested in this topic, there is a bunch of links and a simple example on [Alex Miller's Java 7 page](http://tech.puredanger.com/java7#chained).
How can I set breakpoints in an external JS script in Firebug
Yes, there are many .NET Framework collection, that does not implement generic IEnumerable. I think that's because after 2.0 there was no (at least not so match) development of the core part of FW. Meanwhile I suggest you to make use of following workaround: > using System.Link; ... var nodes = > GetTreeNode...
Yes, there are many .NET Framework collection, that does not implement generic IEnumerable. I think that's because after 2.0 there was no (at least not so match) development of the core part of FW. Meanwhile I suggest you to make use of following workaround: using System.Link; ... var nodes = ...
I suppose the name was chosen because the functionality <code>subprocess</code> is replacing was formerly in the <code>os</code> module as the <code>os.popen</code> function. There could be even ways to automate migration between the two.
`subprocess.Popen` replaces the group of `os.popenX` POSIX functions (which have a long history). I suppose that the name `Popen` makes it more likely for people used to the old functions to find and use the new ones. The [PEP for subprocess (PEP 324)][1] has a little bit of discussion on the name of the module but ...
I think the reason is to ensure that any result can be encompassed. so the natural choice is double as it is the largest data type.
Floating point constants should have the available highest precision. The result can be assigned to a float without undue trouble.