instruction stringlengths 0 30k ⌀ |
|---|
Never done it, but I imagine looking at some of the plug-ins such as Thickbox might be helpful. |
I've always heard it as number of standard deviations |
jQuery uses the standard javascript functionality for creating new classes.
There are some fine examples on the web, but I would recommend looking at David Flanagan's books Javascript: The Definitive Guide.
[Object-Oriented JavaScript][1]
[JavaScript and Object Oriented Programming (OOP)][2]
----------
... |
profiles = ProfileResource.search(params)
output = Array(profiles).collect do |profile|
profile.to_hash
end |
<div id="header" style="vertical-align:middle;">
...
or CSS
.someClass
{
vertical-align:middle;
} |
Please check out this article: [Hidden Gems - Not the same old 3.5 SP1 post][1]
[1]: http://www.hanselman.com/blog/PermaLink.aspx?guid=54292847-2b74-4f6d-a380-a65b25993b6c
It details some of the minor improvements in SP1. It also links to Scott Guthrie's article on SP1.
In my experience, the upgrade went w... |
Class::DBI-like library for php? |
|perl|php| |
I have inherited an old crusty PHP application, and I'd like to refactor it into something a little nicer to deal with, but in a gradual manner. In perl's CPAN, there is a series of classes around Class::DBI that allow you to use database rows as the basis for objects in your code, with the library generating accessor ... |
|php|perl|orm| |
[Verdana][1] - Variable width and easy to read on screen at small sizes.
[1]: http://en.wikipedia.org/wiki/Verdana |
I like Consolas too, but I also like Anonymous: http://www.ms-studio.com/FontSales/anonymous.html |
Lucida Console every time.
I've never found a font that can pack as many lines of code onto the screen at the same point size without looking cramped.
And it looks nice too. |
How to setup Groovy + Eclipse + Junit4 ? |
|eclipse|junit|groovy| |
I am working on a small webapp and I want to use Groovy to write some unit testing for my app. Most of my coding is done on Eclipse and I really want to run all the unit testing with the graphical test runner within Eclipse (I really like the green bar :) )
Sadly, after 4 hours of try-and-error, I'm still not able t... |
I have been using the Dina - http://www.donationcoder.com/Software/Jibz/Dina/index.html - font for awhile now for text editing and it seems to be doing the job nicely. |
When compiling I use Ant and have full control over that from TextMate, what I want is to be able to launch the *debugger* and the *profiler*. The command line debugger is unusable and there is no other profiler available than the one in FlexBuilder. |
You could also decorate s_Initialized with the volatile keyword and forego the use of lock entirely. |
Ack, nevermind... as pointed out, this is indeed incorrect. It doesn't prevent a second thread from entering the "initialize" code section. Bah.
>You could also decorate s_Initialized with the volatile keyword and forego the use of lock entirely.
|
Generic iterator |
You defined the primary key twice. Try:
> CREATE TABLE SHIPPING_GRID(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'Unique ID for each row',
shipping_vendor_no INT(6) NOT NULL COMMENT 'Foreign key to VENDOR.no for the shipping vendor (vendors_type must be 3)',
start_vendor_no INT(6) NOT NU... |
You defined the primary key twice. Try:
> CREATE TABLE SHIPPING_GRID(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'Unique ID for each row',
shipping_vendor_no INT(6) NOT NULL COMMENT 'Foreign key to VENDOR.no for the shipping vendor (vendors_type must be 3)',
start_vendor_no INT(6) NOT NU... |
> Can you provide the definition of the
> VENDOR table
I figured it out. The VENDOR table was MyISAM... (edited your answer to tell me to make them both INNODB ;) )
Thanks!
(any reason *not* to just switch the VENDOR type over to INNODB?) |
document.getElementById('newSkill').options[document.getElementById('newSkill').selectedIndex].value
Should work |
Does this get the correct answer?
document.getElementById("newSkill").innerHTML |
Does this get the correct answer?
document.getElementById("newSkill").innerHTML |
What's the difference in closure style |
|javascript| |
There are two popular closure styles in javascript. The first I call *anonymous constructor*:
new function() {
var code...
}
and the *inline executed function*:
(function() {
var code...
})();
are there differences in behaviour between those two? Is one "better" over the oth... |
I'd suggest checking out [LWJGL][1], the LightWeight Java Game Library. It's got OpenGL bindings, but it also has OpenAL bindings and some great tutorials to get you started.
Just keep in mind that Swing/SWT and OpenGL are generally used for entirely different things. You may end up wanting to use a combination of b... |
I can't think of a specific example when it is good to run explicit GC.
In general, running explicit GC can actually cause more harm than good, because an explicit gc will trigger a full collection, which takes significantly longer as it goes through every object. If this explicit gc ends up being called repeatedl... |
You could use the [Fisher-Yates shuffle][1].
[1]: http://en.wikipedia.org/wiki/Knuth_shuffle |
I do it on my own web site for certain pages that are guaranteed not to change -- I simply run a shell script that could be boiled to (warning: bash pseudocode):
find site_folder -name \*.static.php -print -exec Staticize {} \;
with Staticize being:
# This replaces .static.php with .html
TARGET_NA... |
There is no such operation. The best you can do is
<pre>
<code>
lock(collection){
foreach (object o in collection){
...
}
}
</code></pre> |
Cloning the list is the easiest and best way, because it ensures your list won't change out from under you. If the list is simply too large to clone, consider putting a lock around it that must be taken before reading/writing to it. |
[Suggested answer # 3 of 3]
I have not tried this yet and it would not be so nice in Java (I think?) but I could just tag my classes with Attributes:
[CammandAttribute(Name="HELP")]
Then I can use reflection to get that static information. Would need some simple helper methods to make the information easily av... |
Wrap the list in a locking object for reading and writing. You can even iterate with multiple readers at once if you have a suitable lock, that allows multiple concurrent readers but also a single writer (when there are no readers). |
**C#**
class _{static void Main(){Main();}}
Note that mine is a compilable program, not just a single function. I also removed excess whitespace.
For flair, I made the class name as small as I could. |
You could try ParaDyn's SymtabAPI. It lets you grab all the symbols in a shared library (or executable) and look at their types, offset, etc. It's all wrapped up in a reasonably nice C++ interface and runs on a lot of platforms. It also provides support for binary rewriting, which you could potentially use to do wha... |
Suppose your form is named **form1**:
function selectValue(val)
{
var lc = document.form1.leaveCode;
for (i=0; i<lc.length; i++)
{
if (lc.options[i].value == val)
{
lc.selectedIndex = i;
return;
}
}
}
|
This information is not normally saved. However, you can sign up for an online service that will do this for you. You just install a client that will send your uptime to the server every 5 minutes and the site will present you with a graph of your uptimes:
http://uptimes-project.org/
|
Not that I have a clue how to implement this, but from an audio engineering perspective you'd need to filter first. Bass drum hits would be the first to check. A low pass filter that gives you anything under about 200Hz should give you a pretty clear picture of the bass drum. A gate might also be necessary to cleanu... |
Architecture for real-time system? |
|c#|.net|architecture|frameworks|synchronization| |
I would like to ask some advices or experiences from architecture or
technology for building real-time system. Before I have some
experience on developing "Queuing Management System", I have done by
sending TcpServer and TcpClient message to all operators when a
operator changed the queue number. But I think this s... |
function setSelectValue (id, val) {
document.getElementById(id).value = val;
}
setSelectValue('leaveCode', 14);
|
This isn't stored between boots, but <a href="http://www.uptimes-project.org">The Uptimes Project</a> is a third-party option to track it, with software for a range of platforms.
Another tool available on Debian is <a href="http://podgorny.cz/moin/Uptimed">uptimed</a> which tracks uptimes between boots. |
What are the full-text search tools you can use in SQL Server? |
|sql-server|full-text-search|indexing| |
Besides full-text indexing and using LIKE keyword, what are other tools to build search functionality on top of MS SQL? This question is particularly for searching records, not files. |
It can be done. As of Python 2.5, however, this mechanism is Linux-specific and not portable:
import subprocess
import sys
file = sys.argv[1]
p1 = subprocess.Popen(['hg', 'cat', file], stdout=subprocess.PIPE)
p2 = subprocess.Popen([
'gvimdiff',
'/proc/self/fd/%s' % p1.... |
@Gishu
Actually once I'd accommodated for escaped characters my regex ran slightly slower than my hand written top down recursive parser and that's without the nesting (linking sub-items to their parents) and error reporting the hand written parser had.
The regex was a slightly faster to write (though I do have a... |
I think most users, even today, are more familiar with http than ftp and for that reason you should stick with http by default unless there's a compelling reason to use ftp. It's nit-picking, though. |
How do I make Powershell run a batch file and then stay open? |
|powershell| |
For example; with the old command prompt it would be:
cmd.exe /k mybatchfile.bat
Thanks.
John. |
GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT errors |
|fbo|opengl| |
I'm using [FBO][1]s in my OpenGL code and I'm seeing compilation errors on GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT. What's the cause of this and how do I fix it?
[1]: http://en.wikipedia.org/wiki/Framebuffer_Object |
|opengl| |
|fbo|opengl| |
I'm using [FBO][1]s in my OpenGL code and I'm seeing compilation errors on GL\_FRAMEBUFFER\_INCOMPLETE\_DUPLICATE\_ATTACHMENT\_EXT. What's the cause of this and how do I fix it?
[1]: http://en.wikipedia.org/wiki/Framebuffer_Object |
|opengl| |
|opengl|fbo| |
I'm using [FBO][1]s in my OpenGL code and I'm seeing compilation errors on **GL\_FRAMEBUFFER\_INCOMPLETE\_DUPLICATE\_ATTACHMENT\_EXT**. What's the cause of this and how do I fix it?
[1]: http://en.wikipedia.org/wiki/Framebuffer_Object |
[GNU Emacs][1] is my preferred text editor and it works well on Windows (copy/paste actually works as expected) It's also available on all major platforms so you can reuse your knowledge if you jump around OSes like I tend to do.
I really like [JEdit][2] as well. It's a good text editor for code and random text. It'... |
svn copy --parents http://url/to/subproject http://url/to/repository/branches/version_1/project/subproject
That should create the directory you want to put the subproject in (`--parents` means "create the intermediate directories for me"). |
Almost all of my favorite podcasts have already been mentioned but not the No 1. Do yourself a favor and listen to the best podcast ever, [Linux radio show - LugRadio][1].
[1]: http://lugradio.org |
This should work:
string path = System.Reflection.Assembly.GetExecutingAssembly().Location
|
[http://www.asp.net/mvc][1]
Whoops, submitted before I was done. The ASP.NET MVC site has tons of videos/screencast on getting started with ASP.NET MVC. Definately watch the Scott Hanselman ones first.
[1]: http://www.asp.net/mvc |
[http://www.asp.net/mvc][1]
Whoops, submitted before I was done. The ASP.NET MVC site has tons of videos/screencast on getting started with ASP.NET MVC. Definitely watch the Scott Hanselman ones first.
[1]: http://www.asp.net/mvc |
[http://www.asp.net/mvc][1]
Whoops, submitted before I was done. The ASP.NET MVC site has tons of videos/screencast on getting started with ASP.NET MVC. Definitely watch the Scott Hanselman ones first.
###Edit
The Rob Conery screencasts that [@David provided][2] are provided on the [ASP.NET MVC site][3] also... |
[http://www.asp.net/mvc][1]
Whoops, submitted before I was done. The ASP.NET MVC site has tons of videos/screencast on getting started with ASP.NET MVC. Definitely watch the Scott Hanselman ones first.
###Edit
The Rob Conery screencasts that [@David provided][2] are provided on the [ASP.NET MVC site][3] also... |
The current directory where you exist.
Environment.CurrentDirectory; // This is the current directory of your application
If you copy the .xml file out with build you should find it.
or
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly(typeof(SomeObject));
... |
If you're using TortoiseSVN, you can use its "Repository Explorer" to do such things. Makes it all pretty WYSIWYG simple. |
How to record webcam to flv with constant framerate |
|flash|webcam| |
How to record webcam to flv with smooth playback |
I would like my website to record flvs using webcams. These flvs need to have a constant framerate so I can play with them afterwards.
I've tried many different servers to handle the flv recording. The resulting flvs play OK in Wimpy FLV Player, for example, except that the progress indicator doesn't move smoothly o... |
I would like my website to record flvs using webcams. These flvs need to have a constant framerate so I can play with them afterwards.
I've tried many different servers to handle the flv recording. The resulting flvs play OK in Wimpy FLV Player, for example, except that the progress indicator doesn't move smoothly o... |
It can be done. As of Python 2.5, however, this mechanism is Linux-specific and not portable:
import subprocess
import sys
file = sys.argv[1]
p1 = subprocess.Popen(['hg', 'cat', file], stdout=subprocess.PIPE)
p2 = subprocess.Popen([
'gvimdiff',
'/proc/self/fd/%s' % p1.... |
It can be done. As of Python 2.5, however, this mechanism is Linux-specific and not portable:
import subprocess
import sys
file = sys.argv[1]
p1 = subprocess.Popen(['hg', 'cat', file], stdout=subprocess.PIPE)
p2 = subprocess.Popen([
'gvimdiff',
'/proc/self/fd/%s' % p1.... |
Which is the best Linux C/C++ debugger (or front-end to gdb) to help teaching programming? |
|c++|linux|debugging|teaching| |
I teach a sort of "lite" C++ programming course to novices ("lite" meaning no pointers, no classes, just plain old C, plus references and STL string and vectors). Students have no previous experience in programming, so I believe that using an interactive debugger would help them understand program flow, variables, and ... |
Scanner cannot be resolved to a type |
|java|eclipse|ubuntu| |
I just installed Ubuntu 8.04 and I'm taking a course in Java so I figured why not install a IDE while I am installing it. So I pick my IDE of choice, Eclipse, and I make a very simple program, Hello World, to make sure everything is running smoothly. When I go to use Scanner for user input I get a very odd error:
<b... |
On the VSS side, there are conversion tools that are available to help with migration. They can mostly maintain version history (there are caveats that are explained in the readme and docs). I have migrated well over 50 VSS projcts into perforce using the VSS to perforce tool. Getting the data out of VSS can be a b... |
How do you reverse engineer something?
- You observe the input and output, and develop a set of rules or models that describe the operation of the object.
Example:
Let's say you want to develop a USB camera driver. The "black box" is the software driver.
1. Develop hooks into the OS and/or driver so yo... |
How do you reverse engineer something?
- You observe the input and output, and develop a set of rules or models that describe the operation of the object.
Example:
Let's say you want to develop a USB camera driver. The "black box" is the software driver.
1. Develop hooks into the OS and/or driver so yo... |
You may want to look at:
1. [How do I get a deployable output from a build script with ASP.NET][1]
2. [Step by Step ASP.NET Automated Build/Deploy][2]
We use MSI to create basic installers for our web projects too, often using the Web Setup Projects in VS and sometimes completely custom installers. You may also ... |
Not sure. Maybe:
> %span{:class => item.dashboardstatus.cssclass } item.dashboardstatus.status |
Not sure. Maybe:
> %span{:class => item.dashboardstatus.cssclass }= item.dashboardstatus.status |
Do you need to use a comma separated list? The last couple of years, I've been taking this type of idea and passing in an XML file. The openxml "function" takes a string and makes it like xml and then if you create a temp table with the data, it is queryable.
DECLARE @idoc int
DECLARE @doc varchar(1000)
... |
Your developers need to write change scripts (schema and data change) for each bug/feature they work on, not just simply dump the entire database into source control. These scripts will upgrade the current production database to the new version in development.
Your build process can restore a copy of the producti... |
I was pleased to learn that python has this built in.
import csv
reader = csv.reader(open("some.csv", "r"))
for row in reader:
print row |
Pass the comma separated list into a function that returns a table value. There is a MS SQL example somewhere on StackOverflow, damned if I can see it at the moment.
CREATE PROCEDURE getSomething @keyList varchar(4096)
AS
SELECT * FROM mytbl WHERE name IN (fn_GetKeyList(@keyList))
Call with -
... |
Pass the comma separated list into a function that returns a table value. There is a MS SQL example somewhere on StackOverflow, damned if I can see it at the moment.
> CREATE PROCEDURE getSomething @keyList varchar(4096)
> AS
> SELECT * FROM mytbl WHERE name IN (fn_GetKeyList(@keyList))
Call with -
... |