IO no longer works when running on Linux
Hi everyone,
I have some code which was originally developed and running on a Windows environment, now I am trying to get it working under Linux. Some of the JSP file which output data as text files do not display correctly, I assume that if I change the JSP files to the UNIX newline characters this will fix the problem?
The other issue is that there is some code which saves data to a file, the directory given may be local or on a network. It worked fine under Windows, but throws an Exception below when running under Linux even when using the UNIX like path structure (/machinename/dir/dir/filename). The code is below:
byte[] data = /*method that gets the data to save*/;
String fileDir = this.addExtraBackslashes(config.getOutputDirectory()); // getOutputDirectory sets the directory String
String filePath = fileDir + fileName; // String fileName is set elsewhere in this code
FileOutputStream fos = null;
try {
fos = new FileOutputStream(filePath);
fos.write(data);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
throw new Exception("Error saving file:-" + filePath +", please check the output path in the configuration", e);
} catch (IOException e) {
// TODO Auto-generated catch block
throw new Exception("Error saving file:-" + filePath+", please check the output path in the configuration", e);
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
log.warn("error closing file stream:" + filePath);
private String addExtraBackslashes(String s) {
StringBuffer sbRet = new StringBuffer();
for (int i = 0;i < s.length();i++) {
char ch = s.charAt(i);
switch (ch) {
case '\\':
sbRet.append('\\');
sbRet.append(ch);
break;
default:
sbRet.append(ch);
break;
return sbRet.toString();
}Anyone have any ideas of what could be the problem and possible solutions?
Thanks,
People would have more of an idea if you posted the full exception text and a clue as to which line it was thrown from.
Also, WTF is with all the addExtraBackslashes stuff? It looks like it's going through and doubling-up each \ character. I'm guessing this won't do anything on Linux if you've configured your paths to use / instead, but even so, what did it do on Windows?!
And what are the values of fileDir and filePath? Does fileDir end in a /? Instead of having to worry about that, you could use new File(fileDir, filePath) to construct an abstract path and pass that to your FileOutputStream.
Similar Messages
-
Why will my phone no longer work when calling an system with automated dialing, press 1 for this or 2 for that. Tells me not a valid number.
sunshinesunshine wrote:
So basically if a iphone has a fault after the 1 year warranty period is over, there is nothing the consumer can do but purchase a new phone??
Pretty much. Except that Apple will replace it for a fixed fee that is far less than the cost of a new phone. In the US the replacement cost for an iPhone 4 is $149. It is comparable in the UK. Unless you can prove that the fault was present at the time of purchase. A switch wearing out would probably be considered normal wear and tear, not a "fault". -
The gyro no longer works when using the remote app on my iPad. I updated to iOS 7.0.1.
This seem to happen after the update. Any suggestions?Dear Apple friends,
I have the exact same problem with some apps.
Even when I try some websites in Safari and Chrome that require loading big chunks of data they crash.
Today it crashed in two new places. In the notification center and when I opened newstand app I no longer was able to return to the main window and the dock disappeared.
I have my ipad retina for about three months now but latelly this issue has became more frequent. What should I do?
Should I update to the latest firmware and do what raymond73 said?
Is there a fix for this issue?
Has Apple said anything about this? Because I see that this issue is happening to a lot of people.
Is it possible to downgrade to iOS 6?
Is it a firmware problem? That can be fixed in future releases? Or an hardware issue?
Should I wait or go to the place I bought it and try to get the money back? -
In Yosemite Mail, the control click option no longer works when clicking on attachments, that previously allowed you to save, quicklook, and select app to open with etc. Any solutions?
Hi
It shows just 4 always as an option in the "open with" lsit. Also I haven't downloaded any apps for a while so why would it start now?
Do you know how I can estabilsh how many apps are counting toward this 10 and what they are? -
Just upgraded my 2009 iMac (3.06 Ghz, core 2 duo $GB 1067 Mhz DDR3) to Mavericks OSX 10.9.5 and my HP6100 printer no longer works, when I try to reload the software it says PowerPC apps no longer supported. Printer says the software was improperly installed. Is there a way to use my HP6100 Printer with Mavericks or do I need to go back to Mountain Lion or Snow Leopard?
It's not clear whether your printer is included in the Apple list - there is an Officejet 6100 and a couple of other types. Go to the page linked to above and use the browser search for 6100.
I'm afraid HP are notorious for not supporting older printers - I had the same problem. Probably they hope you will buy another printer (I did, but it was a Canon). I did look on HP's site and couldn't see a driver - you could give it a try (make sure you have the exactly correct printer name):
http://www8.hp.com/uk/en/support-search.html?tab=1#/qryterm=HP6100&search_search type=s-002
Alternatively ou could try Gutenprint (open source software):
http://gimp-print.sourceforge.net/MacOSX.php
I found it would indeed drive the printer, but the colour dithering wasn't very satisfactory and the duplex printing bolt-on wouldn't work. However as Gutenprint is free it's worth trying to see if it's any good for you. -
My forward delete no longer works when searching or editing on Itunes since installing an update
My forward delete no longer works when searching or editing on Itunes since installing an update. Anyone else have that problem? Any fixes?
Have you tried:
- Reset the iPod. Nothing will be lost
Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Reset all settings
Go to Settings > General > Reset and tap Reset All Settings.
All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
- Restore from backup
- Restore to factory settings/new iPod.
Apple will exchange your iPod for a refurbished one for this price:
Apple - Support - iPod - Repair pricing
A third-party place like the following maybe less. Google for more.
iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens -
The control click and external mouse right click no longer works when copying and pasting album art within itunes. Ex. Hit get info for one song to paste to the rest, copying the artwork wont work when it used to.
Hello there, Teworsham90.
The following Knowledge Base article reviews the process of adding artwork to content in your iTunes Library:
iTunes: How to add artwork to songs and videos in your library
http://support.apple.com/kb/HT1409
Thanks for reaching out to Apple Support Communities.
Cheers,
Pedro D. -
Multitouch on track pad not working when running Windows 8 in boot camp
Does anyone know a work around on how to resolve the issue of more than one fingers on the trackpad? For example, I use one finger to click a window then another finger to slide/move the window to a different location on the screen. This does not work when running Windows 8 in Boot Camp latest version. Any suggestion is much appreciated.
very very few gestures are supported in windows
https://discussions.apple.com/message/24548533#24548533
if it's a limitation from ms you need to contact them
if it's a limitation from apples drivers you can use feedback channel
http://www.apple.com/feedback/ -
Powershell Script Send-zip not working when running in cmd
I found there is powershell send-zip script available in technet. I tested it and found that it works when the script is running under powershell env, but when it is calling in cmd env, I can see the zip file, but there is nothing in it. If
I add the "-noexit" switch it runs normally. Anyone have ideas what might be happening?
The orig codes is as following:
function global:SEND-ZIP ($zipfilename, $filename) {
# The $zipHeader variable contains all the data that needs to sit on the top of the
# Binary file for a standard .ZIP file
$zipHeader=[char]80 + [char]75 + [char]5 + [char]6 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0
# Check to see if the Zip file exists, if not create a blank one
If ( (TEST-PATH $zipfilename) -eq $FALSE ) { Add-Content $zipfilename -value $zipHeader }
# Create an instance to Windows Explorer's Shell comObject
$ExplorerShell=NEW-OBJECT -comobject 'Shell.Application'
# Send whatever file / Folder is specified in $filename to the Zipped folder $zipfilename
$SendToZip=$ExplorerShell.Namespace($zipfilename.tostring()).CopyHere($filename.ToString())
SEND-ZIP C:\abc\a.ZIP C:\a\a.bakI've had the same problem with similar code found on another web site.
The reason the zip file ends up being empty is that the temporary $ExplorerShell object you created is deleted when the send-zip function returns,
and any incomplete copy operation that may still be ongoing at that time is aborted. (The copy operation is asynchronous, and continues after the CopyHere() function returns.)
To work around this, you need to add a delay loop before you return, waiting for the copied object to appear in the zip.
(Note that adding a fixed delay, like I've seen on other web sites, does not work: Small files appear almost immediately, whereas large file or worse still large subdirectory trees can take a long time to appear.)
Try changing the end of your routine to something like...
# Create an instance to Windows Explorer's Shell comObject
$ExplorerShell=NEW-OBJECT -comobject 'Shell.Application'
# Open the zip file object
$zipFile = $ExplorerShell.Namespace($zipfilename.tostring())
# Count how many objects were in the zip file initially
$count = $zipFile.Items().Count
# Send whatever file / Folder is specified in $filename to the Zipped folder $zipfilename
$SendToZip=$zipFile.CopyHere($filename.ToString())
# Wait until the file / folder appears in the zip file
$count += 1 # We expect one more object to be there eventually
while ($zipFile.Items().Count -lt $count) {
Write-Debug "$filename not in the zip file yet. Sleeping 100ms"
Start-Sleep -milliseconds 100
# Return deletes the $zipFile object, and aborts incomplete copy operations. -
.hasDefinition no longer working when I move .swf movie to a diff directory
I am on Flex 3.6 (Sorry, the move to 4.5 is just too darn difficult right now as I am on a tight deadline and I ran into many many migration issues).
For years I have used the following code in a component I made that subclasses SWFLoader and it works just dandy fine:
var mClip:MovieClip;
var swfAppDomain:ApplicationDomain = this.loaderContext.applicationDomain;
if (swfAppDomain.hasDefinition(symbolLinkName)){
var classRef:Class = swfAppDomain.getDefinition(symbolLinkName) as Class;mClip = new classRef();
The .swf's I am loading with the SWFLoader contain various animation MovieClips that I created in Flash CS4 and are stored in the library of that animations.swf. When I keep the animations.swf in the relative path of the Flex app MyApp.swf (i.e. I have a folder myApp which has the Flex app MyApp.swf and a folder called assets which has the animations.swf) all works fine. As soon as I move the assets folder to a different folder that is outside the myApp folder foodchain, the .hasDefinition no longer works. That is, the hasDefinition() can't find my animation in the library of the animiations.swf
What on earth could be the issue? I don't get any exceptions or error messages. I just don't get the MovieClips out of the library.Thank you so much for your prompt and helpful reply. I am both testing locally (using file system relative path url's) and going to deploy using http. Where do I put the crossdomain.xml file? In the foodchain of where my app will be running? If I am testing locally and want to test the http url paths, do I put the crossdomain.xml file inside my html-template folder?
Thanks again for all your help. -
Keyboard and mouse no longer work when booting into Rhapsody
I still have a bootable partition with the last release of Rhapsody (aka Mac OS X Server) on my Power Mac G4 but it's been a while (years!) since I actually booted it up. The G4 also has bootable partitions with Mac OS X 10.2, 10.3 and 10.4 (and is in daily use running 10.4.11).
I used to boot into Rhapsody occasionally, mostly for interest's sake, occasionally to test Unix software on legacy systems; I haven't tried to do so since installing 10.4 until now.
When I booted up from the Rhapsody partition today, all went well -- the system started up fine, and the login screen appeared -- but the keyboard and mouse no longer work. I even got out the original keyboard and mouse that came with the G4, with no luck.
I assume that recent firmware updates have bypassed support for Rhapsody. I guess I'm not surprised -- it was a developer-only release, after all. But has anyone a solution?Adding to the above: I also tried plugging in an Microsoft USB keyboard at the point when Windows freezes at the Windows log-in screen. The keyboard is not recognized and the only way I can leave this screen is to power-off the computer.
-
Enqueue works fine Dequeue works when run manually but not via Notification
Hi,
My Enqueue works fine. My Dequeue procedure works fine when run manually. But when I register a notification the procedure is not called.
The log file shows:
ORACLE_HOME = /u01/app/oracle/product/10.2.0
System name: Linux
Node name: gooch.com
Release: 2.4.21-50.ELsmp
Version: #1 SMP Tue May 8 17:18:29 EDT 2007
Machine: i686
Instance name: xml
Redo thread mounted by this instance: 1
Oracle process number: 25
Unix process pid: 7761, image: [email protected] (J000)
*** 2010-03-06 14:09:22.167
*** ACTION NAME:() 2010-03-06 14:09:22.167
*** MODULE NAME:() 2010-03-06 14:09:22.167
*** SERVICE NAME:(SYS$USERS) 2010-03-06 14:09:22.167
*** SESSION ID:(145.99) 2010-03-06 14:09:22.167
Error in PLSQL notification of msgid:8128C090A10BE480E0407E0A660F1B97
Queue :"XML4"."TEST14_Q"
Consumer Name :TEST14
PLSQL function :xml4.test14_proc
: Exception Occured, Error msg:
ORA-00604: error occurred at recursive SQL level 2
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TEST14_PROC'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
my code is
BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE(
queue_table => 'test14_t',
comment => 'Queue Table to process incoming ORDER XML messages from Management Dynamics',
multiple_consumers => TRUE,
queue_payload_type => 'SYS.XMLTYPE',
compatible => '8.1');
END;
BEGIN
DBMS_AQADM.CREATE_QUEUE(
queue_name => 'test14_q',
queue_table => 'test14_t');
END;
BEGIN
dbms_aqadm.start_queue('test14_q');
END;
BEGIN
DBMS_AQADM.ADD_SUBSCRIBER (
queue_name => 'test14_q',
subscriber => SYS.AQ$_AGENT('test14', NULL, NULL)
END;
CREATE or replace PROCEDURE test14_proc AS
deq_opts dbms_aq.dequeue_options_t;
mess_prop dbms_aq.message_properties_t;
mess_handle RAW(16);
message XMLTYPE;
buffer varchar2(100);
msglen number;
begin
deq_opts.wait := dbms_aq.FOREVER;
deq_opts.consumer_name := 'test14';
dbms_aq.dequeue(queue_name=> 'test14_q',
dequeue_options => deq_opts,
message_properties => mess_prop,
payload => message,
msgid => mess_handle);
commit;
insert into testxml values(message);
commit;
insert into hello select extractvalue(xml1, '/Hello') from testxml;
commit;
end test14_proc;
DECLARE
queue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
message_id RAW(16);
message SYS.XMLType;
BEGIN
message := sys.XMLType.createXML('<?xml version="1.0"?><Hello>Test</Hello>');
DBMS_AQ.ENQUEUE( queue_name => 'test14_q',
enqueue_options => queue_options,
message_properties => message_properties,
payload => message,
msgid => message_id);
COMMIT;
END;
BEGIN
DBMS_AQ.REGISTER (
SYS.AQ$_REG_INFO_LIST(
SYS.AQ$_REG_INFO(
'xml4.test14_q:test14',
DBMS_AQ.NAMESPACE_AQ,
'plsql://xml4.test14_proc?PR=0',
HEXTORAW('FF'))),1);
END;Any ideas?
Thanks in advance!I actually changed it to process RAW as well i.e.
BEGIN
DBMS_AQ.REGISTER (
SYS.AQ$_REG_INFO_LIST(
SYS.AQ$_REG_INFO(
'xml4.test14_q:test14',
DBMS_AQ.NAMESPACE_AQ,
'plsql://xml4.test14_proc?PR=0',
HEXTORAW('FF'))),1);
END;and it still is failing with the same error -
Program no longer works when compiled
I'm not really quite sure why, but when I compile this basic RS232 program, it no longer works. It runs fine in the actual LabView block diagram/front panel. Does anyone have any suggestions?
Thanks
Solved!
Go to Solution.
Attachments:
lamp_controller_vii.vi 78 KBWell, I haven't even created an installer for it yet. I've just tried to build an application. The application builds fine and the VISA dependencies are included in the build (along with many others), but the commands I'm trying to send don't appear to be going through the serial port. I've attached output from NI Spy, and it looks like it tries to establish communications with "Com 6" (the port I'm using), and then hangs up. There should be commands going back and forth.
Attachments:
ni_spy_cap.png 75 KB -
Will SUBMIT report EXPORTING LIST TO MEMORY work, when Run in Background?
You can use SUBMIT <report> EXPORTING LIST TO MEMORY, and then Call the FM LIST_FROM_MEMORY to get the Data.
This works fine, when the Program is Run in Foreground. My question is, will it work when I Run the Program in Background? i.e. When I Run the Program in Background, will the SUBMIT Statement, Export the List to Memory? Because only then the FM LIST_FROM_MEMORY will get the Data.
Any alternate solution to meet the same requirement will be appreciated.It works for me... my spool output looked like:
11.01.2008 JC: Calling program - test list to memory 1
ZLOCAL_JC_SDN_CALLING_PROGRAM started at 12:54:29
ZLOCAL_JC_SDN_CALLING_PROGRAM call complete 12:54:30
ZLOCAL_JC_SDN_CALLING_PROGRAM started at 12:54:30
11.01.2008 JC: Called program - testing list to memory
ZLOCAL_JC_SDN_CALLED_PROGRAM was called at: 12:54:29
for the following code:
report zlocal_jc_sdn_calling_program.
parameters:
p_start(1) type c.
start-of-selection.
perform testcase.
*& Form testcase
form testcase.
data:
lt_list type table of abaplist.
write: / sy-repid, 'started at', sy-uzeit.
submit zlocal_jc_sdn_called_program
exporting list to memory
and return.
write: / sy-repid, 'call complete', sy-uzeit.
call function 'LIST_FROM_MEMORY'
tables
listobject = lt_list.
write: / sy-repid, 'started at', sy-uzeit.
call function 'WRITE_LIST'
tables
listobject = lt_list.
endform. "testcase
and
report zlocal_jc_sdn_called_program.
start-of-selection.
write: / sy-repid, 'was called at:', sy-uzeit. -
Button no longer works when inside a Movie Clip?
Again I turn to the almighty Adobe forums for help...
So basically, I've had this problem for over a day now, and I've posted on Experts-Exchange.com... to no avail really.
So here we go:
I have a button in a Flash project I've made. It's used to jump to another place on the root timeline, labelled "Why". It used to work perfectly.
I have now placed the button inside a movie clip (it has to be in an animated sequence), but now it no longer works. It appears to work fine, the rollover state works and all. But when clicked it does nothing.
The code I use to work the buttons goes on the main timeline, the code for this button is:
mc_anim_backdrops_menu.btn_subsection1.onRelease = function() {
gotoAndStop("Why");
_global.swfloaded = "";
Why does it no longer work? and what can I do to fix it?
The question is posted here over at Experts Exchange - http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Act ionScript/Q_24888850.html
what we've tried there is tracing the problem. The code seems to be pointing to the right place, but none of the actual function works.. as you'll be able to see if you open up the attached file (and change it's extension from .txt to .fla to get it working)
So would someone be able to open it up, have a look and tell me what's wrong? Because I'm stumped. And frustrated.My guess is that you have a scope problem. By putting the button inside a movieclip you have made the buttons scope the same as that clip.
So if you add a trace inside the release event handler, what do you get?
trace("My current scope is: "+this);
I'm guessing it is "_level0.mc_anim_backdrops_menu," right?
So since you are using the global function of gotoAndPlay() it is looking for that label in the current timeline and not finding it.
You should probably use the MovieClip method and specifiy which timeline it should look in.
_root.gotoAndPlay("Why");
_level0.gotoAndPlay("Why")
_parent.gotoAndPlay("Why");
both would probably work. I would never use the first two, other than to make sure that there wasn't something else going on...
Maybe you are looking for
-
EA2: ORA-01427 clicking on a view in the navigator
SQLDev: 1.5.0.52.03 Java: 1.6.0_04 Oracle: 9.2.0.7.0 I'm getting the following error when I click on a view in the navigator pane: An error was encountered performing the requested operation: ORA-01427: single-row subquery returns more than one row 0
-
Iphone 6 voice recognition not working
I have an iphone 6 and have had it since October 2014. For about a month now, the voice recognition option does not work. I like to use it rather than texting, and emails when I'm on the go and it's frustrating that I can't figure out what's wrong.
-
Games from Mac to ATV via Airplay
Hello. Why is it not possible to play games from my Macbook pro (Mountain Lion) with ATV (3rd generation) via Airplay mirroring? I can mirror my desk top and watch movies and online video streams with no problem but games lag terribly. On the Macbook
-
How do I subscribe to Smule Sing! from the state of Israel?
Smule Sing! uses an in-app purchase as a renewing subscription. Appearantly the option for using renewing subscriptions is non-existant in the state of Israel. I need a solution for subscribing to this app!
-
CS6 Design trial download, error 109
I've tried twice now to download the trial CS6 Design, but part way through it says error 109, what is going on?