//gets the correct User (checked with printlns)
def user = User.get(params.user?.toString())
println "usern.nickname " + user.id + " " + user.nickname
println "user "+user
/*
* write in database
*/
user.nickname = params.nickname
user.email = params.email
/* a println of user.nickname shows the same as params.nickname, but the database
is not being updated with the value (params.nickname) */
I dont understand this. It´s so simple, but it doesnt update the database. Can anyone help, please give me your vaguest shots, Im thankful for any help
Silly, but did you forget to save?
If you did, user.save(flush:true) should do the trick.
Related
I've been stuck on this for months and I don't know what to do or where to look to solve it If you guys could point me in the right direction...
Basically, I have a simple chat room that will only ever involve two people and whenever a user sends a message I get two values: their username and their message.
At the moment this is my code for showing each message:
private void append_chat_conversation(DataSnapshot dataSnapshot) {
for (DataSnapshot ds : dataSnapshot.getChildren()) {
Log.e("Chat details: ", String.valueOf(ds));
chat_username = dataSnapshot.child("username").getValue(String.class);
chat_msg = dataSnapshot.child("message").getValue(String.class);
Log.e("Chat username: ", "" + chat_username);
Log.e("Chat message: ", "" + chat_msg);
}
messageView.append(chat_username + " - " + chat_msg + "\n");
}
As you can see when I get both values I append them into a simple textView in a scrollView in the chat window. However, I don't want that. I want to make it a bit nicer than just simple text. I just don't know how to show that layout below in the link with the relevant data in it (username + message).
Link to a picture that shows what layout I'd like.
Hope I explained it well enough, thanks for the help in advance.
Here I am trying to get ASSET details in simple java
Here is the code
MXSession session = MXSession.getSession();
session.setHost("localhost:13400/MXServer");
session.setUserName(user);
session.setPassword(pwd);
session.connect();
The connection was successful.
Then I tried to get the asset details with the code
MboSetRemote assetMboSet = session.getMboSet("ASSET");
assetMboSet.setOrderBy("ASSETNUM");
MboRemote assetMbo;
for(int j=0; ((assetMbo = assetMboSet.getMbo(j)) != null); j++)
{
String assetNum = assetMbo.getString("ASSETNUM");
String location = assetMbo.getString("LOCATION");
String desc = assetMbo.getString("DESCRIPTION");
System.out.println(assetNum + " - " + location + " - " + desc);
}
it is giving me the error and could not proceed further in the line
MboSetRemote assetMboSet = session.getMboSet("ASSET");
saying
Exception in thread "main" psdi.util.MXSystemException: system#unknownerror
at psdi.util.RMISession.getMboSet(RMISession.java:330)
Please suggest me how to proceed
My friend I just tried your code scripth and it works fine, here is a snapshot of my environment which shows your work.
This problem may occur, If the admin mode is on OR you need to change take a look at sessions, to do that.
you can go to the users application.
Select action > manage sessions.
You can view users who are currently logged into the system.
You can log out a user from the system or log out and block a user from the system.
You can see the login history of users.
What I have attached below is a copy/paste of my attempt to get and set a series of JComboBox's. hName and hAddress are dealing with a JTextField, so those are working fine, but for some reason I can get from my combo box's, but I can't set to them and including a call to initialiseDatabase() will cause the program to fail.
infoHolder is a resultset and dbstatement is a statement. The database is connecting fine, and the table inside of it is prepared and accessible, it's just the setting of the combobox's that's the issue.
Any help appreciated, and apologies if I'm missing something fundamental in the code below above.
public void initialiseDatabase()
{
try
{
infoHolder = dBStatement.executeQuery("SELECT * FROM House");
infoHolder.next();
hName = infoHolder.getString("Name");
hAddress = infoHolder.getString("Address");
numRooms = infoHolder.getInt("numRooms");
Type = infoHolder.getString("Type");
charge = infoHolder.getString("roomCharge");
Access = infoHolder.getString("dAccess");
Info = infoHolder.getString("oInfo");
houseText.setText(" " +hName);
addressText.setText(" " +hAddress);
roomNumber.setSelectedItem(" " +numRooms);
roomType.setSelectedItem(" " +Type);
chargeRoom.setSelectedItem(" " +charge);
access.setSelectedItem(" " +Access);
oInfo.setText(" " +Info);
current2 = 1;
infoHolder.close();
}
catch(SQLException e8) {JOptionPane.showMessageDialog(this, "Database failed to initialise!", "Message Dialog", JOptionPane.INFORMATION_MESSAGE);;}
}
I am struggling for a couple of hours now on how to link a discid to a musicbrainz mbid.
So, using dietmar-steiner / JMBDiscId
JMBDiscId discId = new JMBDiscId();
if (discId.init(PropertyFinder.getProperty("libdiscid.path")))
{
String musicBrainzDiscID = discId.getDiscId(PropertyFinder.getProperty("cdrom.path"));
}
or musicbrainzws2-java
Disc controller = new Disc();
String drive = PropertyFinder.getProperty("cdrom.path");
try {
DiscWs2 disc =controller.lookUp(drive);
log.info("DISC: " + disc.getDiscId() + " match: " + disc.getReleases().size() + " releases");
....
I can extract a discid for freedb or musicbrainz easily (more or less), but I have not found a way on calculating the id I that I need to download cover art via the CoverArtArchiveClient from last.fm.
CoverArtArchiveClient client = new DefaultCoverArtArchiveClient();
try
{
UUID mbid = UUID.fromString("mbid to locate release");
fm.last.musicbrainz.coverart.CoverArt coverArt = client.getByMbid(mbid);
Theoretically, I assume, I could you the data collected by musicbrainzws2-java to trigger a search, and then use the mbid from the result ... but that cannot be the best option to do.
I am happy about any push into the right direction...
Cheers,
Ed.
You don't calculate the MBID. The MBID is attached on every entity you retrieve from MusicBrainz.
When getting releases by DiscID you get a list. Each entry is a release and has an MBID, accessible with getId():
for (ReleaseWs2 rel : disc.getReleases()){
log.info("MBID: " + rel.getId() + ", String: " + rel.toString());
}
You then probably want to try the CoverArtArchive (CAA) for every release and take the first cover art you get.
Unfortunately I don't know of any API documentation for musicbrainzws2 on the web. I recommend running javadoc on all source files.
I have the below code and on my computer via Eclipse virtual device it works fine. But when installed on a real life phone it always reverts to the else statement.
This activity does not always get passed a value and if it is not I want a random record to appear. Thank you for any help or advice and time taken to read.
searchId = getIntent().getIntExtra("EMPLOYEE_ID", 0);
if(searchId > 0){
Query="SELECT * FROM " + DB_TABLE +" ORDER BY RANDOM() LIMIT 1";
Log.v("STANDARD RANDOM", "Was run");
}
else{
Query ="SELECT * FROM " + DB_TABLE +" WHERE _id=" + searchId + "";
Log.v("FROM SEARCH PAGE", "Was run");
}
Not sure if this fixes your problem. But according to the documentation, your code is not correct:
The name must include a package prefix, for example the app com.android.contacts would use names like "com.android.contacts.ShowAll".
Taken from Intent.putExtra.
You are using "EMPLOYEE_ID", without a package prefix, but you must include one!