instruction stringlengths 0 30k ⌀ |
|---|
Incidentally, is there a good reason for you not to use the strict doctype? strict should always be the default. transitional is only intended for legacy code. |
Is there a better way to create an object-oriented class with jquery? |
|javascript|jquery| |
I use the jquery [extend][1] function to extend a class prototype.
For example:
MyWidget = function(name_var) {
this.init(name_var);
}
$.extend(MyWidget.prototype, {
// object variables
widget_name: '',
init: function(widget_name) {
// do initialization h... |
Can I merge two Microsoft Word documents reliably with Subversion? |
|word|subversion|merge| |
We have concurrent edits happening on Word documents and I want to make sure that Subversion can handle merging .doc files. Do you know if Subversion handles merges of Word documents well? |
|svn|ms-word|merge| |
The iPhone YouTube application automatically downloads lower quality video when connected via EDGE than when connected via Wi-Fi, because the network is much slower. That fact leads me to believe Apple would make the design decision to not bother downloading an MP3 over EDGE. The browser has no way to know in advance... |
if (a % 2 == 0) {
} else {
} |
if (a % 2 == 0) {
} else {
} |
LINQ to SQL could be good alternative to "heave" ORM systems if you'll use it properly. |
Yes, a mocking framework is exactly what you're looking for. You can record / arrange how you want certain mocked out / stubbed classes to return.
Rhino Mocks, Typemock, and Moq are all good options for doing this.
[Steven Walther's post][1] on using Rhino Mocks helped me a lot when I first started playing with ... |
I say grails since there are so many java libraries out there. But I am a bit biased due to the fact that I come from a java background.
If the app isn't going to be big, either suffices - and the choice ought to depend on existing infrastructure. Say if you already have a java servlet container server running, you... |
As far as I know, you should create an interface or a base abstract class for the Helper object. With Rhino Mocks you can then return the value you want.
Alternatively, you can add an overload for LoadData that accepts as parameters the data that you normally retrieve from the Helper object. This might even be easie... |
How does a program ask for administrator privileges? |
|vb.net|privileges| |
I am developing an application using vb.net. For performing some tasks the application needs administrator privileges in the machine. How to ask for the privileges during the execution of the program?
What is the general method of switching user accounts for executing an application? In other words, is there some wa... |
You should be called the Close() method of the Form that contains the button in order to close down the form in an orderly manner. Closing the main form will cause the application to exit for you anyway. |
Another option is to not use the use constant pragma and flip to Readonly as per recommendations in the Perl Best Practices by Damian Conway.
I switched a while back after realizing that constant hash ref's are just a constant reference to the hash, but don't do anything about the data inside the hash.
The readon... |
Help with algorithm for merging vectors |
|algorithm|vector|speed|optimization| |
|algorithm|vector|speed|optimization|c++| |
|c++|algorithm|optimization|speed|vector| |
|c++|algorithm|optimization|graphics|vector| |
I need a very fast algorithm for the following task. I have already implemented several algorithms that complete it, but they're all too slow for the performance I need. It should be fast enough that the algorithm can be run at least 100,000 times a second on a modern CPU. It will be implemented in C++.
I am working... |
Personally, I do stuff like this all the time.
But I don't write a function to do it unless I'll be doing it
every day for a year.
You can easily do it with query-replace, like this:
m-x (query-replace " -option" "^Q^J -option")
I say ^Q^J as that is what you'll type to quote a newline and put it in
th... |
The symbol table is the list of "symbols" in a program/unit. Symbols are most often the names of variables or functions. The symbol table can be used to determine where in memory variables or functions will be located. |
13 years ago I worked on a tool portable to both a DEC ALPHA system and a PC. On this DEC ALPHA the **bits were actually inverted**. That is:
1010 0011
actually translated to
1100 0101
It was almost transparent and seamless in the C code except that I had a bitfield declared like
typedef ... |
Binding a form combo box in Access 2007 |
|ms-access|forms|combobox|data-binding| |
I've created an Access 2007 form that displays, for example, Products from a Product table. One of the fields in the Product table is a CategoryID that corresponds to this product's parent category.
In the form, the CategoryID needs to be represented as a combo box that is bound to the Category table. The idea her... |
|ms-access|data-binding|forms|combobox| |
I've created an Access 2007 form that displays, for example, Products from a Product table. One of the fields in the Product table is a CategoryID that corresponds to this product's parent category.
In the form, the CategoryID needs to be represented as a combo box that is bound to the Category table. The idea her... |
.NET Testing Naming Conventions |
|.net|unit-testing|testing|naming|conventions| |
What are the best conventions of naming testing-assemblies in .NET (or any other language or platform)?
What I'm mainly split between are these options (please provide others!):
- **Company.Website** - *the project*
- **Company.Website.Tests**
*or*
- **Company.Website**
- **Company.WebsiteTests**
... |
It sounds like you have slightly different behavior from your actions based on which header comes in. I would try to isolate the differences as much as possible.
For example, if the application logic is the same, but the only difference is how you render the response to the user, you might consider writing a custom... |
Thanks for the tips...I eventually found a solution:
I deleted the merge delete trigger from the table
Deleted the DTSed rows
Recreated the merge delete trigger
Added my rows correctly using an insert statement.
I was a little worried bout fiddling with the merge triggers but every thing **appears** to b... |
![Hulk MMO Cartoon][1]
[1]: http://farm4.static.flickr.com/3048/2864970757_2fd6d06367.jpg?v=0 |
Although not strictly programming-based, I enjoyed a lot [Robot Odyssey][1], a game where you wired logic gates to sensors and motors in a robot, to make it move and react to environment, to get out of a city, escaping obstacles. I played in on Apple //e, it was one of the best games on this computer (with Lode Runner!... |
Access form won't close |
|ms-access|forms| |
My Access 2000 DB causes me problems - sometimes (haven't pinpointed the cause) the "book" form won't close. Clicking its close button does nothing, File -> Close does nothing, even closing Access results in no action. I don't have an OnClose handler for this form (nor do I have any subforms). The only workaround I ... |
What can prevent an MS Access 2000 form from closing? |
My Access 2000 DB causes me problems - sometimes (haven't pinpointed the cause) the "book" form won't close. Clicking its close button does nothing, File -> Close does nothing, even closing Access results in no action. I don't have an OnClose handler for this form. The only workaround I can find involves opening the... |
I need a very fast algorithm for the following task. I have already implemented several algorithms that complete it, but they're all too slow for the performance I need. It should be fast enough that the algorithm can be run at least 100,000 times a second on a modern CPU. It will be implemented in C++.
I am working... |
A bit outside of the box.
Why not pre-generate your random numbers ahead of time? That way, when you insert a new row into bigtable, the check has already been made. That would make inserts into bigtable a constant time operation.
You will have to perform the checks eventually, but that could be offloaded to a se... |
Since you're still considering going to SQLExpress, has your group considered [SQLite][1]? You can still have the database functionality you require without having to install an engine on the client's system.
[1]: http://www.sqlite.org/ |
Errors creating WebPart subclass in another assembly |
|sharepoint|web-parts| |
I am trying to create a subclass of WebPart that will act as a parent to any WebParts we create. If I create an empty class in the same project, I am able to inherit from it as one would expect. However, if I try to place it in another assembly -- one that I've been able to reference and use classes from -- I get the f... |
I found a pretty good overview of this [here][1], but even that overview seemed to cover every scenario except the one you mention. I'm wondering if this can't be done because javascript objects really are functions (more or less).
What if you wrote a wrapper function that could create the state object using a stri... |
Depends on your embedded platform and what type of timing you are looking for. For embedded Linux, there are several ways you can accomplish. If you wish to measure the amout of CPU time used by your function, you can do the following:
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#... |
No.
Unless you change the plugin code, the default source folder is always the same as that containing the class you right clicked on (not necessarily the first source folder listed). I agree, it would be nice to be able to change it! |
SQL Server 2005 Express Edition is easily installed with any decent installer. A couple hours of work is all it will take! If your heart is set on it then don't let the fear of installation hold you back. |
After looking at the options some more and further consideration, I think you're right in assuming it can't be done. If you examine the stack behaviour of MSIL instructions, you can see that no op leaves its operand(s) on the stack. Since this would be a requirement for a 'get address of stack entry' op, I'm fairly con... |
After looking at the options some more and further consideration, I think you're right in assuming it can't be done. If you examine the stack behaviour of MSIL instructions, you can see that no op leaves its operand(s) on the stack. Since this would be a requirement for a 'get address of stack entry' op, I'm fairly con... |
Providing a C# example is a little difficult because there are a number of variables i.e. the signature method being used, additional parameters the service might be expecting etc. which would affect the complexity of the example.
I've developed an open source [OAuth library for .Net][1] and posted an article on [be... |
You are looking for the [trim() function][1].
[1]: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_trim |
You are looking for the [trim() function][1].
Alright, here is your example
SELECT TRIM(LEADING '0' FROM myfield) FROM table
[1]: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_trim |
Usually 'lost' is a euphemism for "We stopped paying the developer and now he wont give us the source code."
That being said, I own a copy of [Burak's ActionScript Viewer][1], and it works pretty well. A simple google search will find you many other SWF decompilers.
[1]: http://www.buraks.com/asv/index.html |
If by loaded you mean defined, you can check the type of the variable with the typeof function. **HOWEVER** typeof has a few quirks, and will identify an Object, an Array, and a **null** as an object
alert(typeof(null));
Identifying a null as a defined object would probably cause your program to fail, so ... |
NilObject's answer is a good start. Here's some supplemental info pertaining to manual memory management (required on the iPhone).
If you personally alloc/init an object, it comes with a reference count of 1. You are responsible for cleaning up after it when it's no longer needed, either by calling [foo release] or ... |
I also once worked on an app which used PHP4's XML support quite heavily, and would have required quite a bit of work to move toe PHP5.
One of the other significant changes I was looking at the time was the change of the default handling of function parameters. In PHP4 if I remember, they were pass-by-copy unless yo... |
Pros of config file:
1. Easy to do. Don't need to know any Windows API calls. You just need to know the file I/O interface of your programming language.
2. Portable. If you port your application to another OS, you don't need to change your settings format.
3. User-editable. The user can edit the config file ou... |
Scrum.
The daily standup meeting is a great way to make sure things stay on track and progress is being made. I also think it's key to get the product/market folks involved in the process in a real, meaningful way. It'll create a more collaborative environment and removes a lot of the adversarial garbage that comes ... |
According to the documentation for [GetPrivateProfileString](http://msdn.microsoft.com/en-us/library/ms724353.aspx), you should use the registry for storing initialisation information.
However, in so saying, if you still want to use .ini files, and use the standard profile APIs (`GetPrivateProfileString`, `WritePriv... |
Adding to what Corporal Touchy said above, you'll need to [know how to intersect a line segment with a plane][1]. In the description on that page, u represents the parameter in the parametric definition of your line. First, calculate u using one of the 2 methods described. If the value of u falls in the range of 0.0... |
Pick one machine as your development box.
Setup the other one to automatically update from your source control on a regular basis (hourly/daily/whatever). Any build/test failures should send you some sort of warning message. (email,im,whatever). Your non-dev box is still be building locally since it has its own c... |
How do I create a thread dump of a Java Web Start application |
|java|debugging|multithreading|java-web-start|thread-dump| |
Is it possible to get a thread dump of a Java Web Start application? And if so, how?
It would be nice if there were a simple solution, which would enable a non-developer (customer) to create a thread dump. Alternatively, is it possible to create a thread dump programmatically?
In the Java Web Start Console I can ... |
I learned a lot from SutekiShop (mvc, repository pattern, ddd+tdd), TechAvalanche sample app (<http://www.simonsegal.net/blog/CodeDownloads/Orm.zip>, several design patterns, poco with linq), CodeBetter.Award sample app for ddd+tdd, and MVC Storefront from Rob Conery.
|
Set up build configurations for each of your deployment/testing environment and use separate config files based on each build configuration.
ScottGu has [a nice post][1] about this and it works great. The only quirk we have is that we need to make sure that the config files (web.config) are checked out for edit from... |
I've found some information on [http://views-help.doc.logrus.com/][1], escpecialy this page: [http://views-help.doc.logrus.com/help/views/using-theme][2]
[1]: http://views-help.doc.logrus.com/
[2]: http://views-help.doc.logrus.com/help/views/using-theme |
Panels automatically resize to the smallest visible width. So you must resize every panel you add to the RootPanel to 100% including your SplitPanel. The RootPanel itself does not need resizing. So try:
split.setWidth("100%");
split.setHeight("100%"); |
An interesting alternative to Comet is to use sockets in Flash. |
For those of you that are interested in this topic, I should mention how I create the DMG:
hdiutil create XXX.dmg -volname "YYY" -fs HFS+ -srcfolder "ZZZ"
where
XXX == disk image file name (duh!)
YYY == window title displayed when DMG is opened
ZZZ == Path to a folder containing the files tha... |
It won't get rid of any references in code to your referenced assemblies (I think), but you can go to the properties of each of your projects, got to References, and click "Unused References...". Visual Studio then gives you the option to remove them right there.
No way to do it at the solution level though. |
Just as an aside, there was a [blog post over on ITtoolbox][1] about shuffling that may be of interest when it comes to simulating a shuffle.
As to your question, consider that there are 52! deck configurations that one could start with that may play a role in where things land as in Jeff's example of the 3 card dec... |
One sub-optimal solution is to make the project directory read-only in the file system in the underlying OS. I'm not sure how eclipse will react though. |
std::map insert or std::map find? |
|c++|optimization|stl|stdmap| |
Assuming a map where you want to preserve existing entries. 20% of the time, the entry you are inserting is new data. Is there an advantage to doing std::map::find then std::map::insert using that returned iterator? Or is it quicker to attempt the insert and then act based on whether or not the iterator indicates the... |
At which point in the lifecycle does GetConnectionInterface get called? |
|asp.net|sharepoint|web-parts|page-lifecycle|webpart-connection| |
I have this method on a webpart:
private IFilterData _filterData = null;
[ConnectionConsumer("Filter Data Consumer")]
public void GetConnectionInterface(IFilterData filterData)
{
_filterData = filterData;
}
Now, before I can call upon _filterData, I need to know when i can... |
There are two common and related meaning of symbol tables here.
First, there's the symbol table in your object files. Usually, a C or C++ compiler compiles a single source file into an object file with a .obj or .o extension. This contains a collection of executable code and data that the linker can process into a... |
If you can't log into MySQL at all, you will probably have to contact your hosting provider to kill the connections.
If you can use the MySQL shell, you can use the [show processlist][1] command to view connections, then use the [kill][2] command to remove the connections.
It's been my experience that hung SQL co... |
I think the Comet approach isn't really scalable unless you are prepared to expand the web farm horizontally (by adding more web servers to the mix). The way it works is that it leaves a TCP connection open per user session, just so the server can push stuff into that connection from time to time to immediately inform ... |
Another option would be to use a routine. If cases 1-3 all execute the same logic then wrap that logic in a routine and call it for each case. I know this doesn't actually get rid of the case statements, but it does implement good style and keep maintenance to a minimum.....
[Edit] Added alternate implementation to ... |
Clearly the PhoneUserInterface interface, which you can get an implementation of from the PhoneUserFactory.CreatePhoneUser() method, has a method dial(Phone, Number) that you can use to dial the phone. |
Agreed with [Kannel][1]. You can set it up on a LAMP server with a GSM modem too.
[1]: http://www.kannel.org/ |
Absolutely position divs over the text area with a z-index higher and give these divs a transparent gif background graphic. |
Absolutely position divs over the text area with a z-index higher and give these divs a transparent gif background graphic.
Note after a bit more thought - You'd need to have these 'covers' be linked so clicking on them would take you to where the tab was supposed to, which means you could/should do this with the an... |
PLSQL Developer, a tool from All Arround Automations, has a plugin for repositories that works OK ( but not great) with Visual Source Safe.
> From the web:
>>The Version Control Plug-In provides a tight integration between the PL/SQL Developer IDE >>and any Version Control System that supports the Microsoft SCC In... |
I'm not sure if this will help with what you are working on, but long ago I wrote a regular expression to parse ANSI graphic files.
(?s)(?:\e\[(?:(\d+);?)*([A-Za-z])(.*?))(?=\e\[|\z)
It will return each code and the text associated with it. I will try to provide an example in a few minutes. |
I'm not sure if this will help with what you are working on, but long ago I wrote a regular expression to parse ANSI graphic files.
(?s)(?:\e\[(?:(\d+);?)*([A-Za-z])(.*?))(?=\e\[|\z)
It will return each code and the text associated with it. I will try to provide an example in a few minutes.
Input string:
... |
I'm not sure if this will help with what you are working on, but long ago I wrote a regular expression to parse ANSI graphic files.
(?s)(?:\e\[(?:(\d+);?)*([A-Za-z])(.*?))(?=\e\[|\z)
It will return each code and the text associated with it. I will try to provide an example in a few minutes.
Input string:
... |