Perl Select
Good Morning:
I am accesing the DataBase from a Perl Script. In the Insert sentence, I want to use some pl/sql functions:
$stmt = "insert into my_table(field_1) values ( replace('$s_column_name[$i]',CHR(39),CHR(39)||CHR(39)))";
But the function replace is not executed, instead is took as part of the value to insert in field_1:
If $s_column_name[$i]='anyvaluefortest', the program try to execute:
insert into my_table(field_1) values ( replace('anyvaluefortest',CHR(39),CHR(39)||CHR(39)))"
And is generated the error:
ORA-01401: inserted value too large for column
How I can say that "replace" is a function that needs to be executed?
Thanks a lot for your help.
You shouldn't need to.
I have used built-in and my own functions in insert and select statements through perl without any hassles before.
There doesn't look to be anything wrong with the statement.
Just to be sure, what is the type of field_1?
Also you could try having just a single element in the array with a very short value - just to be sure that the statement is working correctly and its not a data problem you are running into.
Similar Messages
-
A bone to pick with SONY products
First off, I have been looking for a place to voice my opinion, this is the only official SONY place I can find. Being a Sony product buyer I feel the need to ask questions and ponder what Sony does wrong and how they can correct things across the board with many of the principal products on the market such as the Play Station 3, Vaio, and Vita, and the soon to be released S1 and S2 tablets.
I own many Sony products from stereo equipment, the play station, cameras, even had a Vaio at one point. All good products and all decent performance wise. What is getting me upset at this moment is how Sony decides what games are available for specific devices.
Example 1: Sony has many PS3 exclusives that could easily be even better graphically on a PC such as Kill Zone 3. Since they don't even attempt to make PC games, that would help raise the awareness of the Sony Vaio laptop, it makes me wonder why? Can't they release certain titles from the PS3 maybe a year later or more once they are no longer the hot gaming item they once were? I would love to play Kill Zone in glorious graphical detail, I have even read as much from the creators of the game which was created on PC, that the game is leaps and bounds BETTER on a PC.
Example 2: Sony is releasing the VITA hand held gaming device almost at the same time as the S1 and S2 tablets. This is the true area I wish to focus on, product marketing, decisions etc. First off, the excitement of the exclusive titles the VITA will have will certainly make gamers flock to get one, but, the catch is that for a portable device it only has close to 3 hours of battery life? Terrible. So the S1 and S2 tablets are coming out, with the stamp of approval of Play Station games, but so far what I have seen are games from PS1 which is a major leap backwards for gaming from Sony. So the VITA is going to be a marvel of graphical wonder while a device, which in theory should be even more powerful, like the S1 tablet is going to be offering content a decade back in terms of technology?
This part of the equation I can't seem to wrap my head around. What the S1 should have been was a major competitor to the Apple iPad and from what I have read in terms of specs and offerings, it is not much better than a Samsung Galaxy tab. Very disappointed that Sony has put out such an underwhelming product. It is still almost too early to be talking about the S1 and S2 as failures, but in terms of marketing, and telling its customers what it actually is and has available I am very very disappointed. If any company on this planet could have made Apple look bad it was Sony and they failed. The Sony S1 tablet should have been rivaling the graphic power of the VITA, it also should have wireless PS3 controller technology, it should already have exclusive games being offered JUST LIKE THE VITA. Instead we are seeing what looks like a product pushed out the gate too early, with specs that do not beat any other tablet on the market, it is simply... there.
As a result of these examples I have given, I will not be buying any Sony Vaio's and I also will be passing on the S1 and S2 tablets in order to buy an Apple iPad 2. As for the VITA, I will also be passing on it for the short battery life, because long airplane rides are going to burn out battery life quickly on this device. It appears I will stick with my PS3 as it is the best gaming CONSOLE out, but not the best gaming platform, which is still being held by the PC which SONY refuses to improve upon.
The over all direction of SONY seems far too uncoordinated, all over the place, and not stream line. This is one of the things APPLE does so well, they make specific product with top notch quality, and they do it well. Sony is usually late to the game in certain areas of technology, but usually they offer something new and improved upon, so far the latest SONY gadgets seem like they are just good enough for a passing grade, but nothing to really be excited about.Hello,
Welcome to the User Discussion Forums
Thank you for your feedback, your comments are always welcome.
Concerning your points on the new VITA gaming device, and game support, your suggestions and comments might get the best exposure with our Playstation Community Forums
Join the official PlayStation Community Forums to talk about PSN, PS3™, PSP® and NGP systems & games & get help, tips & news. Join PlayStation discussions in the PlayStation Forum:
http://community.us.playstation.com
We will definitely pass along your concerns and review of the Sony Tablet S.
Should you wish to research the Tablet S further, we have an entire area at Esupport dedicated to Tablet Support
http://esupport.sony.com/US/perl/select ... ODTYPE=110
There is a dedicated section of the Sony Community Discussion Forum to provide answers to questions or open discussions on various topics for the community to discuss.
viewforum.php?f=100
If you wish to speak with a product specialist concerning any of our VAIO or Home Electronics
Support is always available to you.
http://esupport.sony.com/US/perl/select ... OR=CONTACT
We look forward to hearing from you. -
Sony Support For Blank Media (CDR)
Hi everybody,
just want to share my experience with Sony...
Recently I bought 100 pack of blank CDR media in Costco. Have not had any problems with it before. And now I threw out third part of it because none of my three writers can record on it. Tried different speeds. No success. Obviously the media is defective. Spent two hours to find out that without receipt Sony will not replace the CDRs.
What a nice policy. They make the disks, stamp their logo on it, and do not honor their warranty without receipt. It is not an expensive equipment that you would keep a receipt for.
Huge corporation. Many years on the market. And the same problems as with cheap ones. Customer satisfaction, relation, etc. Bulls**t.
The support web site sucks. Online chat support link brings you to a web page that does not exist. Phone support staff does not even know that such thing as blank media exists. No e-mail support.
BUT they are gladly display success stories and pictures from their happy customers... Unfortunately I'm not anymore.Hello,
Welcome to the forums.
Here is the link to our Recording media Support page
http://esupport.sony.com/US/perl/select ... ODTYPE=102
and instructions for warranty support of the media
http://www.docs.sony.com/release/Warran ... -Media.pdf
If you no longer have your receipt. there is good news, since you are a member of costco you have a costco membership file. bring your card to their returns desk or call them and have them look up your past purchases, they will issue you a new receipt. -
I recently downloaded songs to my walkman from a music download site. When i try to play some songs i get an error message. it says i can't play certain songs unless i update my license information
I apologize that no one replied to your post any sooner. I am not sure what could be causing this. I would advise speaking to Sony to see if there is a quick fix for this. Here is their support site for their MP3 players. Try plugging in your information to see if its a common problem with an easy fix.
http://esupport.sony.com/CA/perl/select-system.pl?PRODTYPE=69
Thanks!
Jesus|Senior Social Media Specialist | Best Buy® Corporate
Private Message -
Has anyone been using a PRS-505 reader on their Mac, using Vista and Parallels as the interface ? If so, or as well as, can anyone tell me how to get back my scroll-bar in the bottom of the e-Library viewing pane ? It was there the first instant I uploaded the software but has since disappeared and I cannot now view the preview pane, which is kinda important.
I have spent two days on phone to Sony and they assure me the problem is with Parallels and Mac, not them.
Any ideas anyone ? Yes, we uninstalled and reinstalled the software a 1000 times.
Dr HookSony reader not working after updating to Lion OS.?
How do I get my sony reader to work on lion os ?
Fix now avalible for UK
http://support.sony-europe.com/computing/prs/prs.aspx?site=odw_en_GB&m=PRS-650
Just pick model then os download
USA fix. http://esupport.sony.com/US/perl/select-system.pl?model_type_group_id=6
pick model number from left then click DRIVERS AND DOWNLOADS...... Enjoy
angus
cooney
angus cooney -
JavaBean not found in JSP code
I'm using a Tomcat 4.0 and i've been trying to run this simple JSP example using java bean in this server.
beans.html:
<html>
<head>
<title>useBean action test page</title>
</head>
<body>
<h1>useBean action test page</h1>
<form method="post" action="beans.jsp">
<p>Please enter your username:
<input type="text" name="name">
<br>What is your favorite programming language?
<select name="language">
<option value="Java">Java
<option value="C++">C++
<option value="Perl">Perl
</select>
</p>
<p><input type="submit" value="Submit information">
</form>
</body>
</html>
beans.jsp:
<jsp:useBean id="languageBean" scope="page" class="LanguageBean">
<jsp:setProperty name="languageBean" property="*"/>
</jsp:useBean>
<html>
<head>
<title>useBean action test result</title>
</head>
<body>
<h1>useBean action test result</h1>
<p>Hello, <jsp:getProperty name="languageBean" property="name"/>.</p>
<p>Your favorite language is <jsp:getProperty name="languageBean" property="language"/>.</p>
<p>My comments on your language:</p>
<p><jsp:getProperty name="languageBean" property="languageComments"/></p>
</body>
</html>
LanguageBean.java:
public class LanguageBean {
private String name;
private String language;
public LanguageBean() {}
public void setName(String name) {
this.name = name;
public String getName() {
return name;
public void setLanguage(String language) {
this.language = language;
public String getLanguage() {
return language;
public String getLanguageComments() {
if (language.equals("Java")) {
return "The king of OO languages.";
} else if (language.equals("C++")) {
return "Rather too complex for some folks' liking.";
} else if (language.equals("Perl")) {
return "OK if you like incomprehensible code.";
} else {
return "Sorry, I've never heard of " + language + ".";
After inserted value in the beans.html form and this action is forwarded to beans.jsp, it outputs the following error message:
A Servlet Exception Has Occurred
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /beans.jsp
Generated servlet error:
D:\jakarta-tomcat-4.0\work\localhost\JSPExamples\beans$jsp.java:56: Class org.apache.jsp.LanguageBean not found.
LanguageBean languageBean = null;
^
An error occurred at line: 1 in the jsp file: /beans.jsp
Generated servlet error:
D:\jakarta-tomcat-4.0\work\localhost\JSPExamples\beans$jsp.java:59: Class org.apache.jsp.LanguageBean not found.
languageBean= (LanguageBean)
^
An error occurred at line: 1 in the jsp file: /beans.jsp
Generated servlet error:
D:\jakarta-tomcat-4.0\work\localhost\JSPExamples\beans$jsp.java:64: Class org.apache.jsp.LanguageBean not found.
languageBean = (LanguageBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "LanguageBean");
^
An error occurred at line: 12 in the jsp file: /beans.jsp
Generated servlet error:
D:\jakarta-tomcat-4.0\work\localhost\JSPExamples\beans$jsp.java:92: Class org.apache.jsp.LanguageBean not found.
out.print(JspRuntimeLibrary.toString((((LanguageBean)pageContext.findAttribute("languageBean")).getName())));
^
An error occurred at line: 14 in the jsp file: /beans.jsp
Generated servlet error:
D:\jakarta-tomcat-4.0\work\localhost\JSPExamples\beans$jsp.java:99: Class org.apache.jsp.LanguageBean not found.
out.print(JspRuntimeLibrary.toString((((LanguageBean)pageContext.findAttribute("languageBean")).getLanguage())));
^
An error occurred at line: 17 in the jsp file: /beans.jsp
Generated servlet error:
D:\jakarta-tomcat-4.0\work\localhost\JSPExamples\beans$jsp.java:106: Class org.apache.jsp.LanguageBean not found.
out.print(JspRuntimeLibrary.toString((((LanguageBean)pageContext.findAttribute("languageBean")).getLanguageComments())));
^
6 errors
at org.apache.jasper.compiler.Compiler.compile(Unknown Source)
at org.apache.jasper.servlet.JspServlet.loadJSP(Unknown Source)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(Unknown Source)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Unknown Source)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown Source)
at org.apache.jasper.servlet.JspServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardContext.invoke(Unknown Source)
at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.valves.AccessLogValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invokeNext(Unknown Source)
at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
at org.apache.catalina.connector.http.HttpProcessor.process(Unknown Source)
at org.apache.catalina.connector.http.HttpProcessor.run(Unknown Source)
at java.lang.Thread.run(Thread.java:484)
If any info will be a great help. Thanks.I think the reason you are getting this problem is that your JSP cannot find the LanguageBean and is therefore looking for it in the default apache package.
try adding this to the top of beans.jsp
<%@page import="com.mycom.LanguageBean" %>
Obviously replacing com.mycom with the package name of your class.
Hope this helps -
SonyStyle webpage is full of errors and bugs
I have been navigating the Sony style website for more than 5 hours now and I can't still get my order done correctly! If there are any Sony representatives here please pm me immediately to fix my problem! You should fire your webpage administrator immediately!
First I create a username using a .edu account. First when I login I can't get the 10% student discount on any Vaio laptop!!! Even at the final payment page!!! Then after trying the same thing for a few times then I couldn't even view my cart! When I click on "my cart" at the top right, I get an "a generic error has occurred please contact the system administrator" message wtf?!?!?!?!
Then I tried logging out then back again and now i can't even log back in? When i enter my details and click login I get directed to the main page without even being logged in? wtf? What kind of service is this?
Note: i tried this on internet explorer 9, Firefox 4 and Google chrome all of them don't work. And I am not an it noob!
Can some Sony rep please pm me immediately!! Or I will buy my stuff elsewhere!Hello and welcome to the forums.
Apologies you were experiencing log in issues to SonyStyle.
We have checked the website and it appears to be operational.
Our forums are for product support and we do our best to give you an answer if the community has not already addressed it. Should you need Immediate assistance on a product and cannot wait for the community, or the moderators to reply, please contact chat support by entering the model of your product here: http://esupport.sony.com/US/perl/select ... OR=CONTACT
To contact Sony to place an order: 1-877-865-7669.
If you are having log in issues please call 1-877-731-7669
Sony Sales Specialists are available Monday through Friday 5 A.M. to 9 P.M. PST, and Saturday through Sunday 7 A.M. to 4 P.M. PST. -
Sony PRS-300 ereader not working with Lion
Hello
I updated to OS Lion on 20 July and now find that my ereader (Sony PRS-300) is not recognised by my Mac when I plug in the USB.
It worked perfectly before!
Am unable to locate any help on the Sony site and the problem only occirred after installing Lion.
Anyone have any ideas to solve it?
Yours in hope
KSony reader not working after updating to Lion OS.?
How do I get my sony reader to work on lion os ?
Fix now avalible for UK
http://support.sony-europe.com/computing/prs/prs.aspx?site=odw_en_GB&m=PRS-650
Just pick model then os download
USA fix. http://esupport.sony.com/US/perl/select-system.pl?model_type_group_id=6
pick model number from left then click DRIVERS AND DOWNLOADS...... Enjoy
Angus Cooney -
Unable to access the "Import to Library"
Not sure why but I am no longer able to import my photo's to IPhoto 11. When I go to Finder (Preview) or to Adobe Photo Shop CS5 to Import the photo's it no longer gives me the option to Import To Library? I've sat here for hours trying to fix these issues but nothing. Earlier today my computer did some updates but now sure if that could be the problem. My Imac in only a few months old?????
Sony reader not working after updating to Lion OS.?
How do I get my sony reader to work on lion os ?
Fix now avalible for UK
http://support.sony-europe.com/computing/prs/prs.aspx?site=odw_en_GB&m=PRS-650
Just pick model then os download
USA fix. http://esupport.sony.com/US/perl/select-system.pl?model_type_group_id=6
pick model number from left then click DRIVERS AND DOWNLOADS...... Enjoy
angus cooney -
Kernel Sercurity Check Failure
Hi guys,
Recently, I am experiencing fews BSOD crashes on my Vaio Laptop, which is running W8. I am not sure how to read or debug .dmp file, so I am posting it here. Hopefully, someone can help me find solutions.
My minidump file: https://onedrive.live.com/redir?resid=77BE40A7A83A3631%2114921
Thank you so much.Hi,
KERNEL_SECURITY_CHECK_FAILURE (139)
This bug check indicates that the kernel has detected the corruption of a critical data structure.
BugCheck 139, {2, ffffd0002288b610, ffffd0002288b568, 0}
The first argument is 2 which indicates a stack cookie instrumentation code detected a stack-based buffer overrun.
2: kd> .exr 0xffffd0002288b568
ExceptionAddress: fffff801224d53ad (NETwew00+0x000000000000e3ad)
ExceptionCode: c0000409 (Security check failure or stack buffer overrun)
NETwew00.sys caused the overrun, which is the Intel® Wireless WiFi Link driver.
2: kd> lmvm NETwew00
start end module name
fffff801`224c7000 fffff801`2280e000 NETwew00 T (no symbols)
Loaded symbol image file: NETwew00.sys
Image path: \SystemRoot\system32\DRIVERS\NETwew00.sys
Image name: NETwew00.sys
Timestamp: Thu Aug 22 17:20:34 2013
Yours is relatively dated, so please update your network drivers ASAP -
http://esupport.sony.com/perl/select-system.pl?DIRECTOR=DRIVER
If the above fails, I am very suspicious of Kaspersky causing problems (does that quite a lot on Windows 8).
Remove and replace Kaspersky with Windows 8's built-in Windows Defender for temporary troubleshooting purposes:
Kaspersky removal - http://support.kaspersky.com/common/service.aspx?el=1464
Windows Defender (how to turn on after removal)
A.Navigate
toControl Panel (with icons).
You can do this by hittingStart
> Search > Control Panel.
Once in Control Panel,
change the drop-down fromCategory
to
Large
and/or Small icons.
B.Among
the list of icons, find and click Action Center.
C.
Assuming the removal of your prior antivirus software went properly, you will notice for both
Spyware and unwated software protection (important) and
Virus protection (important), it'll have a button labeled Turn on now. Click this button (it doesn't matter which, as Windows Defender serves as
both in Windows 8/8.1).
Regards,
Patrick
“Be kind whenever possible. It is always possible.” - Dalai Lama -
Burning speed only 4x max.
Hi Everybody,
Ever since upgrading to 5.0.1.4. my burning speed has dropped to only 4x maximum! That takes almost 20 minutes to burn a cd. I took b noir's advice and updated the firmware of the CD drive, but no difference.
Here are my CD diagnostics:
Microsoft Windows XP Professional Service Pack 2 (Build 2600)
iTunes 5.0.1.4
CD Driver 2.0.4.3
CD Driver DLL 2.0.3.2
LowerFilters: PxHelp20 (2.0.0.0), AFS2K (3.1.14.0),
UpperFilters: GEARAspiWDM (2.0.4.3),
Video Driver: MOBILITY RADEON \MOBILITY RADEON
IDE\DiskIC25N080ATMR04-0______________________MO4OAD1A, Bus Type ATA, Bus Address [0,0]
USBSTOR\DiskSony___MSC-U04________3.00, Bus Type USB
IDE\CdRomMATSHITAUJ-812_________________________K103___, Bus Type ATA, Bus Address [0,0]
If you have multiple drives on the same IDE or SCSI bus, these drives may interfere with each other.
Some computers need an update to the ATA or IDE bus driver, or Intel chipset. If iTunes has problems recognizing CDs or hanging or crashing while importing or burning CDs, check the support site for the manufacturer of your computer or motherboard.
Current user is administrator.
E: MATSHITA UJ-812, Rev K103
Media in drive is blank.
Get drive speed succeeded.
The drive CDR speeds are: 4.
The drive CDRW speeds are: 4.
The drive DVDR speeds are: 4 0.
The drive DVDRW speeds are: 4 0.
Any help would deeply be appreciated.
Best regards
RomanRoman,
Have you been to the Sony support site to look for a new ATA driver? If you go to that main page, click the "detect my model" link. Look for a driver update, probably labeled something like "Intel Chipset Driver".
http://esupport.sony.com/perl/select-system.pl?PRODTYPE=24&NAVDISP=pc
I can't find the model number you gave me manually, so I can't look for you.
But you know, the drive speed listed in the CD diagnostics clearly say that the drive is reporting that it can only burn at 4x with the media you have in there. This is media dependent. Have you tried other brands / kinds of media? -
I wanted to share this new beta browser test from Peacekeeper that shows my Firefox browser on a MacBook Pro compared to tablets and iOS devices.
For the insane sums of money one spends on a iPad, sure is ALOT of the web capability is simply missing.
The new test wouldn't work with Safari on OS X yet, but the last test does and Safari is about twice better than Firefox, but doesn't have the iPad comparison like the above test does. I let the results speak for themselves.Hello,
Welcome to the User Discussion Forums
Thank you for your feedback, your comments are always welcome.
Concerning your points on the new VITA gaming device, and game support, your suggestions and comments might get the best exposure with our Playstation Community Forums
Join the official PlayStation Community Forums to talk about PSN, PS3™, PSP® and NGP systems & games & get help, tips & news. Join PlayStation discussions in the PlayStation Forum:
http://community.us.playstation.com
We will definitely pass along your concerns and review of the Sony Tablet S.
Should you wish to research the Tablet S further, we have an entire area at Esupport dedicated to Tablet Support
http://esupport.sony.com/US/perl/select ... ODTYPE=110
There is a dedicated section of the Sony Community Discussion Forum to provide answers to questions or open discussions on various topics for the community to discuss.
viewforum.php?f=100
If you wish to speak with a product specialist concerning any of our VAIO or Home Electronics
Support is always available to you.
http://esupport.sony.com/US/perl/select ... OR=CONTACT
We look forward to hearing from you. -
Exporting selected contacts from Outlook 2011 for Mac
I've wanted to easily export a set of selected contacts from Outlook in Microsoft Office for Mac 2011. I've been through many threads about synching to Address Book and then exporting, but I've found a host of troubles, including duplicate copies of contacts being created.
So, I finally broke down and wrote an AppleScript script to export all of the currently selected contacts from Outlook to a file in either vcf (vcard) or csv (comma separated value) format. The best use of this script is to:
-- Install this as a script in Microsoft Outlook by saving the script below to Documents>Microsoft User Data>Outlook Script Menu Items
-- Change to your Contacts in Outlook. Use the Outlook search bar to find the contacts you want to export. You might search by name, category, company, or anything else that identifies the contacts you want to export. Or, you might just leave the view showing all contacts.
-- Select the contacts you want to export
-- Launch the script
The script will have you select between vcard and csv and select a destination file. This hasn't been optimized for speed, so if you're exporting 100's or 1,000's of contacts, be patient. And there isn't a progress bar at present, so you have to wait. It will display an alert when it's complete.
Sorry not to have a download location for you. You'll just have to copy the script text :-). Keep in mind there's been some but limited testing. Read the comments for details. And enjoy.
-- jsc
-- Export Outlook Contacts
-- (c) 2012 J. Scott Carr. The script is made available for free use, with no
-- warranty, under the Creative Commons license agreement.
-- This script has only been tested on Mac OS X 10.6.8 with Micrsoft Outlook for
-- Mac 2011 version 14.1.4.
property byCategory : "By category"
property byPattern : "Names matching pattern"
property vcardFormat : "VCard"
property csvFormat : "CSV"
-- main
set contactsToExport to {}
-- Get the contact selection
set contactsToExport to get_contacts_to_export()
if (count of contactsToExport) is 0 then
display alert "Please select contacts to export and rerun script" as warning
return
end if
-- Shall we export to vcard or CSV?
set theFormat to vcard_or_csv()
if theFormat is "" then
display alert "Error: Must select VCard or CSV format" as warning
return
end if
-- Get and open the output file
set oFile to open_output_file(theFormat)
if (oFile is equal to -128) then
display alert "Canceled"
return
else if (oFile < 0) then
display alert "File open failed (" & oFile & ")" as warning
return
end if
-- Export the contacts
display dialog "About to export " & (count of contactsToExport) & " contacts in " & theFormat & " format. Proceed?"
if button returned of result is not "OK" then
try
close access oFile
end try
return
end if
if theFormat is vcardFormat then
export_to_vcard(contactsToExport, oFile)
else if theFormat is csvFormat then
export_to_csv(contactsToExport, oFile)
else
display alert "Invalid format" as warning
end if
close access oFile
display alert "Complete"
return
-- get_contacts_to_export()
-- We're going to export the Contacts currently selected in Outlook.
-- Check that the current selection is Contacts and not some other Outlook
-- object. Snag the selected Contacts and return them as a list.
-- A side note. When I started this, I built options to enter a matching
-- name string or select a category. And then it hit me that those features
-- are much more robust in Outlook, and it would be easy to just use the
-- current selection.
-- There is some strange behavior that Outlook needs to have recently been
-- the front, active window.
on get_contacts_to_export()
set selectedContacts to {}
tell application "Microsoft Outlook"
set theSelection to selection
if class of theSelection is list then
if class of the first item of theSelection is contact then
copy theSelection to selectedContacts
end if
else
if class of theSelection is contact then
copy theSelection to selectedContacts
end if
end if
return selectedContacts
end tell
end get_contacts_to_export
-- vcard_or_csv()
-- Get the format to use when exporting contacts
on vcard_or_csv()
choose from list {vcardFormat, csvFormat} with prompt "Select export file format:"
if result is false then
return ""
else
return first item of result
end if
end vcard_or_csv
-- open_output_file()
-- Open the destination file for the export, returning the file descriptor or the error number
-- if the operation fails
on open_output_file(exportType)
-- Get the filename, letting "choose file name" deal with existing files.
set theDate to current date
set theTime to time of theDate
if exportType is csvFormat then
set fileName to "contacts.csv"
else
set fileName to "contacts.vcf"
end if
try
set outputFile to choose file name with prompt "Select export destination file" default name fileName
on error errText number errNum
return errNum
end try
-- Open the file
try
-- Open the file as writable and overwrite contents
set oFile to open for access outputFile with write permission
set eof oFile to 0
on error errText number errNum
display alert "Error opening file: " & errNum & return & errText as warning
try
close access oFile
end try
return errNum
end try
return oFile
end open_output_file
-- export_to_vcard()
-- Export each of theContacts to the open file outFile as a set of vcards. Note that the
-- vcard data is from the "vcard data" property of the theContacts. This routine
-- doesn't attempt to reformat an Outlook vcard, nor limit the fields included
-- in the vcard.
on export_to_vcard(theContacts, outFile)
set vcards to {}
tell application "Microsoft Outlook"
repeat with aContact in theContacts
copy vcard data of aContact to the end of vcards
end repeat
end tell
repeat with aCard in vcards
write (aCard & linefeed) to outFile
end repeat
end export_to_vcard
-- export_to_csv()
-- Export each of theContacts to the open file outFile in csv format
on export_to_csv(theContacts, outFile)
set csvFields to {}
-- Get the fields of the contact to export
set csvFields to init_csv()
-- Write the header row
set nFields to count csvFields
write first item of csvFields to outFile
repeat with i from 2 to nFields
write "," & item i of csvFields to outFile
end repeat
write linefeed to outFile
-- Export the fields of the contacts in CSV format, one per line
repeat with aContact in theContacts
write build_csv_line(csvFields, aContact) & linefeed to outFile
end repeat
end export_to_csv
-- init_csv(): defines the fields to export when csv format is selected
-- Each of the fields in the list must match a name used in the routine build_csv_line().
-- The idea is to later create a a pick list so the user can select which contact properties
-- to export.
on init_csv()
set csvFields to {"first name", "last name", "middle name", "title", "nickname", "suffix", "phone", "home phone number", "other home phone number", "home fax number", "business phone number", "other business phone number", "busines fax number", "pager number", "mobile number", "home email", "work email", "other email", "company", "job title", "department", "assistant phone number", "home street address", "home city", "home state", "home country", "home zip", "business street address", "business city", "business state", "business country", "business zip", "home web page", "business web page", "note"}
end init_csv
-- build_csv_line(): format one line for the csv file
-- Parameter csvFields determins which fields to include in the export.
-- Unfortunately I've not figured out how to use perl-style generation of
-- indirect references. If I could, this would have been much more elegant
-- by simply using the field name to refer to a Contact properly.
-- Note that email address are a special case as they're a list of objects in
-- Outlook. So these are handled specially in the export function and can only
-- be selected by the column names "home email", "work email", and "other email".
-- Outlook allows a contact to have more than one of each type of email address
-- but not all contact managers are the same. This script takes the first of
-- each type. So if a contact has more than one "home" email address, you will
-- only be able to export the first to a csv file. Suggest you clean up your
-- addresses in Outlook to adapt. The alternative is to support multiple
-- columns in the csv like "other email 1" and "other email 2", but that's not
-- supported in this version.
-- Another note. In this version, any embedded "return" or "linefeed" characters
-- found in a property of a contact are converted to a space. That means that
-- notes, in particular, will be reformated. That said, this gets arond a problem
-- with embedded carriage returns in address fields that throw off importing
-- the csv file.
-- Also note that at this time IM addresses aren't supported, but it's an easy add
-- following the same logic as email addresses.
on build_csv_line(csvFields, theContact)
set aField to ""
set csvLine to ""
set homeEmail to ""
set workEmail to ""
set otherEmail to ""
tell application "Microsoft Outlook"
set props to get properties of theContact
-- Extract email addresses from address list of contact
set emailAddresses to email addresses of props
repeat with anAddress in emailAddresses
if type of anAddress is home then
set homeEmail to address of anAddress
else if type of anAddress is work then
set workEmail to address of anAddress
else if type of anAddress is other then
set otherEmail to address of anAddress
end if
end repeat
-- Export each desired fields of the contact
repeat with aFieldItem in csvFields
set aField to aFieldItem as text
set aValue to ""
if aField is "first name" then
set aValue to get first name of props
else if aField is "last name" then
set aValue to last name of props
else if aField is "middle name" then
set aValue to middle name of props
else if aField is "display name" then
set aValue to display name of props
else if aField is "title" then
set aValue to title of props
else if aField is "nickname" then
set aValue to nickname of props
else if aField is "suffix" then
set aValue to suffix of props
else if aField is "phone" then
set aValue to phone of props
else if aField is "home phone number" then
set aValue to home phone number of props
else if aField is "other home phone number" then
set aValue to other home phone number of props
else if aField is "home fax number" then
set aValue to home fax number of props
else if aField is "business phone number" then
set aValue to business phone number of props
else if aField is "other bsiness phone number" then
set aValue to other business phone number of props
else if aField is "bsuiness fax number" then
set aValue to business fax number of props
else if aField is "pager number" then
set aValue to pager number of props
else if aField is "mobile number" then
set aValue to mobile number of props
else if aField is "home email" then
set aValue to homeEmail
else if aField is "work email" then
set aValue to workEmail
else if aField is "other email" then
set aValue to otherEmail
else if aField is "office" then
set aValue to office of props
else if aField is "company" then
set aValue to company of props
else if aField is "job title" then
set aValue to job title of props
else if aField is "department" then
set aValue to department of props
else if aField is "assistant phone number" then
set aValue to assistant phone number of props
else if aField is "age" then
set aValue to age of props
else if aField is "anniversary" then
set aValue to anniversary of props
else if aField is "astrololgy sign" then
set aValue to astrology sign of props
else if aField is "birthday" then
set aValue to birthday of props
else if aField is "blood type" then
set aValue to blood type of props
else if aField is "desription" then
set aValue to description of props
else if aField is "home street address" then
set aValue to home street address of props
else if aField is "home city" then
set aValue to home city of props
else if aField is "home state" then
set aValue to home state of props
else if aField is "home country" then
set aValue to home country of props
else if aField is "home zip" then
set aValue to home zip of props
else if aField is "home web page" then
set aValue to home web page of props
else if aField is "business web page" then
set aValue to business web page of props
else if aField is "spouse" then
set aValue to spouse of props
else if aField is "interests" then
set aValue to interests of props
else if aField is "custom field one" then
set aValue to custom field one of props
else if aField is "custom field two" then
set aValue to custom field two of props
else if aField is "custom field three" then
set aValue to custom field three of props
else if aField is "custom field four" then
set aValue to custom field four of props
else if aField is "custom field five" then
set aValue to custom field five of props
else if aField is "custom field six" then
set aValue to custom field six of props
else if aField is "custom field seven" then
set aValue to custom field seven of props
else if aField is "custom field eight" then
set aValue to custom field eight of props
else if aField is "custom phone 1" then
set aValue to custom phone 1 of props
else if aField is "custom phone 2" then
set aValue to custom phone 2 of props
else if aField is "custom phone 3" then
set aValue to custom phone 3 of props
else if aField is "custom phone 4" then
set aValue to custom phone 4 of props
else if aField is "custom date field one" then
set aValue to custom date field one of props
else if aField is "custom date field two" then
set aValue to custom date field two of props
else if aField is "note" then
set aValue to plain text note of props
end if
if aValue is not false then
if length of csvLine > 0 then
set csvLine to csvLine & ","
end if
if (aValue as text) is not "missing value" then
set csvLine to csvLine & "\"" & aValue & "\""
end if
end if
end repeat
end tell
-- Change all embeded "new lines" to spaces. Does mess with the formatting
-- of notes on contacts, but it makes it cleans the file for more reliable
-- importing. This could be changed to an option later.
set csvLine to replace_text(csvLine, return, " ")
set csvLine to replace_text(csvLine, linefeed, " ")
return csvLine
end build_csv_line
-- replace_text()
-- Replace all occurances of searchString with replaceString in sourceStr
on replace_text(sourceStr, searchString, replaceString)
set searchStr to (searchString as text)
set replaceStr to (replaceString as text)
set sourceStr to (sourceStr as text)
set saveDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to (searchString)
set theList to (every text item of sourceStr)
set AppleScript's text item delimiters to (replaceString)
set theString to theList as string
set AppleScript's text item delimiters to saveDelims
return theString
end replace_textThank You, but this is a gong show. Why is something that is so important to us all so very, very difficult to do?
-
I'm very disappointed with Apple over the very poor documentation and support for what is potentially an extremely valuable asset in the Mac OSX tool box i.e. being able to test Perl scripts locally using the Apache software included under OSX.
Because it's taken me 2 days to wade through the discussions here and find resources online I want to help others avoid my delays and post what I found. I would also like to comment that the unix community active on this list though so very helpful in many ways could resist scorning those who are entirely unfamiliar with terminal and the command line interface and try to condescend to explain in layman's terms what is essentially not that complex but is so shrouded in jargon, shorthand and arcana that it seems almost deliberately difficult to penetrate. I would ask Apple to please just post a simple 'how to' or if they see fit include this email in their FAQ's.
Thank you to the many who have posted on this subject on this list and I apologize if I have used your suggestions without personal credit. I am with this document merely giving back something of what I have taken out of this useful resource. Please feel free to offer amendments to any obvious mistakes or misunderstandings I am a novice at Unix attempting to help other novices because (Ibelieve) I still speak the same language.
This method is for starting Perl under Tiger OS 10.4x (may work for Panther or earlier I haven't tested it) on a desktop machine, not a server.
To start Apache under OSX
1) To turn on Apache just go to System prefs and turn on 'personal web sharing' under the 'sharing' control panel. Note the IP address that appears under the 'Select a service...' window as this is the IP address of your local web address or 'yourlocalhostaddress' (referenced below). This is what you type into the browser to view your pages locally.
2) It seems intuitive to place your web site in the user/yourusername/sites folder on your hard drive. While this is acceptable for basic web sites it seems to make configuration harder for Perl. I could not access a cgi-bin nor find documentation that satisfactorily informed me how to access a cgi-bin created in this location. That doesn't mean it's not possible just that I don't know how to do it.
Apple have created another folder with a pre-configured cgi folder at the following location;
yourharddrive/library/WebServer
Place your website in the 'Documents' folder and your Perl scripts in the 'CGI_Executables' folder. It's unnecessarily confusing to me that Apple have essentially renamed the cgi-bin to 'CGI_Executables' and the 'html' folder to 'documents' as they would be found under the Apache installation that I'm familiar with but that seems to be what's happened here.
To start Perl support in Apache under OSX
3) If you dont already have one it's useful to have an ultra simple Perl script on hand to test whether your configuration is working. More complex script such as formmail.pl may have additional settings that are confusing as to whether it's the file or the configuration that is causing a script error. To create a simple script copy and paste the following code;
#!/usr/bin/perl
print "Content-type: text/html\r\n\r\n";
print "Hello, World.";
into a new, empty document in a text editor and save it as 'first.pl' in your 'CGI_Executables' folder. You can open it in Safari using the following address;
http://yourlocalhostaddress/cgi-bin/first.pl
4) If you test your script now a call to the Perl script will merely open the page with the script as text and will not run it. This is because Apple supplies their copy of Apache with Perl disabled, it's necessary to edit a file called 'httpd.conf' in order to turn Perl on. The recommended way to turn this file on is using the terminal program but the file can also be located through the mac OS although it is partially hidden, it can be edited in a text editor that is suitable for coding such as BBEdit.
The best online documentation I found about how to edit the httpd.conf file using terminal is here;
http://www.macdevcenter.com/pub/a/mac/2001/12/14/apache_two.html?page=1
However I'm not sure that he is accurate (though I hesitate to disagree with the expert) my experience was significantly different see below(*).
Terminal has useful testing features but the command line is obscure and daunting to the novice. In addition UNIX programmers seem to delight in scaring away the cautious with silly, portentous warnings about privacy etc. This document is very sensitive to the way it's edited, however your computer will not blow up if you get it wrong and there is a back-up default version stored in the same folder so if you do screw up you can restore the defaults and start again.
If you wish to do it without going through the terminal the 'httpd.conf' file is located here;
/private/etc/httpd/httpd.conf
where private is an invisible folder so you cant navigate to it directly via the Mac OS. However if you copy and paste the above address into Safari's address bar the folder window will come up revealing the document (this is an undocumented feature and I discovered it by accident so use at your own risk). Alternatively you can navigate to it using an FTP program such as Transmit when you have 'show hidden files' turned on in the preferences. Transmit is a very useful tool because it also allows you to view and change the permissions (or CHMOD) of the files you view in the same manner as you would on a remote server. Something which you cannot do using the 'Get Info' on the Mac OS
You'll notice that there is an httpd.conf and an httpd.conf.default file. The latter is your backup so dont be overly scared of editing the first file, proceed with caution but not with trembling.
Once you have the program open in BBEdit (or your editor of choice) uncomment the following lines by deleting the # symbol;
#LoadModule perl_module libexec/httpd/libperl.so
#AddModule mod_perl.c
The quickest way to find these lines is to do a find on 'Perl' (something you cant do in Terminal). Dont change anything else just save and close, you will be required to enter your administrator password at this point.
(*)Please note;
Kevin Hemenway in the macdevcenter.com article says to uncomment the following lines;
#LoadModule cgi_module libexec/httpd/mod_cgi.so
#AddModule mod_cgi.c
And makes no mention of the lines ending in perl rather than CGI. His article is from 12/14/2001 so it may be out of date. In my httpd.conf file the lines ending 'cgi' were already uncommented but the lines ending 'perl' were commented out. I uncommented the lines ending 'perl' and now in my version both (cgi and perl) are uncommented and active. There are security implications to uncommenting any lines so I may have opened a security loophole that I'm not aware of however until I uncommented the 'perl' lines my scripts did not work. I would be grateful for an explanation of the implications from any Unix expert reading this.
5) The last thing you need to do is restart Apache so that it can load the new config file. To do this stop web sharing in the preferences pane and then restart it.
If you test your simple Perl script 'first.pl' now it should load and show the text "Hello World" in a browser window.
6) if you wish to load a more complex script and find that they will still not work, at least you know that Perl is working. You can check the error logs by opening the terminal and at the prompt (yourusername$) type;
tail /var/log/httpd/error_log
This enables you to trace the whether a permissions, configuration or other error has occurred.
WARNING;
The above is a distillation of my frustrating experience over the last 2 days, it details how I finally got it to work. With everything in scripting I find that I repeat the same method multiple times, convinced each time that I have it right and all of a sudden it works where it didn't work before. This always leaves me unsure that I may have inadvertently done some thing right (as logically I was obviously inadvertently doing something wrong before) that is not documented here. I offer this method as the product of my experience, because I hope it is helpful and because I have the confidence that there is a way to back out of it using the default config file. Despite the above use at your own risk.
G5 Dual 2.5Ghz + Pbook G4 867Mhz + 15GB iPod Mac OS X (10.4.3)That sounds like a very good useful tip. I would hold on to it in your own computer's repository as well and post sections of it whenever you see someone needing help with it until you are able to add it to the contributions section of the User Tip forum here:
http://discussions.apple.com/category.jspa?categoryID=103 -
Trying to run external dbs script from PERL
I am trying to execute a simple statement from inside a DBI connection of PERL. Here is the statement:
$dbh = DBI->connect("dbi:Oracle:${service}","${owner}","${owner}",{ RaiseError => 1}) || die "Database connection not made: $DBI::errstr\n";
$sth = $dbh->prepare("\@c:\\perl\\scripts\\test.sql");
$rv = $sth->execute;
while ( (@row = $sth->fetchrow_array) ) {
print "row=@row\n";
The error I get is invalid sql statement
Its on a Windows box and I can't figure out how to call an external script to run in Oracle. If anyoen knows, it would be greatly appreciated
Thanks$sth = $dbh->prepare("\@c:\\perl\\scripts\\test.sql");You can't prepare a SQL statement like this. This is not sql statement. It's rather a way of sqlplus calling external script file. A SQL statement is something like
select user from dualIf you want do this, maybe it's better just
`$ORACLE_HOME\bin\sqlplus -s user/pass@tns @c:\perl\scripts\test.sql`
Maybe you are looking for
-
Differences: Outlooksoft 4.x Vs. SAP BPC 7.0 MS
Hello, I need urgently the following information: - What were the specifications of version 4 of OutlookSoft? - What are the improvements and differences involved in SAP BPC 7.0 MS compared to OutlookSoft 4 in all possible areas (security, architectu
-
IPhoto to wireless storage to iPhone?
Hello all, I'm looking for a way to transfer photos from my iPhoto library to my iPhone individually as needed. Ideally, I would like to upload a bunch of my iPhoto images to a wireless storage space and then access that storage on my phone and downl
-
T-Code of SAP Documentation (SAP Help)
which is the T-Code of SAP Documentation (SAP Help)?
-
Library is now locked??
I have just spent the weekend updating to Snow leopard and now finally now from iPhoto 08 to iPhoto 09. When I started up for iPhoto 09 for the first time, it tells me that the library is locked and I do not have permission. I try to redirect the lib
-
Seeking Advice needed for a show this week,
Hey everyone, we are going to be playing a show this friday, and I want to make sure that I use the best setup possible so that things go off without a hitch. Performers: mainstage 2 using playback with 7 or so tracks per song. 2 guitarists live 1 ba