instruction
stringlengths
0
30k
We recently lost a database and I want to recover the data from de Production.log. Every request is logged like this: Processing ChamadosController#create (for XXX.XXX.XXX.40 at 2008-07-30 11:07:30) [POST] Session ID: 74c865cefa0fdd96b4e4422497b828f9 Parameters: {"commit"=>"Gravar", "action"=>"create", "fun...
I think the key thing with VAR is to only use it where appropriate i.e. when doing things in Linq that it facilitates (and probably in other cases). If you've *got* a type for something in the then you should use it - not to do so is simple laziness (as opposed to creative laziness which is generally to be encourag...
Rob Walker is right: the problem isn't specified in enough detail. Considering just parsers (and ignoring the question of whether they perform validation), there are two main flavors: tree-based—think DOM—and streaming/event-based—think [SAX](http://en.wikipedia.org/wiki/SAX) (push) and [StAX](http://en.wikipedia.org/w...
One specific case where var is difficult: offline code reviews, especially the ones done on paper. You can't rely on mouse-overs for that.
Timezone lookup from latitude longitude
|web-services|api|timezone|geocoding|
Is there any library (or even better, web service) available which can convert from a latitude/longitude into a time zone?
I still think var can make code more readable in some cases. If I have a Customer class with an Orders property, and I want to assign that to a variable, I will just do this: var orders = cust.Orders; I don't care if Customer.Orders is `IEnumerable<Order>`, `ObservableCollection<Order>` or `BindingList<Order>...
If I understand correctly, ClickOnce only checks for prerequisites with the first install of an application through the setup.exe file that contains the prerequisite information. If the user opens the app in the future it will check for new versions, but it does not launch the setup.exe again, thus not checking for any...
If I understand correctly, ClickOnce only checks for prerequisites with the first install of an application through the setup.exe file that contains the prerequisite information. If the user opens the app in the future it will check for new versions, but it does not launch the setup.exe again, thus not checking for any...
|.net|clickonce|
If I understand correctly, ClickOnce only checks for prerequisites with the first install of an application through the setup.exe file that contains the prerequisite information. If the user opens the app in the future it will check for new versions, but it does not launch the setup.exe again, thus not checking for any...
Command switch to toggle Notepads word wrap
|command-switch|
I have a costumer showing Notepad with a large set of data that looks totally misaligned if word wrap is on and I want to force it off. Is there a command switch to do this?
Before saving you maybe be able to use the auto-format shortcut. CTRL+K+D
The best way IMHO is to clearly outline exactly what the cost of implementing the new features will be. "It would be nice if" really starts to dwindle when the user starts to see the cost of such additions. Disagreeing with the customer about a feature usually gets you nowhere. If you blatently say NO to them th...
Depending on what you need a tree structure for, you might not need any pre-built implementation. Perl already supports them using arrays of arrayrefs. For example, a simple representation of this tree t / \ a d / \ / \ b c e ...
Have a look at this: [http://www.icu-project.org/][1] [1]: http://www.icu-project.org/ "International Components for Unicode"
How to find out if a file exists in C# / .NET?
|c#|.net|io|
I would like to test a string containing a path to a file for existence of that file (something like the -e test in Perl or the os.path.exists() in Python) in C#.
@Espo, the article in question relates to Exchange servers, not IIS7.0 SMTP server. From the summary: This article describes how to telnet to port 25 on a computer that runs Simple Mail Transfer Protocol (SMTP) services to troubleshoot SMTP communication problems. The information in this article, including error mes...
System.IO.File.Exists(path) [msdn][1] [1]: http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx
[System.IO][1] using System.IO; if (File.Exists(path)) { Console.WriteLine("file exists"); } [1]: http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx
**Oracle: SELECT ... START WITH ... CONNECT BY** Oracle has an extension to SELECT that allows easy tree-based retrieval. This query will traverse a table where the nesting relationship is stored in **parent** and **child** columns. select * from my_table start with parent = :TOP_ARTICLE ...
You can intercept the memory allocation functions and see if there are some memory zones not freed upon program exit (though it is not suitable for *all* the applications). It can also be done at compile time by replacing operators new and delete and other memory allocation functions. For example check in this [s...
Look at: man 3 backtrace And: #include <exeinfo.h> int backtrace(void **buffer, int size); These are GNU extensions.
Looking for a simple C# numeric edit control
|c#|edit|numeric|
I am a MFC programmer who is new to C# and am looking for a simple control that will allow number entry and range validation.
the thing that most people are forgetting is that when floating li items, all the item have to be the same height or the columns start getting out of whack. since you're using a server side language, my recommendation would be to use cf to split the list into 3 arrays, then you can use an outer ul to wrap the 3 inne...
the thing that most people are forgetting is that when floating li items, all the item have to be the same height or the columns start getting out of whack. since you're using a server side language, my recommendation would be to use cf to split the list into 3 arrays, then you can use an outer ul to wrap the 3 inne...
the thing that most people are forgetting is that when floating li items, all the item have to be the same height or the columns start getting out of whack. since you're using a server side language, my recommendation would be to use cf to split the list into 3 arrays, then you can use an outer ul to wrap the 3 inne...
How to tell if a process is running on a mobile device
|mobile|process|native|pocketpc|evc|
I have the handle of process 'A' on a Pocket PC 2003 device. I need to determine if that process is still running from process 'B'. Process 'B' is written in Embedded Visual C++ 4.0.
Using MySQL with Entity Framework
|mysql|ado.net|framework|entity|
Can't find anything relevant about Entity Framework/MySQL on Google so I'm hoping someone knows about it.
Use () and \x. A naive example that assumes the text within the tokens is always delimited by #: text (#+.+#+) text text (#+.+#+) text text The stuff in the () can then be grabbed by using \1 and \2 (\1 for the first set, \2 for the second in the replacement expression (assuming you're doing a search/replace ...
All of them should be sufficient for that. Unless you need some library that is only available in one language, I'd let personal preference guide me.
I don't have an XSLT editor here, but have you tried using *[local-name()='category']/@*[local-name()='term']
From svrist's link: > The first item in [http://java.sun.com/performance/jvmstat/faq.html][1] mentions an option which you can turn off to disable the whole suite of features: -XX:-UsePerfData. [1]: http://java.sun.com/performance/jvmstat/faq.html
According to the [filed bug report][1] there is a work-around: > This undocumented option will disable > the perfdata feature: > -XX:-UsePerfData It's worth mentioning that it is a feature though, not a bug. The above work-around just disables the feature. [1]: http://bugs.sun.com/bugdatabase/view_bug.do?b...
[VS Command Shell](http://www.codeplex.com/Wiki/View.aspx?ProjectName=VSCmdShell) Command shell in the Output pane. Far from perfect, but often very, very useful. Faster and easier to get to than a separate cmd and has easier copy/paste support.
If you're looking for a scripting language that will play well with Java, you might want to look at Groovy. It has the flexibility and power of Perl (closures, built in regexes, associative arrays on every corner) but you can access Java code from it thus you have access to a huge number of libraries, and in particula...
Well when you are using delimiters such as this basically you just grab the first one then anything that does not match the ending delimiter followed by the ending delimiter. A special caution should be that in cases as the example above [^#] would not work as checking to ensure the end delimiter is not there since a s...
Yes you have to synchronize access to collections objects. Alternatively, you can use the synchronized wrappers around any existing object. See [Collections.synchronizedCollection()][1]. For example: List<String> safeList = Collections.synchronizedList( originalList ); However all code needs to use the sa...
Ok, literally ten seconds after I posted this question, I got an email from the palm developer network that led me right where I needed to go. Frustrating. It appears that you'll need the PIM SDK, which is available through the Palm Developer network [here][1]. [1]: https://dts.pdn.palm.com/cgi-bin/palmdev.c...
What is the fastest way to convert float to int on x86
|c|optimization|floating-point|x86|
What is the fastest way you know to convert a floating-point number to an int on an x86 CPU. Preferrably in C or assembly (that can be in-lined in C) for any combination of the following: - 32/64/80-bit float -> 32/64-bit integer I'm looking for some technique that is faster than to just let the compiler do it...
The [Devel module](http://drupal.org/project/devel)'s "Theme developer" feature is handy for seeing what template files Drupal is looking for when it goes to theme something. See the screenshot on that page for an example.
I've been using a freeware windows tail program called baretail (google it) for ages that lets you do a windows-appified version of unix tail command. It lets you colorize lines dependent on whatever keywords you define. What's nice about it as a solution is its not tied to a specific language or setup, etc, you just...
Is it stupid to write a large batch processing program entirely in PL/SQL?
|oracle-database|plsql|batch-processing|
I'm starting work on a program which is perhaps most naturally described as a batch of calculations on database tables, and will be executed once a month. All input is in Oracle database tables, and all output will be to Oracle database tables. The program should stay maintainable for many years to come. It seems st...
Trip time calculation in relational databases
|sql|sql-server|mysql|oracle-database|postgresql|
I had this question in mind and since I just discovered this site I decided to post it here. Lets say I have a table with a timestamp and a state for a given "object" (generic meaning, not OOP object); is there an optimal way to calculate the time between a state and the next occurrence of another (or same) state (w...
I had a similar problem on a website I built full of case reports. I wanted the case reports where the victim name is known to sort to the top, because they are more compelling. Conversely I wanted all the John Doe cases to be at the bottom. Since this also involved people's names, I had the firstname/lastname sorting...
You cannot handle just feature creep - you need to organise your whole development process in an proper way. However from your description it seems that you just code what other people ask for and could not re-organise the process. In this scenario your best way to manage the requests effectively by havign a trackin...
**SELECT ... START WITH ... CONNECT BY** Oracle has an extension to SELECT that allows easy tree-based retrieval. This query will traverse a table where the nesting relationship is stored in **parent** and **child** columns. select * from my_table start with parent = :TOP_ARTICLE connect ...
What do you mean by backend and and frontend? If you mean using Java for the admin side of your site and PHP for the part that the public will see then there is nothing stopping you. The implications are that you will have to maintain two applications in different languages.
This isn't a direct answer to the question, because I feel it's already been answered above, however, one of the books that definitely had an impact on how I code is [Code Reading, Volume 1: The Open Source Perspective][1]. ![alt text][2] [1]: http://www.bookpool.com/ss?qs=0201799405 [2]: http://g.bookpool...
Generate field in MySQL SELECT
|mysql|
If I've got a table containing Field1 and Field2 can I generate a new field in the select statement? For example, a normal query would be: SELECT Field1, Field2 FROM Table And I want to also create Field3 and have that returned in the resultset... something along the lines of this would be ideal: SELE...
|sql|mysql|
Use: File.Exists(path) Edit: In System.IO
Use: File.Exists(path) MSDN: <http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx> Edit: In System.IO
You should take a look at <http://api.openoffice.org/>. A project for creating an API for Open Office. A few languages they say to support are: C++, Java, Python, CLI, StarBasic, JavaScript and OLE. [Java Example of a mailmerge in OpenOffice](http://codesnippets.services.openoffice.org/Writer/Writer.MailMerge.snip).
Try removing the IP restrictions for Relaying in the SMTP server, and opening it up to all relays. If it works when this is set, then you know that the problem has to do with the original restrictions. In this case, it may be a DNS issue, or perhaps you had the wrong IP address listed.
Here are a few more resources you should check out: 1. This DevExpress WinForms control: <http://www.devexpress.com/Products/NET/Controls/WinForms/Wizard/> 2. A home-grown wizards framework: <http://weblogs.asp.net/justin_rogers/articles/60155.aspx> 3. A wizard framework by Shawn Wildermut part of the Chris S...
php mail() not working windows 2003, IIS SMTP
|smtp|iis|php|
Using Outlook API to get to a specific folder
|c#|api|outlook|
I'm trying to write some C# code to get to a specific folder in an Outlook mailbox. I have the following code: Outlook.Application oApp = new Outlook.Application(); Outlook.NameSpace oNS = oApp.GetNamespace("mapi"); Outlook.Recipient oRecip = oNS.CreateRecipient("AccountNameHere"); oRecip.Resolve(...
My gut reaction is "why not?" A database is going to provide a framework for storing information, with all of the input/output/optimization functions provided in a documented format. You can go with a server-side solution, or a local database such as SQLite or the local version of SQL Server. Either way you have a r...
[This post](http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay) should give you most of the opinions you need about storing images in the database. Do you also mean 'should I use a database for the other information?' or are you just asking about the images?
<pre> SELECT id, count(*) INTO #tmp FROM tablename GROUP BY id HAVING count(*) > 1 SELECT * FROM tablename t WHERE EXISTS (SELECT 1 FROM #tmp WHERE id = t.id) DROP TABLE tablename </pre>
<pre> SELECT id, count(*) INTO #tmp FROM tablename WHERE date = @date GROUP BY id HAVING count(*) > 1 SELECT * FROM tablename t WHERE EXISTS (SELECT 1 FROM #tmp WHERE id = t.id) DROP TABLE tablename </pre>
prototype.js (used by scriptaculous) and swfobject.js might be incompatible. What are the versions of theses tools you are using ? Did you try to switch the order of the 'script' import tags in order to import swfobject first ?
The database won't help you much in dealing with the image data itself, but anything that manages a bunch of images is going to have meta-data about the images that you'll be dealing with. Depending on the meta-data and what you want to do with it, a database can be quite helpful indeed with that. And just because t...
I think this use of SSL is part of the Zend GData library so I assume it is correct. I think not having OpenSSL correctly installed is my main issue.
I think both have their places. You shouldn't simply use `DoSomethingToThing(Thing n)` just because you think "Functional programming is good". Likewise you shouldn't simply use `Thing.DoSomething()` because "Object Oriented programming is good". I think it comes down to what you are trying to convey. Stop thinki...
The decoupling between the search process and the search criteria jrudolf proposes in his example is excellent. I wonder why isnt it the most voted solution. Do i miss something?
I'd use a SortedList instead of a dictionary. You can still access it by Key, but you can access it by index as well. SortedList sCol = new SortedList(); sCol.Add("bee", "Some extended string matching bee"); sCol.Add("ay", "value matching ay"); sCol.Add("cee", "Just a standard cee"); ...
I rewrite all URLs referred by several popular sites to be redirected through the coralCDN. An example for Apache: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_USER_AGENT} !^Googlebot RewriteCond %{HTTP_USER_AGENT} !^CoralWebPrx RewriteCond %{QUERY_...
From the 2-D space there will be 2 valid rectangles that can be built. Without knowing the original matrix projection, you won't know which one is correct. It's the same as the "box" problem: you see two squares, one inside the other, with the 4 inside vertices connected to the 4 respective outside vertices. Are you lo...
Yes, because its an ELEMENT name, you can't explicitly remove it. Using XmlTextWriter's WriteStartElement and WirteStartAttribute, and replacing the attribute with empty spaces will likely to get the job done. I'm checking it out now. will update.
Try "ls -U" or "ls -f". "ls", by default, sorts the files alphabetically. If you have 2 million files, that sort can take a long time. If "ls -U" (or perhaps "ls -f"), then the file names will be printed immediately.
[PInvoke.NET addon](www.pinvoke.net) Menu to search for pre-written P/Invoke code. Much easier than working out the marshalling code yourself, especially when there are nasty unions and alignment requirements.
[PInvoke.NET addon](http://www.pinvoke.net) Menu to search for pre-written P/Invoke code. Much easier than working out the marshalling code yourself, especially when there are nasty unions and alignment requirements.
If you are going to be doing a lot of adding, *and* you will not be doing random access (such as <code>myArray[i]</code>). You could consider using a linked list (<code>LinkedList&lt;T&gt;</code>), because it will never have to "grow" like the <code>List&lt;T&gt;</code> implementation. Keep in mind, though, that you ...
SqlExpress would be your best bet, simply because you already have all the support that you need in System.Data.SqlClient. Other then that, there are some decent help on the MSDN.
yes, you pass the array of parameters. $rs = $db->Execute('select * from table where val=?', array('10')); Rest of their docs can be found here,<BR> http://adodb.sourceforge.net/#docs
[CodePlotter]http://www.codeproject.com/KB/macros/codeplotter.aspx and [CodePlotter Remixed](http://www.codeproject.com/KB/applications/codeplotterremoded.aspx)