This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.

Mandar Khire

Ranch Hand
+ Follow
since Sep 11, 2007
Mandar likes ...
Android Java Linux
Pune, Maharashtra,India
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
7
Received in last 30 days
0
Total given
5
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mandar Khire

Thanks all for replying,

Tim Moores wrote:
If I were to solve this, I might resort to Prolog instead.


Prolog is very nice subject which I never used. Surely it will help to solve this problem.
But for me I first prefer basic java, then advance java. Same time I will study this new subject.

Piet Souris wrote:
1) do you use all the 8 numbers 1...8, or is it allowed to have say 3 8's in the matrix?


I am using 1 to 8 for each box. (1,2,3,4,5,6,7,8)
I dont know what is ' 3 8's in the matrix'.

Piet Souris wrote:
2) if a = 2; then I assume that the neighboring cells (b, c, d, e) may not conrtain either 1 or 3


Yes, same way apply for each cell/box.

Piet Souris wrote:
3) how did you get a total number of possibilities of 1.6M?


&

Campbell Ritchie wrote:

. . . . (I calculate total possibilities are 16777216.) . . ..

16777216 = 2²⁴, which suggests to me that the eight boxes don't have to contain distinct numbers, otherwise you would be calculating factorials.



Might I calculate with wrong formula.
I am trying to find out how many possibilities of putting 8 numbers in 8 boxes. So I use 8^8 =  16777216.
But Now I am searching right formula for find total possibilities.
Then i will apply another formula for find accurate possibilities from those total possibilities.
Need to refresh Maths knowledge also.
I found 1 link related to find possibilities might that formula right for this problem.
Permutation Formula

Piet Souris wrote:
4) we have a dedicated forum for all things puzzles and programming 'programming diversions'. Have a look, I think you will like it.



I never seen this section so I put this question in 'Beginning Java'. I decided to solve this problem with only basic java programming.
integer, arithmetic operations(addition, subtraction, division, multiplication), for, while, if-else etc only.
If I succeed then I move more optimize way. So understand importance of optimization.
As I thought. Might this way is not right way.
Need guidance from Java & Mathematics people.

Campbell Ritchie wrote:

Mandar Khire wrote:. . . 2. If 'd' have 1 then its neighboring box are 'a','b','c','e','g','h'.  So those four box should not have number 2. etc etc

Foiur? Six, surely?


Yes.
For simplicity as following:-
2 months ago
Hi,
I found one mathematical funny query. Which I & my friend solving on paper in free time.
But I found challenging to write a program related to it.
See following image.

Fill numbers 1 to 8 in each box. But there are conditions as follows:-
1. specific number enter in box then neighboring box should not have its immediate number.
Example
1. If 'a' have 1 then its neighboring box are 'b', 'c', d','e'.  So those four box should not have number 2.
2. If 'd' have 1 then its neighboring box are 'a','b','c','e','g','h'.  So those four box should not have number 2. etc etc

Question are:-
1. Find total probability of accurate possibility. (I calculate total possibilities are 16777216.)
2. Print accurate set.

I will post when I complete my source code. I will try source with or without GUI.
If I stuck somewhere, then also I post reply for discuss.
If anyone know more questions which can be solved by java then share link.
It might help to refresh java programming.
2 months ago
hi,
I wrote small program for search Person's Name via Text field as I can search in mobile phone Contacts.

I put 5 names in combo box, when I search 'a' ie wrote 'a' in textfield then it shows all 5 names in combo box pop up
because each have character 'a', then I select 3rd or 4th name by mouse, then it should show in Text field where I wrote 'a'.

Each time it replace 'a' in text field to 1st name in combo box, I want to write 2nd, 3rd character, or select from drop down list in combo box.

But I can't do that.

For reference here is my program
3 months ago
Thanks Tim Holloway,
By reading your reply now I understand that which way I should go on learning path.

If you suggest good book/books for learn Hibernate JPA.
So I can migrate my example to Latest, updated Java, Hibernate, Mysql.
I selected 'join' for study purpose, if I get good book then I will study more complex keywords, techniques.

Still for study purpose if I dont have choice, then in Old-style hibernate what is way to solve this query? If any.
If there is way then I can compare how old-style worked & how new style working.

Need guidance.
Thanks,
I read Hibernate Reference Documentation 3.6.10.Final,
I found


3.4.2. Outer Join Fetching
If your database supports ANSI, Oracle or Sybase style outer joins, outer join fetching will often
increase performance by limiting the number of round trips to and from the database. This is,
however, at the cost of possibly more work performed by the database itself. Outer join fetching
allows a whole graph of objects connected by many-to-one, one-to-many, many-to-many and oneto-
one associations to be retrieved in a single SQL SELECT.
Outer join fetching can be disabled globally by setting the property hibernate.max_fetch_depth
to 0. A setting of 1 or higher enables outer join fetching for one-to-one and many-to-one
associations that have been mapped with fetch="join".
See Section 21.1, “Fetching strategies” for more information.



In Section 21.1 I found


Join fetching: Hibernate retrieves the associated instance or collection in the same SELECT,
using an OUTER JOIN.


&


<set name="permissions" <br /> fetch="join">
<key column="userId"/>
<one-to-many class="Permission"/>
</set >



<many-to-one name="mother" class="Cat" fetch="join"/>



But not understand how to use it so I can get result same as I get in mysql workbench by using query.
Need Guidance, Help.
I also tried
following code in exam_dates.java

or

But getting same exception.
Need guidance,Help.
I found
Hibernate – One-to-Many example (Annotation) & Hibernate One-to-Many Association on Join Table Annotations Example
As per it I add Annotations in exam_dates.java


& in student.java


But no use.
Where I am doing wrong?
All example I found are for add data in tables, not fetching data from tables.
Need guidance, Help.
Thanks Knute Snortum,


Now, to reply to your question: MySQL (and any SQL) are very different from Hibernate.  Hibernate deals with objects and has its own query language.  You shouldn't expect a query that works in SQL to work in Hibernate -- in fact it most likely won't.  Do a Google search for hibernate query syntax and you will find many websites to assist you.



I found HQL tutorial.
I tried to use query as


or

It gives me exception as follows:-

When I search related to exception, I found webpage
But not understand how to solve this problem.
Need guidance.
Hi,
I have example which fetch data from tables using Hibernate3.
Source code you can get following link (Coderanch question's 1st reply.)
Join query & hibernate 3!

I download Hibernate latest version ie. hibernate-release-5.3.1.Final from Hibernate ORM.
But not understand which jar files use as library in my program & which line or function I have to change.

Need a guidance.
Thanks,
I asked question related to Hibernate & Join query.
Join query & hibernate 3!.
For reference
Following is my program.
Total files:-
Java Files:-
1. test_db.java
2. JDBCConnection.java
3. HibernateUtil.java
4. Utility.java
5. student.java
6. exam_dates.java

hibernate xml files
1. jdbcdetails.xml
2. hibernate1.cfg.xml
3. student.hbm.xml
4. exam_dates.hbm.xml

1. test_db.java


2. JDBCConnection.java


3. HibernateUtil.java


4. Utility.java


5. student.java


6. exam_dates.java


1. jdbcdetails.xmll


2. hibernate1.cfg.xml


3. student.hbm.xml


4. exam_dates.hbm.xml
Hi,
I use Java 1.8.0_144, Hibernate3.

I wrote small program to fetch combined data from 2 tables.
Query which I use for it, it works in Mysql Workbench. It has 'join' in it.

Its not working in Java program.
I got exception as follows:-


Question is How to solve this problem without migration in Hibernate latest version?

Knute Snortum wrote:Why do you need to rewrite the query without a JOIN?



I am using Hibernate3.jar & related libraries, & in it I get exception as follows:-


So I am searching is there any way to get same result without join, or with join how to get same result in Java program by using hibernate3.
Query works:-


But question is without using 'join' can we write query for getting same result?
Thanks,

Tim Moores wrote:

Mandar Khire wrote:I not understand whether 'and (SELECT MAX(date) FROM exam_dates)' is working or not!


You missed the "WHERE ..." part of what I wrote. Knowing the max date overall doesn't help you much, since you need it for each student separately.



I dont know what should I write after Where ...?
Can you give me complete query, so I can study it, understand it?