Hi,
I need a tool which generates random JSON objects. I want to use this tool to do testing on my HTTP POST requests and use the random JSON object in it.
Any suggestions?
I am using the following options in my ~/.ssh/config in order to enable connection multiplexing:
ControlMaster auto
ControlPath ~/.ssh/control/master-%r@%h:%p
However, this has the annoying problem that the first shell to connect to a particular server must be the last to disconnect, because it is the master connection that all the other connections are using. So if you log out of the master, it appears to just hang. To solve this, I would like to wrap ssh with a script that checks if the control master file exists, and if not, starts a master ssh process in the background. Then it would start a slave ssh session.
In order to accomplish this, my script would have to determine the path to the control file that ssh would use. This would entail parsing the ssh command line options and config files and implementing the logic for determining the ControlPath. Is there any way to just ask ssh what path it would use, so I can check it?
Hi Everyone! I've looked around the Wordpress forums about this and didn't find anything so I thought I might try here.
If you have a staging/dev Wordpress setup used for testing new pluging and such, how do you go about migrating the data in the staging database back to the production database? Is there a "Wordpress best practices" way to do this, or am I limited to having to manually migrate tables from one database to the other?
final Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("image/jpeg");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "this is the test");
emailIntent.putExtra(Intent.EXTRA_TEXT, "testing time");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
For you rails programmers, what's the easiest way to keep your RDoc files up-to-date?
I know I can run rake doc:app manually, but I really don't feel like adding a manual step to the check-in process, and since we're already using cruisecontrolrb to handle deployment and testing automation, it seems like there should be an easy way to regenerate these files on check-in.
Is anyone already automating rake doc:app? And, if so, what are your suggestions?
Hi Is there a way to mock request params, what is the best approach when testing to create fake request values in order to run a test
would some thing like this work?
_context = MockRepository.GenerateStub<HttpContext>();
request = MockRepository.GenerateStub<HttpRequest>();
var collection = new NameValueCollection();
collection.Add("", "");
SetupResult.For(request.Params).Return(collection);
SetupResult.For(_context.Request).Return(request);
I am working on a desktop application using the Qt framework and Qt Creator IDE. I am doing my development on mac, and would like to begin testing on Windows as well. I am having trouble finding documentation on how do this. What's is the best way to develop on mac and automate windows builds of a Qt Creator project?
Hi,
I'm planning to test my Linux box and I want to start in memory testing. But my problem is what should I need to test the memory in my linux box? Should I need a tool? Or there are some APIs to use to build some scripts?
Thanks
The advantage of inversion of control is that it decouples objects from specific lookup mechanisms and implementations of the objects it depends on. As a result, more flexibility is obtained for production applications as well as for testing.
what does it mean actually ?
I need it in FlexUnit to test private methods. Is there any possibility to do this via reflection by using describeType or maybe flexUnit has some build in facility? I dislike artificial limitation that i cannot test private functions, it greatly reduces flexibility. Yes it is good design for me to test private functions, so please do not advise me to refactor my code. I do not want to break the encapsulation for the sake of unit testing.
I have several web projects built with Symfony v1.0, but I am excited by the new features in Symfony version 1.4 (Improved security, native email support and improved performance).
How can I continue to develop my 1.0 projects but also create a testing environment for version 1.4?
I'm trying to put together a static html website with full navigation. In other words, I want the user to click some links and images and actually be taken to another page. I'm a developer so I know how to do this in frameworks like ASP.Net MVC and grails. However, for this particular case, I just want to quickly mock up the UI and provide simple navigation so I can do some user testing. Can anyone advice on how to do this?
Thanks,
I have a network of Java Threads (Flow-Based Programming) communicating via fixed-capacity channels - running under WindowsXP. What we expected, based on our experience with "green" threads (non-preemptive), would be that threads would switch context less often (thus reducing CPU time) if the channels were made bigger. However, we found that increasing channel size does not make any difference to the run time. What seems to be happening is that Java decides to switch threads even though channels aren't full or empty (i.e. even though a thread doesn't have to suspend), which costs CPU time for no apparent advantage. Also changing Thread priorities doesn't make any observable difference.
My question is whether there is some way of persuading Java not to make unnecessary context switches, but hold off switching until it is really necessary to switch threads - is there some way of changing Java's dispatching logic? Or is it reacting to something I didn't pay attention to?! Or are there other asynchronism mechanisms, e.g. Thread factories, Runnable(s), maybe even daemons (!). The answer appears to be non-obvious, as so far none of my correspondents has come up with an answer (including most recently two CS profs). Or maybe I'm missing something that's so obvious that people can't imagine my not knowing it...
I've added the send and receive code here - not very elegant, but it seems to work...;-) In case you are wondering, I thought the goLock logic in 'send' might be causing the problem, but removing it temporarily didn't make any difference. I have added the code for send and receive...
public synchronized Packet receive() {
if (isDrained()) {
return null;
}
while (isEmpty()) {
try {
wait();
} catch (InterruptedException e) {
close();
return null;
}
if (isDrained()) {
return null;
}
}
if (isDrained()) {
return null;
}
if (isFull()) {
notifyAll(); // notify other components waiting to send
}
Packet packet = array[receivePtr];
array[receivePtr] = null;
receivePtr = (receivePtr + 1) % array.length;
//notifyAll(); // only needed if it was full
usedSlots--;
packet.setOwner(receiver);
if (null == packet.getContent()) {
traceFuncs("Received null packet");
} else {
traceFuncs("Received: " + packet.toString());
}
return packet;
}
synchronized boolean send(final Packet packet, final OutputPort op) {
sender = op.sender;
if (isClosed()) {
return false;
}
while (isFull()) {
try {
wait();
} catch (InterruptedException e) {
indicateOneSenderClosed();
return false;
}
sender = op.sender;
}
if (isClosed()) {
return false;
}
try {
receiver.goLock.lockInterruptibly();
} catch (InterruptedException ex) {
return false;
}
try {
packet.clearOwner();
array[sendPtr] = packet;
sendPtr = (sendPtr + 1) % array.length;
usedSlots++; // move this to here
if (receiver.getStatus() == StatusValues.DORMANT || receiver.getStatus() == StatusValues.NOT_STARTED) {
receiver.activate(); // start or wake up if necessary
} else {
notifyAll(); // notify receiver
// other components waiting to send to this connection may also get
// notified,
// but this is handled by while statement
}
sender = null;
Component.network.active = true;
} finally {
receiver.goLock.unlock();
}
return true;
}
Hi.
Could you suggest a fast, deterministic method that is usable in practice, for testing if a large number is prime or not?
Also, I would like to know how to use non-deterministic primality tests correctly. For example, if I'm using such a method, I can be sure that a number is not prime if the output is "no", but what about the other case, when the output is "probably"? Do I have to test for primality manually in this case?
Thanks in advance.
I have a problem with my MacBook Pro's screen - here's a video:
http://yfrog.com/4wm63z
For those who prefer words, if you divide the screen vertically into 4 columns, the second column is corrupted (flickering, and discoloured, usually with yellow).
I took it to an Apple store and they said it could be the screen or the logic board, neither of which will be cheap to replace.
However, occasionally this problem will completely go away. So before I part with my cash, or decide to turn this into an overpriced media center for my TV... could the problem be a loose cable, or something else cheaper to fix?
I am testing some enhanced string related functions with which I am trying to use move as a way to copy strings around for faster, more efficient use without delving into pointers.
While testing a function for making a delimited string from a TStringList, I encountered a strange issue. The compiler referenced the bytes contained through the index when it was empty and when a string was added to it through move, index referenced the characters contained.
Here is a small downsized barebone code sample:-
unit UI;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Rtti, System.Classes,
System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Layouts,
FMX.Memo;
type
TForm1 = class(TForm)
Results: TMemo;
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
function StringListToDelimitedString
( const AStringList: TStringList; const ADelimiter: String ): String;
var
Str : String;
Temp1 : NativeInt;
Temp2 : NativeInt;
DelimiterSize : Byte;
begin
Result := ' ';
Temp1 := 0;
DelimiterSize := Length ( ADelimiter ) * 2;
for Str in AStringList do
Temp1 := Temp1 + Length ( Str );
SetLength ( Result, Temp1 );
Temp1 := 1;
for Str in AStringList do
begin
Temp2 := Length ( Str ) * 2;
// Here Index references bytes in Result
Move ( Str [1], Result [Temp1], Temp2 );
// From here the index seems to address characters instead of bytes in Result
Temp1 := Temp1 + Temp2;
Move ( ADelimiter [1], Result [Temp1], DelimiterSize );
Temp1 := Temp1 + DelimiterSize;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
StrList : TStringList;
Str : String;
begin
// Test 1 : StringListToDelimitedString
StrList := TStringList.Create;
Str := '';
StrList.Add ( 'Hello1' );
StrList.Add ( 'Hello2' );
StrList.Add ( 'Hello3' );
StrList.Add ( 'Hello4' );
Str := StringListToDelimitedString ( StrList, ';' );
Results.Lines.Add ( Str );
StrList.Free;
end;
end.
Please devise a solution and if possible, some explanation. Alternatives are welcome too.
Hi still stuck with the ugly scheme
the problem this time is to get the median of three values (easy)
I did all these :
(define (med x y z) (car(cdr(x y z)))
and it was accepted but when testing it
(med 3 4 5)
I will get this error
Error: attempt to call a non-procedure
(2 3 4)
and when entering letters inetead of number i got
(md x y z)
Error: undefined varia
y
(package user)
using somthin else than x y z i got
(md d l m)
Error: undefined variable
d
(package user)
so what is wronge ?!
If I'm returning ["foo"] from a RESTful web query, Which of these is more proper? Will pedantic REST parsing die on the newline?
["foo"]\n (with newline, Content-Length=8)
["foo"] (no newline, Content-Length=7)
For easy regression testing I like the form with the newline, but I want to make sure I won't be breaking any application frameworks that might have a more strict view of the REST format.
Two questions (questions #2 and #3) did not populate in my survey for respondents. All questions, including these two, was mandatory. The question is visible in the preview and when tested (testing was completed eight times). The browser is internet explorer. The survey link is: https://www.surveymonkey.com/s/3YWNTR5
This survey was used for a graduate school Capstone research project. If I could recover the answers to these questions, I would be grateful. Thank you, Jennifer Granger
We have a lot of drives that need to be sanitized. NIST SP 800-88 recommends software that uses the ATA Secure Erase command. That's apparently the only way to be sure that the drive is properly wiped, due to bad-block remapping and such.
I know that this functionality is available in hdparm. The problem with that approach is that it is inconsistent on multiple platforms, occasionally times out, doesn't have error-checking logic, and doesn't check the resulting drive to make sure that it has, in fact, been erased. So a proper program might use hdparm, but hdparm by itself isn't an answer.
I'm looking for open source software that implements ATA Secure Erase. Ideally it will be a bootable disk image like DBAN, but it will use the ATA command.
Hi All,
I've been programming C# for a while now (I'm a Computer Science major), and have never had to implement threading.
I am currently building an application for a client that requires threading for a series of operations.
Due to the nature of the client/provider agreement, I cannot release the source I am working with. The code that I have posted is in a general form. Pretty much the basic idea of what I am implementing, excluding the content specific source.
The first Snippet demonstrates my basic structure,
The Progress class is a custom progress window that is displayed as a dialog to prevent user UI interaction.
I am currently using the code to complete database calls based on a collection of objects in another area of the application code.
For example, I have a collection of "Objects" of one of my custom classes, that I perform these database calls on or on behalf of. My current set up works just fine when I call the "GeneralizedFunction" one and only one time.
What I need to do is call this function once for every object in the collection. I was attempting to use a foreach loop to iterate through the collection, then I tried a for loop.
For both loops, the result was the same. The Async operation performs exactly as desired for the first item in the collection. This, however, is the only one it works for. For each subsequent item, the progress box (my custom window) displays and immediately closes.
In terms of the database calls, the calls for the first item in the collection are the only ones that successfully complete. All others aren't attempted.
I've tried everything that I know and don't know to do, but I just cannot seem to get it to work.
How can I get this to work for my entire collection?
Any and all help is very greatly appreciated.
Progress progress;
BackgroundWorker worker;
// Cancel the current process
private void CancelProcess(object sender, EventArgs e)
{
worker.CancelAsync();
}
// The main process ... "Generalized"
private void GeneralizedFunction()
{
progress = new Progress();
progress.Cancel += CancelProcess;
progress.Owner = this;
Dispatcher pDispatcher = progress.Dispatcher;
worker = new BackgroundWorker();
worker.WorkerSupportsCancellation = true;
object[] workArgs = { arg1, arg2, arg3};
worker.DoWork += delegate(object s, DoWorkEventArgs args)
{
/* All main logic here
*/
foreach(Class ClassObject in ClassObjectCollection)
{
//Some more logic here
UpdateProgressDelegate update = new UpdateProgressDelegate(updateProgress);
pDispatcher.BeginInvoke(update, arg1,arg2,arg3);
Thread.Sleep(1000);
}
};
worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args)
{
progress.Close();
};
worker.RunWorkerAsync(workArgs);
progress.ShowDialog();
}
public delegate void UpdateProgressDelegate(arg1,arg2,arg3);
private void updateProgress(arg1,arg2,arg3)
{
//Update progress
}
One way of thinking about this is: if we care about the Design of the code then Easymock is the better choice as it gives feedback to you by its concept of expectations
If we care about the maintainability of tests( easier to read,write and having less brittle tests which are not affected much by change), then Mockito seems a better choice.
My question is:
- If you have used Easymock in large scale projects, do you find that your tests are harder to maintain?
- What are the limitations of Mockito( other than endo testing)
Is there any tool or framework able to make it easier to "unit test" distributed software written in Java? My system under test is a peer-to-peer software, and I'd like to perform testing using something like PNUnit, but with Java instead of .Net.
Hi,
I wonder if there is a way to make a copy of one db item?
e.g. I have a model
class Category(models.Model):
slug = models.CharField(max_length=200)
name = models.CharField(max_length = 200)
So if I added one item, how can i clone it 100 times for testing?