Developer Blog

by Roman Soldatow


  • Home

  • Tags

  • Archives

  • Projects

  • Impressum

Hibernate - You have an error in your SQL syntax

Posted on 2018-03-12

If you see following error, it could just be, that you use one of the MySQL reserved words.

ERROR 1064 (42000) at line: You have an error in your SQL syntax

Hibernate Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
@Entity
@Table(name = "user")
@NamedQuery(name = "getAllUsers", query = "SELECT u FROM User u")
public class User {

/** The id. */
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;

/** /The user name. */
private String name;

/** Creation Date. */
private Date create;
}
Read more »

Primefaces Java <-> Javascript

Posted on 2018-03-07

Calling java method from javascript

1
2
3
4
5
6
7
8
<p:remoteCommand name="increment" actionListener="#{counter.increment}" 
out="count" />

<script type="text/javascript">
function customfunction() {
increment(); // Call increment method from counter bean based on remoteCommand name
}
</script>

Calling javascript from java

1
2
3
public void callJavascript() {
RequestContext.getCurrentInstance().execute("refresh();");
}

Primefaces command button execution order (p:commandButton)

Posted on 2018-03-06

Here is the order of the actions, which will be done by clicking on p:commandButton:

  1. User clicks button
  2. onclick is fired
  3. Ajax request is prepared based on process
  4. onstart is fired
  5. Ajax request is sent
  6. actionListener is fired
  7. action is fired
  8. Ajax response is prepared based on update
  9. Ajax response is returned
  10. if HTTP response status is 200, onsuccess is fired
  11. if HTTP response status is 500, onerror is fired
  12. update is performed based on ajax response
  13. oncomplete is fired

Openfire Bot / Listener Plugin Tutorial

Posted on 2018-03-06

If you want to create an openfire plugin which is listening for some packets / messages and should react based on message content e.g. Bot. In my example plugin I want to listen for a message which contains packet extensions and parse the data from XML.

The message looks like:

1
2
3
4
5
<message id="ri1KL-7" to="username@servername.com" type="chat">
<body>Hello World :)</body>
<BotCommand xmlns="https://rmsol.de"><action>google</action>
<data>Openfire Bot Plugin</data></BotCommand>
</message>
Read more »

Eigenes Ambilight mit Raspberry Pi und XBMC / Boblight

Posted on 2015-03-31

Es gibt schon etliche Artikel über selbstgebautes Ambilight mit Hilfe von Raspberry Pi und XBMC, jedoch sind viele nicht mehr up to date, oder liefern einfach nicht genug Details, so das man sich erst viel zusammen suchen muss. Deswegen beschreibe ich hier meine Schritte und meine Erfahrung die ich beim Aufbauen hatte.

Als allererstes sollte man sich die Hardware beschaffen. Aus Kostengründen habe ich mir alle Einzelteile aus China bestellt. Dabei muss man in Kauf nehmen das die Lieferung bis zu 3 Monaten dauern kann. Hier ist meine Liste was ihr zusätzlich zu eurem Raspberry Pi auf jeden Fall benötigt:

  • WS2801 LEDs AliExpress
  • 5V 2A Netzteil für die WS2801 LEDs FastTech (Wenn ihr ein 50er Set gekauft habt)
  • Jumper (Male-Female) FastTech (ich hatte keine, darum habe ich mir es aus zwei Jumpern es jeweils zusammen gebaut)
  • DC Power Converter DX
  • Optional: Klett-band, für das Anbringen an den TV Amazon

Als nächstes sollte man XBMC installieren. Ich hab als erstes mit OpenELEC probiert, womit ich sehr glücklich wahr, doch hatte leider kein Erfolg die LEDs damit anzusteuern, da OpenELEC sehr eingeschränkte Konfigurationsmöglichkeiten hat. Deswegen bin ich auf ein anderes weit verbreitetes XBMC distro. namens Raspbmc gewechselt (Mittlerweise OSMC). Wie man Raspbmc/OSMC installiert könnt ihr hier nachlesen und runterladen. Außerdem soll die Reaktionszeit bei OpenELEC für die LEDs schlechter sein als bei Raspbmc (Hier ist es deutlich zu sehen)

Read more »
1…56

Roman Soldatow

Developer Blog over coding and embedded systems (DIY) projects, and also some tips and tricks around the IT world.
30 posts
16 tags
RSS
GitHub StackOverflow
© 2022 Roman Soldatow