Hi everyone,
I have a Transaction for a batch insert/update block and all of sudden it stopped working.
The are no errors or exception risen and it seems like Rails stops just before the end of the Transaction blog so the methods does not return.
I restarted both MySQL and the system but still.
i am new to junit so any help is appreciated.
I have a class called sysconfig.java for which i have written a
junit class file called TestSysconfig.java that tests some methods in the sysconfig.java.
The method that i am testing in sysconfig.java calls another class file "ethipmapping.java"
i have created a mock of this class file as Testethipmapping.java.
so my question is how do i tell sysconfig.java to call this mock object?
If I have a class "person" with a property $name and its getter(get_name()) and setter(set_name()) methods, then after instantiating the objects and setting the property i.e.
$paddy = new person();
$paddy->set_name("Padyster Dave");
echo "Paddy's full name: ".$paddy->name; //WHY THIS IS NOT RECOMMENDED...
In the above code $paddy->name;WHY THIS IS NOT RECOMMENDED?
I have an Ajax-enabled CRUD application. If I display a record from my database it shows that record's values for each column, including its primary key.
For the Ajax actions tied to buttons on the page I am able to set up their calls by printing the ID directly into their onclick functions when rendering the HTML server-side. For example, to save changes to the record I may have a button as follows, with '123' being the primary key of the record.
<button type="button" onclick="saveRecord('123')">Save</button>
Sometimes I have pages with Javascript generating HTML and Javascript. In some of these cases the primary key is not naturally available at that place in the code. In these cases I took a shortcut and generate buttons like so, taking the primary key from a place it happens to be displayed on screen for visual consumption:
...
<td>Primary Key: </td>
<td><span id="PRIM_KEY">123</span></td>
...
<button type="button" onclick="saveRecord(jQuery('#PRIM_KEY').text())">DoSomething</button>
This definitely works, but it seems wrong to drive database queries based on the value of text whose purpose was user consumption rather than method consumption. I could solve this by adding a series of additional parameters to various methods to usher the primary key along until it is eventually needed, but that also seems clunky.
The most natural way for me to solve this problem would be to simply situate all the Javascript which currently lives in external files, in the <head> of the page. In that way I could generate custom Javascript methods without having to pass around as many parameters.
Other than readability, I'm struggling to see what benefit there is to storing Javascript externally. It seems like it makes the already weak marriage between HTML/DOM and Javascript all the more distant.
I've seen some people suggest that I leave the Javascript external, but do set various "custom" variables on the page itself, for example, in PHP:
<script type="text/javascript">
var primaryKey = <?php print $primaryKey; ?>;
</script>
<script type="text/javascript" src="my-external-js-file-depending-on-primaryKey-being-set.js"></script>
How is this any better than just putting all the Javascript on the page in the first place? There HTML and Javascript are still strongly dependent on each other.
In the following Groovy snippet, I attempt to replace both the hashCode and toString methods
String.metaClass.toString = {-> "override" }
String.metaClass.hashCode = {-> 22 }
But when I test it out, only the replacement of hashCode works
String s = "foo"
println s.hashCode() // prints 22
println s.toString() // prints "foo"
Is toString somehow a special case (possibly for security reasons)?
I'm speaking of this module:
http://docs.python.org/library/operator.html
From the article:
The operator module exports a set of
functions implemented in C
corresponding to the intrinsic
operators of Python. For example,
operator.add(x, y) is equivalent to
the expression x+y. The function names
are those used for special class
methods; variants without leading and
trailing __ are also provided for
convenience.
I'm not sure I understand the benefit or purpose of this module.
Hey there,
I've heard about web scraping software that can take data from a webpage. i'm building an android app and I want to take information from this site www.menupages.ie
All I need is the names of the restaurants, and typing them in myself would be very tedious.
Can someone tell me how i'd go about doing this in eclipse, what methods i need etc.
I dont know anything about it.
Thanks alot.
Hi there
Can someone explain the differences between an Observable and a ConnectableObservable? The Rx Extensions documentation is very sparse and I don't understand in what cases the ConnectableObservable is useful.
This class is used in the Replay/Prune methods.
I'm trying to set a page that displays the visitor's IP. All the methods I have tried show an IP different from the IP my computer has. I've tried:
Looking up http://www.whatismyip.com/automation/n09230945.asp
Using socket.getaddrinfo(socket.gethostname(), None)[0][4][0]
How can I find the real IP of the visitor?
Hey, I'm creating a little GLUT application and need help with hiding/removing the console window.
I am developing on windows and I already know of the various methods to hide the console window on a windows system, however is there no portable method of hiding it?
Thanks...
Is there a way to query an embedded flash element to determine the available methods that can be executed on it via JavaScript?
Edit:
It appears that in IE it's as simple as
for ( i in flashNode ) {
alert(i);
}
After much clicking, they will be some of the very last members enumerated.
Still not able to determine this in Firefox though.
I draw figure in Flsh ID with JSFL methods, for example
// draw rectangle
doc.addNewLine({x:0, y:0}, {x:2000, y:0});
doc.addNewLine({x:2000, y:0}, {x:2000, y:500});
doc.addNewLine({x:2000, y:500}, {x:0, y:500});
doc.addNewLine({x:0, y:500}, {x:0, y:0});
// how can I fill it, because this way doesn't work
doc.setFillColor('#0000ff');
I have a WSDL 1.1 file which describes my Web Service. Now I need get access to its methods using ASP.NET 3.5
I tried to use wsdl.exe utility but I think that this utility use only WSDL 2.0 format.
hi! all,
I was tryin to convert a QSting to char* type but by following methods,but those does'nt seem to work.
// QLineEdit *line=new QLineEdit();{just to describe what is line here}
QString temp=line->text();
char *str=(char *)malloc(10);
QByteArray ba=temp.toLatin1();
strcpy(str,ba.data());
can you elobrate the possible flaw with this method ,or tell alternative method.
If ObjectAlloc cannot deduce type information for the block, it uses 'GeneralBlock'. Any strategies to get leaks from this block that may eliminate the need of my 'trial and error' methods that I use? The Extended Detail thing doesn't really do it for me as I just keep guessing.
I was wondering if PHPStorm by Jetbrains has a tool to sort the methods in my JavaScript object by name. If not are there any other tools that can do this for me?
Ext.regController("dashboard", {
goToShoppingCart:function() {
Ext.dispatch({
controller:"shoppingCart",
action:"loadCart"
});
},
goToDashboard:function() {},
goToContact:function() {}
}
);
to
Ext.regController("dashboard", {
goToContact:function() {},
goToDashboard:function() {},
goToShoppingCart:function() {
Ext.dispatch({
controller:"shoppingCart",
action:"loadCart"
});
}
}
);
This is only for organization.
Thanks
I'm looking to create an ID system for cataloging images. I can't use md5() since that will change if I alter the EXIF tags of the image.
I am currently using the SHA1 checksum computed by imagemagick. It works perfectly, but it's really, really slow on larger images (~15 seconds on a quad-core xeon for a 21 megapixel JPG).
Are there any other "visual" methods of uniquely identifying an image that would be faster?
Thank you.
I know the title sound confusing and thats because it is. its a bit long so try too stay with me.
this is the layout i have my code designed
variables
constructor
methods.
im trying too fill a Jlist full on names. i want too get those names using a method. so here goes.
in my variables i have my JList. its called contactNames;
i also have an array which stores 5 strings which are the contacts names;
heres the code for that anyway
String contact1;
String contact2;
String contact3;
String contact4;
String contact5;
String[] contactListNames;
JList contactList;
simple enough. then in my constructor i have the Jlist defined to fill itself with the contents of the array
fillContactList();
JList contactList = new JList(contactListNames);
that method fillContactList() is coming up shortly. notice i dont have the array defined in the constructor. so heres my first question. can i do that? define the array to contain something in te constructor rather than filling it fromt the array.
now heres where stuff gets balls up.
ive created three different methods all of which havent worked. basically im trying to fill the array with all of them.
this is the simplest one. it doesnt set the Jlist, it doesnt do anything compilicated. all it trys too do is fill the array one bit at a time
public void fillContactList()
{
for(int i = 0;i<3;i++)
{
try
{
String contact;
System.out.println(" please fill the list at index "+ i);
Scanner in = new Scanner(System.in);
contact = in.next();
contactListNames[i] = contact;
in.nextLine();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
unfortunately this doesnt qwork. i get the print out to fill it at index 0; i input something and i get a nice big stack trace starting at
contactListNames[i] = contact;
so my two questions in short are
how i define an array in a constructor.
and why cant i fill the array from that method.
************************888 **************************888
stack trace by request
please fill the list at index 0
overtone
java.lang.NullPointerException
please fill the list at index 1
at project.AdminMessages.fillContactList(AdminMessages.java:408)
at project.AdminMessages.<init>(AdminMessages.java:88)
at project.AdminUser.createAdminMessages(AdminUser.java:32)
at project.AdminUser.<init>(AdminUser.java:18)
at project.AdminUser.main(AdminUser.java:47)
it was a null poiinter exception
Hello, I have an application that have EF 16 classes that share this information: They all are classes only with a key field and a description.
I think it should be a waste if I make a controller with just 1 method just to present a form to fill these classes info, then I was thinking in to make a generic form(with key, description) and dynamically fill the right class through a sort of selection the selected info in any way, any good suggestion or pattern to do that? Where the generic methods should be located.
Seems like a simple thing but I can't seem to find a way to do it.
I saw this but it doesn't seem to work:
NSDate *date = [NSDate dateWithNaturalLanguageString:@"07/17/07"];
It would be great to see a couple different methods.
Thanks,
Nick
I've been trying to learn PHP OOP and have looked at multiple articles, but have yet to find a good resource for learning. I want to learn from the user of setters and getters, $this-, constructors, and so on...! Can anyone please suggest me something? I noticed MOST teachings leave out the explanation of $this-. I want to learn magic methods, decorators, encapsulation, etc... Feel free to suggest something that I haven't explicitly listed.
I'm having serious problems with accepting payments.
I'm passing the total amount in a hidden field
<input type="hidden"
name="checkout-flow-support.merchant-checkout-flow-support.shipping-methods.flat-rate-shipping-1.price"
value="129.00"/>
Some of the users changed this value to 2 using firebug and submitted the form. Instead of getting $129, we only received $2.
I have no idea how to proceed this anyone help me quick .
I'm looking for an idea to write an ISI paper.
till now,I'm thinking to write something about Formal Methods but I'm not sure. So What do you suggest I want to change the subject and still looking for new ideas.
What is a good subject for an ISI paper