for(var i=0;i<temp.length;i++){ temp[i] = removechars(temp[i]); temptemp = temp[i].split(" "); // second split on every space in the frase. tempsplit = tempsplit.concat(temptemp); // add the second split to the final array. }
function removechars(string){ var chars = new Array(',','\r','\n','\'','<','>','-','(',')','{','}','"','.','?','¿','¡','!',':',';',','); // add (or change) here char's to the array if other char's need to be // removed. for(var c=0;c<chars.length;c++){ string = string.replace(chars[c]," "); } return string; }
function RemoveDuplicates(arr){
var result=new Array(); // remove the doubles var lastValue="";
for (var i=0; i<arr.length; i++) { var curValue=arr[i]; if (curValue != lastValue) { result[result.length] = curValue; } lastValue=curValue; } return result; // return this result to the array : tempsplit. }
</script>
</HEAD>
<BODY TEXT="#000000"> <TABLE > <TR> <TD WIDTH=522 HEIGHT=18 ALIGN=LEFT bgcolor="#990000"><u><b> <font face="Arial" size="2" color="#FFFFFF">Javascript </font></b></u></TD> </TR> <TR> <TD WIDTH=522 HEIGHT=334 ALIGN=LEFT> <dl> <dt><font face="Arial" size="2">Deze code leest het ingaveveld = brontekst , sorteert de brontekst en verwijderd de dubplicaatwoorden.</font></dt> <dt><font face="Arial" size="2">vb: </font></dt> <dt><font face="Arial" size="2">Copier de volgende tekst en plak hem onderin het iingaveveld.</font></dt> <dt><font face="Arial" size="2">Druk nadien de "Verwerk" -knop.</font></dt> </dl> <table border="0" cellpadding="5" cellspacing="0" width="400"> <tr> <td align="left" valign="top" bgcolor="#CED8C5" style="border: 1px solid #4F6949"> <textarea rows="8" name="S1" cols="61" id="source" style="border: 1px solid #687D55">Je kan niet voorstellen hoe de mensen de laatste tijd worden belogen hoe ze worden bedrogen hoe ze worden veracht en vernederd, alleen nog in wat ze opbrengen is er nog belangstelling.</textarea> </td> </tr> </table> </TD> </TR> <TR> <TD HEIGHT=18 ALIGN=LEFT bgcolor="#990000"><b> <font face="Arial" size="2" color="#FFFFFF">Ingaveveld</font></b></TD> </TR> <TR> <TD HEIGHT=154 ALIGN=LEFT> <form method="POST" name="sourceform" action=""> <p><textarea rows="4" name="S1" cols="62" id="source"></textarea></p> <input type="button" value="Verwerk" name="B1" onclick="splitsource()"> <input type="reset" value="reset" name="B2"> </form> <p> </TD> </TR> <TR> <TD HEIGHT=18 ALIGN=LEFT bgcolor="#990000"><b> <font face="Arial" size="2" color="#FFFFFF">Resultaat</font></b></TD> </TR> <TR> <TD HEIGHT=40 ALIGN=LEFT id="result"> </TD> </TR> <TR> <TD HEIGHT=21 ALIGN=LEFT> </TD> </TR> </TABLE>
package samples.s01; * * Copyright (c) 2008 willems piet pwProTech All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * */
import com.jgoodies.binding.beans.Model;
public class CustomerBean extends Model { public static final String NAME_PROPERTY = "name"; public static final String OCCUPATION_PROPERTY = "occupation"; private String name; private String occupation;
* * Copyright (c) 2008 willems piet pwProTech All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * */
commitButton = new JButton(presentationModel.getCommitAction()); resetButton = new JButton(presentationModel.getResetAction()); sendButton = new JButton(presentationModel.getSendAction()); }
public void constructGui() { JFrame frame = new JFrame(); JPanel CustomBeanFrm = new JPanel(); frame.getContentPane().setLayout(new RiverLayout()); frame.getContentPane().add(CustomBeanFrm);
CustomBeanFrm.add("br", new JLabel("Name")); CustomBeanFrm.add("tab hfill", nameInput);
CustomBeanFrm.add("br", new JLabel("Occupation")); CustomBeanFrm.add("tab hfill", occupationInput); CustomBeanFrm.add("br hfill", separator(Color.GRAY));
CustomBeanFrm.add("p br left", resetButton); // The button ins't really located to the left side CustomBeanFrm.add("center", sendButton); CustomBeanFrm.add("right", commitButton); CustomBeanFrm.add("br hfill", separator(Color.GRAY));
}
public static void clearForm() { commitButton.setEnabled(false); nameInput.setText(""); occupationInput.setText("");
}
private static TextField separator(Color c) { TextField separator = new TextField(); separator.setBackground(c); separator.setPreferredSize(new Dimension(20, 2)); return separator; } }
CustomerPresentationModel.java
package samples.s01;
* * Copyright (c) 2008 willems piet pwProTech All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * */
public class CustomerPresentationModel extends PresentationModel {
private static final long serialVersionUID = 1L; CommitAction commitAction; ResetAction resetAction; SendAction sendAction; ClearAction clearAction; private final CustomerBean customerBean;
@SuppressWarnings("unchecked") public CustomerPresentationModel(CustomerBean customerBean) { super(customerBean); this.customerBean = customerBean; commitAction = new CommitAction(); resetAction = new ResetAction(); sendAction = new SendAction(); clearAction = new ClearAction();
}
public Action getCommitAction() { return commitAction; }
public Action getSendAction() { return sendAction; }
public Action getResetAction() { return resetAction; }
public Action getClearAction() { return clearAction; }
private class CommitAction extends AbstractAction { /** * */ private static final long serialVersionUID = 1L;
public void actionPerformed(final ActionEvent e) {
// getBean(); if (PresentationModelBuild.resetButton.isEnabled()) { PresentationModelBuild.resetButton.setEnabled(true); }
if (isBuffering()) { PresentationModelBuild.commitButton.setEnabled(true);
displayBufferAndBean("SEND Bufferd :true :: Not yet committed"); } else { PresentationModelBuild.commitButton.setEnabled(false); displayBufferAndBean("SEND Bufferd :true :: yet Committed"); //Bufferd still true so by a reset the bufferd values are still available }
}
}
private class ResetAction extends AbstractAction {
public ResetAction() { super("Reset"); }
public void actionPerformed(ActionEvent e) {
// release(): // Removes the PropertyChangeHandler from the observed bean, if the // bean is not null. Also removes all listeners from the bean that // have been registered with #addBeanPropertyChangeListener before. if (isBuffering()) { triggerFlush(); resetChanged(); System.out.println("RESET action : If changes : Previous restored"); PresentationModelBuild.commitButton.setEnabled(false); } } }
private class ClearAction extends AbstractAction { // Not Used
* * Copyright (c) 2008 willems piet pwProTech All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * */
public class CustomBeanlaunch {
/** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub PresentationModelBuild pme = new PresentationModelBuild(); pme.constructGui(); } }
RESULTAAT
Result SEND Bufferd :true :: Not yet committed ------------------------------------------------- Bufferd values : Buffered beanvalue name :piet Buffered beanvalue occupation :job
Bean values : CustomerBean value name :null CustomerBean value occupation :null --------------------------------------------------- RESET action : If changes : Previous restored Result SEND Bufferd :true :: Not yet committed ------------------------------------------------- Bufferd values : Buffered beanvalue name :piet Buffered beanvalue occupation :job
Bean values : CustomerBean value name :null CustomerBean value occupation :null --------------------------------------------------- Result COMMIT action: ------------------------------------------------- Bufferd values : Buffered beanvalue name :piet Buffered beanvalue occupation :job
Bean values : CustomerBean value name :piet CustomerBean value occupation :job --------------------------------------------------- Tags :: RiverLayout , JGoodies , Valueholder , bindings, formmodel , model , sample, samples, java
/* * Copyright (c) 2008 - 2008 willems piet pwProTech All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
public class CustomComboAdapter extends JPanel { private String CMD_OK = "cmd.ok"/* NOI18N */;
private JButton okButton;
public ComboValueHolder ch, cl; // static
public CustomComboAdapter() { JPanel panel = new JPanel(new RiverLayout()); panel.setBorder(new EmptyBorder(6, 6, 6, 6)); riverFormBuilder(panel); add(panel); }
private void riverFormBuilder(JPanel panel) { ArrayList<String> countries = new ArrayList<String>(); countries.add("England"); countries.add("Scotland"); countries.add("Iereland"); countries.add("Nedtherlands"); countries.add("Flanders");
ArrayList<String> languages = new ArrayList<String>(); languages.add("Dutch"); languages.add("English"); languages.add("Spanish"); languages.add("German"); languages.add("Russian");
Dimension d = new Dimension(150, 20); Font userfont = new Font("Arial",1,12);
public static void main(String[] a) { JFrame f = new JFrame("Custom ComboBox"); f.setDefaultCloseOperation(2); f.add(new CustomComboAdapter()); f.pack(); f.setVisible(true); }
public class ComboValueHolder { String startselection;
ValueModel selectionHolder;
public ValueModel ComboHolder() { ValueModel selectionHolder = new ValueHolder(this.startselection); setSelectionHolder(selectionHolder); return selectionHolder; }
public JComboBox customComboBox(ArrayList countries, Dimension d, Font font, Color color) {
ComboBoxAdapter comboBoxAdapter = new ComboBoxAdapter(countries,ComboHolder()); JComboBox comboBox = new JComboBox(); comboBox.setPreferredSize(d); comboBox.setFont(font); comboBox.setBackground(color); comboBox.setModel(comboBoxAdapter); return comboBox; }
public String getStartselection() { return startselection; }
public void setStartselection(String startselection) { this.startselection = startselection; }
public ValueModel getSelectionHolder() { return selectionHolder; }
public void setSelectionHolder(ValueModel selectionHolder) { this.selectionHolder = selectionHolder; }
// left JPanel left = new JPanel(); left.setLayout(new RiverLayout()); left.add("right", new JLabel("Registration form left")); left.add("p left", new JLabel("Name")); left.add("tab hfill", userinput); left.add("br", new JLabel("Age")); ageinput.setColumns(5); left.add("tab", ageinput); left.add("br vtop", new JLabel("Comment")); commentinput.setRows(3); left.add("tab hfill vfill", new JScrollPane(commentinput)); left.add("p right", okButton); // added to level the content of the 3 panels left.setBorder(Borders.DIALOG_BORDER);
// center JPanel center = new JPanel(); center.setLayout(new RiverLayout()); center.add("right", new JLabel("Registration form center")); center.add("p left", new JLabel("Name-center")); center.add("tab hfill", userinput01); center.add("br", new JLabel("Age-center")); ageinput01.setColumns(2); center.add("tab", ageinput01); center.add("br vtop", new JLabel("Comment-center")); center.add("tab hfill vfill", new JScrollPane(commentinput01)); center.add("p right", ok1Button); center.add(left); // added to level the content of the 3 panels center.setBorder(Borders.DIALOG_BORDER);
JPanel right = new JPanel(); right.setLayout(new RiverLayout()); right.add("right", new JLabel("Registration form right")); right.add("p left", new JLabel("Name-right")); right.add("tab hfill", userinput02); right.add("br", new JLabel("Age-right")); ageinput02.setColumns(3); right.add("tab", ageinput02); right.add("br vtop", new JLabel("Comment-right")); right.add("tab hfill vfill", new JScrollPane(commentinput02)); right.add("p right", ok2Button); // added to level the content of the 3 panels right.setBorder(new EmptyBorder(6, 0, 6, 0));
JSplitPane splitPane0 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel1, right);
JTextField userinput = BasicComponentFactory.createTextField(nameModel); JTextField ageinput = BasicComponentFactory.createTextField(ageModel); ageinput.setColumns(3); // When this configuration isn't done the BasicComponentFactory //will not configure the width and the JTextField will be redused to //a few millimeter. JTextArea commentinput = BasicComponentFactory.createTextArea(commentModel);
Container c = f.getContentPane(); c.setLayout(new RiverLayout()); c.add("right", new JLabel("Registration form")); c.add("p left", new JLabel("Name")); c.add("tab hfill", userinput); c.add("br", new JLabel("Age")); c.add("tab", ageinput); c.add("br vtop", new JLabel("Comment")); c.add("tab hfill vfill", new JScrollPane(commentinput)); c.add("p center", okButton); return c; }
Structured Query Language
Hibernate Query Language
Java Data Objects
Data Access Object
iBATIS
is a persistence framework which enables mapping SQL
queries to POJOs
Apache Struts
is an open-source web application framework for
developing Java EE web applications.
WebWork
is a Java-based web application framework developed
by OpenSymphony.
Tapestry
is an open-source framework for creating dynamic,
robust, highly scalable web applications in Java.
TopLink
is an object-relational mapping package for Java
developers.
Hibernate
is an object-relational mapping (ORM) library for the
Java language, providing a framework for mapping an object-oriented
domain model to a traditional relational database.
Spring
Spring is a layered Java/J2EE application framework,
based on code published in Expert One-on-One J2EE Design and Development
by Rod Johnson (Wrox, 2002).
Macro voor excel om een lijst woorden in één
keer te vervangen in een tekst.
De code voor Visual Basic macro "Vervang"
De lijst woorden die men wenst te vervangen bevindt zich in dit voorbeeld in de kolom C4 tot C13.De wisselwoorden in de kolom daarnaast [Offset(0, 1)].
Sub Vervang()
'author piet :: pwProTech
For Each c In Worksheets(1).Range("C4:C13")
Sheets("Blad2").Cells.Replace What:=c.Value, Replacement:=c.Offset(0, 1).Value,
LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
Next c
End Sub
De inhoud van excel Blad1
Range C4 tot C13 :
Hier plaats je de woorden die je wil vervangen en de veervangtekst
Vb.:Blad1:
Op dit blad kan je ook de knop [VERVANG] (die de macro "Vervang" start)
aanbrengen.:
A
B
C
D
...
1
2
3
Te vervangen:
met:
4
Event
DB_action
5
event
db_action
...
...
...
De inhoud van excel Blad2
Op Blad2 plaats je de tekst die bewerkt moet worden.
Je plakt best de hele tekst in één enkele cel zodat je hem weer gemakelijk kan copiëren Hoe : dubbele klik in de cel die je verkiest en plakken
Noot: Je kan ook een knop voorzien om de woorden op "Blad1" te verwijderen met de macro "Reset"
Code:
Sub Reset()
'author piet :: pwProTech
For Each c In Worksheets(1).Range("C4:C13") c.Value = "" c.Offset(0, 1).Value = "" Next c
1Ga naar start 2.Klik op "Uitvoeren" [run] in het geopend menu. 3.Type in de ingavebalk : msconfig 4.Klik ok
Het venster "Hulpprogramma voor systeemconfiguratie" wordt geopend.
5.In het gegeven venster kan je nu de nodige veranderingen doorvoeren.
Tip :Programma's met "onbekend" als leverancier of "" (prog's die geen indentificartie hebben) zijn dikwijls dubieus tenzij je natuurlijk het programma kent of het zelf geinstalleerd hebt.
Noot -icoons taakbalk bevinden zich onder de tab "Opstarten" -wat bvb. het icoon van het gevaarlijke "antivirusgear" betreft : het bevat in de tab "opstarten" geen gegevens.Het kan wel via deze weg verwijderd worden doch het programma zelf moet apart verwijderd worden.