Tudor Raneti

Ranch Hand
+ Follow
since Nov 29, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tudor Raneti

Now I've run into another problem:
mailet*.log sais:

Exception delivering message (Mail1345880665225-8-to-gmail.com) - [EOF]

Upon some quick investigation (why do these happen when I'm out of time), it seems it may have to to with my PTR record:
with more info on that here:



One common myth about PTR records is that they are created for domain names and your domain has to have one to make sure your mail will not be rejected by other mail servers.


Anyone has any help for me before I waste more time investigating setting a proper email server solution further?
Do I need to set reverse DNS?
9 years ago
I've set my email server in my domain's MX record and configured the email server name as such. Thanks for pointing that out

The problem most probably was that public mail servers block "anonymous" emailing as spam, not even bothering to send it to spam or junk folders (sometimes it did, then it didn't catch my mails at all). After making my email server "legit", the mails arrive in yahoo and gmail safely.

Also... keep in mind that most public or commercial email servers out there have a send email per hour limit, which is why it isn't a good idea to use gmail as your email sending device. Roll your own server for unconstrained mail services
9 years ago
I'll follow this tomorrow, and by that time maybe my ISP responds too.

I managed to get blacklisted by yahoo in the meantime , so I got an extra chore now...

Will come back with outcome...
9 years ago
I've also sent to yahoo.com, nothing arrives there. It's possible it's my ISP's blocking of port 25, but I'll see that in a few days. I made a request for unblocking.
In the meantime should I know anything else about mail server? Something I didn't configure?

EDIT: Ok, this is what happened:
when sending to yahoo:
05/08/12 02:05:27 INFO James.Mailet: RemoteDelivery: Could not connect to SMTP host:, port: 25

when sending to gmail:
05/08/12 01:59:51 INFO James.Mailet: RemoteDelivery: Could not connect to SMTP host:, port: 25

Any thoughts?
9 years ago
I'm using the example here:
I've forwarded, virtual hosted, port 25. No firewall. Debug checks all ok but no email goes through!? Mail sends from one user to another at localhost, just not to my internet mail account.
What could be the problem please?

SENDING message from red@localhost to tudor.raneti@gmail.com

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "localhost", port 25, isSSL false
220 Desktop SMTP Server (JAMES SMTP Server 2.3.2) ready Sun, 5 Aug 2012 01:35:18 +0300 (EEST)
DEBUG SMTP: connected to host "localhost", port: 25

EHLO Desktop
250-Desktop Hello Desktop (localhost [])
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<red@localhost>
250 2.1.0 Sender <red@localhost> OK
RCPT TO:<tudor.raneti@gmail.com>
250 2.1.5 Recipient <tudor.raneti@gmail.com> OK
DEBUG SMTP: Verified Addresses
DEBUG SMTP: tudor.raneti@gmail.com
354 Ok Send data ending with <CRLF>.<CRLF>
To: tudor.raneti@gmail.com
Message-ID: <23063136.2.1344119718490.JavaMail.red@localhost>
Subject: Testing blue from red
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This is a test message
250 2.6.0 Message received
221 2.0.0 Desktop Service closing transmission channel

9 years ago
I entered in the list a new forum, pushed up, it worked, pushed up again, the forum went down instead.
Then, after moving the forum one up, I tried pushing the above one down, it went down in the list, in the forum index it didn't appeared in the position in the list.
I also tried moving down the second forum from top, and it went in an infinite request loop or something...

Please fix it, I probably need to manually edit the database in jforum_forums > forum_order
9 years ago
The quickest solution is to use 2.1.8 instead. I've also run into the DEADLOCKs problem with 2.1.9 and there's no apparent solution while I read about what others tried.

EDIT: either they fixed 2.1.9 or I did with an reinstall... there no more problems with 2.1.9 that I can see at the moment

EDIT2: there were no errors in the original package per se, I was making a dumb mistake when I replaced all TYPE with ENGINE, some 'type' got replaced too. I blame the heat
I don't know where the above error originated from, after re-downloading and re-installing everything works fine
9 years ago
I get this error after I install (and I'm not familiar with freemarker). How do I fix it quick please?

9 years ago
There's hibernate.jndi property to be set but I haven't the time to get into that now... dunno if that's the answer.
For some reason the other people that asked the same question didn't make use of this option.
Questions are marked bold below. This is the context of the question:

Shiro wants a JNDI datasource:

so I configured it one in Tomcat:

however, I'm using another setup from hibernate for my application:

This is also necessary in web.xml for the line in hibernate.cfg.xml:

I think I'm using two separate datasources, aren't I?Is that bad? Because I can't tell wether I'm using one PooledDataSource or two at the moment... Everything looks fine, except I think I will run into connection problems or the datasource registered in JNDI because it's not properly set with c3p0... also need to confirm this is a proper setup for this scenario.

What I want, is to register the hibernate datasource in JNDI to use it with Shiro, in common with the rest of my application. How do I do that? Is there any chance the configuration I'm using treats both datasources with the same c3p0 configuration, or maybe it sees the two datasources as one? Hopeful thinking...

Logs indicate there's two separate data sourcepools registering:
One at start, immediately after "INFO: Initializing Shiro environment", probably the tomcat configured one:

and the other later(s!?) when application calls on it, probably the hibernate one:

but afterwards there's a lot of pools initializing:

This is from the datasource configured in tomcat

this seems related to the initial settings of c3p0 in hibernate.cfg.xml

then on a short distance this appears:

... probably a separate thread and connection/settings for caching statements? hmm...

then another initialization

and afterwards, when there's idle checks, only one triggers according to settings:

meaning the other one will run into problems after the 8 hours set by mysql wait_timeout of 28800 seconds (in fact that's exactly what happened if I think about it, because authorization/authentication failed ...can't tell if the application crapped out too because everything was behind Shiro, anyway, enabling c3p0 for the hibernate connection will not enable it for Shiro datasource too...)

EDIT: In the meantime I discovered this, for Tomcat 7 (lucky me if it works):

EDIT2: EDIT doesn't work, there's some bug going on that was patched supposedly but can't get it to work.
Anyway, that's for a JDBC pooled datasource. For a com.mchange.v2.c3p0.ComboPooledDataSource there's

still, it would be nice if I could register the hibernate datasource in JNDI...
I don't see how a copy constructor would work in this case. My objects are queried for data used in charts, they don't do something themselves with the data, and, sometimes the object has one behavior, sometimes another, sometimes none like the others, so I can't apply something that works like the composition pattern, that is polymorphism, because each behavior represents data fetching, each needing special treatment. Also, I mention my objects are like that because I broke the rule that my object model should represent the data model to the maximum of granularity, meaning I joined columns like Date from other table into my entity.

So I'm wondering if I should slap myself because Scott Meyers sais so in Effective C++:

Anytime you find yourself writing code of the form "if the object is of type T1, then do something, but if it's of type T2, then do something else," slap yourself.

This is a case just like that, but I can't use polymorphism except if I would generalize the attributes of the object into attribute1, ..., attributeN, then treat it by known data types when slapping them to the chart object, which again is a slappity slap logic bit.
For instance I got Sum objects with sum field (one field), and Parity object with odds and evens field (two fields). Both can be dated, but the number of fields differs. Sometimes I can get 6 fields...
Anyway... polymorphism means overhead, and if I generalize, it automatically means more overhead... so why do it? Surely generalizing means abstracting the business rules, making the code less readable IMO. Designing with interfaces looks clear to me since that's what interfaces do, declare a behavioral contract on an object.

You can't override final, or sealed methods in C#.
Casting to the superclass to use its behavior is in respect to Liskov substitution principle, in reverse.
Overriding a final method makes no sense.
Maybe you are referring to hiding methods which is possible in Java as well with static methods.

Disclaimer. I may be excused for writing on this topic only when getting away from work, or like today, before I flee to the gym, or like now, before I go to sleep, so if it doesn't make sense, don't take it seriously, it's not because it's written smart
9 years ago

Jeff Verdegan wrote:

Tudor Raneti wrote:
This way, I handle the casts myself (there's no compile time casts occuring in Java AFAIK though compile time checks are made), but being specific should yield a slight performance boost if JIT cooperates?

How do you figure?

It's hypothetical. What I read around said that RTTI always runs in Java, even when you cast (I even remember I read somewhere RTTI can be turned off, but can relocate that knowledge now; seems in Visual C++ compiler you can). I was refering to the C++ and C# capability to cast and use the supertype functionality, as for cooperation, perhaps I should've referred to Oracle doing something about it JIT, not JIT

I'm not micro-optimizing, I'm just exploring design options (see title). I have nobody do discuss these things at work. There's another side of learning by mistakes, not being afraid to make them and see why they are mistakes and explore a bit... and sometimes you discover the mainstream is a mistake as a bonus, beside doing some theory cardio in the process.

My conclusion is that in the client code, there's no difference, hardly any difference in performance as for maintainability, you end up with roughly the same amount of types/interfaces.
What can I say... 'twas a nice trip, learned some things, remembered others, and that's all there is to it. Sometimes it's like this
9 years ago

Dennis Deems wrote:

Tudor Raneti wrote:RTTI ... HQL ... ISP ... JIT

Please spell out words instead of using abbreviations like this. There may be readers of the forum who are not familiar with them.


If I was using inheritance w/o interfaces in this, and there would be many attributes such as Dated but that wouldn't be always common among all the beans that share one main attribute in my application, that is Timelined in my case for example, then I would have lots of redundant functionality around and I would have to use reflection or annotations to ascertain which bean has something and which does not when fetching data in a generic way from all of them.

Otherwise there's no real difference if I inherit only in my code now... nor do I see how it's more or less brittle since whenever I add a new functionality I still have to extend the logic below.

9 years ago

Even *if* this works

I wouldn't have posted this if it didn't

the boost in performance would be so incredibly marginal that you would never notice any difference.

Yes, though there's no improvement at all, because I upcast (which is safe - no explicit cast needed), RTTI only checks if the cast is correct, then the call follows those jump tables you referred to I think and calls the downmost override.
If there was a downcast, again, RTTI only checks if the cast is correct then the call is done on the downmost override.

If there was an improvement though, take that marginal boost in ms and multiply it by 1000, then, consider that it exist in a multiuser environment, with many other such tasks.
It is a micro optimisation, true, but...

You're performing premature nano optimizations, which half of the time won't work out as you hoped.

...I'm exploring a concept. If I was micro optimising, I would separate the static variables in my caches into two, to avoid read contention

after the compiler has performed type checking

I thought I was using the explicit cast as in C++, which I didn't (it doesn't exist actually in Java, RTTI always intervenes and then the downmost overriden behaviour is imposed). Check out this:

In C++, the classic cast "(Shape)" does not perform RTTI. It simply tells the compiler to treat the object as the new type. In Java, which does perform the type check, this cast is often called a "type-safe downcast."

from Thinking in Java 4th Edition

As a consequence of Liskov Substitution principle application in Java polymorphism, upcasting limits the behaviours that of a subtype in number, though it shouldn't be meant to restrict the client from using the supertype's behaviours since only methods are polymorphic, not fields, so there's no danger.
Casting won't call the supertype's behaviour if it has been overriden, or, in other words RTTI always runs detecting and calling the downmost override.

So, why this should work:
1. Objects in inheritance (is-a) can be regarded when built conceptually (and probably physically) by analogy to sheets of an onion (or a lot within another lot), so, if I'm casting to the supertype Sum explicitly, doing RTTI is useless logically because I'm refering explicitly to the Sum instance within the instance that extended Sum. That is, I explicitly said (though I have no operator to say it in Java) I want the Sum class instance, not the downmost subtype of it within that instance. If the compiler would ignore my explicit cast then it's doing RTTI, which it does in Java. The cast only helps me identify the object at compile time to call the right method.
2. Types and subtypes are supposed to be designed in respect to Liskov substitution principle, so explicitly casting to a supertype should be fine, but isn't available...

For the validity of this idea I mention: http://en.wikipedia.org/wiki/Method_overriding
Where C# allows for instance method hiding, then casting to the supertype and obtaining its behaviour.

In short, this only allows me to write like in the example above. RTTI happens anyway and thus no improvement in performance exists. Extending a common class instead of casting doesn't change the overall logic because I'm using the objects for something else not telling them to do something, so there's no difference but in style

9 years ago
Well, I don't have the time to go deeper and see how the compiler handles RTTI exactly, and what happens in byte code, and when it happens.
If I would extend SumsDated, it would be all RTTI (dynamic) at work.
This way, I handle the casts myself (there's no compile time casts occuring in Java AFAIK though compile time checks are made), but being specific should yield a slight performance boost if JIT cooperates?
There's no need for dynamic polymorphism need in this case too, compiler should be able to tie things together somehow...

This quote Java Language Specification:

Also some relevant articles:

Someone confirm with some experiment if you please? Thanks

P.S. Does it violate OCP? Since every time I add a new behaviour, I also have to add it to the module, it's more of extending the module, not modifying what already is.
9 years ago