instruction stringlengths 0 30k ⌀ |
|---|
I've been working through <a href="http://gigamonkeys.com/book">Practical Common Lisp</a> and as an exercise decided to write a macro to determine if a number is a multiple of another number:
<code>(defmacro multp (value factor)
`(= (rem ,value ,factor) 0))</code>
so that :
<code>(multp 40 10)</code>
eva... |
|lisp|macros| |
What is Adobe Flex? Is it just Flash II? |
|apache-flex|flash| |
Alright, I'm confused by all the buzzwords and press release bingo going on.
- What is the relationship between flash and flex:
- Replace flash (not really compatible)
- Enhance flash
- The next version of flash but still basically compatible
- Separate technology altogether
- ???
- If ... |
Question
--------
Alright, I'm confused by all the buzzwords and press release bingo going on.
- What is the relationship between flash and flex:
- Replace flash (not really compatible)
- Enhance flash
- The next version of flash but still basically compatible
- Separate technology altogeth... |
Is there a good tutorial on Websphere 6.1 ND deployments? |
|websphere|was| |
I need to deploy an application on the WAS ND 6.1 and do not know anything about it and cannot afford to go to training...
I thank you in advance for your help! |
It is worth the upgrade for me for the main reason that I can target different .NET versions (2, 3, 3.5) from the same IDE whereas in the past, one version of Visual Studio supported one version of .NET.
The UI seems much more responsive now, but the core set of tools and processes hasn't changed that much. |
I vote bug. I don't see how this could be by design. |
iconv(1)
iconv -f FROM-ENCODING -t TO-ENCODING file.txt
Also there are iconv-based tools in many languages. |
Javascript has support for ctrl+alt+shift keys. I assume you can figure out the rest.
http://www.javascripter.net/faq/ctrl_alt.htm |
As long as your HTML-writing code is separate from your application logic, and the HTML is guaranteed to be well-formed somehow, you should be okay. |
As long as your HTML-writing code is separate from your application logic, and the HTML is guaranteed to be well-formed somehow, you should be okay.
The only code that should be mixed in markup-based pages (i.e, those that contain literal HTML) is the code used for formatting the HTML (e.g., a loop for writing out a... |
I've used
die() {
echo $1
kill $$
}
before; i think because 'exit' was failing for me for some reason. The above defaults seem like a good idea, though. |
You probably need to get a JMS connection from JNDI, like this:
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.setProperty(Context.PROVIDER_URL,
"tcp://hostname:61616");
java... |
I've never heard of that being possible; it would make sense to me if it was _not_ supported by all compilers. So here is an idea for a workaround:
Implement a template function outside of your class which takes the same action as the method. Then you can specialize this function, and it call it from the method. ... |
I use the free (2 user?) licence of [Perforce][1]. Powerful, fast, and well documented.
[1]: http://www.perforce.com |
Templates In VB |
|vba|templates| |
I've got some VB code (actually VBA) which is basically the same except for the type on which it operates. Since I think the DRY principle is a good guiding principle for software development, I want to write one routine for all of the different types which need to be operated on. For example if I had two snippets of... |
Since you are using SQL Server 2005, you can use the new (CROSS|OUTTER) APPLY clause. The APPLY clause let's you join a table with a table valued function.
To solve the problem, first define a table valued function to retrieve the top n rows from Thing for a specific id, date ordered:
CREATE FUNCTION dbo.fn_G... |
Since you are using SQL Server 2005, you can use the new (CROSS|OUTTER) APPLY clause. The APPLY clause let's you join a table with a table valued function.
To solve the problem, first define a table valued function to retrieve the top n rows from Thing for a specific id, date ordered:
CREATE FUNCTION dbo.fn_G... |
There's [File System Events API][1] as of Leopard.
[1]: http://developer.apple.com/documentation/Darwin/Conceptual/FSEvents_ProgGuide/UsingtheFSEventsFramework/chapter_4_section_1.html#//apple_ref/doc/uid/TP40005289-CH4-SW4 |
**Magic Methods** are fall-through methods that get called whenever you invoke a method that doesn't exist or assign or read a property that doesn't exist, among other things.
class X {
public function __get($fieldName) { ... }
public function __set($fieldName, $vlaue) { ... }
publi... |
You can't, it's a language feature as opposed to a IDE feature. To be honest i'd prefer then IDE to add the private variable in for you. I agree that it is slightly weird for the class to internally have to use the public entry point to access its own variables. Hence I don't use this new feature that much myself. |
> Behind the scenes what happens is the injection of a private member variable, prefixed with <>k__AutomaticallyGeneratedPropertyField#
From [C# 3.0 Automatic Properties explained][1]
Although it may be possible to use that private member directly, it's very hacky and unnecessary.
[1]: http://community.bartd... |
[jQuery] Figure out div that is visible out of four divs. |
|jquery|dom|css-selectors| |
I need to figure out what div is visible out of four possible divs using jQuery. Only one of those div's will be visible at any given time.
This is what I have that works so far:
$("#FeatureImage1:visible, #FeatureImage2:visible, #FeatureImage3:visible, #FeatureImage4:visible").attr("id");
Is there a way ... |
The [documentation][1] gets my vote. I haven't encountered a more thorough online documentation for a programming language - everything else I have to piece together from various websites and man pages.
[1]: http://www.php.net/manual/en/ |
This syntax is commonly called "syntax sugar", which means that the compiler takes that syntax and translates it into something else. In your example, the compiler would generate code that looks something like this:
[CompilerGenerated]
private int <Age>k_BackingField;
public int Age
{
... |
Your usage of automatic properties implies that you do not need any getting/setting logic for the property thus a private backing variable is unneccessary.
Don't use automatic properties if you have any complex logic in your class. Just go `private int _age` and normal getters/setters as you normally would.
IMO, ... |
You'll have to pop everything off the stack to get the bottom element and then put them all back on for every "dequeue" operation. |
if you are not touching any specific properties, you can get all base and common properties to the style which's target type would be FrameworkElement. then, you can create specific flavours for each target types you need, without need of copying all those common properties again. |
Check out selenium: http://selenium.openqa.org/
Also, check out the answers to this other question: http://stackoverflow.com/questions/484/how-do-you-test-layout-design-across-multiple-browsersoss |
IMHO, yield will handle this.
http://msdn.microsoft.com/en-us/library/9k7k7cf0(VS.80).aspx
Something like:
get_next() {
foreach( float x in meas ) {
yield x;
}
} |
@Alan Storm
Your comment on my other answer got me to thinking:
>When you load an HTML file with DOMDocument, it appears to do some level of cleanup re: well well-formedness, BUT requires all your tags to be legit HTML tags. I'm looking for something that does the former, but not the later. (Alan Storm)
Run a re... |
<anything> | sort | uniq -c | sort -n
will give you a count of all the different occurrences of <anything>.
Often, awk, sed, or cut help with the parsing of data in <anything>. |
You could also check out [WatiN][1].
[1]: http://watin.sourceforge.net/ |
The general consensus is that programmers prefer Drupal whereas mere mortals prefer Joomla. Joomla is praised for having a simpler user interface. (I personally don't agree with that; I think Joomla's UI is pretty painful to use. But then again, I'm looking at it with a programmer's eye.) Drupal, on the other hand, is ... |
Sounds like your engine could generate a test script using something like [Test::WWW::Mechanize][1]
[1]: http://search.cpan.org/~petdance/Test-WWW-Mechanize-1.20/Mechanize.pm |
Just start the debugger on another page, and then change the browser url to what you wanted.
It's not ideal but it should work.
I have high hopes for their next release. |
Another **hack** is the old 1x1 transparent pixel trick. Insert an 1x1 transparent gif image and set its width in the image tag to the width you want. This will force the cell to be at least as wide as the image. |
You may want to looking to something like this:
[JSqlParser][1]
which uses JavaCC to parse and return the query string as an object graph. I've never used it, so I can't vouch for its quality.
[1]: http://jsqlparser.sourceforge.net "JSqlParser" |
You could use [psservice][1] to query the status of the RFC or Print Spooler services. The Spooler is usually one of the last services to start.
[1]: http://technet.microsoft.com/en-us/sysinternals/default.aspx |
You could use [psservice][1] to query the status of the RFC or Print Spooler services. The Spooler is usually one of the last services to start. You could use syntax like:
psservice \\someothermachine query spooler
That will return something like this once the service is running.
<pre>
SERVICE_NAME: Spo... |
Just turn off the Automatic Update service. It will restart the next time you reboot so you'll still get the updates done. |
Find checkout history for SVN working folder |
|svn| |
We have an intranet site backed by SVN, such that the site is a checkout out copy of the repository (working folder). Something on the site has been causing problems today, and I want to know how to find out what was checked out to that working folder in the last 48 hours. |
We have an intranet site backed by SVN, such that the site is a checkout out copy of the repository (working folder). Something on the site has been causing problems today, and I want to know how to find out what was checked out to that working folder in the last 48 hours.
If there's an option I need to turn on to ... |
Since you are using SQL Server 2005, you can use the new (CROSS|OUTTER) APPLY clause. The APPLY clause let's you join a table with a table valued function.
To solve the problem, first define a table valued function to retrieve the top n rows from Thing for a specific id, date ordered:
CREATE FUNCTION dbo.fn_G... |
If I understand you correctly you are looking for [TAP::Harness][1]
[1]: http://search.cpan.org/~andya/Test-Harness/lib/TAP/Harness.pm |
Any distributed revision control system is best for lone developers, like git or Mercurial. Best thing is you can incorporate more developers to your project seamlessly, as opposed to having to give them access to your main centralized SVN or CVS repository. |
I'd suggest you take the pieces of information you want in the key, and hash it with md5, and then just take the first X characters (where X is a key length you think is manageable).
Cryptographically, it's far from perfect, but this is the sort of area where you want to put in the minimum amount of effort which wil... |
I'd suggest you take the pieces of information you want in the key, and hash it with md5, and then just take the first X characters (where X is a key length you think is manageable).
Cryptographically, it's far from perfect, but this is the sort of area where you want to put in the minimum amount of effort which wil... |
<pre>
scala> val list = List(("A", "B", 1), ("C", "D", 1), ("E", "F", 1), ("C", "D", 2), ("G", "H", 1))
list: List[(java.lang.String, java.lang.String, Int)] = List((A,B,1), (C,D,1), (E,F,1), (C,D,2), (G,H,1))
scala> list find {e => e._1 == "C" && e._2 == "D"}
res0: Option[(java.lang.String, java.lang.String, Int... |
making portable code |
|c++|c|portability| |
with all the fuss about opensource projects, how come there is still not a strong standard that enables you to make portable code (i mean in C/C++ not java or c#)
everyone is kind of making it's own soup.
there are even some third party libs like Apache Portable Runtime. |
Assign the same class to each div then:
$("div.myClass:visible").attr("id"); |
How Do I Access The Host From VMware Fusion? |
|rails|networking|vmware| |
I've just created a new Windows XP VM on my Mac using VMware Fusion. The VM is using NAT to share the host's Internet connection.
How do I access a Rails application, which is accessible on the Mac itself using http://localhost:3000? |
|networking|vmware| |
**Array manipulation.**
Tons of tools for working with and manipulating arrays. It may not be unique to PHP, but I've never worked with a language that made it so easy. |
I think the main reason there isn't any single library anyone agrees on is that everyone's requirements are different. When you want to wrap system libraries you'll often need to make some assumptions about what the use cases will be, unless you want to make the wrapper huge and impossible to work with. I think that mi... |
[Greg's][1] way should work (not me, other Greg :P). Regarding your comment, origin is a configuration variable that is set by Git when you clone the central repository to your local machine. Essentially, a Git repository remembers where it came from. You can, however, set these variables manually if you need to using ... |
[Greg's][1] way should work (not me, other Greg :P). Regarding your comment, origin is a configuration variable that is set by Git when you clone the central repository to your local machine. Essentially, a Git repository remembers where it came from. You can, however, set these variables manually if you need to using ... |
|apache-flex|flash| |
Question
--------
Alright, I'm confused by all the buzzwords and press release bingo going on.
- What is the relationship between flash and flex:
- Replace flash (not really compatible)
- Enhance flash
- The next version of flash but still basically compatible
- Separate technology altogeth... |
The stacktrace app found [here][1] is also useful, especially on Windows machines when the java app is not started from the command line.
[1]: http://www.adaptj.com/main/download |
How do you balance fun feature creep with time constraints? |
|estimation|intermediate|feature-creep|in-the-zone| |
I enjoy programming, usually. Tedius stuff is easy to get done as quickly and correctly as possible so I can get through it and not have to see it again.
But a lot of my coding is *fun* and when I get in the 'zone' I just really enjoy myself.
Which is where I make the mistake of spending too much time, perhaps a... |
|estimation|in-the-zone|feature-creep|intermediate| |
I enjoy programming, usually. Tedious stuff is easy to get done as quickly and correctly as possible so I can get through it and not have to see it again.
But a lot of my coding is *fun* and when I get in the 'zone' I just really enjoy myself.
Which is where I make the mistake of spending too much time, perhaps ... |
Give yourself a hard deadline--even for your own projects. Otherwise, you'll just keep tweaking and adding features ad infinitum. |
Singletons are very useful, and using them is not in and of itself an anti-pattern. However, they've gotten a bad reputation largely because they force any consuming code to acknowledge that they are a singleton in order to interact with them. That means if you ever need to "un-Singletonize" them, the impact on your co... |
Under Linux you can use the very powerful **recode** command to try and convert between the different charsets as well as any line ending issues. **recode -l** will show you all of the formats and encodings that the tool can convert between. It is likely to be a VERY long list. |
Build it starting with the largest bill towards the smallest. This will yeild the lowest number of bills.
Take the initial amount and apply the largest bill as many times as you can without going over the price.
Step to the next largest bill and apply it the same way.
Keep doing this until you are on your sma... |
**Edit:** The following will work *some* of the time. Think about why it won't work all the time and how you might change it to cover other cases.
Build it starting with the largest bill towards the smallest. This will yeild the lowest number of bills.
Take the initial amount and apply the largest bill as many ... |
Stand-alone utility approach:
iconv -f UTF8 -t ISO88591 in.txt > out.txt
f: from <br />
t: to
|
The script I use is quite similar; I post it here as an example of how to use the email.* modules to generate MIME messages; so this script can be easily modified to attach pictures, etc.
I rely on my ISP to add the date time header.
My ISP requires me to use a secure smtp connection to send mail, I rely on the s... |
On Windows you can use the 'high performance counter API'. Check out: [QueryPerformanceCounter][1] and [QueryPerformanceCounterFrequency][2] for the details.
[1]: http://msdn.microsoft.com/en-us/library/ms644904(VS.85).aspx
[2]: http://msdn.microsoft.com/en-us/library/ms644905(VS.85).aspx |
We've used the following algorithm at [my company][1] for years without a single incident.
1. Decide the fields you want in the code. Bit-pack as much as possible. For example, dates could be "number of days since 2007," and then you can get away with 16-bits.
2. Add an extra "checksum" field. (You'll see why ... |
All the previous suggestions are pretty simple, and I know cvs is a bit out of vogue these days, but I like to use it's local mode for a repository that doesn't even need a server to install or set up. The repository can be anywhere on your hard drive. I have mine on a memory stick to have access to it anywhere even wi... |
HTTP authentication information is sent on every request, not just to log in. The browser will cache the login information for the session after you log in the first time. So, you don't really save anything by trying to check if you are already logged in.
You could also forget about greasemonkey altogether and jus... |
Use-cases for reflection |
|reflection| |
This is my current workaround:
/// <summary>
/// Replacement for the static methods on FaultCode to generate Sender and Receiver fault codes due
/// to what seems like bugs in the implementation for basicHttpBinding (SOAP 1.1). wsHttpBinding
/// (SOAP 1.2) seems to work just fine.
///
/// The subC... |
In Applescript, how can I get to the Help menu Search field, like Spotlight? |
|macos|search|menu|applescript|spotlight| |
In OS X, in order to quickly get at menu items from the keyboard, I want to be able to type a key combination, have it run a script, and have the script focus the Search field in the Help menu. It should work just like the key combination for Spotlight, so if I run it again, it should dismiss the menu. I can run the ... |
Here is the script I came up with.
tell application "System Events"
tell (first process whose frontmost is true)
click menu "Help" of menu bar 1
end tell
end tell
|
Usual test methodologies applies; white box and black box.
White box testing for you may mean instrumenting your application to be able to make it go into a particular state, then you can predict the the result you expect.
Black box may mean that you hit a page, then consider of the possible outcomes valid. Repe... |
We have an intranet site backed by SVN, such that the site is a checkout out copy of the repository (working folder used only by IIS). Something on the site has been causing problems today, and I want to know how to find out what was checked out to that working folder in the last 48 hours.
**Update:** If there's an... |
|svn|tortoisesvn| |