So what would be nice is if you could do something like the following (not necessarily with this format, just the general idea):
data Minor = MinorA | MinorB
data Major = Minor | MajorB
isMinor :: Major -> Bool
isMinor Minor = True
isMinor _ = False
So isMinor MinorA would report True (instead of an error.)
At the moment you might do…
I'm looking at some Java classes that have the following form:
public
abstract
class A <E extends A<E>> implements Comparable <E> {
public final int compareTo( E other ) {
// etc
}
}
public
class B extends A <B> {
// etc
}
public
class C extends A <C> {
// etc
}
My usage of…
Ok, here's the problem. I have a label component in a panel. The label is aligned as alClient and has wordwrap enabled. The text can vary from one line to several lines. I would like to re-size the height of the the panel (and the label) to fit all the text.
How do I get the necessary height of a label when I know the text and the width…
Looking for strategies for a very large table with data maintained for reporting and historical purposes, a very small subset of that data is used in daily operations.
Background:
We have Visitor and Visits tables which are continuously updated by our consumer facing site. These tables contain information on every visit and visitor,…
Hi!
I'd like to know if there's a way to verify if an index exists before getting it.
So it'd be way to protect my code against:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (2) beyond bounds (0)'
Like in PHP you can do: isset($object[10]); and it'll return true…
I've searched here and not found any question that really covers this.
I have a cross-platform Windows-OS/X application in which I'd like to be able to detect whether modifier keys like shift or control are being held down while the application starts up.
We'd like to do this to allow the application to start up without reading its…
How can I display the graphical "enter symbol" within java applet using fonts?
I want to show "?", which is U+21B5 DOWNWARDS ARROW WITH CORNER LEFTWARDS. –
I want to draw this to applet's screen so that it works in WIN, LINUX, MACOSX, etc.
Is there a font available that makes this possible or should I draw it manually somehow?
…
I'm trying to implement a Facebook like toolbar on the bottom of the screen for a website I'm currently working on.
Currently, I have it 100% of the width of the screen but I'd like to have it look almost exactly like Facebook's toolbar, centered, bottom justified on top, around 80% of the current screen's width.
Here is the…
Software Architecture for High Availability in the Cloud | Brian Jimerson
Brian Jimerson looks at the paradigm shifts from machine-based architectures to cloud-based architectures when designing fault tolerance, and how enterprise applications need to be engineered to ensure the highest level of availability in the cloud.…
JFall 2012 was over far too soon! Seven tracks going on simultaneously in a great location, with many artifacts reminding me of JavaOne, and nice snacks and drinks afterwards. The day started, as such things always do, with a keynote. Thanks to @royvanrijn for the photo below, I didn't take any myself and without a picture…
I have a collection of articles in MongoDB that has the following structure:
{
'category': 'Legislature',
'updated': datetime.datetime(2010, 3, 19, 15, 32, 22, 107000),
'byline': None,
'tags': {
'party': ['Peter Hoekstra', 'Virg Bernero', 'Alma Smith', 'Mike Bouchard', 'Tom George', 'Rick…
(the example code below is self-contained and runnable, you can try it, it won't crash your system :)
Tom Hawtin commented on the question here: http://stackoverflow.com/questions/3018165
that:
It's unlikely that the EDT would crash. Unchecked exceptions thrown in EDT dispatch are caught, dumped and the thread…
Tom Christiansen's example code (à la perlthrtut) is a recursive, threaded implementation of finding and printing all prime numbers between 3 and 1000.
Below is a mildly adapted version of the script
#!/usr/bin/perl
# adapted from prime-pthread, courtesy of Tom Christiansen
use strict;
use warnings;
use…
I want to select the 10 last messages you received OR you sent TO different users.
For example the results must be shown like that:
1. John1 - last message received 04/17/10 3:12
2. Thomy - last message sent 04/16/10 1:26
3. Pamela - last message received 04/12/10 3:51
4. Freddy - last message…
I have to be missing something simple here but it escapes me. After the user enters a new person to a mutable array I want to update the table. The mutable array is the datasource. I believe my issue lies within cellForRowAtIndexPath.
- (UITableViewCell *)tableView:(UITableView *)tableView…
Is there a way to resolve mathematical expressions in strings in javascript? For example, suppose I want to produce the string "Tom has 2 apples, Lucy has 3 apples. Together they have 5 apples" but I want to be able to substitute in the variables. I can do this with a string replacement:
…
I need to process a big data file that contains multi-line records, example input:
1 Name Dan
1 Title Professor
1 Address aaa street
1 City xxx city
1 State yyy
1 Phone 123-456-7890
2 Name Luke
2 Title Professor
2 Address bbb street
2 City …
I have the following code:
List<string> test1 = new List<string> { "@bob.com", "@tom.com" };
List<string> test2 = new List<string> { "joe@bob.com", "test@sam.com" };
I need to remove anyone in test2 that has @bob.com or @tom.com.
What I have…
Tom Christiansen's example code (à la perlthrtut) is a recursive, threaded implementation of finding and printing all prime numbers between 3 and 1000.
Below is a mildly adapted version of the script
#!/usr/bin/perl
# adapted from prime-pthread, courtesy of Tom Christiansen
use…
I have found that the local school's website installed a Perl Calendar - this was years ago, it has not been used for ages, but Google has it indexed (which is how I found it) and it full of Viagra links and the like ... program was by Matt Kruse, here is details of the exploit:…
Hi there,
I open a .doc file in Word 2007 (sorry I am unable to supply the .doc) which pops up with a message above the document "Security warning: Macros have been disabled" but there are no macros shown in the macros listing and no functionality displayed in the VBScript…
Hello,
I am searching for it on Google, but i didn't find anything. Is there a way tho set up proftpd that it will only accept a connection on ftp.website.ext and not on website.ext or test.website.ext
I am running proftpd on Debian 5
Tom
My music library is organized (roughly) like this:
Music
mp3 (original)
Artist/Album/Song
mp3 (from Tom)
Artist/Album/Song
mp3 (from Dick)
Artist/Album/Song
mp3 (from Harry)
Artist/Album/Song
... etc.
When I use the…