instruction stringlengths 0 30k ⌀ |
|---|
Make Test.QuickCheck.Batch use a default type for testing list functions |
|testing|haskell|typeinference| |
I am testing a function called extractions that operates over any list.
extractions :: [a] -> [(a,[a])]
extractions [] = []
extractions l = extract l []
where extract [] _ = []
extract (x:xs) prev = (x, prev++xs) : extract xs (x : prev)
I want to test it, for example, with
... |
|testing|haskell|type-inference| |
Fundeps and GADTs: When is type checking decidable? |
|haskell|typeinference|decidability|fundeps|gadt| |
I was reading a research paper about Haskell and how HList is implemented and wondering when the techniques described are and are not decidable for the type checker. Also, because you can do similar things with GADTs, I was wondering if GADT type checking is always decidable.
I would prefer citations if you have th... |
You really only need something to parse the Packages file, no? [Example Packages file][1]. I've never attempted to do this before, but I cant imagine it being a horrendous task.
Edit: Well it would technically be spidering the repo to process a series of Packages files, but that wouldn't make it too much tougher.
... |
The 6502 manuals are on the Web, at various history sites. The KIM-1 shipped with them. Maybe more in them than you need to know. |
Simply mkdir /etc/portage and edit as mentioned here: http://gentoo-wiki.com/TIP_Dealing_with_masked_packages#But_you_want_to_install_the_package_anyway... |
This all really depends on HOW you imported the blog posts. What was your method? |
This all really depends on HOW you imported the blog posts. What was your method?
When you view the raw source of the posts in wordpress (plain text view) - what does the post look like (a copy of the HTML would be nice)
-- Note - edit your original post to give the answers, a reply doesn't really work if other... |
If you look into references like <http://www.atarimax.com/jindroush.atari.org/aopc.html>, you will see that each opcode has an encoding specified as:
HEX LEN TIM
The HEX is your 1-byte opcode. Immediately following it is LEN bytes of its argument. Consult the reference to see what those arguments are. The TIM... |
If you look into references like <http://www.atarimax.com/jindroush.atari.org/aopc.html>, you will see that each opcode has an encoding specified as:
HEX LEN TIM
The HEX is your 1-byte opcode. Immediately following it is LEN bytes of its argument. Consult the reference to see what those arguments are. The TIM... |
While <a href="http://en.wikipedia.org/wiki/Kerberos_(protocol)">Kerberos</a> and <a href="http://en.wikipedia.org/wiki/Secure_Sockets_Layer">SSL</a> are both protocols, Kerberos is an authentication protocol, but SSL is an encryption protocol. Kerberos uses <a href="http://en.wikipedia.org/wiki/User_Datagram_Protocol"... |
I have always been fascinated by this secret sharing technique. I've seen code implementing it on the internet, but have never seen actual applications. [Shamir's secret sharing][1] The wikipedia article links to some actual code, as well as the original academic article.
[1]: http://en.wikipedia.org/wiki/Sha... |
For applications such as most embedded platforms where you do not have the luxury of a heap to store the strings being manipulated, and where deterministic preallocation of string buffers is required. |
There's [SpiderMonkey][1], a JavaScript engine written in C and [Rhino][2], an implementation of JavaScript in Java.
[1]: http://www.mozilla.org/js/spidermonkey/
[2]: http://www.mozilla.org/rhino/ |
There is a known memory leak with the N-series Nokia devices. It is not specific to Java and is in the underbelly of the OS somewhere.
Recently working on a game that targeted the Nokia N90, I had similar problems. I would run into memory problems that would accumulate over several different restarts of the applicat... |
There is a known memory leak with the N-series Nokia devices. It is not specific to Java and is in the underbelly of the OS somewhere.
Recently working on a game that targeted the Nokia N90, I had similar problems. I would run into memory problems that would accumulate over several different restarts of the applicat... |
Algorithm to blend gradient filled corners in image |
|image|image-manipulation|gradient|algorithm|graphics| |
I need to put an alpha blended gradient border around an image. My problem is in blending the corners so they are smooth where the horizontal and vertical gradients meet. I believe there is a standard algorithm that solves this problem. I think I even encountered it in school many years ago. But I have been unsucces... |
Best Free Text Editor Supporting *More Than* 4G Files? |
|files|text-files|editor|text-editor|largefile| |
I am looking for a text editor that will be able to load a 4+ Gigabyte file into it. Textpad doesnt work. I own a copy of it and have been to its support site, it just doesnt do it. Maybe I need new hardware, but that's a different question. The editor needs to be free OR, if its going to cost me, then no more tha... |
|editor|files|text-editor|text-files|largefile| |
I am looking for a text editor that will be able to load a 4+ Gigabyte file into it. Textpad doesnt work. I own a copy of it and have been to its support site, it just doesnt do it. Maybe I need new hardware, but that's a different question. The editor needs to be free OR, if its going to cost me, then no more tha... |
Generate a Sandcastle help file for a website without the "Xml Documentation File" option |
|asp.net|visual-studio|sandcastle| |
I am trying to generate a Sandcastle help file for a website. In the properties window for project, there aren't any options for creating the XML Documentation File required for Sandcastle.
The Build tab in the property pages only contains options for: Start Action, Build Solution Action, and Accessibility validatio... |
Check out [nLite][1]. Allows you to pre-configure many options, slipstream updates and service packs, etc.
[1]: http://www.nliteos.com/ |
The real problem here is the "write-only" table design - by which I mean, it's easy to insert data into it, but tricky and inefficient to get useful information out of it! Your "temporary" table has the structure the "permanent" table should have had in the first place.
Could you perhaps do this:
- Create a pe... |
Why do you want to load a 4+ GB file into memory? Even if you find a text editor that can do that, does your machine have 4 GB of memory? And unless it has a lot more than 4 GB in physical memory, your machine will slow down a lot and go swap file crazy.
So why do you want a 4+ GB file? If you want to transform i... |
I don't think XSL is set up to work that way: it's designed to be used by something else on one or more documents, and the something else would be responsible for finding files to which the XSLT should be applied.
If you had one main document and a fixed set of supporting documents, you could possibly use the [`doc... |
In the first instance I recommend inheriting from wxControl not wxWindow, wxControl is designed for that exact purpose and you are less likely to find yourself fighting the system. When I look at a control I am building in my own wxWidgets app, I see that my click handler is attached to wxEVT_LEFT_DOWN. Looking in my c... |
The common example is collections. e.g. a set of type T, as an Add(T) method and a T get() method. Same code, different type safe collections.
C++, D, Ada and others have templates, a superset of generics that do it a little different bug get the same end result (and then some).
IIRC Java has generics, but I don'... |
One of the rules in applying CSS styles is "last in wins." This means if your CSS reset styles set elements to `margin:0; padding:0` you can then override these rules by declaring your desired values for the same elements afterwards.
You can do this in the same file (YUI offers a one-liner reset I think so I someti... |
I use both actually.
I use return codes if it's a known, possible error. If it's a scenario that I know can, and will happen, then there's a code that gets sent back.
Exceptions are used solely for things that I'm NOT expecting. |
Another option is to simply use another Ruby file as your configuration file.
Example, create a file called 'options'
{
:blah => 'blee',
:foo => 'bar',
:items => ['item1', 'item2'],
:stuff => true
}
And then in your Ruby code do something like:
ops = e... |
The problem here is a missing DLL dependency, such as the CRT (C Runtime Library). A good tool for diagnosing this sort of problem is Dependency Walker (depends.exe), which you can find here:
http://www.dependencywalker.com/
You would run this program on the computer that generates the error message you posted, a... |
I like jQuery. Prototype is very similar. There are several others but I highly recommend you evaluate them yourself. |
Set up automated builds and unit tests. Any kind of repository that tracks changes is good, but won't prevent bugs.
Also, only make changes that you can run right away. The Agile methodology that says release early and often helps here. That way, you can get a better understanding of the code as you get deeper in... |
I'm working on an iphone application (not web app) and I'd like to build a form asking a user to indicate a price range. Instead of using two text fields, I would prefer to use a double slider to set the minimum and the maximum price. I know that it is possible de use a simple slider (sound control for exemple) but i'... |
C# doesn't have built-in support for parsing Polish notation.You'll need to write your own parser, or find one online.
Take a look at [this][1], maybe you'll find it useful.
[1]: http://www.dreamincode.net/forums/showtopic35320.htm |
Get an external hard drive with a network port so you can keep your backups in another room which provides a little security against fire in addition to being a simple solution you can do yourself at home.
The next step is to get storage space in some remote location (there are very cheap monthly prices for servers ... |
Displaying code in blog posts |
|blogs|content| |
What libraries and/or packages have you used to create blog posts with code blocks? Having a javascript library that would support line numbers and indentation is ideal. |
First of all: keeping backups off-site is as important for individuals as it is for businesses. If you house burns down, you don't want to loose everything.
This is especially true because it is so easy to accomplish. Personally, I have an external USB harddisk I keep at my fathers house. Normally, it is hooked up t... |
Bacula is a good software, it's open source, and shall give good performance, kind of commercial software, a bit difficult the first time to configure, but not so hard. It has good documentation |
You must add your control inside OnInit event and viewstate will be preserved. Don't use if(ispostback), because controls must be added every time, event in postback!
(De)Serialization of viewstate happens after OnInit and before OnLoad, so your viewstate persistence provider will see dynamically added controls if t... |
The Shunting Yard Algorithm is used to convert Infix (i.e. algebraic) to RPN. This is the opposite of what you want.
Can you give me an example of your RPN input? I am a veteran HP calculator user/programmer. I presume you have a stack containing all the inputs & operators. I would guess that you need to reconstruc... |
Unfortunately there is no way to swap to a screen where you can get user via the feature activation process. Couple of comments for you:
1. I'm assuming the connection string is going to be different for every installation, so there is no way you can include it directly in the Solution.
2. I'm assuming that you ... |
+1 for Biri's text based ID - define a "template_mnemonic" text based column and make it the primary key. This will be a known value when you insert it as you, the developers will have decided on it (or auto-generated it) and you will always be able to reference a template by its mnemonic regardless of how many user sp... |
You may need to install (reinstall) VS 2005 SP1, since a security update from Microsoft (KB928365) on July 10 may have caused the issue. |
Looks like CMFCVisualManager offers several methods for getting color information, e.g.
CMFCVisualManager::GetSmartDockingBaseGuideColors()
CMFCVisualManager::GetToolbarHighlightColor()
Take a look at the MSDN docs for <a href="">CMFCVisualManager</a>. |
C#.Net case-insensitive string |
|c#|.net| |
A quick and simple question...
Why does C#.Net allow the declaration of the string object to be case-insensitive?
String sHello = "Hello";
string sHello = "Hello";
Both the lower-case and upper-case S of the word String are acceptable and this seems to be the only object that allows this.
Can anyon... |
Add all the strings to a dictionary and get the Keys property afterwards. This will produce each unique string, but not necessarily in the same order your original input had them in.
If you require the end result to have the same order as the original input, when you consider the first occurance of each string, use ... |
|algorithm|graphics|image|image-manipulation|gradient| |
I need to put an alpha blended gradient border around an image. My problem is in blending the corners so they are smooth where the horizontal and vertical gradients meet. I believe there is a standard algorithm that solves this problem. I think I even encountered it in school many years ago. But I have been unsucces... |
I think you should extend from Sprite, but be sure to initialize it first and maybe put to the stage. Try to enable debugging and see what exactly is null as exception report says. |
Script# has extensions for Vista Gadgets.
http://projects.nikhilk.net/ScriptSharp/
|
[PLT Scheme][1] has got a JIT compiler.
[Stalin][2] is a Scheme compiler which does ridiculously aggressive optimisation.
All Common Lisp implementations that I know of except [CLISP][3] compile to native code. (Whether one ought to consider CL a functional language depends on what is meant by the term “function... |
If you just need a simply row column grip type layout you shouldn't feel guilty using tables. I don't know how anyone can call that 'bad design' just because it's not CSS. I've seen **many** bad CSS based designs. I love CSS and think it far superior in many ways to traditional nested table layouts, but do what work... |
Datagridview virtual model combobox |
|c#|datagridview|combobox| |
how can you dynamically add items to a combobox using the datagridview virtual mode? |
Most IT staff in Poland use english terms, polish language is used only when communicating with business or users.
Personally I tend to set locale on all my computers to english - I **know** which word is used in english manual, but I'm not sure how was it translated in polish version.
On my university all of lec... |
On OS X, I have an Applescript that I run at the beginning of the day. It sets an away message on IM, hides or quits programs that would distract me, gets new mail, and so forth. I also plug in my USB backup disk, so when I'm going home, another script ejects it and quits some programs. When the script is done, so a... |
On OS X, I have an Applescript that I run at the beginning of the day. It sets an away message on IM, hides or quits programs that would distract me, gets new mail, and so forth. I also plug in my USB backup disk, so when I'm going home, another script ejects it and quits some programs. When the script is done, so a... |
How much business logic should Value objects contain? |
|java|oop| |
One mentor I respect suggests that a simple bean is a waste of time - that value objects 'MUST' contain some business logic to be useful.
Another says such code is difficult to maintain and that all business logic must be externalized.
I realize this question is subjective. Asking anyway - want to know answers ... |
|java|oop|data-transfer-objects| |
My advice would be not to rely on unit tests to detect concurrency issues for several reasons:
- Lack of reproducibility: the tests will fail only once in a while, and won't be really helpful to pinpoint the problems.
- Erratic failing build will annoy everybody in the team - because the last commit will always... |
I don't have the book reference anymore, and I'll have to find it just to confirm, but I thought the default base hash just hashed together all of the members of your object. It got access to them because of the way the CLR worked, so it wasn't something that you could write as well as they had.
That is completely ... |
I don't have the book reference anymore, and I'll have to find it just to confirm, but I thought the default base hash just hashed together all of the members of your object. It got access to them because of the way the CLR worked, so it wasn't something that you could write as well as they had.
That is completely ... |
I don't have the book reference anymore, and I'll have to find it just to confirm, but I thought the default base hash just hashed together all of the members of your object. It got access to them because of the way the CLR worked, so it wasn't something that you could write as well as they had.
That is completely ... |
* AndAlso/OrElse logical operators |
* AndAlso/OrElse logical operators
(EDIT: Learn more here: [Should I always use the AndAlso and OrElse operators?][1])
[1]: http://stackoverflow.com/questions/55013/should-i-always-use-the-andalso-and-orelse-operators |
As the container grows, a reallocation for a vector requires copying all the elements into the new block of memory. Growing a deque allocates a new block and links it to the list of blocks - no copies are required. |
As the container grows, a reallocation for a vector requires copying all the elements into the new block of memory. Growing a deque allocates a new block and links it to the list of blocks - no copies are required.
Of course you can specify that a different backing container be used if you like. So if you have a s... |
Could you use JScript.NET?
If so, should be easy enough with eval() - then just loop through the objects returned and translate into KeyValuePair's or whatever |
With any decent compiler or runtime environment exceptions do not incur a significant penalty. It's more or less like a GOTO statement that jumps to the exception handler. Also, having exceptions caught by a runtime environment (like the JVM) helps isolating and fixing a bug a lot easier. I'll take a NullPointerExcepti... |
Well, depending on the level of messaging, you could implement a messaging service. Objects listen for messages, or register as a MessageListener on some MessageProvider.
You end up with cyclical dependencies if two objects have references to each other, which I would consider bad in most cases. |
One can use an automation program such as AutoIt or AutoHotkey to simulate the user clicking and moving the shortcut to another location. These programs can also create the shortcut and place it on the desktop. |
The easiest way to explain it is to give an example. Say you want two hashtables, one that maps objects of type string to type int and one that maps objects of type string to type double. You could define Hashtable <K, V> and then use the K and V types. Without generics, you'd have to use the 'object' type which, in... |
It's all about controlling what people can do with what you give them. The more controlling you are the more assumptions you can make.
Also, theorectically you can change the underlying implementation or something, but since for the most part it's:
private Foo foo;
public Foo getFoo() {}
public void... |
C# and VB have generics to take advantage of generics support in the underlying CLR (or is the other way around?). They allow you to write code ina statically-typed language that can apply to more than one kind of type without rewriting the code for each type you use them for (the runtime will do that for you) or othe... |
Java also has generics. C++ has templates.
Dynamic languages like Perl and Javascript don't have the same type restrictions so they get mostly the same benefits with less work. |
From [MSDN][1]:
> Generics provide the solution to a
> limitation in earlier versions of the
> common language runtime and the C#
> language in which generalization is
> accomplished by casting types to and
> from the universal base type Object.
> By creating a generic class, you can
> create a collection tha... |
In practice I always follow only one rule, the "no size fits all" rule.
Encapsulation and its importance is a product of your project. What object will be accessing your interface, how will they be using it, will it matter if they have unneeded access rights to members? those questions and the likes of them you need... |
It's a grey area. Not everything in markup has clearly defined boundaries, and this is one case where you get to use your personal preference and make a judgement call. It doesn't quite fit the idea of data being organised, but the cells are related across multiple axes, and that's the rule of thumb I use to decide w... |
cl.exe is VS2008 (and any other VS) C/C++ compiler, so check for more detailed error message why it cannot be spawned. Be sure you've installed C++ language support when installing VS2008. |
Well, you can get the file descriptor - I forget whether the method is fd() or getfd().
From that, you can use fdopen(fd, mode) to get a FILE*.
However, I think that the mechanisms the standard requires for synching STDIN/cin, STDOUT/cout and STDERR/cerr don't have to be visible to you. So if you're using both t... |
Well, you can get the file descriptor - I forget whether the method is fd() or getfd(). *The implementations I've used provide such methods, but the language standard doesn't require them, I believe - the standard shouldn't care whether your platform uses fd's for files.*
From that, you can use fdopen(fd, mode) to ... |
Yes, it does apply for form layouts. Keep in mind that there are also tags like FIELDSET and LABEL which exist specifically for adding structure to a form, so it's not really a question of just using DIV. You should be able to markup a form with pretty minimal HTML, and let CSS do the rest of the work. E.g.:
... |