instruction stringlengths 0 30k ⌀ |
|---|
|eclipse|ide|emacs|hints-and-tips| |
Having programmed through emacs and vi for years and years at this point, I have heard that using an IDE is a very good way of becoming more efficient.
To that end, I have decided to try using Eclipse for a lot of coding and seeing how I get on.
Are there any suggestions for easing the transition over to an IDE. ... |
If it is a fresh install not everything may be setup. Check SQL Server Configuration Manager, <http://msdn.microsoft.com/en-us/library/ms174212.aspx>. Step by step instructions <http://download.pro.parallels.com/10.3.1/docs/windows/Guides/pcpw_upgrade_guide/7351.htm>.
|
It sort of depends on your needs. If you're doing the work in memory on one machine, then ehcache will work perfectly, assuming you have enough RAM or a fast enough hard disk so that the overflow doesn't cause disk paging/thrashing. if you find you need to achieve scalability, even despite this particular operation ha... |
You have to watch people use your application. If you work in a reasonable sized company, do some 'hallway testing'. Pull someone who is walking past your door into the room and say something like, 'Could you please run the payroll on this system for the next month? It should only take two minutes'.
Hopefully they w... |
Sometimes there are two pieces of information that you just always pass around together, whether as a parameter, or a return value, or whatever. Sure, you could write your own object, but if it's just two small primitives or similar, sometimes a pair seems just fine. |
How can I get a history of the number of pages in Google's index for a particular site? |
you could use URL re-writting with a filter to look for "cs" or "vb" at the begining of each file and direct it to the appropriate directory. |
Command Pattern : How to pass parameters to a command ? |
|c#|design-patterns| |
My question is related to the command pattern, where we have the following abstraction (C# code) :
public interface ICommand
{
Execute();
}
Let's take a simple concrete command, which aims to delete an entity from our application. A `Person` instance, for example.
I'll have a `DeletePers... |
Is there a .NET performance counter to show the rate of p/invoke calls being made? |
|.net|performance|interop|pinvoke|analysis| |
Is there a .NET performance counter to show the rate of p/invoke calls made? I've just noticed that the application I'm debugging was making a call into native code from managed land within a tight loop. The intended implementation was for a p/invoke call to be made once and then cached. I'm wondering if I could hav... |
Honestly, I would setup replication for this, as if you don't lock tables you will get inconsistent data out of the dump.
If the dump takes longer time, tables which were already dumped might have changed along with some table which is only about to be dumped.
So either lock the tables or use replication. |
In Sybase SQL Anywhere, the columns and table information are stored separately, so you need a join:
select c.column_name from systabcol c
key join systab t on t.table_id=c.table_id
where t.table_name='tablename'
|
No, you're pretty much going to have to "screen scrape" every page. You might consider writing most this in JavaScript instead of C#. Depending on the HTML of the game site, this could be more or less difficult depending on whether they provide good id attributes on the page elements, etc... |
Short answer: based on the context, I can't tell whether this is just some quick-and-dirty code for personal use, or a key part of Goldman Sachs' latest internal accounting software, so I'll open by saying: eww. That's a rather funky sorting algorithm; try to use something a bit less "twisty" if you can.
Long answe... |
AJAX, like any technology can be a good thing or a bad thing depending on the situation and how it is implemented. If you have a specific need for the asynchronous process then it is a good tool to use. However, if you use it irresponsibly you can get into trouble. If you do use it, try to find a good framework that... |
Performance of what exactly? I'm going to assume you meant performance of an application in terms of user experience.
What Ajax appears to be best at is causing network traffic only when it's needed. Rather than downloading a honkin' great web page in one hit, it downloads only what's needed in as quick a manner a... |
At work we use good ol' [Ant][1] to build our Java servlets.
[1]: http://ant.apache.org/ |
I started experimenting with a way to do user documentation with these goals:
**Markdown/Html/Javascript/file-based relatively linked documents** for portability (_can run on local file system or you can throw it on a webserver_), built-in handling of screenshots (_interactively resize_), and open source in case any... |
`make` and `bash` on linux
`make` and `cmd` on windows |
Depending on the situation, AJAX may have a performance overhead or it can actually have better performance than an equivelantly functioning web site that doesn't use AJAX.
It's very easy to overuse AJAX to overload the server with tons of frivilous requests and it can also be a burden on the client's CPU. Conversel... |
The data management features for LCDS described here are certainly valid, however I believe they do not let you actually develop a solution faster. A developer still has to write ALL the data access code, query execution, extracting data from datareaders into value objects. ALL of this has been solved a dozen of times ... |
For example, you can't serialize classes implementing IDictionary interface. |
There is [XULRunner][1], which let's you build GUI apps like Firefox using JavaScript and XUL. It has a lot of extension to JavaScript though, using XPCOM. They also offer [Prism][2] which let's you build web apps that work offline, sort of like AIR. Yahoo uses it for their [Zimbra][3] email desktop client.
[1]:... |
PHP replace double backslashes "\\" to a single backslash "\" |
|php|replace|backslashes| |
Okay so im working on this php image upload system but for some reason internet explorer turns my basepath into the same path, but with double backslashes instead of one; ie:
C:\\Documents and Settings\\kasper\\Bureaublad\\24.jpg
This needs to become C:\Documents and Settings\kasper\Bureaublad\24.jpg. |
Data access is possible because you can set up a test database.
Generally the 'untestable' stuff is FTP, email and so forth. However, they are generally framework classes which you can rely on and therefore do not need to test if you hide them behind an abstraction.
Also, 100% code coverage is not enough on it's ... |
Besides the other answers, check out Leon's <a href="http://search.cpan.org/dist/CPAN--Mini-Webserver">CPAN::Mini::Webserver</a>, which gives you a <a href="http://search.cpan.org">CPAN Search</a> interface to your local CPAN copy.
If you want to do more fancy things, see my <A href="http://www.slideshare.net/brian_... |
http://developer.apple.com/iphone/
They have some pretty basic apps and some good articles. |
How can i temporarily load a font? |
|delphi| |
I need to load some fonts temporarily in my program. Preferably from a dll resource file. |
|winapi|delphi| |
The only reasons I've had to use them is when interfacing with 3rd party libraries that use C style strings. There might also be esoteric situations where you would use C style strings for performance reasons, but more often than not, using methods on C++ strings is probably faster due to inlining and specialization, ... |
The only reasons I've had to use them is when interfacing with 3rd party libraries that use C style strings. There might also be esoteric situations where you would use C style strings for performance reasons, but more often than not, using methods on C++ strings is probably faster due to inlining and specialization, ... |
### Limited Scope is Best ###
Use your second option:
for ( ... ) {
String s = ...;
}
### Scope Doesn't Affect Performance ###
If you disassemble code the compiled from each (with the JDK's `javap` tool), you will see that the loop compiles to the exact same JVM instructions in both cases. N... |
[TypeMock][1] (commercial) has a unit testing framework that automatically tries to find deadlocks in multithreaded applications and I think can be set up to run threads with predictable context switching.
I saw a demo this week at a show -- apparently it's in Alpha (called Racer)
[http://www.typemock.com/Typem... |
|seo| |
A Google search for "site:example.com" will tell you the number of pages of example.com that are currently in Google's index. Is it possible to find out how this number has changed over time? |
How to put up an off-the-shelf https to http gateway? |
|apache|http|https|webserver|gateway| |
I have an HTTP server which is in our internal network and accessible only from inside it. I would like to put another server that would listen to an HTTPS port accessible from outside, and forward the requests to that HTTP server (and send back the responses via HTTPS). I know that there are several ways to do this wi... |
How to secure database passwords in PHP? |
|php|database| |
When a PHP application makes a database connection it of course generally needs to pass a login and password. If I'm using a single, minimum-permission login for my application, then the PHP needs to know that login and password somewhere. What is the best way to secure that password? It seems like just writing it in t... |
If you've been using emacs/vi for years (although you listed both, so it seems like you may not be adapted fully to one of them), using said editor will probably be faster for you than an IDE. The level of mind-meld a competant emacs/vi user can achieve with a customized setup and years of muscle memory is astounding. |
In WinForms, you should be able to set the
Me.dataEvidence.SelectedRows
property to the row you want selected. |
Try making a couple of test applications just to get your feet wet. At first, it will probably feel more cumbersome. The benefits of IDEs don't come until you begin having a good understanding of them and their various capabilities. Once you know where everything is and start to understand the key commands, life gets e... |
One thing that helped me transition from Emacs to other IDEs was the idea that IDEs are terrible editors. I scoffed at that person but I now see their point.
An editor, like Emacs or Vim, can really focus on being a good editor first and foremost.
An IDE, like Visual Studio or Eclipse, really focuses on being a ... |
You could try setting the "disabled" flag on the input (type=submit) element, rather than just changing the style. That should entirely shut down the from on the browser side.
See: <http://www.prototypejs.org/api/form/element#method-disable> |
Read the doc...
And see what shortcuts/keybindings equivalents are with your familiar ones. Learn the new ones... |
For automated builds, I think the best tool going right now is JetBrain's Team City. The free version has all the features you'll need for most 5-10 person teams. Set up is easy, configuring new projects is painless (relatively), and most importantly, it's reliable.
For automated migrations, nothing beats PowerShe... |
NAnt for builds (but MSBuild, Rake, almost anything would be fine) and CruiseControl.NET for deployments. I'm currently working with the new Cruise from ThoughtWorks studios as it provides a better way to stage the various pipelines and let's me deploy any version I want to a target environment. |
Webforms with ASP.NET Ajax is *heaven*. The integration between the 2 is just amazing and feels so natural to work with.
Using webforms instead of mvc will give you the ability to utilize the lifecycle to develop very good and re-usable controls.
But I still like to add a little jQuery into the mix for traversin... |
The cunningly name [upload class][1] is very good and has a very responsive and supportive developer. Apart from uploading, it also has built-in support for lots of common image functions.
[1]: http://www.verot.net/php_class_upload.htm |
I use descent as well. I don't use it's debugger bit but that is because I'm editing on a windows desktop and building/running/debugging on a Linux server. |
Interfaces are not instantiable, so Bar cannot have an attribute of type iFoo, and Foo cannot have an attribute of type iBar.
You say you don't want an Association between Bar and Foo. So you could create a new Class (FooEx) and have that Class implement iFoo. Then Bar can have an Association to FooEx instead of Fo... |
Statistically speaking yes. You only retain about 20% of what you read and hear, but 80% of what you teach.
By writing about something or teaching about it, you force yourself to understand the concepts on a much deeper level. |
Statistically speaking yes. You only retain about 20% of what you read and hear, but 80% of what you teach.
By writing about something or teaching about it, you force yourself to understand the concepts on a much deeper level.
**UPDATE:**
I wanted to update this with some links to more concrete data to support... |
/* I type one liners with brackets like this */
if(0){return(0);}
/* If else blocks like this */
if(0){
return(0);
}else{
return(-1);
}
I never use superfluous whitespace beyond tabs, but always including the brackets saves heaps of time. |
One minor correction to the answer above: you can actually use the Express edition to compile your assembly. With WebORB you can simply deploy your DLLs into the /bin folder of the virtual directory and it will take care of enabling your classes as Flex Remoting services. You do not need to implement any special interf... |
Why not write a simple test application to find out? Here's one I wrote (excuse the C# instead of VB, but I have the C# Express version of VS2008 open at the moment).
[Serializable]
class TestClass
{
[NonSerialized]
public Queue<string> queue = new Queue<string>();
}
c... |
I don't mean to be presumptive, but it seems like the purpose of your **finished_flag** variable is to pause the main thread (at some point) until the thread **thrd** has completed.
The easiest way to do this is to use **boost::thread::join**
// launch the thread...
thrd = new boost::thread(boost::bind(... |
Not quite a unit test, but you could write some test code which repeatedly calls the code that will execute on different threads. Trying to create maximal interleaving between threads with a periodic or final consistency check. Of course this approach has the downside of not being reproducable, so you would need to use... |
I use Linux. I have a bunch of scripts that do anything I want. Typically I write a script whenever a "block" of work can be reused in the future. For example, simple refactorings, deployments, etc...
Over time I started to combine these blocks, hence getting ever more efficient.
Regarding the "load stuff at star... |
If you only need to covert tables and data, that's rather simple. Just use ODBC driver for InterBase, connect to it and pump the data.
But, if you need business logic as well, you cannot covert it just like that. You can convert regular tables and views without too much problems. Domain info would be lost but you do... |
You can use fsockopen() to redirect to the new web site while preserving your POST variables. There is a good tutorial on how to accomplish this [here][1].
In case that web site gets eaten by the Internet monster, I've copied and pasted the function but I suggest checking out the original web site for the context.
... |
Attend conferences and local user group meetings, get on twitter and start following a bunch of folks. Join or start up a mailing list (google groups is my favorite provider, Yahoo groups aren't half bad either) in your area to discuss issues.
Propose a talk at your local DNUG to have someone do a quick overview of... |
Ah, if I've misunderstood what cURL does, I guess i'll settle for a HTML form with JS auto-submit. Creates quite a bit more work for me, but if it's the only way, i'll have to do it.
Thanks for the help all. |
How to retrieve and set the default printer in Windows:
<http://support.microsoft.com/default.aspx?scid=kb;EN-US;246772> |
Well, here is the regex you will need...
^[A-Fa-f0-9]{32}$|^({|\\()?[A-Fa-f0-9]{8}-([A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}(}|\\))?$|^({)?[0xA-Fa-f0-9]{3,10}(, {0,1}[0xA-Fa-f0-9]{3,6}){2}, {0,1}({)([0xA-Fa-f0-9]{3,4}, {0,1}){7}[0xA-Fa-f0-9]{3,4}(}})$
But that is just for starters. You will also have to verify that the... |
In the constructor and stored as fields.
You will also want to eventually make your ICommands serializable for the undo stack or file persistence. |
Since I can never find time to go and dabble or play with new technologies, typically I choose one based on some small amount of information - maybe an article, maybe a recommendation of a friend - and then I force myself to use the new technology in a project that I'm working on. That how got into the current process... |
When it comes to database queries, always try and use prepared parameterised queries. The <code>mysqli</code> and <code>PDO</code> libraries support this. This is infinitely safer than using escaping functions such as mysql_real_escape_string.
Yes, mysql_real_escape_string is effectively just a string escaping funct... |
STL vectors with uninitialized storage? |
|c++|stl|vector|optimization| |
I'm writing an inner loop that needs to place `struct`s in contiguous storage. I don't know how many of these `struct`s there will be ahead of time. My problem is that STL's `vector` initializes its values to 0, so no matter what I do, I incur the cost of the initialization plus the cost of setting the `struct`'s mem... |
I'm writing an inner loop that needs to place `struct`s in contiguous storage. I don't know how many of these `struct`s there will be ahead of time. My problem is that STL's `vector` initializes its values to 0, so no matter what I do, I incur the cost of the initialization plus the cost of setting the `struct`'s mem... |
|c++|optimization|stl|vector| |
I'm writing an inner loop that needs to place `struct`s in contiguous storage. I don't know how many of these `struct`s there will be ahead of time. My problem is that STL's `vector` initializes its values to 0, so no matter what I do, I incur the cost of the initialization plus the cost of setting the `struct`'s mem... |
To clarify on reserve() responses: you need to use reserve() in conjunction with push_back(). This way, the default constructor is not called for each element, but rather the copy constructor. You still incur the penalty of setting up your struct on stack, and then copying it to the vector. On the other hand, it's poss... |
How to scroll only the right side of a table, listview, or datagrid? |
Like GUI Unit-testing, this is a bit of a Waterloo for Automated tests. True threads are by definition.. unpredictable.. they'll interfere in ways that can't be pre-determined. Hence writing **true** tests is difficult if not impossible.
However you have some company with this... I suggest searching through the arch... |
A favorite way is to leave the computer on at night or better, if it's a laptop, put it to sleep. Running a web browsing virtual machine in VMware or similar works also, you can set the VM start along with the machine and save its state on shutdown, so your web pages and email client stay open. This works for developme... |
Zero SQL deadlock by design - any coding patterns? |
|sql|sql-server|design-patterns|deadlock| |
I am encountering very infrequent yet annoying SQL deadlocks on a .NET 2.0 webapp running on top of MS SQL Server 2005. In the past, we have been dealing with the SQL deadlocks in the very empirical way - basically tweaking the queries until it work.
Yet, I found this approach very unsatisfactory: time consuming and... |
I find it a little puzzling that anyone would want to write a GUI for a Erlang program in something other than Erlang? Erlang's concurrency model makes it an excellent language to write GUIs in. UI elements and events map perfectly onto Erlang processes and messages.
|
SQLite / Firebird embedded for numeric data |
|sqlite|database| |
I have an experiment streaming up 1Mb/s of numeric data which needs to be stored for later processing.
It seems as easy to write directly into a database as to a CSV file and I would then have the ability to easily retrieve subsets or ranges.
I have experience of sqlite2 (when it only had text fields) and it seeme... |
I have an experiment streaming up 1Mb/s of numeric data which needs to be stored for later processing.
It seems as easy to write directly into a database as to a CSV file and I would then have the ability to easily retrieve subsets or ranges.
I have experience of sqlite2 (when it only had text fields) and it seeme... |
## <code>this</code> on a C++ compiler
The C++ compiler will silently lookup for a symbol if it does not find it immediately. Sometimes, most of the time, it is good:
* using the mother class' method if you did not overloaded it in the child class.
* promoting a value of a type into another type
But sometimes... |
DeletePersonCommand can have parameter in its constructor or methods . DeletePersonCommand will have the Execute() and in the execute can check attribute that will be passed by Getter/Setter previously the call of the Execute(). |
I would add any necessary arguments to the constructor of `DeletePersonCommand`. Then, when `Execute()` is called, those parameters passed into the object at construction time are used. |
Maybe you need to include this?
SetADProperty(newUser, "objectClass", "top")
Also, check what the required fields for `organizationalPerson` and `person` are...you might be missing one. |