@RubberDuck funny, I'm hitting the same wall as this guy: zbz5.net/adventures-vb6-reflection-and-error-handling - basically I thought "hey I'll make Assert raise an error, and then I don't need the test methods to be functions anymore, and failed Assert calls will stop test execution like an error does".
his solution was... to make test methods be functions.
I have a controller/action which should simply track the action has been hit (a click) and find the appropriate url to redirect to, and then redirect.
I would like this to perform as quickly as possible, I am a bit rubbish at threading so could you have a look and let me know if this is actually...
2014-09-14 21:18:00 TestSomething: [FAIL] - This result shouldn't be reachable
Public Sub TestSomething()
Assert.IsTrue False, "This result shouldn't be reachable"
End Sub
Public Sub Test()
TestClass.RegisterTestMethod Me, "TestSomething"
TestClass.RunAllTests
End Sub
(uh, nevermind the assert message, make it "False isn't True" instead)
so it works, but it's a fugly hack. a few more tests, and ...@RubberDuck do you mind if I post it for review?
At the documentation for QGraphicsScene, there is a simple example that does not work. Hence, I've tried to incorporate their code into a minimal example that does work. I'm curious if I succeeded.
From the docs (does not work):
scene = QGraphicsScene()
scene.addText("Hello, world!")
view = QGr...
I am working on calculating change, and investment rates with java. My code gives me the correct values, but does not display them how I'd like. For the first part, when I calculate the dollar amount of someones change, for example if they have forty cents it gives me 0.4, instead of 0.40. Im not...
It's either private, or public not creatable @Mat. Either way, you can't directly create a new object from outside the project. You'll need a list factory.
This is sourced from the Stanford Coursera self study DB class SQL quizzes.
Students at your hometown high school have decided to organize their social network using databases. So far, they have collected information about sixteen students in four grades, 9-12. Here's the schema:
Highschooler (...
If you saw it, and read all the relevant links, you'd know it, but I dunno how you would track it down in the first place unless you cheated and used mod tools.
Not long after I joined the team, I heard another employee with mod powers (I don't remember exactly who anymore) mention a personal rule of thumb: not voting on a site until earning enough rep there to do so without the mod powers. It's not an official rule, but I thought it was a decent idea, at least for main sites.
Inspired by this post, I wanted to be able, in any vba project I could be working on, to create a test class and write test methods. Like this:
ThisWorkbook Workbook | class module (client code)
Option Explicit
Public Sub TestAreEqual()
Assert.AreEqual 12, 34, "Values should be equal."...
Out of fun, I solved "Nice Angles" challenge on CodeEval in C# 4.0. My code produces correct output on my machine for any input, but on the CodeEval server, it produces an error. I have tried to dig in to this, but so far my conclusion is that there is something wrong on the CodeEval server. The ...
I was explained that first piece of code should be much slower than the other, but when I try to implementing it, I don't see any improvement. Any idea what went wrong with my code? Should be slower code: for (i = 0; i < 1000; i++) column_sum[i] = 0.0; for (j = 0; j < 1000; j++) column_sum[i] += b[j][i]; Should be much faster code: for (…
I'm working on a jquery plugin. The problem is that when I use it I can see a high CPU usage in task manager.
I think the problem is here .
$elementTSMask.on("mousemove", function(event){
if(isMouseDown && isLeftButton){
var toScroll;
if(endPosition != 0){
toScroll...
I have a script that makes use of datetime in order to name files.
Only business days (Mon - Fri) are used.
Here is my part of the code that finds the last business day:
lastBusDay = datetime.datetime.today()
shift = datetime.timedelta(max(1,(lastBusDay.weekday() + 6) % 7 - 3))
lastBusDay = la...
I wrote this program for a code test on some website. This program do some predefined transformations (transformation can be horizontally, vertically or by shifting to given number of keys) for every char in a file. How can I improve the efficiency of this program. I only intend to change the Pyt...
In a typical Minesweeper game, the board starts out as 256 fields, 51 mines. And then you make a few moves, and then you need to calculate the probabilities there. Those calculations involves something like 238 nCr 46 or something like that.
Ultimately, we are talking probabilities, yes. But I want to have some nCr methods that is using BigInteger as well, because on some occasions I want to regenerate a board (i.e. pick a random solution for the mines), and then I think it needs to be more exact.
@rolfl FieldRule.simplify() is a very fast method I believe, I didn't expect that to be so big there. Although it does get called very very often which is probably what did it.
@rolfl yes, I can imagine that. What analyze was it that you gave it to solve?
First of all I'm still new to c# and still learning how things goes on. My problem is I have so many global variable and I know it was wrong but I don't know how to manage this in c#. This code is about a server client network multithreaded and it's not finish yet. And can I convert this code to ...
I have been using entity framework 5 as DataAccess layer for my application.
I have a case where there are a set of 'Levels' offered. And I have a set of 'Colleges' offering the 'Levels'.
Class Level:
public partial class Level
{
public Level()
{
}
public in...
I would like to send let's say 2 variables to node js server. I know how to do it with one... But if I want to send two datas, which could be separately read in node and then written into xml file the method I used doesnt work.
http.createServer(function (req, res) {
if (req.method === "POST") ...
So there is a website that has 2 buttons (id of first is "player1" and the second is "player2"). I also have a textbox where you can enter number.
When the button is clicked, it disables itself and it shows up again after some random time.
I want to enter number in textbox and click on a button,...
@CodeX Well, from my research, there's Scrumpy, there's scrumpy, and there's Scrumpy. Two of them are not (so far as I have been able to find) available here, and the other is hard to judge. Efforts continue. I do have hard cider in the fridge though.
Meme: hello / hi / hey there
Originator: Bored Code Reviewers
Cultural height: The 2nd Monitor
Background: Core Reviewers like to greet each other in chat, and most of the time it's just a casual "Hello" then "Hi @someone". But on days of high activity, some unusual things can happen...
Or....
First of all: yes, I need this kind of array to generate data for a piece of hardware, and it must be stored and manipulated somewhere. The general consensus regarding bit manipulation seems to be "if you need to do that, there's something wrong".
The array-like container (PackedBitfieldArray) I...
I got a leather notepad holder thing with a cool pen, nalgene bottle(superuser), hoody(superuser), T-shirt, the mug, and some stickers (I don't know where to put them).
well I want to get that NLog you keep telling me about
@Mat'sMug you should one project that I took from 2005 i think....ugh. I have backups and copies of that thing all over the place..... it got ugly. but I finally got it into 2010 and it works....not touching it again until I have to
I deployed a little WPF app over here, whenever any user breaks it and the app throws an exception, I get an email with the full stack trace before the user even okays the error dialog.
having asked a question and then coming here is a bit like waiting at the doctor's. Sit around, watch other people doing - whatever, not knowing what will happen and when.
Australians have crazy hair, just ask Michael Hooper..... but, they don't throw up when drunk, they just tell crude jokes and then pass out (and how's that for many massive broad generalizations).
@Yuushi forward_iterator_tag just because I thought that I wouldn't need more. The use case is that I have an array of objects that can be converted to "uint4_t", and the desstination array of "uint4_t"s. For std::copy I just need a forward iterator
Getting back to the waiting room analogy: You also don't know who's your doctor. In my case it seems to be the guys who said "I'm...probably too drunk". This is great for a monday!
@Mat'sMug going to ask you later about using that NLog, I have it installed in that project but I have to to some other things, might not be until tomorrow... but I am going to bug you about it and how to use it in my application and website.
@Malachi you just add the configurations in the app.config xml, and then in your code you get a logger with LogManager.GetLogger() - I can show you how I've set up my mail logger if you want - make a chatroom and invite me, I'll get you started.
@Yuushi it's not that simple actually because the (bits*n) might cross a boundary, and I'd need at least one statement to check that. comparing indices is faster, and here's the trade off: more space (data*, index* and offset) plus added redundancy, or remove one member and have more calculations to do
@Yuushi I'm just thinking about speed issues, but I guess I'll have to run it on the target hardware to find out if I'm running into problems with this (or some of the possible random access iterator variants)
like, if the test method doesn't call any Assert methods, it looks like nothing's going to be reported - damn... and the error-handling in TestClass.RunTest is a relic from the AssertError-based approach (which failed for the reasons explained in the blog I've linked to)... I shouldn't have gone to sleep last night.
I had even left a sentence unfinished in my post...
the thing is that I like the way I have my API right now - I don't want to change it.. the client code just calls Assert methods and it just works, love it.
This is how I'm registering them now, but the benefit is I can write a tool to create new TestMethods.
Not really, and it's a lot easier to spot if you forget to register it.
Public Sub TwoNonEquatableObjectsAreEqual()
test.Assert.Name = "TwoNonEquatableObjectsAreEqual"
Dim a As New MockNotEquatable
Dim b As New MockNotEquatable
Set b = a
test.Assert.AreEqual a, b
End Sub
basically I want the client's test code to be just that: the client's test method. no boilerplate, just a one-liner somewhere at the class level to say "here, this class instance, it's a test class. register all TestXxxxxx methods in it."