instruction stringlengths 0 30k ⌀ |
|---|
As it turns out, `<C-[>` is exactly identical to Esc, they are the same character. So no need to wonder about any difference there. :) |
Check the sourcecode for Executors.newFixedThreadPool():
return new ThreadPoolExecutor(nThreads, nThreads,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
ThreadPoolExecutor has a getActiveCount() method. So you might eithe... |
Also you could think about the kind of things which make you want to browse the net, check your email, etc. For example, if a build I'm working on is taking too long my mind will wander.
So it actually pays off to make the build process as quick and efficient as you can make it, so you can make changes and test qui... |
I first ran across [Software Carpentry][1] looking at lists of python tutorials.. but its a lot more than a tutorial on python. turns out what I really learned was how to use subversion, and that none of my projects are better suited to python than to perl... yet.
[1]: http://swc.scipy.org/ |
The trick the [Getting Things Done][1] system teaches is to have a trusted system you can put action items into. That way you don't have to keep "juggling". To keep with the metaphor, you can put the other balls down and have confidence that they will not be forgotten. Then you can concentrate on a single ball at a tim... |
You might be able to make use of this technique to make design-time easier:
[http://aspadvice.com/blogs/ssmith/archive/2007/10/19/Render-User-Control-as-String-Template.aspx][1]
[1]: http://aspadvice.com/blogs/ssmith/archive/2007/10/19/Render-User-Control-as-String-Template.aspx
Basically you create an ins... |
Use `\r` instead of `\n`. |
Mark: Just wanted to point out that operator++'s are good candidates to be inlined, and if the compiler elects to do so, the redundant copy will be eliminated in most cases. (e.g. POD types, which iterators usually are.)
That said, it's still better style to use ++iter in most cases. :-) |
\r seems to work. |
I agree with Pascal on using winsock's gethostname() function.
Here you go:
#include <winsock2.h> //of course this is the way to go on windows only
void GetHostName(std::string& host_name)
{
WSAData wsa_data;
int ret_code;
char buf[MAX_PATH];
WSAStartup(MA... |
If you want to improve something, you first have to measure it.
I like [Rescuetime][1]. It logs all applications and websites you visit and how much time you spend there. You can tag applications/websites, i. e. with "work", "waste", "news" and get nice charts, productivity measures etc.
[1]: http://rescuetim... |
Ruby - Match All Occurrences Of a Regex |
|ruby|regex| |
Is there a quick way to find every match of a regular expression in Ruby? I've looked through the Regex object in the Ruby STL and searched on Google to no avail. Thanks! |
I've used D templates (think C++ without the pain and you'll be 50% there) to generate a AJAX based Object proxy. |
We choose to script everything, and that includes all stored procedures and schema changes. No wysiwyg tools, and no fancy 'sync' programs are necessary.
Schema changes are easy, all you need to do is create and maintain a single file for that version, including all schema and data changes. This becomes your convers... |
We choose to script everything, and that includes all stored procedures and schema changes. No wysiwyg tools, and no fancy 'sync' programs are necessary.
Schema changes are easy, all you need to do is create and maintain a single file for that version, including all schema and data changes. This becomes your convers... |
In general, it depends :)
I haven't had a lot of problems when the application side has just been updating the data through the forms. You can get warnings/errors when the same row has been updated by more than one user; but Access seems to be constantly updating its live record sets all the time.
Problems can h... |
If you have SSH installed, you should be able to run..
ssh-keygen
Then go through the steps, you'll have two files, id_rsa and id_rsa.pub (the first is your private key, the second is your public key - the one you copy to remote machines)
Then, connect to the remote machine you want to login to, to the fil... |
You can use this free .NET library to read/write MP3 metadata.
[Link][1]
[1]: http://home.fuse.net/honnert/hundred/?UltraID3Lib |
You could use an integer which is related to the row number but is not sequential. For example, you could take the 32 bits of the sequential ID and rearrange them with a fixed scheme (for example, bit 1 becomes bit 6, bit 2 becomes bit 15, etc..).
This will be a bidirectional encryption, and you will be sure that tw... |
I definitely see the value in using SQL Profiler while you're app is running, and EXPLAIN or SET STATISTICS will give you information about individual queries, but does anyone routinely put measurement points into their code to gather information about database queries ongoing - that would pick up on for example, a que... |
LINQ is just a set of new C# features: extension methods, lambda expressions, object initializers, anonymous types, etc.
"LINQ to SQL" on the other hand is something you can compare other SQL wrappers.
|
<b>Byteflow</b> is a blog engine, written on Python, using Django |
I think it all depends on time/effort. While a purist might say "only use tables for tabular data," I've used tables to ease cross-browser layouts in the past.
For me, it's matter of time utilization. I can either spend my time cranking away on the CSS to get it right or I can toss it in a table and spend far le... |
Your comment:
> No, the major problem is the amazingly
> disk-intensive initial import of data
> into the table. MyISAM time: 12
> minutes. InnoDB time: 3+ hrs. After my
> initial load, UPDATEs are non-existent
> and INSERTs are rare. No known
> solution to InnoDB's disappointing
> load operation.
suggests... |
If you go to Site Settings, under Galleries there is an option for Site Columns. You can create your choice list there. Then, under the Library Settings there is an option to Add From Existing Site Columns. You should be able to see and select your newly created column there. |
This may be that polish uses a specific font (special characters) which is not installed by default on an OS. So the pdf converter includes the complete font into the document in order to render it correctly at the destination.
This is just speculation though. |
In `/etc/subversion/servers` you are setting `http-proxy-host`, which has nothing to do with `svn://` which connects to a different server usually running on port 3690 started by `svnserve` command.
If you have access to the server, you can setup `svn+ssh://` as [explained here.][1]
[1]: http://svnbook.red-b... |
In `/etc/subversion/servers` you are setting `http-proxy-host`, which has nothing to do with `svn://` which connects to a different server usually running on port 3690 started by `svnserve` command.
If you have access to the server, you can setup `svn+ssh://` as [explained here.][1]
**Update**: You could also tr... |
I think the reason this comes up so much is that using html tables is easier to understand when creating structure and layout than CSS. Using CSS is more abstract but helps seperate your code.
<br><br>
In response to the "structure" argument...by definition, isn't using html tables giving structure to data so that y... |
In my opinion, having briefly tried Prototype, and then later trying and loving jQuery: the jQuery API just feels much cleaner and well thought out. John Resig, the creator/architect of jQuery really knows his stuff, and it shows in the design of jQuery, as well as the various other impressive JavaScript projects that... |
Check out [suneido][1].
I made a fairly complicated GIS app as an experiment with it some years ago (database, complex gui, reports, client/server). It was a pleasant experience (apart from some documentation issues...) and I became productive with it very fast.
I don't use it anymore mainly because:
- it's ... |
How can one host Flash content in a WPF application and use transparency? |
|wpf|flash| |
How can I go about hosting flash content inside a WPF form and still use transparency/alpha on my WPF window? Hosting a WinForms flash controls does not allow this. |
You don't "have" to change your workflow in a drastic way. You could, and in some cases you should, but that's not something version control dictates.
You just use the files as you would normally. Only under version control, once you reach a certain state of "finished" or at least "working" (solved an issue in your ... |
There are two things to remember in regards to .NET 2.0 and .NET 3.5.
1. The .NET Framework 3.5 is just a few libraries that run on top of .NET 2.0.
2. When developing in Visual Studio 2008 and targeting .NET 2.0 you can still use certain C# 3.0 language features such as Extension Methods since they are in fact a... |
You can use a security manager with the InetAddress.getByName(addr) call.
If the addr is not a dotted quad, getByName will attempt to perform a connect to do the name lookup, which the security manager can capture as a checkConnect(addr, -1) call, resulting in a thrown SecurityException that you can catch.
You c... |
To manage the general mayhem of the job, I try to use a toned down version of <a href="http://en.wikipedia.org/wiki/Getting_Things_Done">GTD</a> focusing mainly on trying to maintain <a href="http://www.43folders.com/izero">Inbox Zero</a> and pushing tasks into a todo list (I use <a href="http://rmilk.com">Remember the... |
If you were to make a branch and delete the result files from the branch, then merging your branch back into master would also try to delete the results from master. A file delete is a change just like any other.
Perhaps you could use the git submodule support to manage your code changes as a submodule of the fat re... |
First function moves the cursor to the last non-empty row in the column.
Second Function prints that columns row.
Selection.End(xlDown).Select
MsgBox (ActiveCell.Row)
|
Yes, we haved moved away from Stingray. It depends on what Stingray components you are using. For the grid control, you can use the free MFC gridcontrol from www.codeproject.com or the commercial one from http://www.bcgsoft.com/. The free one is OK but development has stalled, so no modern UI rendering etc.
The 'lay... |
I enjoy going to the library. The quiet but busy, concentrated atmosphere basically forces you to work. The change of venue also seems to shut out some of the busyness and maybe worries you have in day-to-day life. |
Okay, I found where I read that. This is all from "Learning Java" (O'Reilly 2005):
> The problem with a traditional JIT compilation is that optimizing code takes time. So a JIT compiler can produce decent results but may suffer a significant latency when the application starts up. This is generally not a problem fo... |
If you don't care about sub strings than a simple
>>> 'a short sized string with spaces '.split()
Performance:
>>> s = " ('a short sized string with spaces '*100).split() "
>>> t = timeit.Timer(stmt=s)
>>> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000)
171.39 usec/pa... |
These may be a bit heavy for you depending on your needs but:
http://www.nservicebus.com/
http://blog.phatboyg.com/masstransit/
|
The essential principles to drive home are:
- Microsoft tools are a good place to start, but it's possible to write better software faster by using other companion products
- Change is good, so always think about ways that code can be changed and verified quickly
- If it isn't tested, it's not production quality
... |
Depending on exactly how you are doing sorting you could use one of the above methods, or you could return to the DB and get the sorting done there if the columns are actually a number type, then add your decoration to it later. |
Reparenting a Window as a Tab in a GTK Notebook |
|gtk|gtk#| |
I'm using Mono with GTK# and am trying to display an existing window as a new tab in a GTK.Notebook. I'm currently re-parenting the widget to the notebook as follows:
<pre>
MyWindow myWindow = new MyWindow();
myWindow.Children[0].Reparent(myNotebook)
</pre>
Should I be doing this, or is there a better way to ... |
Well, I just created a bookmark in FF3, went back and updated it and added the following test:
javascript:alert('Wacky%20test%20yo');
Low and behold, after I saved and loaded, I was able to get my alert.
I'm sure you can work up something similar for your needs. |
I <a href="http://stackoverflow.com/questions/7244/anyone-know-a-good-workaround-for-the-lack-of-an-enum-generic-constraint">asked recently</a> about something similar.
If you use flags you can add an extension method to enums to make checking the contained flags easier (see post for detail)
This allows you to do... |
@Brad Barker
I think if you have to use nullable types, it's better to use Nullable<.T> rather than the question mark notation. It makes it eye-achingly obvious that magic is occurring.
Not sure why anyone would ever want to use Nullable<bool> though. :-)
Krzysztof Cwalina (one of the authors of Framwork Design... |
@Brad Barker
I think if you have to use nullable types, it's better to use Nullable<.T> rather than the question mark notation. It makes it eye-achingly obvious that magic is occurring.
Not sure why anyone would ever want to use Nullable<.bool> though. :-)
Krzysztof Cwalina (one of the authors of Framwork Desig... |
You can do:
SELECT column1, column2, column4 FROM table WHERE whatever
without getting column3, though perhaps you were looking for a more general solution? |
To the best of my knowledge, there isn't. You can do something like "SELECT col1, col2, col3, col4 FROM tbl" and manually choose the columns you want. However, if you want a lot of columns, then you might just want to do a "SELECT * FROM tbl" and just ignore what you don't want. |
To the best of my knowledge, there isn't. You can do something like "SELECT col1, col2, col3, col4 FROM tbl" and manually choose the columns you want. However, if you want a lot of columns, then you might just want to do a "SELECT * FROM tbl" and just ignore what you don't want.
In your particular case, I would sugg... |
I found this page, which shows a compact self-contained solution. It seems to work on every browser and has an explanation on how:
http://www.kryogenix.org/days/2007/09/26/shortloaded |
I believe the most beneficial quality of OOP is data hiding/managing. However, there are a LOT of examples where OOP is misused and I think this is where the confusion comes in.
Just because you can make something into an object does not mean you should. However, if doing so will make your code more organized/easie... |
three options:
1) create the new database, bring down the server, move the files from one database folder to the other, and restart the server. note that this will only work if ALL of your tables are myisam.
2) create the new database, use CREATE TABLE ... LIKE statements, then use INSERT ... SELECT * FROM statem... |
If you're using Apache, you can use mod_rewrite to statically cache your web pages. Lets say you're using PHP, and you have a request for "/somepage.php". In your .htaccess file you put the following:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^$ # let's not cache urls with queries
RewriteCond %{REQU... |
Okay, I found where I read that. This is all from "Learning Java" (O'Reilly 2005):
> The problem with a traditional JIT compilation is that optimizing code takes time. So a JIT compiler can produce decent results but may suffer a significant latency when the application starts up. This is generally not a problem fo... |
Get your self a Lotus Domino developer, it would be only a few hours work or less to create a scheduled agent that will pick up and process the email as it comes in. You don't want to go near API level code as this is far more complicated than you need. The file can be detached easily but you are limited by the fact th... |
I'm using my own templated collection class with exposed value type semantics, but internally it stores pointers. It's using a custom iterator class that when dereferenced gets a value reference instead of a pointer. Copying the collection makes deep item copies, instead of duplicated pointers, and this is where most o... |
Escaping all user input is enough for most sites. Also make sure that session IDs don't end up in the URL so they can't be stolen from the `Referer` link to another site. Additionally, if you allow your users to submit links, make sure no `javascript:` protocol links are allowed; these would execute a script as soon as... |
My way to think about it is, write what you want your code to look like first.
Once you have a sample of your target code (that right now does nothing) see if you can place a test scaffolding onto it.
If you can't do that, figure out why you can't.
Most of the time it's because you made a poor design decision (99%... |
Visual Studio: How to trigger an alarm when a breakpoint is hit? |
|visual-studio|breakpoints| |
Is there a way to trigger a sound or alarm when my breakpoint is hit? I'm using Visual Studio 2005/2008. |
Is there a way to trigger a beep/alarm/sound when my breakpoint is hit? I'm using Visual Studio 2005/2008. |
Rebind Access combo box |
|ms-access| |
I have an Access 2007 form that is searchable by a combobox. When I add a new record, I need to update the combobox to include the newly added item.
I assume that something needs to be done in AfterInsert event of the form but I can't figure out what.
How can I rebind the combobox after inserting so that the ... |
Nuking huge file in svn repository |
|svn|huge-files| |
As the local subversion czar i explain to everyone to keep only source code and non-huge text files in the repository, not huge binary data files. Smaller binary files that are parts of tests, maybe.
Unfortunately i work with *humans*! Someone is likely to someday accidentally commit a 800MB binary hulk. This ... |
Is there another way to do screen scaping apart from regular expressions? |
|screen-scraping|speculation| |
1. Use urlrewriteing.net for asp.net webforms, or routing with mvc. Rewrite www.site.com/en/something.aspx to url: page.aspx?lang=en.
UrlRewriteing.net can be easily configured via regex in web.config. You can also use routing with webforms now, it's probably similar...
2. with webforms, let every aspx page inherit... |
If you try opening up a project that can no longer be found, Visual Studio will prompt you for permission to remove it from the MRU list. So if you temporarily rename an appropriate top level folder to fake the projects' disappearance, you can get rid of the projects one by one. |
I'm just getting into ASP.NET MVC, so these are some early thoughts comparing it to Rails:
**Mostly manages to stick with static typing, at the expense of a little extra code.**
This will either give you the warm fuzzies or make you feel slightly shackled depending on how you feel about dynamic typing. For instan... |
Shouldn't you just use an HTTP HEAD request (Ruby `Net::HTTP::Head` method) to see if the resource is there, and only proceed if you get a 2xx or 3xx response? This presumes your server is configured to return a 4xx error code if the document is not available. I would argue this was the correct solution.
An alterna... |
What impact (if any) does Delphi 2009's switch to Unicode have on executable size and memory footprint? |
If your state machine is very simple, then I would say that you should just roll your own. You have more control over everything. You can deal with persistence on your own terms and not worry about how they do it.
WF does look pretty cool though, but I think that it's power probably lies in the fact that it is eas... |
Using PHP, what you want to do is checkout your entire project/site to a working folder on a test apache site. You should have the repository set up so this can happen with a single checkout, including any necessary sub folders.
Then you can make your changes and hit F5 to refresh as normal. When you're happy wi... |
Depending on the source control system, 'checkout' may mean different things. In the SVN world, it just means retrieving (could be an update, could be a new file) the latest copy from the repository. In the source-safe world, that generally means updating the existing file _and locking it._ The text below uses the S... |
Fast, Pixel Precision 2D Drawing API for Graphics App? |
|graphics|2d|drawing| |
I woud like to create a cross-platform drawing program. The one requirement for writing my app is that I have pixel level precision over the canvas. For instance, I want to write my own line drawing algorithm rather than rely on someone elses. I do not want any form of anti-aliasing (again, pixel level control is requi... |
I woud like to create a cross-platform drawing program. The one requirement for writing my app is that I have pixel level precision over the canvas. For instance, I want to write my own line drawing algorithm rather than rely on someone elses. I do not want any form of anti-aliasing (again, pixel level control is requi... |
Aside from ObjC, you can use the PyObjC or RubyCocoa bindings to access it also. If you're not picky about which language, I'd say use Ruby, as PyObjC is horribly badly documented (even the official Apple page on it refers to the old version, not the one that came with OS X Leopard)
Quartz Composer is probably the e... |
@ggasp Here is what I got off IBM's Information Center
> A node is a logical grouping of managed servers.
>
>A node usually corresponds to a logical or physical computer system with a distinct IP host address. Nodes cannot span multiple computers.
<http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp... |
Select all columns except one in MySQL? |
|mysql|select| |
I'm trying to use a select statement to get all of the columns from a certain MySQL table except one. Is there a simple way to do this? |
I'm trying to use a select statement to get all of the columns from a certain MySQL table except one. Is there a simple way to do this?
EDIT: There are 53 columns in this table (NOT MY DESIGN) |
I'm trying to use a select statement to get all of the columns from a certain MySQL table except one. Is there a simple way to do this?
EDIT: There are 53 columns in this table (NOT MY DESIGN)
Sounds like there's no good solution, thanks anyways guys. |
If the column that you didn't want to select had a massive amount of data in it, and you didn't want to include it due to speed issues and you select the other columns often, I would suggest that you create a new table with the one field that you don't usually select with a key to the original table and remove the fiel... |