сбърках.
Month: April 2011
Проблем с онлайн банкирането на ЦКБ
Ето един мейл, който пратих на ЦКБ:
Здравейте,
Пратил съм ви поне 3 мейла относно един и същ проблем. Да приемем, че Mac OS не е много популярна платформа и не ви се занимава. Оказа се, че същите проблеми с макетите ги има и с Internet Explorer. Ваш служител (<angel.yakimov@ccbank.bg>) обеща, че "скоро" ще има ъпдейт, ама досега нищо не се е случило. Не знам дали съм ви скъп клиент ама, ако продължавате така да нехаете и откровено да лъжете, ще си сменя банката. Изборът е ваш.С намаляващо уважение,Михаил Стойнов
RichFaces presentation
This is a lecture I presented that is part of the JavaEE course.
The presentation was prepared by Radoslav Ivanov.
Exercises: RichFacesJSF1.2 project for eclipse
Installation: eclipse -> import -> existing project into workspace -> archive -> finish
Richfaces installation instructions for Eclipse in the presentation (ppt).
Gmail's support for multiple accounts in a single interface
I have multiple gmail and google apps accounts and hate the idea that I have to go through each of them to check them out.
There was always the possibility that I can forward them all to one big merge account, but then I would have to reply to a mail sent to mihail1@gmail.com with a mail account of mihail.merge@gmail.com and the user that sent a mail to mihail1@gmail.com would receive a response from mihail.merge@gmail.com which is not consistent (emails are made up).
Google has a fast account switch in the upper right corner, but that is not consistent, and google apps that have not been upgraded cannot use this feature.
Today I found out that gmail has substantially upgraded their support for other accounts.
This feature is found here gmail -> mail settings -> accounts -> send mail as:
First, you can "own" other email accounts with your google account, which means that you confirm that you own that other email address. For example I can own mihail1@gmail.com from my mihail.merge@gmail.com. Then when I log in to mihail.merge@gmail.com I can send mail pretending to be from mihail1@gmail.com which is very cool. Long time ago gmail used to say that the mail may come from mihail1@gmail.com, but really it was from mihail.merge@gmail.com which made this feature useless. This is no longer the case. But for that to work gmail will use the smtp server of mihail1@gmail.com (one has to supply user/pass for gmail to be able to login). Now gmail leaves no trace (I checked the headers) of the account the mail was really sent from - I always add reply-to address when I own an email, haven't tested it without supplying.
Second, gmail automatically sets the from field when sending a message. This feature is really cool. If I login to gmail with mihail.merge@gmail.com and receive a message sent to mihail1@gmail.com and click reply, gmail will automatically set the from: field to mihail1@gmail.com even though I'm logged as mihail.merge@gmail.com. This makes this feature an awesome one. Thus the guy that is sending mail to mihail1@gmail.com would have no idea I'm logged to gmail as mihail.merge.
The last thing, how to get the mail from mihail1 to mihail.merge? I use the forward feature. It works fine. Gmail allows me to add a mail and check for incoming mail via pop or imap, but does that with a timer, which would mean mail would arrive more slowly. This might have changed since I last used it.
Adding filters to sort mail makes this feature complete.
Conclusion: it's now easy to use one gmail account that can receive and now send mail from multiple accounts. Great work, Google.
Disable session persistence in Tomcat
This a pretty common issue when running java web applications on Tomcat. One puts an object into session and after a restart one gets:
Caused by: java.io.NotSerializableException: java.lang.Object |
It may not always be java.lang.Object, any class not implementing java.io.Serializable could be in this error.
This is due to Tomcat's default behavior of serializing all the sessions and after restart trying to deserialize them. (A good question is how does tomcat serialize them in the first place, but no time to research that).
The solution is pretty simple, find tomcat_dir/conf/context.xml and find a place where it says:
<!-- Uncomment this to disable session persistence across Tomcat restarts --> |
This works for both Tomcat 6 and Tomcat 7. Tomcat guys did the effort to prepare everything so it's easy for us.
This solution deserves a blog post because every once in a while I get bugged by this problem and have forgotten the solution. Now I know where to search for one.
Howto start tomcat on port 80 without root privileges on linux
Opening ports below 1024 on a *nix machine requires root privileges. If the application opening the port is exploited, then the exploiter would have full access to the machine since the application was run with root. The way to avoid this is to run the application without root privileges. Then the application has to open a port above 1024. Then the real port (<1024) has to be forwarded to the local one (>1024).
This solution would work on a wide variety of *nix machines that route with iptables. This solution is adequate not only for tomcat but for all kinds of applications and ports >1024.
- Check unprivileged user has java in its path. Check with java -version
- Check JAVA_HOME is set properly in the env of the unprivileged user.
- change 80 to 8080 in server.xml. Check if tomcat works with startup.sh. 8080 may be changed to any other port > 1024.
- execute the following to forward the port:
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
- After restart, do step 4 again or make permanent (depends on the linux used).
The most valuable part of this howto is the iptables script in step 4. Everything else is a prerequisite.
Note: I have made this port short by design. There are many tutorials that are quite long and explain everything. This just worked with me. I read a lot to get it to work. All I wanted is a solution that works without much explanation.
Note: I'm not an administrator or a linux/unix specialist. I have found that this solution works and allows me to start tomcat without sudo. Use at your own risk.