instruction stringlengths 0 30k ⌀ |
|---|
For me VI is a good emergency editor, but not something I want to use if there is any other alternative available. I realize this is not for everyone though, I'm not saying it's horrid or anything, I just personally prefer a discoverable UI.
But you really have to know VI if you do anything significant in Linux!
... |
So clarify, you want the selected text to render somewhere besides directly below the text input. Correct?
ComboBox is just a composite of [Ext.DataView](http://extjs.com/deploy/dev/docs/?class=Ext.DataView), a text input, and an optional trigger button. There isn't an official option for what you want and hacking i... |
You could try putting the iframe inside a div and then use the div for the scrolling. You can control the scrolling on the div in IE without issues, IE only really has problems with iframe scrolling. Here's a quick example that should do the trick.
<html>
<head>
<title>iframe test</title>
... |
There is no one time all the data is populated. NSTableView does not store data, it dynamically asks for it from its data source (or bound-to objects if you're using bindings). It just draws using data it gets from the data source and ditches it. You shouldn't see the table ask for data for anything that isn't visib... |
Has your skin file should have the extension .skin? I always call them theme.skin and give them the same name as the folder. Eg in Theme col2, the folder is
App_Themes\col2
and contains the css and col2.skin
[Microsoft][1] is your best reference:
[1]: http://msdn.microsoft.com/en-us/library/ms247256(VS.80)... |
# [`:help NL-used-for-Nul`](http://www.vim.org/htmldoc/pattern.html#NL-used-for-Nul) |
# [`:help NL-used-for-Nul`](http://www.vim.org/htmldoc/pattern.html#NL-used-for-Nul)
> ## Technical detail:
> `<Nul>` characters in the file are stored as `<NL>` in memory. In the display
they are shown as "`^@`". The translation is done when reading and writing
files. To match a `<Nul>` with a search pattern y... |
C++ can't do this either. Did you mix up declaration with de<em>finition</em>? |
How to simulate pressing enter in html text input with Selenium? |
|user-interface|selenium| |
My friend who faced this error in the past recommends:
Try
- Backing up the DB. The maintenance plan includes truncation of these files.
- Also try changing the 'recovery mode' for the DB to *Simple* (instead of *Full* for instance)
Cause:
The transaction log swells up due to events being logged (Maybe y... |
lambdas are simply syntactic sugar on a delegate. The compiler ends up converting lambdas into delegates.
These are the same, I believe:
Delegate delegate = x => "hi!";
Delegate delegate = delegate(object x) { return "hi";}; |
Just to add to Free Wildebeest's answer I have also used [HSQLDB][1] to do a similar type testing where each test gets a clean instance of the DB.
[1]: http://hsqldb.org/ |
In Python how do I sort a list of dictionaries by values of the dictionary? |
|python|list|dictionary|sorting| |
I got a list of dictionaries and want that to be sorted by a value of that dictionary.
This
[{'name'='Homer', 'age'=39}, {'name'='Bart', 'age'=10}]
sorted by name, should become
[{'name'='Bart', 'age'=10}, {'name'='Homer', 'age'=39}]
|
|python|sorting|dictionary|list| |
I got a list of dictionaries and want that to be sorted by a value of that dictionary.
This
[{'name':'Homer', 'age':39}, {'name':'Bart', 'age':10}]
sorted by name, should become
[{'name':'Bart', 'age':10}, {'name':'Homer', 'age':39}]
|
What's the best way to handle long running process in an ASP.Net application? |
|asp.net|asp.net-ajax|.net|c#| |
In my web application there is a process that queries data from all over the web, filters it, and saves it to the database. As you can imagine this process takes some time. My current solution is to increase the page timeout and give an AJAX progress bar to the user while it loads. This is a problem for two reasons - 1... |
|c#|.net|asp.net|asp.net-ajax| |
In my web application there is a process that queries data from all over the web, filters it, and saves it to the database. As you can imagine this process takes some time. My current solution is to increase the page timeout and give an AJAX progress bar to the user while it loads. This is a problem for two reasons - 1... |
|html|http|forms|upload|post| |
|html|https|forms|upload|post| |
|html|http|forms|upload|post| |
Basically, something better than this:
> [input type="file" name="myfile" size="50"]
First of all, the "browse" button looks different on every browser. Unlike the "submit" button on a form, you have to come up with some [hack-y](http://www.quirksmode.org/dom/inputfile.html) way to style it.
Secondly, there's... |
Basically, something better than this:
> <input type="file" name="myfile" size="50">
First of all, the "browse" button looks different on every browser. Unlike the "submit" button on a form, you have to come up with some [hack-y](http://www.quirksmode.org/dom/inputfile.html) way to style it.
Secondly, t... |
The methods are perfect example for usage of overloading.
getEmployeeName(int batchID)
getEmployeeName(Object SSN)
getEmployeeName(String emailID)
getEmployeeName(SalaryAccount salaryAccount)
If the methods have common processing inside, just write one more getEmplyeeNameImpl(...) and extract... |
Processing Javascript RegEx submatches |
|javascript|regex|markdown| |
I am trying to write some JavaScript RegEx to replace user inputed tags with real html tags, so [b] will become <b> and so forth. the RegEx i am using looks like so
var exptags = /\[(b|u|i|s|center|code){1}]((.){1,}?)\[\/(\1){1}]/ig;
with the following JavaScript
s.replace(exptags,"<$1>$2</$1>");... |
So clarify, you want the selected text to render somewhere besides directly below the text input. Correct?
ComboBox is just a composite of [Ext.DataView](http://extjs.com/deploy/dev/docs/?class=Ext.DataView), a text input, and an optional trigger button. There isn't an official option for what you want and hacking i... |
Depends on what information you are looking to manage. Can you be more specific?
I use google reader to handle things i read, RememberTheMilk to remind me of what i have to do, and gmail overall to quickly store and search data/correspondences.
Oh and i use the <a href="http://www.43folders.com/2004/09/03/introducin... |
[FXCop][1] is a good start for coding problems/mistakes, [StyleCop][2] is good for coding style (obviously), but if neither of those two work then you then you can either write a parser yourself or use the [VBCodeProvider][3] class in the .Net Framework
[1]: http://go.microsoft.com/fwlink/?LinkId=70294
[2]: h... |
Seapine CM - Cross platform issue management and version control
http://www.seapine.com |
If your version of grep supports **-P (--perl-regexp)** option, then
grep -P '\r\n'
could be used.
|
Use FxCop, this isn't a project you want to undertake personally. The parsing/lexical rules involved and the possible catches would be insane. The only way I could imagine doing it while retaining a modicum of sanity would be to use Lisp thanks to the extreme amount of expressiveness, but again, best to use FxCop.
I... |
In a web interface, I've got a text field. When user enters text and accepts with enter, application performs an action.
I wanted to test the behavior with Selenium. Unfortunately, invoking 'keypress' with chr(13) insert representation of the character into the field.
Is there a way other then submitting the form... |
I would stick to something similar to what you are familiar with: there's no point being a stranger in your own project directory. :-)
Typical things I always have are lib|src, bin, test.
(I dislike these monster generators: the first thing I want to do with a new project is get some code down, not write a README... |
There is indeed no such thing as a forward declaration of enum. As an enum's definition doesn't contain any code that could depend on other code using the enum, it's usually not a problem to define the enum completely when you're first declaring it.
If you edit your question to include the original reason why you're... |
There is indeed no such thing as a forward declaration of enum. As an enum's definition doesn't contain any code that could depend on other code using the enum, it's usually not a problem to define the enum completely when you're first declaring it.
If the only use of your enum is by private member functions, you ca... |
The answer is "it depends".
It depends on what you're trying to achieve. I'm going to assume that you're aiming for more performance.
The simplest solution is to find another way to improve your performance. Run a profiler. Look for hot spots. Reduce unnecessary IO.
The next solution is to break your program i... |
Why doesn't BackColor work for TabControls in .NET? |
|.net|microsoft|controls|tabcontrol| |
If you use the standard tab control in .NET for your tab pages and you try to change the look and feel a little bit then you are able to change the back color of the tab pages but not for the tab control. The property is available, you could set it but it has no effect. If you change the back color of the pages and not... |
First, big NO on CVS. Using CVS in 2008 is like driving a 92 Isuzu Trooper. The only reason they are on the road, and that people spend money to maintain them, is for purely sentimental reasons. CVS is old hat, technology-wise, and you will regret it.
I'd generally steer away from open source tools in that size of a... |
Here's the code for getting the Center Lat/Long point of the map. This method works in both Road/Aerial and Birdseye/Oblique map styles.
function GetCenterLatLong()
{
//Check if in Birdseye or Oblique Map Style
if (map.GetMapStyle() == VEMapStyle.Birdseye || map.Get... |
Does the file it is looking for actually exist? Is it in that location?
It may be one of a few things I can think of:
1) The thing did not compile, and therefore does not exist.
2) It exists, but somewhere else, and the environment variable that tells it where to find it is set wrong.
3) The permissions are ... |
>>> import struct
>>> struct.pack('f', 3.141592654)
'\xdb\x0fI@'
>>> struct.unpack('f', '\xdb\x0fI@')
(3.1415927410125732,)
>>> struct.pack('4f', 1.0, 2.0, 3.0, 4.0)
'\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@'
|
For explicit time tracking for projects I use [SlimTimer][1]. I also run [RescueTime][2] to track my time implicitly, but I end up not looking at that data very often.
[1]: http://slimtimer.com
[2]: http://www.rescuetime.com/ |
Try using autocomplete="off" as an attribute of the text box. I've used it in the past to stop credit card details being stored by the browser but i dont know if it works with passwords. e.g. `print("<input type="text" name="cc" autocomplete="off" />");` |
Linked List in SQL |
|sql|data-structures| |
Whats the best way to store a linked list in a mysql database so that it can easily be pulled out in order. |
Whats the best way to store a linked list in a mysql database so that inserts are simple (i.e. you dont have to reindex a bunch of stuff every time) and such that the list can easily be pulled out in order. |
Capturing cout in Visual Studio 2005 output window? |
|c++|visual-studio| |
I created a C++ console app and just want to capture the cout/cerr statements in the Output Window within the Visual Studio 2005 IDE. I'm sure this is just a setting that I'm missing. Can anyone point me in the right direction? |
Access USB with Java, in order to find thumbdrive manufacturer's serial#/unique-ID |
|java|usb| |
Looking for a way to read the unique ID / serial# of a USB thumb drive;
please note that
- I am looking for the value that the manufacturer's value, not the one Windows allocates for it
- need to support multiple OSs (Windows, Unix, Mac), thus needs to be a Java solution
the idea is to be able to distinguish betw... |
I don't think we're getting to the actual issue here - [see this DDJ article][1].
The default value of the loader optimization attribute is SingleDomain, which "causes the AppDomain to load a private copy of each necessary assembly's code". Even if it were one of the Multi domain values "every AppDomain always maint... |
For memory usage, the following will work,
long total = Runtime.getRuntime().totalMemory();
long used = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
For CPU usage, you'll need to use an external application to measure it. |
Isn't "Function" a data type? |
Objective-C looks like a good match for your requirements (the latest version with optional GC), although it is too dynamic and Smalltalk-like for my taste. |
I've used swfupload quite a bit. It's pretty awesome: http://www.swfupload.org/ |
The presence of a method in a derived class hides all methods with the same name (regardless of parameters) in base classes. This is done to avoid problems like this:
class A {} ;
class B :public A
{
void DoSomething(long) {...}
}
B b;
b.DoSomething(1); // calls B::D... |
XNA is your best bet I think. Being supported by the .NET framework you can build for a Windows or Xbox 360 platform by simply changing a setting in Game Studio. Best yet, all the tools are free!
If you decide to go with XNA you can easily get started using their quickstart guide
[XNA Quickstart guide][1]
It has... |
Like you say most sites have a RSS feed today. Get a RSS Reader that sync between computers if you use more than one computer, so you don't have to mark alot of post as read. A good program is FeedDeamon, its free and sync between computers, there is even a online version as well, if you are on the road. FeedDeamon als... |
[JConsole][1] is an easy way to monitor a running Java application or you can use a Profiler to get more detailed information on your application. I like using the [NetBeans Profiler][2] for this.
[1]: http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html
[2]: http://profiler.netbeans.org/ |
There is no portable way to tell the amount of data coming from a pipe.
The only thing you could do is to read and process data as it comes.
For that you could use something like a [circular buffer][1]
[1]: http://en.wikipedia.org/wiki/Circular_buffer |
Connection pooling is a mechanism to re-use connections, as establishing a new connection is slow.
If you use an MSSQL connection string and System.Data.SqlClient then you're already using it - in .Net this stuff is under the hood most of the time.
A loop of 30k iterations might be better as a server side cursor ... |
[The Algorithm Design Manual][1] contains some interesting case studies with creative use of graphs. Despite its name, the book is very readable and even entertaining at times.
[1]: http://www.amazon.com/Algorithm-Design-Manual-Steve-Skiena/dp/0387948600 |
We use GUIDs as primary keys for all our tables as it doubles as the RowGUID for MS SQL Server Replication. Makes it very easy when the client suddenly opens an office in another part of the world... |
Interfaces on different logic layers |
|architecture| |
Say you have an application divided into 3-tiers. GUI, business logic and data access. In your business logic layer you have described your business objects. Getters, accessors and so on... you get the idea. The interface to the business logic layer guarantees safe usage of the business logic, so all the methods and ac... |
A little more info on the connection pooling thing... you're using it already with SqlClient, but only if your connection string is identical for each new connection you open. My understanding is that the framework will pool connections automatically when it can, but if the connection string varies even slightly from o... |
Just so you know why that rule doesn't work:
The reason that it isn't able to rewrite to **/home/other\_files/file.html** is that mod\_rewrite is parsing the path as **/home/webroot/home/other\_files/file.html** since from mod\_rewrite's point of view the preceding slash is equivelant to your document root of **/ho... |
Use an existing user-input sanitization library to clean *all* user-input. Unless you put a *lot* of effort into it, implementing it yourself will never work as well. |
the easist way would probably be to use the follow events in the global.asax file:
protected void Application_BeginRequest(Object sender, EventArgs e)
protected void Application_EndRequest(Object sender, EventArgs e)
You could also implement a custom httpmodule
|
Depends on your background and what you already know.
I found this a useful book though: <http://www.ineasysteps.com/books/details/?1840781246> |
I'm mystified by some of the answers that suggest DI as an alternative to using singletons; these are unrelated concepts. You can use DI to inject either singleton or non-singleton (e.g. per-thread) instances. At least this is true if you use Spring 2.x, I can't speak for other DI frameworks.
So my answer to the OP ... |
See [How It Works: Non-Yielding Resource Monitor][1] on the PSS SQL Server Engineers blog.
If this, and the linked whitepaper, don't help, then you're probably best to contact PSS (Microsoft Product Support Services) directly.
[1]:http://blogs.msdn.com/psssql/archive/2008/03/28/how-it-works-non-yielding-resource-... |
[W3Schools][1] are generally good for this type of stuff.
[1]: http://www.w3schools.com/xml/default.asp |
If you want to do it the old fashioned way , you need to connect with a socket to the webserver's port , and then send the following data :
GET /file.html HTTP/1.0
Host: site.com
<ENTER>
<ENTER>
then use the `Socket#getInputStream` , and then read the data using a BufferedReader , and parse the... |
If I've understood correctly, IEnumerable is derived from monads. I wonder if that might be an interesting angle of approach for those of us from the C# world?
For what it's worth, here are some links to tutorials that helped me (and no, I still haven't understood what monads are).
- [http://osteele.com/archive... |
Though I haven't tested this I imagine you can use "\r\n" appended to a string to simulate a new line. If not look for the languages equivalent to "Environment.NewLine;" ? |
There won't be much difference between EJB3 and Spring based on Performance. We chose Spring for the following reasons (not mentioned in the question):
- Spring drives the architecture in a direction that more readily supports unit testing. For example, inject a mock DAO object to unit test your business layer, or... |
How do I stop IIS7 dropping my cookies? |
|iis|http|windows-vista|iis-7|cookies|session| |
I'm using Windows Vista x64 with SP1, and developing an ASP.NET app with IIS7 as the web server. I've got a problem where my cookies aren't "sticking" to the session, so I had a google and found that there was a known issue with duplicate response headers overwriting instead of being added to the session. This problem ... |
|iis|https|windows-vista|cookies|iis-7|session| |
|iis|http|windows-vista|cookies|iis-7| |
Check out [makdepend][1]
[1]: http://www.xfree86.org/current/makedepend.1.html |
I have the Web developer add-on, so pressing Ctrl-Shift-O opens the Java console. (Firefox 3 on Ubuntu) |
We've put role_requirement into [Bort][1] too, as it's probably the best solution out there at the moment.
[1]: http://github.com/fudgestudios/bort/tree/master |
Checking FTP status codes with a PHP script. |
|php|http|ftp|server-response|pear| |