How to replace a Smart object content with folder of JPGs
Greetings!
Sorry if that title is not clear. I have a cover design template (see example). The image is a transformed Smart Object. I want to streamline my workflow.
Say I have a folder of jpgs, and need to replace the smart object of the template with the new cover jpg, then save for web as a JPG comp. Repeat.
I already have a nice "scale layer to current canvas size" script from Michael L Hale. Which would be necessary in case the jpg is larger or smaller than the Smart object's content it will replace.
Any thoughts if this could be done?
Michael's resize script is here: http://forums.adobe.com/thread/1233856
Thanks
Maxi
Remember in that other tread I wrote you would need to take aspect ratio into account if you don't want distortion. You do not want distortion placing in images. You also do not want to place in all image in canvas size. If your images vary in size you do not want to replace the contents of a smart object layer for the smart object associated transform to work correctly you need the replace the embedded object with an object with exactly the same size of the original embedded object.
Also in that other thread I gave you code from one of my Photoshop Photo Collage Toolkit. You seem to be creating a collage. You man want to look at my Photo Collage Toolkit.
Templates are very easy to create for my Toolkit's scripts to work, You just need to follow four simple easy rules.
The Four Rules:
Size the photo collage templates for the print size you want - width, height and print DPI resolution.
Photo collage templates must have a Photoshop background layer. The contents of this layer can be anything.
Photo collage templates must have alpha channels named "Image 1", "Image 2", ... "Image n".
Photo collage templates layers above the background layers must provide transparent areas to let the images that will be placed below them show through.
So your template would be easy and look like this, Red rectangle outlines my scripts.
You would then use one of the scripts like interactive popopulate select the template then hit create collage
The script would the open the template copy it the go to full screen show you a cyan mask as to where the next image will be placed, And put you into an interactive select image dialog.
Once you select the script will place in the image resize and position it the put you in an interactive transform so you can tweak the position and size. The Populated collage will remain open in Photoshop.
Documentation and Examples
Similar Messages
-
How to create labeled table of Content with expand and collapse
Hi All,
Can somebody help me how to create labeled table of Content with expand and collapse as example given below:
User1
Template1
Template2
User2
+
User3
Template1
Template2
Like when we see expand (+) and collapse (-) button when we click on 'about this page' link.
Thanks
BhupendraHi,
Tou can use Table inside table to show the details this way but I'm not sure about Expand/Collapse.
Expand/Collapse are part of HGRID.
I think we can develop this functionality with little manipulation.
Regards,
Reetesh Sharma
Edited by: Reetesh Sharma on Jun 28, 2010 4:56 AM -
How do you block copying of content with createPDF??
new user
how do you block copying of content with createPDF??You'll need Acrobat Std. or Pro. to set security on a PDF document that disallows copying of the content.
-
I have a photo template with a few smart object. The templated works fines when i perform a "replace content" command. I was trying to automated this with an action, however the action just places the same photo when i point it to a folder with many images. Is there method of having the action cycle through the images?
You can't use the Replace Contents action step in a Batch to flow in a folder of different images unless you use a Javascript to direct it. That can get very complicated if you've never worked with it.
Variables and Data Sets is the standard method of approach with many tutorials online.
Video Layer framing is quicker and more versitle. You won't find any documentation on that method, will require more experimenting probably.
If you're more comforable with just actions and batches, then you could try a different layer structure. Create an action that you can batch directly on the images that:
- Selects all layers.
- Convert to Smart Object (hopefully content is same size between files?).
- Places your main background file as a SO.
- Moves the main background SO to the bottom.
- Transforms the original SO to the correct placement. (use a dummy layer to record or group before transform to properly record values).
Before, you were batching the same Replace Contents statement on all files, when none of the files contained the Smart Object you wanted to affect. That's why it didn't work. Here, you are Batching the individual files, sending them to another folder, or overwriting them by 'Save and Close'. Your main content is placed underneath the contents of each file.
Good luck,
-f -
Replacing smart object content using Droplets ???
Hi,
I have a .psd with a smart object as one of the layers.
I could easily go to Layers>Smart Objects>Replace Contents...
but I have a couple of thousand files to replace.
Is there a way to create a droplet so i can just drop the files into it
and it automatically replaces the content of the smart object
then saves out a new file for me?
This would help me tremendously.
I would appreciate any help.
Moo...In my opinion this task will need some Scripting unless the Layer-names and Layer-structure are identical in all the files.
One should be able to include the Script in a Droplet, but one might just as well use a dialog within the Script itself, I guess.
If you should find no other option you might be able to get some help in the Photoshop Scripting Forum. -
Can you replace embedded smart object with linked smart object?
Hi,
I'd like to update some document to reflet the new workflow that linked smart object provide. I have made some transformation on those embedded smart object and would like to not have to redo all those so is there anyway way to replace those SO with the linked version of the same SO?
TIA
JeffHi,
I'd like to update some document to reflet the new workflow that linked smart object provide. I have made some transformation on those embedded smart object and would like to not have to redo all those so is there anyway way to replace those SO with the linked version of the same SO?
TIA
Jeff -
How to copy a smart object transform in Photoshop
Hello!
Smart objects in photoshop is realy powerfull tool, i use it in many different ways and create complicated web graphic. But many times i need to do one thing with them and always fail:
If i have several different smart objects, and I do DIFFERENT perspective transform to them (it means scaling distortion rotation etc)
how can i apply the *same* transform that has one of my objects to another one smart objet that yet has no transformation (or it has some alrady dosn't matter)?
In other words how can i copy the transformation in some way (as you might copy a layer style and apply the same one to a different layer)
Is there any way? or i shoud look to scripting to do that?
Is there real photoshop guru who knows how to do that?
thanks in advanceThank you!
Yes i know about this workaround but unfortunatly there will be immediatly other question raised :
if i do this (replace content of my new smart object created by copying from original) then this new smart object will be disconnected from any other smart object, and there is no way how to restore this connection betwen smart objects after content replace operation. Or there is?
This is important for me cause in my work i have a lot of smart objects with different transformations but conneted to one source data object.
So unfortunatly for me but this idea is not even workaround for my workflow? It's so pity -
How can we make smart objects smarter?
Smart objects are great and can be a really useful time saver. That said, i'm having a problem and I'm hoping that there is a solution out there. I'll preface this with the statement that, I may not be using smart objects as they were intended, but I feel like this is how they should work:
A basic example - say you have a "Login" button.
It would be great/obvious to have that as a smart object. It would be greater still to have the on, off, rollover, clicked states to be within that smart object.
Now, if you place that smart object as a linked object into a document, there is no way to say "in this instance, I want to show the off state of the button". If you open the smart object and change the state to that and save - then it will update all instances everywhere in all PSDs where it exists and all of your buttons are now in an off state.
Now, clearly, in this example, the easy answer is just make 4 smart objects. Easy peasy.
The problem with that is two fold:
1. if "Login" changes to "Logon" I need to make that change in 4 places instead of just one.
2. The button example is simple, but what if my smart object is more complicated than that? What if there a complex set of layers that make up that object? Making changes to multiple complex layer files kind of defeats the purpose of having smart objects no?
You can embed the object and thus break the external link and change things to your heart's content without effecting other instances - but then what really is the value of creating the smart object then? You might as well just have a layer group that you drag from PSD to PSD.
The way smart objects should work, IMHO, is that you should be able to toggle layers on and off per instance of the object, BUT any pixel modifications to a layer within, bubble up to all instances that are displaying that layer (say - a colour change, or text change, etc).
Thoughts?Hi,
Check the below links.
http://sharepoint.aspcode.net/view/635399286724222582123340/sso-between-2-host-named-sitecollections-with-different-subdomains
http://blogs.msdn.com/b/russmax/archive/2013/10/31/guide-to-sharepoint-2013-host-name-site-collections.aspx
http://blog.repsaj.nl/index.php/2014/07/sp2013-host-named-site-collections-adfs-claims-and-aam/
Krishana Kumar http://www.mosstechnet-kk.com
Please mark the replies and Proposed as answer if they help and solve your issue -
How open and copy smart object
Hi,
I read topics about smart objects but i not found solution on my problem.
1. I need open smart object layer
2. copy all layers from the smart object to another file
ThanksI think you may be better off just copying the smart object layer from the source document into the target document. There may be several different resolutions involved and other complexities. Within a smart object layer there is a copy of the original object. So how the smart object layer was created determines what the imbedded object is. A smart object may be many thing. Could be a copy of a raw file, a copy of a layered file, contain a group of layers created from within the source document. There is a transform associated with smart object layers. When you open a smart layer into Photoshop so you can edit the embedded smart object it opens at the resolution and size of the object which may be different then the document its a layer in. The transform is only associated the layer not the object. Once open into Photoshop you can of course dupe the layers into the target document. It may be a bit complex for some layers may have layer mask and perhaps other layers clipped to it or be within a group then there is the layers visibility state. If you have both the source document and target document open in Photoshop it is easy co copy a layer from the source document to the target document. If the source layer is a smart object the associated transform will also be copied to the target document however it easy re transform the smart object layer in the target document. In the source document target the smart object layer the use menu Layers>Duplicate Layer... in the Duplicate Layer dialog in the destination section use the pull down menu to select the target document You can use the scriptlistener plugin to capture the action manager code to do that.
// =======================================================
var idDplc = charIDToTypeID( "Dplc" );
var desc24 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref14 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref14.putEnumerated( idLyr, idOrdn, idTrgt );
desc24.putReference( idnull, ref14 );
var idT = charIDToTypeID( "T " );
var ref15 = new ActionReference();
var idDcmn = charIDToTypeID( "Dcmn" );
ref15.putName( idDcmn, "Untitled-2" ); <====================================== target document
desc24.putReference( idT, ref15 );
var idVrsn = charIDToTypeID( "Vrsn" );
desc24.putInteger( idVrsn, 5 );
executeAction( idDplc, desc24, DialogModes.NO ); -
How to Populate the JTable Object programatically with SQL Results
I'm wondering if someone could help me on how to populate the JTable Object with SQL Results wherein the Row of tjhe JTable object is automatically adjusted depending on how many records you have queried.
Thanks in advance and God bless! (",)
* frmMain.java
* Created on October 4, 2006, 6:15 AM
package tds;
import java.io.*;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.imageio.*;
import javax.swing.JFrame;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
* @author Dexter.Carlit
public class frmMain extends javax.swing.JFrame {
private Connection connection = null;
private DefaultTableModel model;
/** Creates new form frmMain */
public frmMain() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
jSplitPane = new javax.swing.JSplitPane();
jScrollPane1 = new javax.swing.JScrollPane();
jPanel3 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jTree1 = new javax.swing.JTree();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jPanel5 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jGrid = new javax.swing.JTable();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jProgressBar1 = new javax.swing.JProgressBar();
jPanel2 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
getAccessibleContext().setAccessibleName("frmMain");
jSplitPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jSplitPane.setDividerLocation(200);
jSplitPane.setDividerSize(10);
jScrollPane2.setViewportView(jTree1);
org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel3Layout.createSequentialGroup()
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 916, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
jScrollPane1.setViewportView(jPanel3);
jSplitPane.setLeftComponent(jScrollPane1);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jLabel1.setText("First Name:");
jLabel2.setText("Last Name:");
jLabel3.setText("Position :");
jLabel4.setText("Department:");
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Search Results"));
jGrid.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
new String [] {
"LName", "FName", "Position", "Department", "Office No", "Local No", "Office Mobile No", "Home No", "MobileNo", "Email Address"
jGrid.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jGrid.setColumnSelectionAllowed(true);
jGrid.setName("");
jGrid.setTableHeader(jGrid.getTableHeader());
jScrollPane3.setViewportView(jGrid);
jScrollPane3.getAccessibleContext().setAccessibleName("rset");
org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 386, Short.MAX_VALUE)
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
jButton1.setText("Find");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
jButton2.setText("Clear");
jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton2MouseClicked(evt);
org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel2)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
.add(1, 1, 1))
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel4)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE))
.add(jPanel4Layout.createSequentialGroup()
.add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
jPanel4Layout.linkSize(new java.awt.Component[] {jButton1, jButton2}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(jTextField1))
.add(18, 18, 18)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(jTextField2))
.add(16, 16, 16)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel3)
.add(jTextField3)
.add(jLabel4)
.add(jTextField4))
.add(14, 14, 14)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, jProgressBar1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE))
.addContainerGap())
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jProgressBar1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
jTabbedPane1.addTab("Search", jPanel1);
org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 458, Short.MAX_VALUE)
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 401, Short.MAX_VALUE)
jTabbedPane1.addTab("Directory", jPanel2);
jSplitPane.setRightComponent(jTabbedPane1);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jSplitPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 675, Short.MAX_VALUE)
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jSplitPane)
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
jGrid.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null}
new String [] {
"LName", "FName", "Position", "Department", "Office No", "Local No", "Office Mobile No", "Home No", "MobileNo", "Email Address"
jGrid.updateUI();
}//GEN-LAST:event_jButton2MouseClicked
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
try {
//Load and register SQL Server driver
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
//Establish a connection
Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://X.X.X.X:1433","MyAccount","MyPassword");
//Create a Statement object
Statement sql_stmt = connection.createStatement();
//Create a ResultSet object, execute the query and return a
// resultset
ResultSet rset = sql_stmt.executeQuery("SELECT * FROM EpxDirectory..Directory Order By LName");
// Populates a JTABLE Object
int i=0;
while (rset.next()){
String LName = rset.getString(1);
String FName = rset.getString(2);
String Position = rset.getString(3);
String Dept_Code = rset.getString(4);
String OffPhoneNo = rset.getString(5);
String LocalNo = rset.getString(6);
String OffMobileNo = rset.getString(7);
String HomePhoneNo = rset.getString(8);
String MobileNo = rset.getString(9);
String Email = rset.getString(10);
jGrid.updateUI();
jGrid.setValueAt(rset.getString(1).trim(),i,0);
jGrid.setValueAt(rset.getString(2).trim(),i,1);
jGrid.setValueAt(rset.getString(3).trim(),i,2);
jGrid.setValueAt(rset.getString(4).trim(),i,3);
jGrid.setValueAt(rset.getString(5).trim(),i,4);
jGrid.setValueAt(rset.getString(6).trim(),i,5);
jGrid.setValueAt(rset.getString(7).trim(),i,6);
jGrid.setValueAt(rset.getString(8).trim(),i,7);
jGrid.setValueAt(rset.getString(9).trim(),i,8);
jGrid.setValueAt(rset.getString(10).trim(),i,9);
i++;
//Close the ResultSet and Statement
rset.close();
sql_stmt.close();
//Close the database connection
connection.close();
System.out.println(Integer.toString(i) + " rows found");
} catch(Exception e) {
System.out.println("Failed to connect; Please view Stack Trace");
e.printStackTrace();
}//GEN-LAST:event_jButton1MouseClicked
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
}//GEN-LAST:event_formWindowOpened
public static void run(){
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
frmMain frmMain = new frmMain();
frmMain.setLocationRelativeTo(null); // Center the JFrame on the
frmMain.setVisible(true);
private void exitApplication() {
// try {
// //gui.putStatus("Closing the connection....please wait.....");
// if(connection != null) {
// // connection.close(); //Closing the connection object.
// } catch(SQLException ex) { //Trap SQLException
// //gui.putStatus(ex.toString());
System.exit(0); //Exit the aplication
* @param args the command line arguments
public static void main(String args[]) {
run();
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JTable jGrid;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JProgressBar jProgressBar1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JSplitPane jSplitPane;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTree jTree1;
// End of variables declaration//GEN-END:variables
}Use code tags.
Don't mix GUI and JDBC together. Split them out into separate classes.
You have a good start, but you will need to loop through your resultset and also pull the ResultSet metaData for you column headings -
How to replace all existed objects when impdp a schame ???
I wrote 2 functions which do expdp and impdp
the impdp funciton is :
create or replace function impdp_schema(fromusr in varchar2,
tousr in varchar2,
dir in varchar2,
dmpfile in varchar2,
logfile in varchar2 default null)
return number as
h1 NUMBER;
job_name varchar2(128);
job_state varchar2(32767);
ret number;
BEGIN
if dir is null or dmpfile is null then
return 1;
end if;
ret := 0;
job_name := 'IMP' || to_char(sysdate, 'yyyymmddhh24miss');
h1 := DBMS_DATAPUMP.OPEN('IMPORT',
'SCHEMA',
NULL,
job_name,
'COMPATIBLE',
DBMS_DATAPUMP.KU$_COMPRESS_METADATA);
DBMS_DATAPUMP.ADD_FILE(h1,
dmpfile,
dir,
null,
DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE);
if logfile is not null then
DBMS_DATAPUMP.ADD_FILE(h1,
logfile,
dir,
null,
DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
end if;
DBMS_DATAPUMP.METADATA_REMAP(h1,
'REMAP_SCHEMA',
UPPER(fromusr),
UPPER(tousr));
DBMS_DATAPUMP.set_parameter(h1, 'TABLE_EXISTS_ACTION', 'REPLACE');
DBMS_DATAPUMP.START_JOB(h1);
dbms_datapump.wait_for_job(h1, job_state);
dbms_datapump.detach(h1);
dbms_output.put_line(job_state);
return ret;
exception
when others then
dbms_output.put_line(SQLERRM);
dbms_datapump.detach(h1);
return 1;
END;------------------------------------
when I test this function, I found some errors :
Master table "SYS"."IMP20100823152536" successfully loaded/unloaded
Starting "SYS"."IMP20100823152536":
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:"WIS00001" already exists
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
ORA-31684: Object type SEQUENCE:"WIS00001"."SEQ_ID_WIS_LOG" already exists
ORA-31684: Object type SEQUENCE:"WIS00001"."SEQ_TID_TABLENAME" already exists
ORA-31684: Object type SEQUENCE:"WIS00001"."SEQ_WIS_MASS" already exists
ORA-31684: Object type SEQUENCE:"WIS00001"."SEQ_WITSDELAY_1" already exists
ORA-31684: Object type SEQUENCE:"WIS00001"."SEQ_WITSDELAY_2" already exists
ORA-31684: Object type SEQUENCE:"WIS00001"."SEQ_WITSDELAY_3" already exists
ORA-31684: Object type SEQUENCE:"WIS00001"."SEQ_WITSEDIT" already exists
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "WIS00001"."WITS_98_PIC" 28.28 KB 97 rows
. . imported "WIS00001"."DRAWING_CONTROL" 26.94 KB 218 rows
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
ORA-31684: Object type PROCEDURE:"WIS00001"."PROC_GETITEM" already exists
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
**Job "SYS"."IMP20100823152536" completed with 9 error(s) at 15:30:12**---------------
how to replace all objects when exist ??? include sequence, table, procedure/function???
</pre>
Edited by: UNISTD on 2010-8-23 上午12:50I love posts without a 4 digit version number. This may well be because of a bug, and as this post is lacking a 4 digit version number, nobody will be able to answer it.
You posted in vain.
I recommend you search on Metalink whether there are issues with this parameter.
Sybrand Bakker
Senior Oracle DBA -
How to save properly Smart Object?
Hello!
I've got a file where I have 2 groups of layers (SET1 SET2) (the first one is duplicated and made -100% (minus 100%) width - which effects with horrizontal mirror of the first one). SET1 have texts, and as you may guess the mirrored groups of layers (SET2) has texts mirrored which I need to make readible (revert them back). That's why I made text layers as Smart Object and when I open this object I can rotate text back, but saving the Smart Object and returning back to the project gives me proper text on SET2 but rotated again SET1. I guess the Smart Object's in both sets are somehow related to each other. Every time I change something in one make an impact on the second. I noticed that even I save my Smart Object with some new name, to the directory I created for the project, it doesn't seem project choose that one in the project directory, but one from TEMP folder in windows root system. I thought to name them separately and load them to loose that relativeness. But I try and I try I do not know how to do it, how to make them independent.
Any ideas?
Kindest Pawel
//I had to use Smart Object as Layers are transformed with Perspecitve transform tool, and vector objects (like text) can not be perspective transformed...and I can not in fact rasterize those Smart Objects as the project is a template to edit by others. If I rasterize them anybody could not change text layers anymore...
I am getting to be sure, that's immpossible:/omg, somehow I did it. It seems that 'New Smart Object by Copy' breaks that relativness, but I am not quite sure as I tried to did it before withou success. Anyway, I am on the track again:)
Thanks for listening -
How to replace a substring that starts with and end with another substring?
Hi,
I am trying to parse data from HTML tables. First I want to remove all useless tags like <font>. Now, how can I remove substrings like-
*<font face="Verdana, Arial, Helvetica, sans-serif" size="1">My_Data_to_parse</font>*
I was searching for any method which replaces a substring what starts with a substring (in this case "<font") and ends with another substring (in this case ">") . Is there any method like that? Or any better solution?
Another situation like the following-
*<td align="left" height="30" width="100%">*
In this case I want to remove all the height, align , width etc and make it as simple as "<td>". How can I do that?
Finally, all I am trying to do just to parse data from the tables in a html file. Is there any parser API or library to help me do that? Or to bring the data down to array from the tables based on table structure? Please suggest me.
Thanks in advance.probably the best place to start is to search for the "<keyword" of all of the html keywords, then search for the location of the next ">" - this will indicate the end of the <keyword> opening tag.
-
I am a photographer and want my signature on every photo I print. I have created the text I want in Illustrator and have been dragging that text into Photoshop.When I do this I am asked if I want it to be a Smart Object or Pixels, Path or shape layer. I have been choosing it to be a smart object. When I try and place it on my photograph, the sizes that the text come into Photoshop per photo can vary. I would like all of my signatures to be proportionally the same size all across my print sizes. How do I accomplish this?
Thanks!!I pasted the signature at 1.75" on my photo and printed it on 8.5"X11" paper, measured it's actual size once printed and it is 1 1/8" on the paper. Am I missing something in the sizing of the picture? How can I make it to come out the same size and consistent.
-
How do you edit smart objects in Elements 12?
In CS, I just double click on the SO and it opens in a new tab. Can I not edit SOs in Elements 12?
Please advise.
~marloThere's a smart object in a layered image I was sent which I need to edit.
In CS, you're able to open it, edit and save and the changes appear in the original file.
From what I've read, this is impossible to do in Elements (which is on my home PC - I have CS at work).
Anyway, I'm pretty sure I'll either have to upgrade what I have at home or deal with it when I get back to work.
m
Maybe you are looking for
-
How to synchronize PI service registry and IBM WSRR
Hello All, In our current project we have developed one web service which resides in SAP CE and is registered in SAP PI Service Registry. But our client has IBM websphere that acts as a middleware for all ther services (interfaces/web services) Now,
-
TouchPad has stopped working in Satellite L300
Hi Xaxer, hi there, as I dont know how to post a new topic, I just reply (I apologize for that way). The touch pad on my L300 has stopped working. (Vista 32 bit). Fn and F9 does not change anything. USB-Mouse works fine. Downloaded new touch-pad driv
-
CD burner not recognized?
I just burned three CDs. Now, it's saying "disc burner or software not found." I ran the diagnostic and it says, "Microsoft Windows XP Home Edition Service Pack 2 (Build 2600) Gateway Gateway M320 and 4500 Series iTunes 7.0.0.70 CD Driver 2.0.6.0 CD
-
Apple Certified Tech grasping at Straws iMac 24" 8,1
I have a 2.8 GHZ 24" 8,1 version iMac sitting on my bench. This one has the upgraded video card 8800, 512k that was something like $800 new. Always Kernel Panics on startup just as the gear stops and the screen ordinarily goes to blue. Doesn't matt
-
How do I add characters (ie cartoon) to photos on imovie. I did this recently for the first time, now cannt remember how I did it. I tried going to "edit" drop down menu, then to "Characters". I selected a character then dragged it to the photo, bu