Mark Spritzler

ranger
Sheriff
+ Follow
since Feb 05, 2001
Mark likes ...
IntelliJ IDE Mac Spring
Cows and Likes
Cows
Total received
11
In last 30 days
0
Total given
4
Likes
Total received
186
Received in last 30 days
0
Total given
14
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Mark Spritzler

I know this has been solved for the OP. But there is another possible solution, not in the query, but in terms of removing an unknown number of leading "0" and returning what is left, and then being able to use it in JPA queries after. It is posted in the SO post linked at the top, so I can't take credit for it, but that one did have one slight error though in that the result of the formula is a String not an Integer.

@Formula("TRIM(LEADING '0' FROM account_number)")
private String trimmedAccountNumber;

Thanks

Mark
Ever since i upgraded a couple weeks ago, my machine has gotten to a crawl. The solution to speed it back up is to disconnect my second monitor and then reconnect it. It isn't exactly IntelliJ's fault, but it is Java/IntelliJ that is causing the issue of IntelliJ taking up too much CPU % over 300% when there is a second monitor connected.

Some solutions says you just have to upgrade your Nvidia Graphics driver, but I have done that and it did not help me.

I am also on a 2013 15" MacBook Pro with 16GB ram and I heard 2016 and higher might not have this issue.

But be careful

Mark S.
1 month ago
I know this is a long time since posted but

row.createCell() creates a new cell in a row.

Mark
1 year ago
By the way Norman is one of the coolest person's in the whole world! And he gets to work at Apple.

But the big question is, are you going to be moved the big space ship office space when it is finished?

Welcome Norman.

Mark
I recommend making the server side speak to the client with JSON, not XML. So either a REST API using something like Spring REST MVC. Another option, but something new to learn is something like Vert.x which allows for http, sockets and web sockets to connect to a server. but still sending JSON back and forth.

Mark
2 years ago
iOS
No. You should only create one SessionFactory/EntitnyManagerFactory for your entire application. And you "registerEmployeeBean" Is not of type LocalSessionFactoryBean.

In A Spring Application you use a layered approach. Service layer for your business use case code and transaction demarcation at methods level. Repository Layer that stores your queries to run. And then there is the SessionFactory underneath. The sessionFactory gets injected into your repository classes. So one bean for sessionFactory and one bean per repository class with dependency injection injecting the sessionFactory into the repository classes. Then the repository classes are injected into the Service layer classes.

Mark
relational mapping??? No idea what you mean by that as a separate thing. In Hibernate you are mapping to your relational database, so technically all the mapping in Hibernate is relational mapping. And you can't use hibernate without any mapping.

Now Inheritance mapping is different, and it is used for specific reasons. Personally, I actually avoid using Inheritance as much as possible. HOWEVER, there are times where a hierarchical Domain object model is warranted. If you have domain objects that inherit from other domain objects, then you sort of have to use inheritance mapping. Just to make it cleaner. It still isn't required.

Basically, it is about your domain classes. And in Java, I think it is always better to try not to use inheritance in your domain code, but sometimes it is necessary. I still find it rare when I need to use it. My friend on my team though, loves ORM inheritance mapping. ;)

What I find with inheritance mapping is that later when you want to delete data in via ORM code, it becomes a bit tougher to delete it because the data model becomes coupled/intertwined and more difficult to find the right order of deletion of rows through a bunch of db tables.

Mark
I am a huge proponent of Hibernate and JPA in general. But based on your description of what you are doing, I actually recommend using something like Spring Batch with Spring JdbcTemplate class to do the work.

If anything use JDBC and Spring's JdbcTemplate. You do not need to include all of Spring and an ApplicationContext if you just use the template and not Spring Batch. It is a simple class that only needs a reference to your DataSource object. But in the end it will save you from all the JDBC boilerplate code.

Friends don't let friends write straight JDBC code.

Mark
Not enough information to say yes or no. But if that is the exception you see, then that is what is being thrown.

Mark
I am going to move this to the JSF forum. This forum is for ORM questions, and your issue isn't about ORM.

Good Luck

Mark
2 years ago
Um, what is the actual value of bookType? You can either put a break point in there to see the value when it gets there, or a log message, or even a println "${bookType}"

Maybe there isn't an "ALL" value, maybe it is "All" or "all" where it is a different case. The only time an else will run is if the "if" is truly false. I like that truly false. Or just false.

Mark
2 years ago
John's solution is the most elegant and easiest. But to demonstrate what you did wrong. Here is where we assign the var outside the loop and the results. Run this code in a Groovy Console and look at the results.

Basically, I took out the query from the equation as you will see why stuff isn't getting into the Map. Then after you fix your code, put a break point or printout the values in your map so you can see the values inside there, then if it doesn't show up in your table then it is the table/view that is wrong.



Mark
2 years ago

Guillermo Ishi wrote:

Mark Spritzler wrote:

Yes 100% it has to be unbreakable

The other criteria was to try and make the server side not have to keep track of time for this,

(But there still will always be the timer) and that is the puzzle of this thread.

Mark



I think if you are relying on a timer other than one on your server the prizes should not be very valuable! I think the security should be in the timer on your server. I would suggest maybe everybody could be on the same timer and so you might have to be logged in as long as 59 min. before you become eligible (in the next hour). You could display "next giveaway begins in..." A local timer is too easy to defeat, just by switching computers for example.

You mean if I click on something that says free gift I might really get something besides a virus?



There isn't an actual "timer" on the server side that counts down. It is time since last free chips that the player received. It is a very common thing on casino type games with chips. For instance. My Vegas ios App is one then you have to wait at least 3 hours to get your next one. But you don't have to be logged in/in the game.

Mark

fred rosenberger wrote:

Mark Spritzler wrote:Here's where that logic fails. I have not received my first free giveaway. I login, so my timer starts. I log out in 59 minutes with one minute left till the first gift will be available. I log back in and there should be 1 minute left. But lastGivenTime is still null. Now you have to do extra work to find last login time, and use that in the calculation too.




I really just kind of throwing out random thoughts here. You've probably thought through all this already, but I do find this to be kind of fun.



Yeah, even though it is something real for work that I am working on, I found it fun to work through this, and why I posted it.

We figured out, for the first giveaway, they don't have to wait 60 minutes. Their first time in they can see the button active. That way the first one doesn't have to be calculated to how much time they have to wait. Then they get the first one, and all the subsequent ones are now good to find the last one given out.

Yes 100% it has to be unbreakable and not give out more than it should because people will definitely exploit it. No cheating allowed.

The other criteria was to try and make the server side not have to keep track of time for this, as for all the users would need this and having all those timers (We already have thousands of other timers running at the same time) isn't the best or needed.

We also added another interesting twist, that the general code should also work with a reward system, where you can receive gifts at any time, or an admin might reward a player on their own without a players interaction. (But there still will always be the timer) and that is the puzzle of this thread.

Mark

fred rosenberger wrote:I'm not sure I understand the problem, because I would think you'd simply store the time you last gave a gift.

The client would ping for lastGivenTime, and the timer would count down if < 1 hour, else display "you can get your gift now".

When the user clicks the 'get gift', you give them one gift, and reset the lastGivenTime to <now>. The client pings for the new value, and starts over.



Here's where that logic fails. I have not received my first free giveaway. I login, so my timer starts. I log out in 59 minutes with one minute left till the first gift will be available. I log back in and there should be 1 minute left. But lastGivenTime is still null. Now you have to do extra work to find last login time, and use that in the calculation too.

Mark