Hello,
Im trying to do load testing on a web server. I want to customise the error fields whenever i get results other than 200 ok. At present the error is realised only when the server doesnot respond. Is there anyway i could customise error as i need.
I would like to know what are the open source and commerical tools for window Service Testing. Like memeory usage and code leakes etc ..
C# 2.0 - Window Service.
Hi,
this is something I know I should embrass in my coding projects but, due to lack of knowledge and my legendary lazyness, I do not do.
In fact, when I do them, I feel like overloaded and I finally give up.
What I am looking for is a good book/tutorial on how to really write good tests -i.e useful and covering a large spectrum of the code -.
Regards
I'm trying to figure out if
g++ -fsyntax-only
does only syntax checking or if it expands templates too.
Thus, I ask stack overflow for help:
is there to write a program so that syntactically it's valid, but when template expansion is done, an error occurs?
Thanks!
I'm really not confident with Regex, I know some basic syntax but not enough to keep me happy.
I'm trying to build a regular expression to check if an email is valid. So far here's what I've got:
[A-Za-z0-9._-]+@[A-Za-z0-9]+.[A-Za-z.]+
It needs to take account of periods in the username/domain and I think it works with multiple TLDs (e.g. co.uk).
I'm working with the preg engine in PHP so it needs to work with that. Thanks if you can help!
I want to get the code coverage of my tests. So I set the settings, build an app with .gcno files and run it on simulator.
It can get the coverage data successfully if there is no crash issue.
But if the app crashed, I will get nothing.
So how can I get the code coverage data when the app crash?
In my thought, this is because it will not call __gcov_flush() method when app crash. I only add app does not run in background to my plist file, so __gcov_flush() is called only at the time I press Home button.
Is there any way to call __gcov_flush() before the app crash?
Hello I have a Rewrite rule I am trying to implement on my local host but I cannot get it to do the action no matter how I setup the regex
the files are in this naming scheme /docroot/css/stylesheet.min.css and I have them printed in the code like /docroot/css/stylesheet.min.123438348.css (the number is example it comes from a get modified function). Note docroot is an example directory
how can I have the server ignore the numbers and redirect to the stylesheet.min.css
I need to do this for every css and js files (/js and /css) as well as one specific spritemap image
my current attempt
RewriteRule ^/(docroot)/(js|css)/(.+)\.(min)\.(.+)\.(js|css)$ /$1/$2/$3.$4.$6
RewriteRule ^(/docroot/images/spritemap)\.([0-9]+)\.(png)$ $1.$3
I have this wrapped in a I am on linux..should this be mod_rewrite.so?"
Hi,
What's the recommended way to cover off unit testing of generic classes/methods?
For example (referring to my example code below). Would it be a case of have 2 or 3 times the tests to cover testing the methods with a few different types of TKey, TNode classes? Or is just one class enough?
public class TopologyBase<TKey, TNode, TRelationship>
where TNode : NodeBase<TKey>, new()
where TRelationship : RelationshipBase<TKey>, new()
{
// Properties
public Dictionary<TKey, NodeBase<TKey>> Nodes { get; private set; }
public List<RelationshipBase<TKey>> Relationships { get; private set; }
// Constructors
protected TopologyBase()
{
Nodes = new Dictionary<TKey, NodeBase<TKey>>();
Relationships = new List<RelationshipBase<TKey>>();
}
// Methods
public TNode CreateNode(TKey key)
{
var node = new TNode {Key = key};
Nodes.Add(node.Key, node);
return node;
}
public void CreateRelationship(NodeBase<TKey> parent, NodeBase<TKey> child) {
.
.
.
HI there
I was wondering if there is a better way of testing that a view has rendered in MVC.
I was thinking perhaps I should render the view to a string but perhaps there are simpler methods?
Basically what I want to know if that the view for a given action has rendered without errors
I m already testing the view model but I want to see that rendering the view giving a correct ViewData.Model works
How do you access a file to use in unit tests? (Every time I have asked with more specific information I cannot get ANYONE to answer. This is as freaking basic as it gets. HELLO? IS ANYONE OUT THERE?)
Is there any good framework for comparing whole objects?
now i do
assertEquals("[email protected]", obj.email);
assertEquals("5", obj.shop);
if bad email is returned i never get to know if it had the right shop, i would like to get a list of incorrect fields.
Guice Singletons are weird for me
First I thought that
IService ser = Guice.createInjector().getInstance(IService.class);
System.out.println("ser=" + ser);
ser = Guice.createInjector().getInstance(IService.class);
System.out.println("ser=" + ser);
will work as singleton, but it returns
ser=Service2@1975b59
ser=Service2@1f934ad
its ok, it doesnt have to be easy.
Injector injector = Guice.createInjector();
IService ser = injector.getInstance(IService.class);
System.out.println("ser=" + ser);
ser = injector.getInstance(IService.class);
System.out.println("ser=" + ser);
works as singleton
ser=Service2@1975b59
ser=Service2@1975b59
So i need to have static field with Injector(Singleton for Singletons)
how do i pass to it Module for testing?
I have a file containing the following content 1000 line in the following format:
abc def ghi gkl
how to write perl script to convert it into :
abc ghi
??
Below is a GLSL fragment shader that outputs a texel
if the given texture coord is inside a box, otherwise a
color is output. This just feels silly and the there
must be a way to do this without branching?
uniform sampler2D texUnit;
varying vec4 color;
varying vec2 texCoord;
void main() {
vec4 texel = texture2D(texUnit, texCoord);
if (any(lessThan(texCoord, vec2(0.0, 0.0))) ||
any(greaterThan(texCoord, vec2(1.0, 1.0))))
gl_FragColor = color;
else
gl_FragColor = texel;
}
Below is a version without branching, but it still feels clumsy.
What is the best practice for "texture coord clamping"?
uniform sampler2D texUnit;
varying vec4 color;
varying vec4 labelColor;
varying vec2 texCoord;
void main() {
vec4 texel = texture2D(texUnit, texCoord);
bool outside = any(lessThan(texCoord, vec2(0.0, 0.0))) ||
any(greaterThan(texCoord, vec2(1.0, 1.0)));
gl_FragColor = mix(texel*labelColor, color,
vec4(outside,outside,outside,outside));
}
I am clamping texels to the region with the label is -- the texture s & t coordinates will be between 0 and 1 in this case. Otherwise, I use a brown color where the label ain't.
Note that I could also construct a branching version of the code that does not perform a texture lookup when it doesn't need to. Would this be faster than a non-branching version that always performed a texture lookup? Maybe time for some tests...
I'm writing an RPC middleware in C++. I have a class named RPCClientProxy that contains a socket client inside:
class RPCClientProxy {
...
private:
Socket* pSocket;
...
}
The constructor:
RPCClientProxy::RPCClientProxy(host, port) {
pSocket = new Socket(host, port);
}
As you can see, I don't need to tell the user that I have a socket inside.
Although, to make unit tests for my proxies it would be necessary to create mocks for sockets and pass them to the proxies, and to do so I must use a setter or pass a factory to the sockets in the proxies's constructors.
My question: According to TDD, is it acceptable to do it ONLY because the tests? As you can see, these changes would change the way the library is used by a programmer.
HOSTNAME=$1
#missing files will be created by chk_dir
for i in `cat filesordirectorieslist_of_remoteserver`
do
isdir=remsh $HOSTNAME "if [ -d $i ]; then echo dir; else echo file; fi"
if [ $isdir -eq "dir" ]
then
remsh $HOSTNAME "ls -d $i | cpio -o" | cpio -id
else
remsh $HOSTNAME "ls | cpio -o" | cpio -id
fi
done
i need simple solution for checking remote file is directory or file ?
thanks
I've got a simple class that gets most of its arguments via init, which also runs a variety of private methods that do most of the work. Output is available either through access to object variables or public methods.
Here's the problem - I'd like my unittest framework to directly call the private methods called by init with different data - without going through init.
What's the best way to do this?
So far, I've been refactoring these classes so that init does less and data is passed in separately. This makes testing easy, but I think the usability of the class suffers a little.
Ok I had a Paypal Sandbox account a year ago. I am developing a new site for a client and when I try to Login it won't recognize my email address. I tried forgot my password forgot password still nothing. So I guessed that maybe due to inactivity for such a long time they may have deleted my account. So then I try to Sign Up for a new one. I entered my details 3 times now and spent 6 hours trying to figure out what is the proper link to do this. Then I went to another Sandbox link which required me to entered a US Zip code and its a dead end. I am not even sure which Paypal account I signed up for those three times. No email nothing at all.
I am a Non US developer and the FAQ link for Non US developers just points to their REST API. Can someone please guide me to the proper Paypal Sandbox Setup for Non US developers including the proper sign up links please. And I know Stackoverflow does not like rants but from my experience dealing with Paypal, GTA 6 should make a satirical Paypal company in their next Game with Paypal Developer Rampage mode for the main protagonist who also happens to be a Developer.
EDIT: REST API does not include UK :(
I came across this algorithm for testing primality through trial division I fully understand this algorithm
static boolean isPrime(int N) {
if (N < 2)
return false;
for (int i = 2; i <= Math.sqrt(N); i++)
if (N % i == 0)
return false;
return true;
}
It works just fine. But then I came across this other one which works just as good but I do not fully understand the logic behind it.
static boolean isPrime(int N) {
if (N < 2)
return false;
for (int i = 2; i * i<N; i++)
if (N % i == 0)
return false;
return true;
}
It seems like i *i < N behaves like i <= Math.sqrt(N). If so, why?
Using Hibernate, what is the most efficient way to determine if a table is empty or non-empty? In other words, does the table have 0, or more than 0 rows?
I could execute the HQL query select count(*) from tablename and then check if result is 0 or non-0, but this isn't optimal as I would be asking the database for more detail than I really need.
I'm not experiencing any performance issues, however I'd like to take a look at what takes how long and how much memory cpu it uses etc.
I'd like to get a firsthand understanding of which things can be bottle necks etc and improve any code i might reuse or build upon... (perfectionist)
I'm looking to create a litte function that i can call at the begining and end of each function that records:
execution time
memory used
cpu demand
any ideas?
I currently have a testing environment for web apps on a virtual machine.
The problem - i would like to keep IE 6 for testing and also have access to newer versions of IE as well.
How can i do this?
Thanks.