« first day (314 days earlier)      last day (579 days later) » 

2:00 AM
0
Q: What is the cause of this nullPointerException?

user2973447When I run my test harness I am getting a NullPointerException on the line: if(flower.extractPollen(pol)){ which I am struggling to explain. In my test harness I am adding flowers to the instance of my garden and the flowers have pollen as far as I can tell from println's. In my test harness I...

 
 
6 hours later…
user1804599
8:22 AM
@FredOverflow I removed it and now I’ve got a template keyword. :)
 
user1804599
I’ll just have type classes instead of subtype polymorphism.
 
9:17 AM
0
Q: C# Singleton used as a picture buffer

user2667775i want to use the singleton pattern to create a buffer where all needed pictures are stored. Something like that: public sealed class BaseBuffer { private static readonly Dictionary<string, Bitmap> pictures = new Dictionary<string, Bitmap>(); public static Bitmap GetPicture(string name...

 
 
1 hour later…
10:44 AM
0
Q: Get the name of the class in a Singleton method

berkesI want a class to return its own name, pluralized, using e.g. "active_support/inflector": describe "self.resource" do it "should be databases" do Database.resource.should equal "databases" end end class Database self.resource self.class.to_s.tableize end end This fails with: ...

 
 
5 hours later…
3:56 PM
0
Q: What is the best way to implement a component scoped singleton?

user3091735Let's say there is an application that creates an instance of the Task class every time when it needs to process some data. The task instance have some other services injected into it but all this services and the task object itself are unique within a single task instance. Some global services a...

 
 
2 hours later…
5:57 PM
0
Q: C# asp.net Datamanager

user2188043Currently I have an assignment with the following tasks, I have created the class called TestFetchOffer and am not sure how to approach the rest. I am very new to programming and will really appreciate guidance and code examples, thanks. 1.  Create a new class classed TestFetchOffer in the FlipF...

 
 
2 hours later…
8:02 PM
@rightfold Didn't we establish a long time ago that this won't work with polymorphic lists?
 
user1804599
It can, actually.
 
How?
 
user1804599
Haskell solves this as follows:
 
user1804599
data ShowBox = forall s. Show s => SB s

heteroList :: [ShowBox]
heteroList = [SB (), SB 5, SB True]
 
user1804599
Also dynamic even though that’s fugly.
 
8:05 PM
@rightfold Is it possible to put Elton John in that hetero list?
 
user1804599
Can you show him?
 
@rightfold I can show him my etchings.
 
user1804599
Also.
 
user1804599
Templates will be great.
 
user1804599
It was saved in the Java room.
 
8:14 PM
Allright
 
8:29 PM
@rightfold So, have you chosen a language for implementing the compiler yet?
 
user1804599
 
user1804599
@FredOverflow I have done that already. rightfold.github.io/gear
 
user1804599
Pattern matching was one of the easiest parts.
 
I like how C++ has a very primitive form of "pattern extracting" with assigning to a std::tie.
 
user1804599
8:34 PM
C++ has compile-time pattern matching which is not very primitive. :)
 
user1804599
I’ll have to implement pattern matching for Styx too.
 
I'm thirsty. Going to the kitchen to make milkshake. And them I'm gonna pwn me, erm, drink my milkshake :)
 
user1804599
You can match on ADTs and some built-in types.
 
user1804599
And with guards, of course.
 
10:55 PM
0
Q: "Race condition" when passing variable from onHandleIntent() to the application Singleton

alpinescramblerI am just starting to learn android programming, and I came across multiple iterations when passing a complex variable "solved" in an IntentService (onHandleIntent method) back to the main Activity. I do not intend to have this data, available to other applications, other than mine (the running A...

 

« first day (314 days earlier)      last day (579 days later) »