svn get folder
cd D:\projects svn update 17_HF9_OnlineMatch/Source/DatabaseLogon --set-depth infinity
| CARVIEW |
actionscript activerecord administration ajax apache applescript array awk bash c cli convert css database date delphi expressionengine file find google html http image java javascript lighttpd linux mac mysql osx perl php python rails regex ruby rubyonrails shell sql ssh string subversion svn terminal text textpattern unix web windows xml
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
What next?
1. Bookmark us with del.icio.us or Digg Us!
2. Subscribe to this site's RSS feed
3. Browse the site.
4. Post your own code snippets to the site!
cd D:\projects svn update 17_HF9_OnlineMatch/Source/DatabaseLogon --set-depth infinity
private void setThreadPooledMethods() { final Method[] methods = TransactionService.class.getMethods(); for (final Method aMethod : methods) { boolean isSecurityRelated = false; final Class[] parameters = aMethod.getParameterTypes(); for (final Class<?> element : parameters) { if ((SecurityMessage.class).isAssignableFrom(element)) { isSecurityRelated = true; break; } } if (isSecurityRelated) { System.out.println(aMethod.getName()); } else { //System.out.println("Non eligible :" + aMethod.getName()); } } }
File multiUserFile = new File(filepath); try { BufferedWriter ficTexte = new BufferedWriter(new FileWriter(multiUserFile)); ficTexte.write("singlepath=false"+System.getProperty("line.separator")); ficTexte.write("multiuser=false"+System.getProperty("line.separator")); ficTexte.close(); } catch (IOException e) { e.printStackTrace(); }
/** * Charge la liste des propriétés contenu dans le fichier spécifié * * @param filename le fichier contenant les propriétés * @return un objet Properties contenant les propriétés du fichier */ private static Properties load(String filename) { Properties properties = new Properties(); FileInputStream input; try { input = MeiboFile.getFileInputStream(filename); properties.load(input); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return properties; } public static void main(String[] args){ // chargement des propriétés Properties prop = PropertyLoader.load("monFichier.properties"); // Affichage des propriétés // Récupère la propriété ma.cle // Si la propriété n'existe pas, retourne la valeur par défaut "vide" System.out.println("ma.cle: "+ prop.getProperty("ma.cle", "vide")); }
import java.awt.*; import javax.swing.*; import java.awt.Color; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JWindow; import java.awt.event.*; public class CreateForm { JFrame frame; JFrame frame2; public static void main(String[] args){ CreateForm db = new CreateForm(); } public CreateForm(){ frame = new JFrame("Show Message Dialog"); Container fc = frame.getContentPane(); fc.setLayout(new FlowLayout()); fc.setBackground(Color.blue); JButton button = new JButton("Click Me"); button.addActionListener(new MyAction()); button.setPreferredSize(new Dimension(100, 20)); frame.add(button, BorderLayout.CENTER); frame.setSize(400, 400); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); button.setLocation(10, 10); //frame2 = new JFrame("Show Message Dialog"); //Container fc2 = frame2.getContentPane(); //fc2.setLayout(new FlowLayout()); //fc2.setBackground(Color.black); //frame2.setSize(400, 400); //frame2.setVisible(true); //frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public class MyAction implements ActionListener{ public void actionPerformed(ActionEvent e){ int bdate = 1989 ; int currentYear = 2010; int age = currentYear - bdate ; JOptionPane.showMessageDialog(frame,"Your age is " + age ); } } }
void gtk_table_adjust_attach (GtkTable *table, GtkWidget *widget, gint left_adjust, gint right_adjust, gint top_adjust, gint bottom_adjust) { guint top_attach; guint bottom_attach; guint left_attach; guint right_attach; GtkAttachOptions xoptions; GtkAttachOptions yoptions; guint xpadding; guint ypadding; gtk_container_child_get (GTK_CONTAINER (table), widget, "top-attach", &top_attach, "bottom-attach", &bottom_attach, "left-attach", &left_attach, "right-attach", &right_attach, "x-options", &xoptions, "y-options", &yoptions, "x-padding", &xpadding, "y-padding", &ypadding, NULL); g_object_ref (G_OBJECT (widget)); gtk_container_remove (GTK_CONTAINER (table), widget); gtk_table_attach (table, widget, left_attach + left_adjust, right_attach + right_adjust, top_attach + top_adjust, bottom_attach + bottom_adjust, xoptions, yoptions, xpadding, ypadding); g_object_unref (G_OBJECT (widget)); } /* * Delete multiple table rows */ void gtk_table_delete_rows (GtkTable *table, guint firstRow, guint count) { if (count == 0) { return; } GtkContainer *tableC = GTK_CONTAINER (table); guint n_columns; guint n_rows; g_object_get (G_OBJECT (table), "n-columns", &n_columns, "n-rows", &n_rows, NULL); guint topBound = firstRow; guint bottomBound = firstRow + count; if (bottomBound > n_rows) { bottomBound = n_rows; count = bottomBound - topBound; } GList *toBeDeleted = NULL; GList *toBeShrunk = NULL; /* indexed by top-attach */ GPtrArray *toBeMoved = g_ptr_array_sized_new (n_rows - topBound); g_ptr_array_set_size (toBeMoved, n_rows - topBound); GList *childIt = gtk_container_get_children (tableC); while (childIt) { GtkWidget *widget = GTK_WIDGET (childIt->data); guint top_attach; guint bottom_attach; gtk_container_child_get (tableC, widget, "top-attach", &top_attach, "bottom-attach", &bottom_attach, NULL); if (top_attach >= topBound && bottom_attach <= bottomBound) { toBeDeleted = g_list_prepend (toBeDeleted, widget); } else if (top_attach <= topBound && bottom_attach > topBound) { toBeShrunk = g_list_prepend (toBeShrunk, widget); } else if (top_attach > topBound) { GList *rowList = (GList*)g_ptr_array_index (toBeMoved, top_attach - topBound); rowList = g_list_prepend (rowList, widget); g_ptr_array_index (toBeMoved, top_attach - topBound) = rowList; } childIt = childIt->next; } g_list_free (childIt); /* remove anything that is completely within the segment being deleted */ while (toBeDeleted) { gtk_container_remove (tableC, GTK_WIDGET (toBeDeleted->data)); toBeDeleted = toBeDeleted->next; } g_list_free (toBeDeleted); /* shrink anything that spans the segment */ while (toBeShrunk) { GtkWidget *widget = GTK_WIDGET (toBeShrunk->data); gtk_table_adjust_attach (table, widget, 0, 0, 0, -count); toBeShrunk = toBeShrunk->next; } g_list_free (toBeShrunk); /* move everything below the segment being deleted up, in order */ /* note that "n-rows" is not a valid "top-attach" */ for (int offset = 0; offset < (n_rows - 1) - topBound; ++offset) { GList *rowList = (GList *)g_ptr_array_index (toBeMoved, offset); guint top_attach = offset + topBound; guint overlap = bottomBound - top_attach; while (rowList) { GtkWidget *widget = GTK_WIDGET (rowList->data); gtk_table_adjust_attach (table, widget, 0, 0, -offset, -(offset + overlap)); rowList = rowList->next; } g_list_free (rowList); g_ptr_array_index (toBeMoved, offset) = NULL; } gtk_table_resize (table, n_rows - 1, n_columns); } /* * Delete a table row */ void gtk_table_delete_row (GtkTable *table, guint row) { gtk_table_delete_rows (table, row, 1); }
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails