I was stuck on windows reboot, after having tried to connect my windows laptop to a projector.
I could see just black screen, it was scaring.
Solution: Hold [Windows key] + P
source
giovedì, marzo 12, 2020
domenica, febbraio 02, 2020
Uninstall Logitech GHUB from Mac
- Delete the G Hub application from /Applications
- Trash the entire folder lghub at ~/Library/Application Support/
- Trash ~/Library/Application Support/Logitech/Gaming/ghubDevices.json
- Trash settings.json from that same folder
domenica, gennaio 05, 2020
default spring security in spring-boot app
If you include this dependency in your pom:
groupId: org.springframework.boot
artifactId: spring-boot-starter-security
you "inherited" the default spring security.
When you application starts, have a look to this message:
Using generated security password: 03219696-3a8d-49d5-8385-11e84fe94ac8
Then if the login mask shows up:
Type this:
user: user
password: that password in the message...
groupId: org.springframework.boot
artifactId: spring-boot-starter-security
you "inherited" the default spring security.
When you application starts, have a look to this message:
Using generated security password: 03219696-3a8d-49d5-8385-11e84fe94ac8
Then if the login mask shows up:
Type this:
user: user
password: that password in the message...
martedì, settembre 10, 2019
Issue with wireless Ubuntu 18.04 - board QCA6174
- Issue: Wifi gets disconnected automatically
- Context: wi-fi - QCA6174 802.11ac / Ubuntu 18.04
- Solution: I have applied a workaround based on this solution: https://support.killernetworking.com/knowledge-base/wi-fi-issues-with-1435-1535-1525-on-debian-ubuntu-and-arch/
Workaround:
- Replace the folder /lib/firmware/ath10k/QCA6174/hw3.0 with the corresponding from https://github.com/kvalo/ath10k-firmware/tree/master/QCA6174/hw3.0
- rename firmware-4.bin_WLAN.RM.2.0-00180-QCARMSWPZ-1 to firmware-6.bin
sabato, luglio 27, 2019
giovedì, marzo 28, 2019
Information about maven plugin
$mvn help:describe -Dplugin=io.swagger.codegen.v3:swagger-codegen-maven-plugin:3.0.7 -Ddetail=true
link
link
martedì, marzo 19, 2019
Debugging test with maven
$ mvn -Dmaven.surefire.debug -Dtest=MultipleJsonDatasetLoaderTest#loading_Multiple_Dataset_Loading_From_Jar testFrom intellij remote attach debug on port 5005
venerdì, marzo 08, 2019
intellij - find class not working
In case [ctrl]+[N] is no longer working in intelli then delete the following folder:
%USER_HOME%\.IntelliJIdea70\system\caches.
link
link
mercoledì, febbraio 13, 2019
martedì, gennaio 08, 2019
martedì, novembre 13, 2018
Ubuntu deja-dup Backup [exclude list]
$ dconf-editor
- Search for /org/gnome/deja-dup/exclude-list
- Add ['**/target', '**/.git']
lunedì, settembre 24, 2018
lunedì, gennaio 01, 2018
domenica, agosto 06, 2017
sabato, luglio 29, 2017
maven dependency tree
$ mvn dependency:tree > result.txt
or
$ mvn dependency:tree | grep -A 5 -B 2 module
or
$ mvn dependency:tree | grep -A 5 -B 2 module
mercoledì, giugno 21, 2017
Chrome: Bypass “Your connection is not private” Message
- To proceed, simply choose the “Advanced” link, then choose “Proceed to (unsafe).
https://www.technipages.com/google-chrome-bypass-your-connection-is-not-private-message
sabato, maggio 20, 2017
Ma quanto prendi al mese?
Spesso mi viene chiesto, ma quanto prendi al mese a Zurigo? Beh è una domanda a cui non si può rispondere, gli stipendi in Svizzera sono considerati strettamente confidenziali, però per avere un' idea di quanto possa guadagnare un senior software engineer a Zurigo si può fare riferimento a questo sito: payscale .
Ciò detto alcune considerazioni di base devono essere fatte.
Aspetti negativi:
- ci sono solo 12 mensilità;
- non c'è di regola il TFR;
- non esiste art. 18 quindi si può essere licenziati anche senza giusta causa.
- il pranzo a lavoro te lo paghi te, non esiste mensa gratis né buoni pasto.
- hai un' assicurazione sanitaria molto costosa da pagare ogni mese, diciamo di base circa 250 chf al mese.
- le ferie sono molto di meno rispetto all' Italia, parliamo di qualcosa come 25 giorni all' anno, anche se ci sono aziende che ne offrono anche meno, 20.
- si lavora 42 ore settimanali, rispetto alle 40 ore (?) italiane.
- last but not least, il costo della vita è esageratamente alto: affitto, ristoranti, alimentari, etc.
Aspetti positivi:
- stipendi lordi annuali molto alti;
- servizi (trasporti, pubblica amministrazione, etc) eccellenti;
- le tasse sono estremante più basse rispetto all' Italia. Approssimativamente tra tasse cantonali e federali, al netto di detrazioni e rimborsi, mi viene da dire meno del 10% sul lordo annuale, almeno se hai un permesso di lavoro di tipo C.
- se perdi il lavoro hai diritto ad un' indennità di disoccupazione pari a circa il 70% della tua retribuzione, per almeno 18 mesi.
Fatte queste considerazioni lascio a voi se conviene lavorare in Svizzera o in Italia :-)
Ciò detto alcune considerazioni di base devono essere fatte.
Aspetti negativi:
- ci sono solo 12 mensilità;
- non c'è di regola il TFR;
- non esiste art. 18 quindi si può essere licenziati anche senza giusta causa.
- il pranzo a lavoro te lo paghi te, non esiste mensa gratis né buoni pasto.
- hai un' assicurazione sanitaria molto costosa da pagare ogni mese, diciamo di base circa 250 chf al mese.
- le ferie sono molto di meno rispetto all' Italia, parliamo di qualcosa come 25 giorni all' anno, anche se ci sono aziende che ne offrono anche meno, 20.
- si lavora 42 ore settimanali, rispetto alle 40 ore (?) italiane.
- last but not least, il costo della vita è esageratamente alto: affitto, ristoranti, alimentari, etc.
Aspetti positivi:
- stipendi lordi annuali molto alti;
- servizi (trasporti, pubblica amministrazione, etc) eccellenti;
- le tasse sono estremante più basse rispetto all' Italia. Approssimativamente tra tasse cantonali e federali, al netto di detrazioni e rimborsi, mi viene da dire meno del 10% sul lordo annuale, almeno se hai un permesso di lavoro di tipo C.
- se perdi il lavoro hai diritto ad un' indennità di disoccupazione pari a circa il 70% della tua retribuzione, per almeno 18 mesi.
Fatte queste considerazioni lascio a voi se conviene lavorare in Svizzera o in Italia :-)
martedì, aprile 04, 2017
PHP Resources
lunedì, marzo 06, 2017
jerky movement of the mouse with ubuntu - how to fix it
$ xinput (search for id corresponding to external mouse -> 9 )
$ xinput --list-props 9
$ xinput --set-prop 9 "Device Accel Constant Deceleration" 2
It's also possible to calibrate acceleration and threshold by using xset command
$ xset q | grep -A 1 Pointer
$ xset m 18/10 0
$ xinput --list-props 9
$ xinput --set-prop 9 "Device Accel Constant Deceleration" 2
It's also possible to calibrate acceleration and threshold by using xset command
$ xset q | grep -A 1 Pointer
$ xset m 18/10 0
giovedì, gennaio 26, 2017
Singleton are effectively final
Singleton classes, if properly implemented, do not need to be declared final in order to not be extended. Since all the constructors of the singleton class are private, you can't extend that class. In fact, singleton classes are effectively final.stackoverflow
giovedì, gennaio 12, 2017
giovedì, dicembre 22, 2016
concatenate pdf files with ubunbtu
$ pdfunite ES_0818_1.pdf ES_0818_2.pdf ES_0818_3.pdf ex_082018.pdf
In order to remove an (unknown) password from a protected pdf use this command:
$ gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf
domenica, agosto 07, 2016
venerdì, giugno 17, 2016
ReactJS Resources
- https://www.pluralsight.com/courses/react-styling-components
- https://egghead.io/courses/react-fundamentals
- React in 15ish minutes - Reactjs Tutorial
- React Official
- https://www.codeschool.com/screencasts/add-a-build-system-to-a-react-application
- https://www.codeschool.com/screencasts/es2015-and-the-virtual-dom-in-a-react-application
- https://www.codeschool.com/screencasts/add-a-router-to-a-react-application
- http://jamesknelson.com/learn-raw-react-no-jsx-flux-es6-webpack/ - [new!]
giovedì, maggio 19, 2016
lunedì, aprile 18, 2016
backticks on italian keyboard
https://forums.modx.com/thread/55468/backtick-e-tilde-su-una-tastiera-italiana
Alt Gr + ’ = `
Alt Gr + ì = ~
Alt Gr + ’ = `
Alt Gr + ì = ~
martedì, febbraio 23, 2016
ab benchmark
$ ab -A myUsername:myPassword -n 1000 -c 1000 http://localhost:8090/api/words
http://httpd.apache.org/docs/2.4/programs/ab.html
http://httpd.apache.org/docs/2.4/programs/ab.html
mercoledì, febbraio 17, 2016
Restarting wireless in Ubuntu
$ sudo service network-manager restart
$ sudo nmcli nm sleep false && sudo pkill -f wpa_supplicant
http://askubuntu.com/questions/564556/cant-connect-to-wifi-after-suspend
$ sudo nmcli nm sleep false && sudo pkill -f wpa_supplicant
http://askubuntu.com/questions/564556/cant-connect-to-wifi-after-suspend
sabato, dicembre 12, 2015
sabato, novembre 14, 2015
martedì, ottobre 13, 2015
PassportJS - NodeJS login with Facebook
http://passportjs.org/
https://github.com/jaredhanson/passport-facebook/tree/master/examples/login
Create an appId and App secrete from https://developers.facebook.com/
In local development make sure you follow this http://stackoverflow.com/a/26457495/379173
I added localhost:3000 since my node js process was running on port 3000.
https://github.com/jaredhanson/passport-facebook/tree/master/examples/login
Create an appId and App secrete from https://developers.facebook.com/
In local development make sure you follow this http://stackoverflow.com/a/26457495/379173
I added localhost:3000 since my node js process was running on port 3000.
Installing postgresql on Ubuntu [Notes]
$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib
Ubuntu Software center: pgAdmin III
$ sudo -u postgres -s
$ psql
postgres=# ALTER USER postgres PASSWORD 'xxx';
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04
http://www.linuxscrew.com/2009/07/03/postgresql-show-tables-show-databases-show-columns/
exit from psql
$ sudo apt-get install postgresql postgresql-contrib
Ubuntu Software center: pgAdmin III
$ sudo -u postgres -s
$ psql
postgres=# ALTER USER postgres PASSWORD 'xxx';
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04
http://www.linuxscrew.com/2009/07/03/postgresql-show-tables-show-databases-show-columns/
exit from psql
venerdì, settembre 25, 2015
MongoDB session
enrico@enrico-XPS13:~/mongodb$ mongo
MongoDB shell version: 3.0.6
connecting to: test
> show dbs
enrico 0.078GB
local 0.078GB
nodetest1 0.078GB
test 0.078GB
> use enrico
switched to db enrico
> for (var i=0;i<10 i="" p="" print="">0
1
2
3
4
5
6
7
8
9
> use blog
switched to db blog
> db
blog
> db.posts.insert({
... title: "My first post",
... authorName: "Alvise",
... authorEmail: "enricogiurin@gmail.com",
... pubDate: new Date
...
... });
WriteResult({ "nInserted" : 1 })
> db.posts.count()
1
> db.posts.findOne()
{
"_id" : ObjectId("5604925564958e61b7a10dda"),
"title" : "My first post",
"authorName" : "Alvise",
"authorEmail" : "enricogiurin@gmail.com",
"pubDate" : ISODate("2015-09-25T00:16:21.649Z")
}
> db.posts.insert({title: "another post", "_id": 123});
WriteResult({ "nInserted" : 1 })
> db.posts.count()
2
> db.posts.find()
{ "_id" : ObjectId("5604925564958e61b7a10dda"), "title" : "My first post", "authorName" : "Alvise", "authorEmail" : "enricogiurin@gmail.com", "pubDate" : ISODate("2015-09-25T00:16:21.649Z") }
{ "_id" : 123, "title" : "another post" }
> db.posts.find().pretty()
{
"_id" : ObjectId("5604925564958e61b7a10dda"),
"title" : "My first post",
"authorName" : "Alvise",
"authorEmail" : "enricogiurin@gmail.com",
"pubDate" : ISODate("2015-09-25T00:16:21.649Z")
}
{ "_id" : 123, "title" : "another post" }
> db.posts.insert({
... title: "My first post",
... author: {
... firstName: "Enrico",
... lastName: "Giurin",
... email: "enricogiurin@gmail.com"
... },
... tags: ["coding", "mongodb", "db"],
... pubDate: new Date
...
... });
WriteResult({ "nInserted" : 1 })
> db.posts.find().pretty()
{
"_id" : ObjectId("5604925564958e61b7a10dda"),
"title" : "My first post",
"authorName" : "Alvise",
"authorEmail" : "enricogiurin@gmail.com",
"pubDate" : ISODate("2015-09-25T00:16:21.649Z")
}
{ "_id" : 123, "title" : "another post" }
{
"_id" : ObjectId("5604946d64958e61b7a10ddb"),
"title" : "My first post",
"author" : {
"firstName" : "Enrico",
"lastName" : "Giurin",
"email" : "enricogiurin@gmail.com"
},
"tags" : [
"coding",
"mongodb",
"db"
],
"pubDate" : ISODate("2015-09-25T00:25:17.293Z")
}
> db.posts.find({title: "My fist post"});
> db.posts.find({title: "My first post"});
{ "_id" : ObjectId("5604925564958e61b7a10dda"), "title" : "My first post", "authorName" : "Alvise", "authorEmail" : "enricogiurin@gmail.com", "pubDate" : ISODate("2015-09-25T00:16:21.649Z") }
{ "_id" : ObjectId("5604946d64958e61b7a10ddb"), "title" : "My first post", "author" : { "firstName" : "Enrico", "lastName" : "Giurin", "email" : "enricogiurin@gmail.com" }, "tags" : [ "coding", "mongodb", "db" ], "pubDate" : ISODate("2015-09-25T00:25:17.293Z") }
> db.posts.find({title: "My first post"}).count()
2
> db.posts.find({title: /po/i}).count()
3
> db.posts.find({title: /pos/i}).count()
3
> db.posts.find({title: /first/i}).count()
2
> db.posts.find({title: /first/i},{title:1})
{ "_id" : ObjectId("5604925564958e61b7a10dda"), "title" : "My first post" }
{ "_id" : ObjectId("5604946d64958e61b7a10ddb"), "title" : "My first post" }
> db.posts.find({title: /first/i},{title:1, _id: 0})
{ "title" : "My first post" }
{ "title" : "My first post" }
> db.posts.find({title: /first/i},{title:1, _id: 0}).pretty()
{ "title" : "My first post" }
{ "title" : "My first post" }
> db.posts.find({"author.email": "enricogiurin@gmail.com"}).pretty()
{
"_id" : ObjectId("5604946d64958e61b7a10ddb"),
"title" : "My first post",
"author" : {
"firstName" : "Enrico",
"lastName" : "Giurin",
"email" : "enricogiurin@gmail.com"
},
"tags" : [
"coding",
"mongodb",
"db"
],
"pubDate" : ISODate("2015-09-25T00:25:17.293Z")
}
> db.posts.find({"author.email": "enricogiurin@gmail.co"}).pretty()
> db.posts.find({"author.email": /urin@gmail.co/}).pretty()
{
"_id" : ObjectId("5604946d64958e61b7a10ddb"),
"title" : "My first post",
"author" : {
"firstName" : "Enrico",
"lastName" : "Giurin",
"email" : "enricogiurin@gmail.com"
},
"tags" : [
"coding",
"mongodb",
"db"
],
"pubDate" : ISODate("2015-09-25T00:25:17.293Z")
}
10>
sabato, giugno 20, 2015
giovedì, giugno 18, 2015
Avoiding CORS issues with chromium
Install 'Chromium Web Browser' in ubuntu through Ubuntu Software Center.
From any location type:
$ chromium-browser --disable-web-security &
This avoid limitations of browsers with CORS.
From any location type:
$ chromium-browser --disable-web-security &
This avoid limitations of browsers with CORS.
venerdì, giugno 05, 2015
venerdì, maggio 29, 2015
"Venture" Meet Suport Organizations Zurich - May 28th 2015
Here some notes, in random order, taken from the event which took place yesterday at the ETH in Zurich, subject: support for startups in Switzerland.
- Formation, TechnoPark (4 modules)
- Entrepreneur club
- ETH spin off
- CTI start-up
- http://www.startzentrum.ch/
- Blue Lion incubator
- start-up battle
- start-up support http://www.ifj.ch/index.cfm
- http://www.venturelab.ch/index.cfm
- http://www.venturekick.ch/
- Supporting Social Business - http://seif.org/de_DE/
- http://www.startupticker.ch/en/home
- CTI invest - deals events training
- http://www.ceoday.ch/
- Pitch competition
- http://www.angelday.ch/
- Lean methodology
- Providing network for startups - http://www.i-net.ch/en/ (Basel)
- ICT - Information and communications technology
mercoledì, maggio 20, 2015
Ansible resources
http://networklore.com/ansible/
http://networklore.com/ansible-getting-started/
http://en.wikipedia.org/wiki/Ansible_(software)
Similar tools: puppet, chef, salt
http://networklore.com/ansible-getting-started/
http://en.wikipedia.org/wiki/Ansible_(software)
Similar tools: puppet, chef, salt
sabato, maggio 16, 2015
giovedì, aprile 23, 2015
Linux/Unix useful commands
- ls | wc -l (number of files in a folder)
- $ find . -iname 'Courses.json' -> find in the current folder and subfolders the file 'Courses.json'
- $ grep MemTotal /proc/meminfo
- $find . -type f -name '*.DS_Store*' -delete
mercoledì, aprile 01, 2015
git useful commands
################ git commands ################
$ git config --global user.name "Enrico Giurin"
$ git init --> creates local repo /users/enrico/store/.git
$ git add xxx
$ git commit -m ".." .
$ git status
$ git add --all .
branch: master
$ git add --all
creates snapshot
$ git log
##############################
$ git diff
$ git reset
$ git reset --hard - undo local changes since that revision
$ git checkout -- (blow way all changes since last commit)
$ git commit -a -m "xxx" add & commit
$ git reset --soft HEAD undo last commit
$ git commit --amend -m "..." changed the last commit
$ git reset --hard HEAD^ undo last commit and all changes
$ git reset --hard HEAD^^ undo last 2 commits and all changes
$ git push
$ git pull
- origin: name of the remote repository
$ git remote add origin https.//github.com/egch/xxx
$ git remote -v
$ git push -u origin master (origin: remote / master: local)
##############################
$ git clone
$ git clone yourName
$ git remote -v
$ git branch (cat)
$ git checkout cat
$ git checkout master
$ git merge cat
$ git branch -d cat (removing branch cat)
$ git checkout -b admin (switch and create a new branch)
--> go back to master
$ git checkout master
(fix something in the master and now we merge the admin)
$ git merge admin
vi editor
git log ( a message log related to the merge)
##############################
$ git pull (fetch)
$ git push
$ git commit -a -m "merged"(after merge)
<<<<< my version
>>>>> their version
##############################
$ git checkout -b shopping_cart
$ git push origin shopping_cart
$ git push
[jane] $ git pull
$ git branch
$ git branch -r (remote branches)
$ git checkout shopping_cart
$ git remote show origin
$ git push origin :shopping_cart (to delete the remote branch)
$ git branch -d shopping_cart (trying to delete local branch)
$ git branch -D shopping_cart (force to delete local branch)
$ git remote prune origin (to cleanup delete remote branches)
$ git tag (list all tags)
$ git checkout v0.0.1 (checkout code at commit)
$ git tag -a v0.0.3 -m "version" (to create a new tag)
$ git push --tags (to push the tags)
########################################
$ git log
$ git config --global color.ui true
$ git log --pretty=oneline
$ gitl log --pretty=format: "%h %ad- %s [%an]"
(ad=author date, an=author name,h=SSH hash, s=subject,d=ref names)
$ git log --online -p
$ git log --online --stat
$ git log --online --graph
$ git log --since=2000-02-02 --until=2003-10-10
$ git diff
$ git diff HEAD~5 (5 commits ago)
$ git diff master bird
$ git diff --since=1.month.ago --until=2.minutes.ago
$ git blame list.html --date short
.git/info/exlude : to esclude some files from commit
pattern: logs/*.log
.gitignore (logs/*.log)
$ git rm README.txt
$ git rm --cached mylog.log
$ git config --global core.editor notepad++
ALIASES
$ git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"
$ git myLog
$ git config --global user.name "Enrico Giurin"
$ git init --> creates local repo /users/enrico/store/.git
$ git add xxx
$ git commit -m ".." .
$ git status
$ git add --all .
branch: master
$ git add --all
creates snapshot
$ git log
##############################
$ git diff
$ git reset
$ git commit -a -m "xxx" add & commit
$ git reset --soft HEAD undo last commit
$ git commit --amend -m "..." changed the last commit
$ git reset --hard HEAD^ undo last commit and all changes
$ git reset --hard HEAD^^ undo last 2 commits and all changes
$ git push
$ git pull
- origin: name of the remote repository
$ git remote add origin https.//github.com/egch/xxx
$ git remote -v
$ git push -u origin master (origin: remote / master: local)
##############################
$ git clone
$ git clone
$ git remote -v
$ git branch
$ git checkout cat
$ git checkout master
$ git merge cat
$ git branch -d cat (removing branch cat)
$ git checkout -b admin (switch and create a new branch)
--> go back to master
$ git checkout master
(fix something in the master and now we merge the admin)
$ git merge admin
vi editor
git log ( a message log related to the merge)
##############################
$ git pull (fetch)
$ git push
$ git commit -a -m "merged"(after merge)
<<<<< my version
>>>>> their version
##############################
$ git checkout -b shopping_cart
$ git push origin shopping_cart
$ git push
[jane] $ git pull
$ git branch
$ git branch -r (remote branches)
$ git checkout shopping_cart
$ git remote show origin
$ git push origin :shopping_cart (to delete the remote branch)
$ git branch -d shopping_cart (trying to delete local branch)
$ git branch -D shopping_cart (force to delete local branch)
$ git remote prune origin (to cleanup delete remote branches)
$ git tag (list all tags)
$ git checkout v0.0.1 (checkout code at commit)
$ git tag -a v0.0.3 -m "version" (to create a new tag)
$ git push --tags (to push the tags)
########################################
$ git log
$ git config --global color.ui true
$ git log --pretty=oneline
$ gitl log --pretty=format: "%h %ad- %s [%an]"
(ad=author date, an=author name,h=SSH hash, s=subject,d=ref names)
$ git log --online -p
$ git log --online --stat
$ git log --online --graph
$ git log --since=2000-02-02 --until=2003-10-10
$ git diff
$ git diff HEAD~5 (5 commits ago)
$ git diff master bird
$ git diff --since=1.month.ago --until=2.minutes.ago
$ git blame list.html --date short
.git/info/exlude : to esclude some files from commit
pattern: logs/*.log
.gitignore (logs/*.log)
$ git rm README.txt
$ git rm --cached mylog.log
$ git config --global core.editor notepad++
ALIASES
$ git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"
$ git myLog
giovedì, marzo 26, 2015
Windows 32-64 bit
http://windows.microsoft.com/en-us/windows7/find-out-32-or-64-bit
Vista: Click the Start button , right-click Computer, and then click Properties.
Vista: Click the Start button , right-click Computer, and then click Properties.
mercoledì, marzo 25, 2015
Node.js Resources
- how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04
- http://runnable.com/U0MpcpIzdaRkX2VH/querying-mongodb-from-express-using-mongoose-for-node-js
- http://abdelraoof.com/blog/2014/11/11/install-nodejs-without-admin-rights/ (how to install NodeJS in Windows with no admin grants)
- https://rtcamp.com/tutorials/nodejs/node-js-npm-install-ubuntu/ - how to install the latest version of nodejs and npm on ubuntu 12.04
- https://davidwalsh.name/upgrade-nodejs - how to upgrade your version of node to the latest
martedì, febbraio 17, 2015
Remote work resources
- weworkremotely.com
- jobs.github.com
- jobs.remotive.io
- careers.stackoverflow.com
- nomadjobs.io
- hnhiring.me
- jobmote.com
Thanks to Luca Guidi (JUG Milano)
domenica, febbraio 15, 2015
lunedì, gennaio 19, 2015
mercoledì, dicembre 17, 2014
martedì, novembre 25, 2014
Create a simple maven project
$ mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart
It works in interactive mode, so you will be asked to type groupId, atifactId and so on.
Here how to create a webapp template from the maven archetype plugin in not interactive mode.
$ mvn archetype:generate -DgroupId=org.enricogiurin.poc -DartifactId=maven-usage -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
https://maven.apache.org/archetype/maven-archetype-bundles/maven-archetype-quickstart/
http://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/
http://maven.apache.org/guides/mini/guide-building-for-different-environments.html
http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
To make compatible with java 8, add this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
martedì, giugno 17, 2014
lunedì, novembre 25, 2013
Soup with vegetables
Here a simple recipe to prepare a tasty soup with vegetables.
Before starting make sure you have the following ingredients: 2 potatoes without peel, 3 carrots, 10 green beans with the ends cut, 1 pepper, 300ml tomato sauce, salt, oil of olive, 1 onion without peel.
So, let's start!
I learned how to prepare it today in the soup session with my friend Cristian, I hope to have not forgotten some steps so I won't consider myself responsible of the success of the soup ;-)
So, let's start!
- Cut the potatoes, carrots, green beans, pepper, onion in small pieces, not so small though.
- Put these ingredients in a pot and fill it with the water.
- Light the fire and wait till the water in the pot start to boil.
- Once it's boiling reduce the level of firing to minimum and let it boil for other 60 minutes; really this is important, the level of firing should be very low, you should observe the level of water just boiling a bit.
- Add the potatoes in the pot.
- Add two spoons of oil of olive and a bit of salt.
- Let it boil, always with low fire, for about 25 minutes.
- Add the tomato sauce and half of dado knorr
- Let it boil for the last 5 minutes.
I learned how to prepare it today in the soup session with my friend Cristian, I hope to have not forgotten some steps so I won't consider myself responsible of the success of the soup ;-)
giovedì, novembre 21, 2013
Building Reactive Apps @ Jug Lausanne
Yesterday I've participated at the meeting @ JUG Lausanne, where there was a presentation with the title "Building Reactive Apps" kept by James Ward.
In the room there were about 40 persons and the speech was kept in English.
After having talked about the reactive manifesto , the speaker shortly introduced the principles of reactive programming
Has followed a demo of how to build a reactive application with the play framework, where he showed the usage of Future classes. Other topics were related websocket, actors in AKKA, scala and so on.
I think I'll give a try to these new technologies.
In the room there were about 40 persons and the speech was kept in English.
After having talked about the reactive manifesto , the speaker shortly introduced the principles of reactive programming
Has followed a demo of how to build a reactive application with the play framework, where he showed the usage of Future classes. Other topics were related websocket, actors in AKKA, scala and so on.
I think I'll give a try to these new technologies.
venerdì, settembre 13, 2013
NoClassDefFoundError in Jboss with maven EJB plugin when using SNAPSHOT dependencies
Context: Jboss 5.1.0, maven 2.x, snapshot dependencies.
Problem: I got this exception after deployed my ear in jboss 5.1.
EAR name: myEAR.ear
ejb component: services.jar
Jboss classloader cannot find the myPackage/MyInterface.class when this is a SNAPSHOT dependency of my services.jar.
Solution: Correct configuration of the maven ejb plugin.
You need to set to false the useUniqueVersion attribute.
Problem: I got this exception after deployed my ear in jboss 5.1.
EAR name: myEAR.ear
ejb component: services.jar
Jboss classloader cannot find the myPackage/MyInterface.class when this is a SNAPSHOT dependency of my services.jar.
Solution: Correct configuration of the maven ejb plugin.
You need to set to false the useUniqueVersion attribute.
org.apache.maven.plugins
maven-ejb-plugin
3.0
true
false
Exception stack-trace:
er.MBeanServerImpl@52f97d27[ defaultDomain='jboss' ]
2013-09-13 14:22:03,699 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to PostClassLoader: name=vfszip:/usr/local/jboss-5.1.0.GA-jdk/server/standard/deploy/myEAR.ear/ state=ClassLoader mode=Manual requiredState=PostClassLoader
org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/usr/local/jboss-5.1.0.GA-jdk/server/standard/deploy/myEAR.ear/services.jar/
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:177)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
at org.jboss.Main.boot(Main.java:221)
at org.jboss.Main$1.run(Main.java:556)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NoClassDefFoundError: myPackage/MyInterface
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:572)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)
at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)
2013-09-13 14:22:03,699 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to PostClassLoader: name=vfszip:/usr/local/jboss-5.1.0.GA-jdk/server/standard/deploy/myEAR.ear/ state=ClassLoader mode=Manual requiredState=PostClassLoader
org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/usr/local/jboss-5.1.0.GA-jdk/server/standard/deploy/myEAR.ear/services.jar/
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:177)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
at org.jboss.Main.boot(Main.java:221)
at org.jboss.Main$1.run(Main.java:556)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NoClassDefFoundError: myPackage/MyInterface
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:572)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)
at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)
lunedì, maggio 20, 2013
Spring - Unable to process claimed identity 'https://www.google.com/accounts/o8/id'
Issue - The openId gmail authentication, built on top of springsecurity, stopped to work on my website and I got this error:
org.springframework.security.authentication.AuthenticationServiceException: Unable to process claimed identity 'https://www.google.com/accounts/o8/id'
Reason - in the class OpenID4JavaConsumer
error: org.openid4java.discovery.DiscoveryException: 0x70d: Error parsing XML document
Solution
I fixed the issue by updating the version of xmlParserAPIs and xercesImpl from 2.5 to 2.6.x.
The wrong version for xmlParserAPIs and xmlParserAPIs was brought by jcaptcha so I had to exclude those two.
See this link on jugevents.
org.springframework.security.authentication.AuthenticationServiceException: Unable to process claimed identity 'https://www.google.com/accounts/o8/id'
Reason - in the class OpenID4JavaConsumer
error: org.openid4java.discovery.DiscoveryException: 0x70d: Error parsing XML document
Solution
I fixed the issue by updating the version of xmlParserAPIs and xercesImpl from 2.5 to 2.6.x.
The wrong version for xmlParserAPIs and xmlParserAPIs was brought by jcaptcha so I had to exclude those two.
See this link on jugevents.
giovedì, ottobre 11, 2012
mercurial and mercurialEclipse plugin in ubuntu
Install the latest version of mercurial
- $ sudo add-apt-repository ppa:mercurial-ppa/releases
- $ sudo apt-get update
- $ sudo apt-get install mercurial
- check version of mercurial: $ hg --version
Mercurial eclipse plugin
- Help/Eclipse marketplace
- Find: Mercurial
- Install MercurialEclipse (requires at least mercurial 2.0)
Resources
mercoledì, ottobre 10, 2012
Creating a shortcut to eclipse on the ubuntu desktop
Proceed in this way:
- right click on desktop: Create Launcher
- set the proper icon eclipse_home/icon.xpm
- Set the command: eclipse_home/eclipse
Troubleshooting
Issue: "A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations "
Solution
- $ cd eclipse_home
- $ mkdir jre
- $ cd jre
- $ ln -s /opt/jdk1.6.0_35/jre/bin/ bin
Resources:
http://ubuntuforums.org/showpost.php?p=11081349&postcount=4
http://www.linuxquestions.org/questions/linux-newbie-8/how-to-create-desktop-shortcut-with-eclipse-ide-icom-876136/#post4331155
http://www.linuxquestions.org/questions/linux-newbie-8/how-to-create-desktop-shortcut-with-eclipse-ide-icom-876136/#post4331155
martedì, maggio 08, 2012
filesync eclipse plugin
Nice eclipse plugin to synchronize resources.
http://andrei.gmxhome.de/filesync/index.html
Adopting it will speed up your development process without need to rebuild each time you edit a resource in the src folder, for instances a jsp.
http://andrei.gmxhome.de/filesync/index.html
Adopting it will speed up your development process without need to rebuild each time you edit a resource in the src folder, for instances a jsp.
venerdì, gennaio 27, 2012
Remotely debug tomcat on linux
Create this simple shell script: debugtomcat.sh
resource
#leave this command for future reference
#export currentdir=`pwd`
export JAVA_OPTS='-Xmx1024m -XX:MaxPermSize=512m
-Xdebug -Xrunjdwp:transport=dt_socket,
address=8000,server=y,suspend=n'
echo JAVA_OPTS: $JAVA_OPTS
/$HOME/MyPrograms/apache-tomcat-6.0.35/bin/catalina.sh run
resource
mercoledì, dicembre 07, 2011
svn ignore list commands
- % set SVN_EDITOR=notepad
- % svn propedit svn:ignore .
- % svn propget svn:ignore .
Decrease the double click speed for Java Applications on Ubuntu Linux
I couldn't properly use double click on idea so I found a great solution in this post.
To resume:
It's amazing that intellij doesn't take in account this issue.
To resume:
In your home directory create a file called .Xresources and add the following line
*multiClickTime: 400
Then from the commandline execute
xrdb ~/.Xresources
It's amazing that intellij doesn't take in account this issue.
venerdì, luglio 22, 2011
Serving jboss logs as static content
This configuration has been tested using red hat linux and jboss 5.1.x
Links
Enable symlinks
Enable directory browsing
- Edit the
<jboss_home>/server/default/deployers/jbossweb.deployer/web.xml
and change the servlet attribute listings from false to true. - Edit the
<jboss_home>/server/default/deploy/jbossweb.sar/servlet.xml
and add the attribute allowLinking="true" to the Context element. - Create a log folder in the path
<jboss_home>/server/default/deploy/ROOT.war - In the log folder create a symbolic link to the log folder of jboss
$ ln -s ../../../log listAll - Restart the jboss instance
- The logs will be available at this url http://myHost:8080/log/listAll
Links
Enable symlinks
Enable directory browsing
venerdì, maggio 27, 2011
sabato, maggio 14, 2011
martedì, febbraio 22, 2011
Jboss - Port already in use: 1098
I got this exception after started jboss 5.1 on windows XP.
I tried to understand which process was using that port by running this command:
But the result didn't show any port associated to 1098.
Finally I edited the file at <jboss_51_home>\server\default\conf\bindingservice.beans\META-INF\bindings-jboss-beans.xml
and changed the value of the port 1098 to 10980 and the error has disappeared.
Windows and Jboss ...such a nightmare.
Here the link where I found the solution.
ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main)
Error installing to Start: name=jboss:service=Naming
state=Create mode=Manual requiredState=Installed
java.rmi.server.ExportException: Port already in use: 1098;
nested exception is:
java.net.BindException: Address already in use: JVM_Bind
I tried to understand which process was using that port by running this command:
$> netstat -a -o -n
But the result didn't show any port associated to 1098.
Finally I edited the file at <jboss_51_home>\server\default\conf\bindingservice.beans\META-INF\bindings-jboss-beans.xml
and changed the value of the port 1098 to 10980 and the error has disappeared.
Windows and Jboss ...such a nightmare.
Here the link where I found the solution.
Nice java client to execute remote ssh
http://www.journaldev.com/246/java-program-to-run-shell-commands-on-ssh-enabled-system
Just add this dependency at your pom.xml
Just add this dependency at your pom.xml
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.42</version>
</dependency>
lunedì, febbraio 21, 2011
Stop jboss in the case it's running
If you need to stop jboss inside a shell script this block of code could be useful.
if ps -ef | grep "<jboss_home>/bin/run.jar" | grep -v grep
then
echo [deploy] Stopping Jboss...
<jboss_home>/bin/shutdown.sh -S --server=localhost:1199
sleep 12s
else
echo [deploy] Jboss was already stopped
sleep 2s
fi
venerdì, febbraio 18, 2011
java.net.MalformedURLException: no protocol: and
I was trying to configure maven cargo plugin when I came across this exception:
I spent several hours trying to find the meaning of this error message when finally I found this link:
http://jackrabbit.510166.n4.nabble.com/jcr-rmi-problems-td534137.html
The author says:
So found the root of the problem, the maven local repository in windows is located at the path:
C:\Documents and Settings\<user>\.m2
So I have overridden the local maven repository folder adding this entry in the settings.xml maven configuration file:
After this change the error has disappeared.
Caused by: java.net.MalformedURLException: no protocol: and
I spent several hours trying to find the meaning of this error message when finally I found this link:
http://jackrabbit.510166.n4.nabble.com/jcr-rmi-problems-td534137.html
The author says:
The "and"
comes from the folder where your classes are which is probably something
beneath "C:\Documents and Settings"
So found the root of the problem, the maven local repository in windows is located at the path:
C:\Documents and Settings\<user>\.m2
So I have overridden the local maven repository folder adding this entry in the settings.xml maven configuration file:
<localRepository>c:/mavenrepository</localRepository>
After this change the error has disappeared.
giovedì, febbraio 10, 2011
Accesing to windows file system from cygwin
$ cd /cygdrive/c
That's pretty easy, but I always forget it...
martedì, febbraio 08, 2011
Spring - Referring to a String as a bean
<bean id="myString" class="java.lang.String">
<constructor-arg type="java.lang.String" value="Lucio"/>
</bean>
<bean id="myUser" class="com.benfante.User">
<property name="firstName" ref="myString"/>
</bean>
Thanks to Lucio for the example
lunedì, febbraio 07, 2011
svn client issue
After connecting to svn server using different users I got this message:
I have sorted out it deleting this folder on windows:
C:\Documents and Settings\
svn: Server sent unexpected return value (501 Method Not Implemented) in response to MKCOL request for
I have sorted out it deleting this folder on windows:
C:\Documents and Settings\
myUser\Application Data\Subversion\auth
giovedì, gennaio 27, 2011
Enable access to local resources from remote desktop connection
How to enable access to local resources from the remote desktop connection in order to move back and forward files.
- Remote Desktop Connection
- Options
- Local Resources
- More
- Check Drives
- Mark Enrico$ on 'hostX'
- OK
Labels:
local resources,
remote desktop connection,
Windows
martedì, ottobre 05, 2010
lunedì, agosto 23, 2010
issue while accessing with IPhone to the d-link dap 1160 access point
If you are facing issue trying to connect with your iphone to the secure wireless network supplied by the access point d-link dap 1160, maybe this link can help you:
http://www.dlink-forum.info/index.php?topic=8.40.
Use: wp2, channel 6 and disable WMM from the advanced menu wireless.
In order to configure the access point type: http://192.168.0.50 from your browser. Connect network cable from your pc to the d-link access point.
If you don't remember the admin password just reset your access point from the back.
The default username for that access point is admin while the password is empty field.
If you are in a different subnet go to the TCP/IP properties of your windows network connection and be sure to have this settings:
http://www.dlink-forum.info/index.php?topic=8.40.
Use: wp2, channel 6 and disable WMM from the advanced menu wireless.
In order to configure the access point type: http://192.168.0.50 from your browser. Connect network cable from your pc to the d-link access point.
If you don't remember the admin password just reset your access point from the back.
The default username for that access point is admin while the password is empty field.
If you are in a different subnet go to the TCP/IP properties of your windows network connection and be sure to have this settings:
- IP: 192.168.0.51
- SUBNET MASK: 255.255.255.0
lunedì, marzo 01, 2010
HQL Date Comparison
It appeared rather complicated to perform a date comparison using HQL. The only way is to use the native functions provided by hibernate: day(), month(), year(), current_date().
Here the named query used in JUGEvents for the scheduler reminder:
Here the named query used in JUGEvents for the scheduler reminder:
query =
"from Participant p where p.event.id = ? and (p.winner = null or p.winner = false)"),
@NamedQuery(name = "Participant.findParticipantsToBeReminded",
query = "from Participant p where p.confirmed = true and (p.cancelled is null or p.cancelled = false) "+
"and p.reminderEnabled = true and p.reminderSentDate is null and p.event.numOfDaysReminder >= 0 "+
"and (day(p.event.startDate) - day(current_date())) <= p.event.numOfDaysReminder "+
"and month(p.event.startDate) = month(current_date()) and year(p.event.startDate) = year(current_date()) "+
"and p.event.startDate >= current_date() order by p.event.id")})
martedì, dicembre 22, 2009
La neve, Spinea e Andrea
Enrico, scrivi qualcosa cribbio!
"Tornando da una seratina passata al lume di candela con la fata Monia, incontrai Andrea. Ma che ci fa Andrea da solo, alle 22, davanti ad un cassettone delle immondizie, in tuta da ginnastica? Era uscito a buttare la spazzatura ?"
Ma che ne so Enrico inventa!
(Testo della mail di Andrea...scusate ma sono troppo pigro ultimamente :) )


"Tornando da una seratina passata al lume di candela con la fata Monia, incontrai Andrea. Ma che ci fa Andrea da solo, alle 22, davanti ad un cassettone delle immondizie, in tuta da ginnastica? Era uscito a buttare la spazzatura ?"
Ma che ne so Enrico inventa!
(Testo della mail di Andrea...scusate ma sono troppo pigro ultimamente :) )


giovedì, dicembre 17, 2009
Deploying Spring @Component annotated application in JBoss 5.1
I've spent the last few days fighting with jboss 5.1 trying to deploy a spring based web application using the Component annotation.
The application as opposed works using Tomcat 6.
Basically the spring context was not able to find the definition of SchedulerBo which is my Component annotated class.
This is the section of my spring configuration file which allows the spring context to auto-scan the schedulerBo.
This is the exception I had.
This is the main section of my listener (ServletContextListener) class which I used to load the spring context(marked in red the row to change)
To sort out this problem you have to use org.jboss.spring.factory.VFSXmlWebApplicationContext instead of rg.springframework.web.context.support.XmlWebApplicationContext.
Therefore I changed this row in my listener.
Here the steeps to follow to solve the problem:
This is the link in JBoss JIRA which reports the bug and shows the solution.
The application as opposed works using Tomcat 6.
Basically the spring context was not able to find the definition of SchedulerBo which is my Component annotated class.
package webscheduler.bo;
@Component
public class SchedulerBo {
...............................
}
This is the section of my spring configuration file which allows the spring context to auto-scan the schedulerBo.
<context:component-scan base-package="webscheduler.bo"/>
This is the exception I had.
19:17:09,706 ERROR [ContextListener] Error in base ContextListener.contextInitialized
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobNormal' defined in ServletContext resource [/WEB-INF/schedulerContext.xml]: Cannot resolve reference to bean 'schedulerBo' while setting bean property 'jobDataAsMap' with key [TypedStringValue: value [schedulerBo], target type [null]]; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'schedulerBo' is defined
............................................................
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'schedulerBo' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.
getBeanDefinition(DefaultListableBeanFactory.java:387)
This is the main section of my listener (ServletContextListener) class which I used to load the spring context(marked in red the row to change)
private WebApplicationContext applicationContext;
.....................................
config.add("WEB-INF/schedulerContext.xml");
XmlWebApplicationContext ctx = new XmlWebApplicationContext();
ctx.setServletContext(servletContext);
ctx.setConfigLocations(config.toArray(new String[config.size()]));
ctx.refresh();
applicationContext = ctx;
To sort out this problem you have to use org.jboss.spring.factory.VFSXmlWebApplicationContext instead of rg.springframework.web.context.support.XmlWebApplicationContext.
Therefore I changed this row in my listener.
XmlWebApplicationContext ctx = new org.jboss.spring.factory.VFSXmlWebApplicationContext();
Here the steeps to follow to solve the problem:
- Add this dependency to your pom, be sure to have the jboss repository in your pom.xml
<dependency>
<groupId>org.jboss.snowdrop</groupId>
<artifactId>snowdrop-vfs</artifactId>
<version>1.0.0.GA</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
</exclusions>
</dependency> - Using VFSXmlWebApplicationContext in your listener class in this way
XmlWebApplicationContext ctx = new org.jboss.spring.factory.VFSXmlWebApplicationContext(); - run $ mvn clean install and deploy the new generated war into <JBOSS_HOME>/server/default/deploy
This is the link in JBoss JIRA which reports the bug and shows the solution.
lunedì, marzo 23, 2009
skip maven test
In order to skip the test you have to add the parameter -Dmaven.test.skip=true when you run the mvn from command line.
Do not forget to add the clean goal before install, otherwise the test will be executed anyway
It seems to be a strange behaviour of maven.
$ mvn -Dmaven.test.skip=true clean installDo not forget to add the clean goal before install, otherwise the test will be executed anyway
It seems to be a strange behaviour of maven.
lunedì, febbraio 23, 2009
Validate xml against the schema
The code is a an adjustment of what published in this post, just using InputStream instead of File as arguments for schema and xml.
public static void validateXMLAgainstSchema(InputStream xmlStream, InputStream schemaStream) throws SAXException, SAXParseException, ParserConfigurationException, IOException {
SchemaFactory schemaFactory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI );
schemaFactory.setErrorHandler( new DefaultHandler());
Schema schemaXSD = schemaFactory.newSchema(new StreamSource(schemaStream));
Validator validator = schemaXSD.newValidator();
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(xmlStream);
validator.validate( new DOMSource( document));
}
giovedì, febbraio 05, 2009
Monologo fantastico
caro Jack ho conosciuto un capitano dell' aviazione, ci siamo innamorati. Voglio il divorzio per potermi risposare con lui, so che puoi negarmelo ma te lo chiedo lo stesso in nome di tutto quello che ci ha unito, dei ricordi. Perdonami...Jack c'era troppa solitudine. Un giorno ci rincontreremo, persone che sono state così vicine come noi si rincontrano sempre. Non ho alcun diritto di dirti queste cose, ma non riesco ad impedirmelo. E' un legame così difficile da spezzare.
Oh compagno di tutti quegli anni splendenti aiutami a lasciarti.
venerdì, gennaio 09, 2009
spring message tag libray
If you are using spring message tag library you know how much is annoying get a runtime exception in the case you have inserted a wrong code as attribute.
For every message code tag library you define in your jsp you have to add the corresponding property entry in the message.properties file but can happen you forget to insert it or maybe you insert a wrong value.
For example having such tl message where the code is Email
I have to define the corresponding entry in the file message.properties, or in more files depending on the type of internationalization I use.
A way to avoid to get the runtime exception, in case of wrong code, is to add the property text to the message tl. In case of not matching the value of text will appear in the page and you could fix the problem after. Better to use text property with ? before and after the string so that you can easily understand there is a wrong value of code.
Therefore use
As usual, thanks to Lucio.
For every message code tag library you define in your jsp you have to add the corresponding property entry in the message.properties file but can happen you forget to insert it or maybe you insert a wrong value.
For example having such tl message where the code is Email
<spring:message code="Email" />
I have to define the corresponding entry in the file message.properties, or in more files depending on the type of internationalization I use.
Email=E-Mail
A way to avoid to get the runtime exception, in case of wrong code, is to add the property text to the message tl. In case of not matching the value of text will appear in the page and you could fix the problem after. Better to use text property with ? before and after the string so that you can easily understand there is a wrong value of code.
Therefore use
<spring:message code="Email" text="?Email?"/>
As usual, thanks to Lucio.
domenica, dicembre 28, 2008
BLOB type in MySQL
I had this exception when I was trying to insert a big image in a BLOB column using MySQL.
The problem didn't happen with small images, i.e. with the size of 2,3Kb. After spent some time to investigate about the problem, I understood that the reason is due to the BLOB type in MySQL whose maximum size is 64k. Therefore if you want to store big binary data in a MySQL database you need to use another blob type as MEDIUMBLOB or LONGBLOB.
If you are using JPA annotations to define your tables you need to specify the length of your BLOB attribute using the @Column annotation.
Here is what I have defined for the picture attribute used in jugevents application.
In this way the type of the column corresponding to the picture attribute will be MEDIUMBLOB instead of BLOB and you won't get that exception
java.sql.BatchUpdateException: Data truncation: Data too long for column 'picture' at row 1
The problem didn't happen with small images, i.e. with the size of 2,3Kb. After spent some time to investigate about the problem, I understood that the reason is due to the BLOB type in MySQL whose maximum size is 64k. Therefore if you want to store big binary data in a MySQL database you need to use another blob type as MEDIUMBLOB or LONGBLOB.
If you are using JPA annotations to define your tables you need to specify the length of your BLOB attribute using the @Column annotation.
Here is what I have defined for the picture attribute used in jugevents application.
@Lob
@Basic(fetch = FetchType.LAZY)
@Column(length=1048576)
public byte[] getPicture() {
return picture;
}
In this way the type of the column corresponding to the picture attribute will be MEDIUMBLOB instead of BLOB and you won't get that exception
Labels:
"Data truncation: Data too long",
BLOB,
JPA,
MEDIUMBLOB,
mysql
venerdì, dicembre 05, 2008
Auto injected spring beans
A colleague of mine asked me to solve a problem about using beans, configured using the spring container, in legacy code.
Basically he couldn't change the way those beans are created but he wanted to be able to inject their properties using a spring configuration file.
This is the way he wants to create an instance of the class BeanAutoInjecting.
The class BeanAutoInjecting has its attributes injected by spring container but we don't want to have any trace of Spring in the code that use this class.
A friend of mine, Lucio, proposed me to use the class AutowiredAnnotationBeanPostProcessor to sort out this problem.
Therefore we have to modify the constructor of the class BeanAutoInjecting in this way:
The trick is to define a dummy constructor and to instruct the spring container to use it. Here the dummy constructor
Here the definition of the bean and the auto-wiring directive in the spring configuration file.
That's cool I would say, I am able to use a spring managed bean in my legacy code creating it out of the spring container!!!
Basically he couldn't change the way those beans are created but he wanted to be able to inject their properties using a spring configuration file.
This is the way he wants to create an instance of the class BeanAutoInjecting.
BeanAutoInjecting bai = new BeanAutoInjecting();
The class BeanAutoInjecting has its attributes injected by spring container but we don't want to have any trace of Spring in the code that use this class.
A friend of mine, Lucio, proposed me to use the class AutowiredAnnotationBeanPostProcessor to sort out this problem.
Therefore we have to modify the constructor of the class BeanAutoInjecting in this way:
public BeanAutoInjecting()
{
ApplicationContext ctx = SpringLoader.getApplicationContext();
AutowiredAnnotationBeanPostProcessor aabpp = (AutowiredAnnotationBeanPostProcessor)ctx.getBean(
"org.springframework.context.annotation.
internalAutowiredAnnotationProcessor");
aabpp.processInjection(this);
}
The trick is to define a dummy constructor and to instruct the spring container to use it. Here the dummy constructor
public BeanAutoInjecting(int a)
{
System.out.println("I am the dummy constructor!");
}
Here the definition of the bean and the auto-wiring directive in the spring configuration file.
<!-- auto wiring directive -->
<context:component-scan base-package="spikes.springexamples"/>
---------------------------
<!-- bean definition with dummy constructor ->
<bean name="beanAutoInjecting" class="spikes.springexamples.BeanAutoInjecting">
<constructor-arg>15</constructor-arg>
</bean>
That's cool I would say, I am able to use a spring managed bean in my legacy code creating it out of the spring container!!!
sabato, novembre 08, 2008
I love jugevents
Just to say that I am really lucky to be one of the developers of jugevents, according to me the best ever web application I have worked on. I mean, nothing special over there but all is rational, logic, simple.
Just an example, in development I need to test the functionality add new jugger but I don't want to send emails every time I test it, because I have previously test that service. Well, I only need to mock the dependency to the mail sender bean in this way
And it's done. Honestly think for a while about one of the crap application you are working on in your job. Could you easily mock the dependencies as easily as we do in jugevents? Well I think the answer is no.
I should dedicate more time in development jugevents as it's good for my education and even for my mood.
Just an example, in development I need to test the functionality add new jugger but I don't want to send emails every time I test it, because I have previously test that service. Well, I only need to mock the dependency to the mail sender bean in this way
<bean id="mailSender" class="it.jugpadova.mock.ParancoeMockMailSender"/>
And it's done. Honestly think for a while about one of the crap application you are working on in your job. Could you easily mock the dependencies as easily as we do in jugevents? Well I think the answer is no.
I should dedicate more time in development jugevents as it's good for my education and even for my mood.
domenica, ottobre 19, 2008
Flights web site
Finally I have found a nice web site to find international cheap flights, very easy to use and with really complete search results. Have a try at http://www.tickets-to-europe.com/
lunedì, ottobre 13, 2008
Ubuntu Window Grouping
The default window grouping setting in ubuntu results in opening a separate tab, in the bottom bar, for every application running.
i.e. if you are using skype and you are talking with 3 different users you will see three different tabs in the bar.
In order to change the window grouping settings follow this steps:
i.e. if you are using skype and you are talking with 3 different users you will see three different tabs in the bar.
In order to change the window grouping settings follow this steps:
- Right click on the bottom bar, on the left (in the visible space);
- Preferences
- Check Always group windows
venerdì, ottobre 10, 2008
Refreshing cache DNS in Windows
In Windows there is cache for DNS. In order to refresh the cache from command line and refer to the correct IP you need to execute this command:
After that verify the correct IP of the website you want to connect using:
Thanks to my colleague Roman.
$ ipconfig /flushdns
After that verify the correct IP of the website you want to connect using:
$ tracert <myWebSite>
Thanks to my colleague Roman.
lunedì, ottobre 06, 2008
Chain commands with maven
If you need to run two (or more) maven command in cascade you can chain these two commands in the following way:
Example:
instead of:
Thanks again to Lucio.
$ mvn commandA commandB
Example:
$ mvn clean install
instead of:
$ mvn clean
$ mvn install
Thanks again to Lucio.
martedì, luglio 29, 2008
org.eclipse.core.runtime.AssertionFailedException in Eclipse RCP
If you are working on development (or bug fixing) of a eclipse-plugin application and you get this error:
or any eclipse specific error, in order to find out the real exception thrown by your code proceed in this way:
Thanks to Roman ;)
org.eclipse.core.runtime.AssertionFailedException: assertion failed:
or any eclipse specific error, in order to find out the real exception thrown by your code proceed in this way:
- Right click on the error message;
- Open log
Thanks to Roman ;)
Labels:
AssertionFailedException,
eclipse,
export log,
plugin
sabato, maggio 31, 2008
MySQL case sensitive in linux
MySQL table names are case-sensitive depending on the filesystem of the server. e.g. insensitive on Windows & Mac HFS+, Case sensitive on Unix.
It means that if you have stored the table PIPPO (upper case) in your database, the select query:
select * from pippodoesn't work and it returns a message like ..."table pippo doesn't exist".
In order to prevent this problem you have to set set lower_case_table_names=1 in your /etc/mysql/my.cnf file. In this way the mysql server will store the table in the file system using lower case.
Here the steps I have followed:
- Chek the status of lower_case_table_names typing:
$ mysqladmin -uroot -p variables $ sudo gedit /etc/mysql/my.cnf- edit the file adding the entry lower_case_table_names=1 just under the group definition: [mysqld]
[mysqld]
#
# * Basic Settings
#
#
# * IMPORTANT
# If you make changes to these settings and your system uses apparmor, you may
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#
lower_case_table_names=1
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking - shutdown the mysqlserver:
$ mysqladmin -uroot -p shutdown - start the mysqlserver:
$ sudo mysqld & - Chek the new status of lower_case_table_names typing:
$ mysqladmin -uroot -p variables - Remember that you have to re store the tables in the database, the best way to do that is dropping your database and running the SQL script.
- Test if works running a query like
$ select * from pipposupposing you have stored PIPPO upper case
I ran this configuration with ubuntu 8.0.4, dell XPS1530, mysql 5-0
Enjoy with MySQL on linux.
dell XPS 1530 + ubuntu = fast
Here the log after executed mvn install on parancoe (trunk). Before I ran the command mvn clean, so the total time includes the compile step.
21 seconds not bad at all.
21 seconds not bad at all.
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Parancoe .............................................. SUCCESS [2.784s]
[INFO] Parancoe Yaml ......................................... SUCCESS [5.407s]
[INFO] Parancoe Core ......................................... SUCCESS [9.599s]
[INFO] Parancoe Web .......................................... SUCCESS [2.964s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21 seconds
[INFO] Finished at: Sat May 31 02:15:55 IST 2008
[INFO] Final Memory: 37M/132M
[INFO] ------------------------------------------------------------------------
install activation with maven
Problem
Link
activation
Command
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) javax.activation:activation:jar:1.1.1
Try downloading the file manually from the project website.
Link
activation
Command
mvn install:install-file -DgroupId=javax.activation -DartifactId=activation -Dversion=1.1.1 -Dpackaging=jar -Dfile=activation.jar
Labels:
activation.jar,
java activation framework,
mvn
giovedì, maggio 29, 2008
Executing main class with maven
If you want to run the main class of your application, let say mypackage.Pluto from maven, just run this command:
That's great, easy, simple...that's the maven way. Thanks to Lucio.
$ mvn exec:java -Dexec.mainClass=mypackage.PlutoThat's great, easy, simple...that's the maven way. Thanks to Lucio.
giovedì, aprile 03, 2008
Installing cruisecontrol as service on windows XP
Here the steps I have followed in order to install and run cruisecontrol as a windows service.
- Download cruisecontrol. I used the version 2.6.2 windows installer.
- Run the installer and check the windows service box.
- Remove the service using the command: $ sc delete CruiseControl
- Go to <CRUISE_HOME> folder and edit the wrapper.conf file and be sure it contains the following entry:
# Application parameters.
# Add parameters as needed starting from 1
wrapper.app.parameter.1=CruiseControlWithJetty
wrapper.app.parameter.2=-jmxport
wrapper.app.parameter.3=8000
wrapper.app.parameter.4=-configfile
wrapper.app.parameter.5=config.xml
wrapper.app.parameter.6=-rmiport
wrapper.app.parameter.7=1099
wrapper.app.parameter.8=-webport
wrapper.app.parameter.9=8180 - I set the listening port of cruisecontrol to 8180, you can change the value as you like.
- Open a dos windows corresponding to <CRUISE_HOME> folder and type: $ wrapper -i wrapper.conf
- You should read the message: "wrapper | CruiseControl Service installed."
- Try to open a browser at the url: http://localhost:8180
- If you see the normal screen of cruisecontrol you have been lucky (not like me) and you are done!.
- ...Otherwise...If you see an error like 500 code open the wrapper.log under the log folder. Check for a message like:
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
proceed with the following item. - Copy the file tools.jar to <JAVA_HOME>\jre\lib\ext folder. I found this solution here.
- Restart the service, it should be works.
- If still doesn't work... copy the tools.jar also under the folder
/lib/ext
Maybe there is a faster and easier process to have cruisecontrol running as service. Anyway if you follow this guide you will successfully configure cruise as service.
venerdì, marzo 28, 2008
Do not make complex simple things
I can't say much more, just I was wondering why do people tend to complicate all the things that could be easily developed, why do I need a bus to go to work if I am alone in the bus, why do I need an expansive computer if I have only to use excel, and why do I need to define another language if I can use well known languages to do the same. So why I have to spend 1000 eur for a watch when I could spend 50 to achieve the same result, that is checking the time. Keep things easy and you would be loved, common patterns, common words. Ask yourself what are you going to produce, what the costumer wants and try to realize it as simple as you can, there is no way to invent things if they are already available, and most of them for free. Look at jugevents, it's one of the best web application in the world, and it works, it's easy to understand, and it uses common frameworks. I like working on it, just would like having more time to dedicate on it.
Iscriviti a:
Post (Atom)





