Dmitry Mamonov

Greenhorn
+ Follow
since Dec 24, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dmitry Mamonov

You may try to use http://commons.apache.org/configuration/
It's properties functionality allow to change properties values preserving properties file structure, including comments.
http://commons.apache.org/configuration/userguide/howto_properties.html#Properties_files
12 years ago
With truth, protecting of software is a some kind of keeping secret.
Java is pretty weak in this case.

By default Java bytecode may be decompiled to very good readable Java code,
so any one can do so, switch your logic and compile code back again.

You may use bytecode obfuscation technique to prevent it, but for user
who really want to crack your software it will be only a minor barrier.

-------------------------
Two ways how to implement software protection:

1. Use a network repository to check user software licence, steps:
- Ship a licence key to user
- Licence key is entered into your application form
- Application requests a License Server to generate installation key, additional data is something related to hardware (MAC/IP/etc.)
- Licence server generates Installation key which is locked (some way) to this hardware settings (i.e. Intallation key will not work on other machine)
- check Installation key some times as your want.

2. Use a "secret" file
- Ship a Licence file to user
- User may put it into installation directory of your application (for example)
- on first run - copy this file somewhere outside installation directory (prevent this operation if installation file is 7 days old after shipment, for example)
- check the copy each time

Also, you may find RSA useful.
-----------------------------

It is just a couple of solutions, but I'm not an expert in this area.
12 years ago
Hi Renjith.

My example explains how to configure text background color,
to change foreground you may use tag <font> like:

<html><span bgcolor="blue"><font color="red">Red on blue</font><span>
12 years ago
It's even simpler to solve your problem, try HTML for your values:

<html><span bgcolor="blue">Blue</span> Normal <span bgcolor="red">Red</span>
12 years ago
Looks like I have solved similar problem.

My point was to dash cell background with diagonal lines under the cell value so everything is displayed in cell as usual,
but over diagonal dashes.

The solution was to implement proxy renderer which inherits from JPanel. It contains any custom
renderer as subcomponent of panel.
Before display placed component is switched to invisible,
the panel rendered,
the any other staff rendered over empty panel,
the component switched to visible and rendered with property opaque=false.

Please consider sources for details.

http://code.google.com/p/morena/source/browse/trunk/morena/src/morenoapp/components/common/table/renderer/ProxyPanelTableCellRenderer.java
12 years ago
Sorry, I missed with thread to post comment. It's dummy message. Just ignore it.
12 years ago
Chad Fowler, Welcome from "India" :)
12 years ago
I'm not experienced with SWING in ages, but here is my vision.

The application (data) model is not only thing you need to build UI.

I see three types of models needed, with corresponding controllers sure, to build UI app.

1. Application model - common data for all UI forms, i.e. text document in document editor application.

2. model inheriting UI - all data stored like:
class MyPanel extends JPanel {
String firstName; String lastName; etc.
boolean formFilledCorrectly = false;
}


3. model delegating to UI:
class MyTableModel extends TableModel {
List<MyDataBean> myDataList; etc.
}


4. Also, data is stored in concrete UI components, i.e. jTextField.getText().

BeansBinding will help you much to connect data of
models No2 and No3 to model No4.
But model No1 is a different one, I think it's bad idea to connect
application model to JTextField model directly. This way I should
pass data from Model No1 to Model No4 through models No2 and No3,
it is much more flexible. I can use same custom components
in completely different context if they are not locked onto root model (No1).

12 years ago
Sasika, would you like to trick us posting code which has no relation to you real problem?

with you posted code we have next:
rt.exec("C:/Programme Files/MySQL/MySQL Server 5.0/bin/mysqldump -u uname -ppassword databaseName>C:/backup.sql");

1. http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String) refers to http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String,%20java.lang.String[],%20java.io.File)
2. and consequentally to http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String[],%20java.lang.String[],%20java.io.File)
3. the command line you have passed as factual argument of exec() method is stripped into String[] with
http://java.sun.com/javase/6/docs/api/java/util/StringTokenizer.html

here is example from javadoc

The following is one example of the use of the tokenizer. The code:


prints the following output:


So, as I described above, you are executing "C:/Programme" which will be turned by OS "C:/programme.exe" (or .com or .bat).

To evaluate executable "\"C:/Programme Files/MySQL/MySQL Server 5.0/bin/mysqldump\"" you should enclose it's path with quotes, it may help, but I'm not sure.
Or, better, use method: http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String[],%20java.lang.String[],%20java.io.File)
12 years ago
Sure, empty catch block is the bad point to find error.
Also, you are running "C:/Programme.exe"
with arguments
1. Files/MySQL/MySQL
2. Server
3. 5.0/bin/mysqldump
etc.
have you any executables with such name?
12 years ago
Yes, particular object instances are buffered.

e.g. values of type Integer from range -128 to 127. Here is the rt.jar code:


Other interesting point in answer to this question is method:

of class String. Please consider javadoc for details.
12 years ago
NetBeans is also application development platform. Meir Yan, you can use NetBeans core libraries (module) to develop
your UI or either headless application. But it is complex task which will give you profit
only when your application is large enough.

You may try to use Swing Application Framework which is intended to solve
common problems of building UI application.
NetBeans has deep integration with Swing App Framework,
and also visual form editor, so it's a good point
to use it as main development IDE for UI applications.

12 years ago
Here is bytecode difference;

// Method descriptor #8 ()V
// Stack: 1, Locals: 3
public void f();
0 aload_0 this
1 getfield sys.JavaMemoryPuzzle.dataSize : int 24
4 newarray byte 8
6 astore_1
XX iconst_1 <<<difference
XX istore_1 i <<<difference
7 aload_0 this
8 getfield sys.JavaMemoryPuzzle.dataSize : int 24
11 newarray byte 8
13 astore_2 data2
14 return


My suggestion is:
when code walks out from nested {} block it will not assign null values to variables in such block.
We just will not see them in java code.

Second example of code works fine (marked with XX in bytecode list) cause
the value=1 is stored into variable name = "i" exactly into the same place (index=1)
where variable name="data" was stored before.
This breaks reference to first allocated array so it could be collected with GC.
12 years ago
Don't know but:

is also failed, BUT:

works fine.
12 years ago