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);
**/
}
}
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 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;
}
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 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 9 years ago.
Improve this question
On OS X, a common way of running an application on some files is to drop them on the application bundle in Finder. I need to get the list of those files.
I tried to get them from command arguments (like in Windows), but the command line contains only the program path.
How can I get this list using Qt 5.2 or the Cocoa framework?
To accept files being opened with your application, you need to accept the openFile call for your application delegate, e.g.
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
NSLog(#"%#", filename);
return YES;
}
Now if you want to accept dragged files onto a window, you have to implement the NSDraggingDestination protocol, there are several answers here about dealing with that API.
Now for Qt, you need to implement the event handler, and deal with the QEvent::FileOpen event, who's parameter is a QFileOpenEvent e.g.
class MyApp : public QApplication
{
protected:
bool event(QEvent *);
};
bool
MyApp::event(QEvent *event)
{
switch (event->type()) {
case QEvent::FileOpen: {
QFileOpenEvent *evt = static_cast<QFileOpenEvent *>(event));
// Do something with event->file() - the file that was opened
return true;
}
default:
return QApplication::event(event);
}
}