Skip to content

Commit 7de6502

Browse files
author
technik
committed
restore repository after security issue
1 parent f412a53 commit 7de6502

File tree

4,492 files changed

+314718
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,492 files changed

+314718
-0
lines changed

!temp/src/ArrayList_Insert.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import java.util.ArrayList;
2+
3+
public class ArrayList_Insert {
4+
public static void main(String[] args){
5+
ArrayList<String> list=new ArrayList<String>();
6+
for(int counter=0;counter<10;counter++){
7+
list.add("");
8+
}
9+
list.add("one");
10+
printArrayList(list);
11+
list.set(2, "insert_element");
12+
printArrayList(list);
13+
list.set(2, "new insert element - replacer");
14+
Float value=1.7f;
15+
System.out.println("value:"+value.intValue());
16+
}
17+
18+
private static void printArrayList(ArrayList<String> list){
19+
for(int counter=0;counter<list.size();counter++){
20+
System.out.println(counter+" : "+list.get(counter));
21+
}
22+
}
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
/** ïîêàçûâàåò ÷òî àâòîðàñïàêîâêà èç "Integer" â "int" íå ðàáîòàåò(NullPointerException) â ñëó÷àå êîãäà çíà÷åíèå Integer - null */
3+
public class AutoPackIntegerFromNull {
4+
public static void main(String[] args){
5+
int value=getValue();
6+
System.out.println("value:"+value);
7+
}
8+
9+
private static Integer getValue(){
10+
return null;
11+
}
12+
}

!temp/src/DateTemp.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import java.text.SimpleDateFormat;
2+
import java.util.Calendar;
3+
import java.util.Date;
4+
5+
6+
public class DateTemp {
7+
/**
8+
* @param args
9+
*/
10+
public static void main(String[] args){
11+
SimpleDateFormat sdf=new SimpleDateFormat("dd.MM.yyyy HH.mm.ss.SSS");
12+
13+
Calendar calendarBegin=Calendar.getInstance();
14+
Calendar calendarEnd=Calendar.getInstance();
15+
calendarEnd.add(Calendar.DAY_OF_MONTH, +2);
16+
17+
Date dateBegin=calendarBegin.getTime();
18+
Date dateEnd=calendarEnd.getTime();
19+
20+
System.out.println("Date begin:"+sdf.format(dateBegin));
21+
System.out.println("Date end:"+sdf.format(dateEnd));
22+
}
23+
}

!temp/src/ExtractFileName.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
public class ExtractFileName {
3+
public static void main(String[] args){
4+
String path="d:\\photo\\2009_01_18-11_06_58-624_b.jpeg";
5+
System.out.println(path);
6+
System.out.println(getFileName(path,"\\"));
7+
}
8+
9+
private static String getFileName(String pathToFile,String delimeter){
10+
int delimeterPosition=pathToFile.lastIndexOf(delimeter);
11+
if(delimeterPosition>=0){
12+
return pathToFile.substring(delimeterPosition+delimeter.length());
13+
}else{
14+
return pathToFile;
15+
}
16+
}
17+
}

!temp/src/FormattedTextExample.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.text.MessageFormat;
2+
import java.util.Date;
3+
4+
5+
public class FormattedTextExample {
6+
public static void main(String[] args){
7+
int planet = 7;
8+
String event = "a disturbance in the Force";
9+
10+
String result = MessageFormat.format(
11+
"At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.",
12+
planet, new Date(), event);
13+
System.out.println(result);
14+
int value=0;
15+
System.out.println(MessageFormat.format("{0,number,00}", new Object[]{new Integer(value)}));
16+
}
17+
}

!temp/src/GetFileNameFromPath.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
3+
public class GetFileNameFromPath {
4+
public static void main(String[] args){
5+
String beginPath="D:\\Photo\\2009_01_17-01_49_47-203_b.jpeg";
6+
System.out.println("before:"+beginPath+" after:"+getFileName(beginPath,"\\"));
7+
}
8+
9+
10+
private static String getFileName(String path, String delimeter){
11+
String returnValue=path;
12+
int position=path.lastIndexOf(delimeter);
13+
if(position>0){
14+
returnValue=path.substring(position+1);
15+
}
16+
return returnValue;
17+
}
18+
}

!temp/src/JFrame_main.java

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* JFrame_main.java
3+
*
4+
* Created on 8 òðàâíÿ 2008, 17:01
5+
*
6+
* To change this template, choose Tools | Template Manager
7+
* and open the template in the editor.
8+
*/
9+
10+
import java.awt.event.ActionEvent;
11+
import java.awt.event.ActionListener;
12+
import java.awt.event.KeyEvent;
13+
import java.awt.event.KeyListener;
14+
import java.beans.PropertyChangeEvent;
15+
import java.beans.PropertyChangeListener;
16+
import javax.swing.*;
17+
import com.toedter.calendar.*;
18+
import javax.swing.event.ChangeEvent;
19+
import javax.swing.event.ChangeListener;
20+
/**
21+
*
22+
* @author Technik
23+
*/
24+
public class JFrame_main extends JFrame{
25+
/** Creates a new instance of JFrame_main */
26+
public JFrame_main() {
27+
super("JCalendar listener demo");
28+
this.setBounds(100,100,200,100);
29+
JDateChooser field_calendar=new JDateChooser(new java.util.Date(),"dd.MM.yyyy");
30+
field_calendar.addPropertyChangeListener(new PropertyChangeListener(){
31+
public void propertyChange(PropertyChangeEvent evt) {
32+
System.out.println("Property:"+evt.getPropertyName()+" Old Value:"+evt.getOldValue()+" New Value:"+evt.getNewValue());
33+
}
34+
});
35+
field_calendar.addPropertyChangeListener("date",new PropertyChangeListener(){
36+
public void propertyChange(PropertyChangeEvent evt) {
37+
System.out.println("date is new:"+evt.getNewValue());
38+
}
39+
});
40+
41+
42+
JTextField field_textfield=new JTextField();
43+
field_textfield.addPropertyChangeListener(new PropertyChangeListener(){
44+
public void propertyChange(PropertyChangeEvent evt){
45+
System.out.println("Property:"+evt.getPropertyName()+" Old Value:"+evt.getOldValue()+" New Value:"+evt.getNewValue());
46+
}
47+
});
48+
field_textfield.addActionListener(new ActionListener(){
49+
public void actionPerformed(ActionEvent evt){
50+
System.out.println("JTextField actionevent");
51+
}
52+
});
53+
field_textfield.addKeyListener(new KeyListener(){
54+
public void keyTyped(KeyEvent e) {
55+
System.out.println("Key typed:"+e.getKeyChar());
56+
}
57+
58+
public void keyPressed(KeyEvent e) {
59+
}
60+
61+
public void keyReleased(KeyEvent e) {
62+
if(e.getSource() instanceof JTextField){
63+
System.out.println("Text for read:"+((JTextField)e.getSource()).getText());
64+
}
65+
}
66+
});
67+
68+
JButton field_jbutton=new JButton();
69+
field_jbutton.addPropertyChangeListener(new PropertyChangeListener(){
70+
public void propertyChange(PropertyChangeEvent evt) {
71+
System.out.println("PropertyName:"+evt.getPropertyName()+" OldValue:"+evt.getOldValue()+" NewValue:"+evt.getNewValue());
72+
}
73+
});
74+
75+
this.getContentPane().setLayout(new java.awt.GridLayout(3,1));
76+
this.getContentPane().add(field_calendar);
77+
this.getContentPane().add(field_textfield);
78+
this.getContentPane().add(field_jbutton);
79+
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
80+
this.setVisible(true);
81+
}
82+
83+
}

!temp/src/ListExchange.html

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+
<title>Insert title here</title>
6+
<script type="text/javascript">
7+
var prefix="p_";
8+
var suffixCounter=0;
9+
function move(source, destination,method){
10+
for(var counter=(source.options.length-1);counter>=0;counter--){
11+
if(source.options[counter].selected){
12+
var element=source.options[counter];
13+
source.removeChild(element);
14+
destination.appendChild(element);
15+
16+
method(element);
17+
}
18+
}
19+
}
20+
21+
function removeElementFromForm(element){
22+
var formElement=document.getElementById("body_destination");
23+
var typeName;
24+
var typeValue;
25+
var currentElement;
26+
for(var counter=0;counter<formElement.childNodes.length;counter++){
27+
try{
28+
currentElement=formElement.childNodes[counter];
29+
typeName=currentElement.getAttribute("type");
30+
typeValue=currentElement.getAttribute("value");
31+
if((typeName=="hidden")&&(typeValue==element.text)){
32+
formElement.removeChild(currentElement);
33+
return ;
34+
}
35+
}catch(err){
36+
}
37+
}
38+
}
39+
40+
function addElementToForm(element){
41+
var elementText=element.text;
42+
var hiddenElement=document.createElement("input");
43+
//suffixCounter++;
44+
hiddenElement.name=element.getAttribute("id");//prefix+suffixCounter;
45+
hiddenElement.type="hidden";
46+
hiddenElement.value=elementText;
47+
formDestination=document.getElementById("body_destination");
48+
formDestination.appendChild(hiddenElement);
49+
}
50+
51+
52+
function fromSource(){
53+
var source=document.getElementById("source");
54+
var destination=document.getElementById("destination");
55+
move(source,destination,addElementToForm);
56+
}
57+
58+
function fromDestination(){
59+
var source=document.getElementById("destination");
60+
var destination=document.getElementById("source");
61+
move(source,destination,removeElementFromForm);
62+
}
63+
</script>
64+
</head>
65+
<body>
66+
<table>
67+
<tr>
68+
<td valign="center">
69+
<select multiple="multiple" id="source">
70+
<option id="first_id">first </option>
71+
<option id="second_id">second </option>
72+
<option id="third_id">third </option>
73+
<option id="forth_id">forth </option>
74+
<option id="fifth_id">fifth</option>
75+
</select >
76+
</td>
77+
<td valign="center">
78+
<input type="button" value=">" onclick="fromSource()">
79+
<br>
80+
<input type="button" value="<" onclick="fromDestination()">
81+
</td>
82+
<td>
83+
<select multiple="multiple" id="destination">
84+
</select >
85+
</td>
86+
</tr>
87+
<tr>
88+
<td colspan=3>
89+
<form action="http://localhost:8080/TempDynamic/Test" id="body_destination" method="get">
90+
<input type="submit" value="goto" >
91+
</form>
92+
</td>
93+
</tr>
94+
</table>
95+
<span id="console">
96+
<span>
97+
98+
</body>
99+
</html>

!temp/src/ListOfCurrentDirectory.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.io.*;
2+
3+
public class ListOfCurrentDirectory {
4+
public static void main(String[] args){
5+
File file=new File(".");
6+
if(file.exists()&&file.isDirectory()){
7+
System.out.println("Directory");
8+
String[] listOfFile=file.list();
9+
for(int counter=0;counter<listOfFile.length;counter++){
10+
System.out.println(counter+":"+listOfFile[counter]);
11+
}
12+
}else{
13+
System.out.println("ListOfCurrentDirecotry: this is not directory");
14+
}
15+
}
16+
}

!temp/src/Log4j_NDC.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import org.apache.log4j.BasicConfigurator;
2+
import org.apache.log4j.Level;
3+
import org.apache.log4j.Logger;
4+
import org.apache.log4j.NDC;
5+
6+
7+
/** Example Log4j NDC ( Nested Diagnostic Context ) */
8+
public class Log4j_NDC {
9+
10+
public static void main(String[] args){
11+
BasicConfigurator.configure();
12+
Logger logger=Logger.getLogger("Log4j_NDC");
13+
logger.setLevel(Level.DEBUG);
14+
15+
NDC.push("level 1");
16+
NDC.push("level 2");
17+
NDC.push("level 3");
18+
logger.debug("Begin:");
19+
logger.debug("End:");
20+
NDC.pop();
21+
}
22+
}

!temp/src/Main.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Main.java
3+
*
4+
* Created on 8 òðàâíÿ 2008, 17:01
5+
*
6+
* To change this template, choose Tools | Template Manager
7+
* and open the template in the editor.
8+
*/
9+
10+
/**
11+
*
12+
* @author Technik
13+
*/
14+
public class Main {
15+
16+
/** Creates a new instance of Main */
17+
public Main() {
18+
}
19+
20+
/**
21+
* @param args the command line arguments
22+
*/
23+
public static void main(String[] args) {
24+
// TODO code application logic here
25+
new JFrame_main();
26+
}
27+
28+
}

!temp/src/ReturnInt.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
public class ReturnInt {
3+
public static void main(String[] args){
4+
ReturnInt value=new ReturnInt();
5+
int tempInt=value.getInt();
6+
System.out.println("Result:"+tempInt);
7+
}
8+
9+
public ReturnInt(){
10+
11+
}
12+
13+
public Integer getInt(){
14+
return null;
15+
}
16+
}

0 commit comments

Comments
 (0)