Mandar Khire

Ranch Hand
+ Follow
since Sep 11, 2007
Mandar likes ...
Android Java Linux
Merit badge: grant badges
For More
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

Hi,
Nice explanation about 'Generate pdf invoice in java'.
Basic concept is Read Template/format (empty invoice), replace/add some words, generate file as pdf.
I created same way using empty pdf invoice to actual invoice using pdfbox.
But I like that I can add Word also in my program, now I can keep this as backup program, if my fails at least this one will work.
ie. Read Template from pdf or Word,...& so on.
Thanks.
4 years ago
Hi,
With reference of following link
Running a JAR file from a java program,
First I wrote simple Hello world program.
Then export it as Jar file, Sealed it. named it as hello1.jar
It works fine.
Then I wrote program for run this jar file from java program as example shown in given link.

I got exception

Need to understand where I am writing wrong code?
5 years ago
Hi,
I tried to use JD GUI, but it has problem.
How to decompile jar file in Java version 10.0.2, in Window 10 64 bit?
5 years ago
Thanks Tim Moores,
I want to generate following kind of invoice. Image I got via Google.

Currently I am using Excel sheet as format of empty invoice (which has company logo in header) look like above.
Fill it manually & save it as different name. In whole process No Java.
But now I am trying to use java program which help me to generate invoice/bill etc.
For that rest of program is ready but confuse about
1. Should I use my empty format of excel sheet & by java using Apache POI generate invoice?
2. Or use PDFbox?
Which way give me beautiful invoice?
5 years ago
Hi,
I know that there are multiple API libraries for generate files like pdf, doc, excel etc.
But As I am searching about invoice related.
I have excel file in that I kept invoice format. but read it & modify its values & save it in different name, is very tedious job. New file might be editable via excel editors. New file also not add company logo & formating like I design in format file.
Is there other way to do it?
Is there any API for it? pdf might be right choice, I am thinking to use pdfbox API for this.
5 years ago
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:-
5 years 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.
5 years 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
5 years 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,