Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 months ago.
Improve this question
contracts/simplestorage1.sol:7:20: DeclarationError: Identifier not found or not unique.
function store(unit256 _favoriteNumber) public {
^-----^
pragma solidity ^0.6.0;
contract SimpleStorage1 {
uint256 favoriteNumber;
function store(unit256 _favoriteNumber) public {
favoriteNumber = _favoriteNumber;
}
}
There is a typo in your code Please see the function argument you have typed unit instead of uint. Correct code is like
function store(uint256 _favoriteNumber) public {
favoriteNumber = _favoriteNumber;
}
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
fun sayHello(greet:String,itemsToGreet:List<String>){
itemsToGreet.forEach { itemsToGreet ->
println("$greet, $itemsToGreet")
}
}
fun main() {
val interestingThings = listOf("kotlin","program","comic")
sayHello(greet="hi", interestingThings)
}
A couple of problems:
You can't mix named and positional arguments in a method call. This results in a compilation error.
While not explicitly wrong, the fact that you're shadowing the itemsToGreet variable in your lambda expression is a code smell.
This fixes both:
fun sayHello(greet:String,itemsToGreet:List<String>) {
itemsToGreet.forEach { item -> // new variable name
println("$greet, $item")
}
}
fun main() {
val interestingThings = listOf("kotlin", "program", "comic")
sayHello("hi", interestingThings) // positional arguments
sayHello(greet="hi", itemsToGreet=interestingThings) // named arguments
}
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
public void SQLread()
{
sdr=cmd.ExecuteReader();
}
private void btnLOGIN_Click(object sender, EventArgs e)
{
OpenCon();
SqlCmd("select * Student where USN=#usn and Password=#pw");
Parameters("#usn", txtUSER.Text);
Parameters("#pw", txtPWD.Text);
SQLread();
if (sdr.HasRows)
{
MessageBox.Show("Welcome");
frmMain mm = new frmMain();
mm.Show();
this.Hide();
}
else
{
MessageBox.Show("Incorrect Username/Password");
}
}
I'm new to everything. I don't know why it keeps happening. Checked SQL if i misspelled anything but i don't think there's any problem.
The error happens here:
sdr=cmd.ExecuteReader();
tnks for yogesh sharma for the answer.
i forgot the \from\ in SqlCmd("select * Student where USN=#usn and Password=#pw"); -_-
You missed the from clause :
select s.*
from Student s
where USN = #usn and Password = #pw
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 10 months ago.
Improve this question
I have this code.
enum EnumA {
VALUE_X(EnumA.EnumB.VALUE_J),
VALUE_Y(EnumA.EnumB.VALUE_J);
EnumB propertyC;
enum EnumB {
VALUE_J;
int propertyX;
}
EnumA(EnumB c) {
this.propertyC = c;
}
}
public class {
main(...) {
EnumA.VALUE_X.propertyC.propertyX = 1;
EnumA.VALUE_Y.propertyC.propertyX = 2;
if(EnumA.VALUE_X.propertyC.propertyX == EnumA.VALUE_Y.propertyC.propertyX) {
(Any statement)
}
}
}
So the problem is that my IDE shows that the condition is always false. But when I run the project the statement get executed (condition is true) why?
Since enum values are static VALUE_X and VALUE_Y are using the same instance of VALUE_J and have in turn the same value for propertyX.
You are setting it to 1 and right afterwards to 2.
You can check this by logging/printing out the information of both before, between and after the assignments. It should be 0, 1 and 2 respectively.
The reason for your IDE to state it's always false most likely is, that a simple check of the variables shows, they are different.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How do I create a method in objective-c where I can run the method with different parameters each time. For example I want to be able to do something like this:
int thisMethod (int thisInt; NSString *thisString) {
int anotherInt = thisInt+2;
self.thisLabel.stringValue = thisString;
return 0;
}
So in this code, I want to run thisMethod with two parameters that can be used in the method.
i.e:
thisMethod(10; #"String");
Do I need to use a structure like this:
- (int) thisMethod:(id)sender{
//code here
}
If so, how do I use the parameters?
- (int)thisMethodWithInt:(int)thisInt andString:(NSString *)thisString {
int anotherInt = thisInt+2;
self.thisLabel.stringValue = thisString;
return 0;
}
Calling the Method then would look like this:
[self thisMethodWithInt:3 andString:#"My Super String"];
What you are describing is a c function and not a objective-c one..
You would have to pass the label object too, because self has no meaning in a C function. In Objective-C it's a hidden parameter that is passed to every method, but in a C function you have to pass it yourself (and use commas, instead of semicolons):
int thisMethod (int thisInt, NSString *thisString, id object) {
int anotherInt = thisInt+2;
object.thisLabel.stringValue = thisString;
return 0;
}
You probably have to explicitly set the type though, instead of using id, or the compiler will complain.
Again, use commas to separate arguments:
thisMethod(10, #"String", self);
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I have a windchill service from which I'm capturing the revision event.I'm using the API VersionControlServiceEvent.NEW_VERSION
But this event is capturing both checkout and revision event.I need to capture only the revise event.How to modify this to capture revise event alone or Is there any other API to do that.I need some help
Thanks
Starting from my previous answer (here), you just need to test the status of the target object :
public class VersionEventListenerAdapter extends ServiceEventListenerAdapter {
public VersionEventListenerAdapter(String serviceId) {
super(serviceId);
}
public void notifyVetoableEvent(Object event) throws WTException, WTPropertyVetoException {
if (!(event instanceof KeyedEvent)) {
return;
}
Object target = ((KeyedEvent) event).getEventTarget();
Object eventType = ((KeyedEvent) event).getEventType();
if (eventType.equals(VersionControlServiceEvent.NEW_VERSION))
{
//Check if the object is checkedOut
if (target instanceof Workable && WorkInProgressHelper.isCheckedOut((Workable)target) {
return;
}
/** Call your business code here
example : yourMethod(target);
**/
}
}