Relative paths in Windows XP - windows

I have an application which works perfectly in Mac OS and I want to make it work in Windows XP.
I have a function which returns this one. This is where I declare my folder My_Home.
return "." + File.separator + "My_Home" + File.separator + HomePane.objFile ;
I want to do the same thing in Windows. I have tried:
return File.separator + "My_Home" + File.separator + HomePane.objFile ;
return "My_Home" + File.separator + HomePane.objFile ;
".\My_Home\" HomePane.objFile ;
"\My_Home\" HomePane.objFile ;
"My_Home\" HomePane.objFile ;
"./My_Home/" HomePane.objFile ;
etc. with \, but nothing seems to work in Windows, because all the objects (I want to use this return in order to save some objects in folder My_Home) are saved outside of the folder.
What can I do?

"My_Home" + File.separator + HomePane.objFile
was right, the problem was mine. Thank you all:)

Related

Need Script for W10

There is a folder with many subfolders.
Each subfolder has one .jpeg and another subfolder with .png
Script needs to delete the only .jpeg in that subfolder.
Then take .png from the folder inside and delete the folder, but leave the .png.
I hope you understand what i am in need.
Please text me otherwise !
import os
import shutil
previous_path = ""
previous = ("","")
for base, dirs, files in os.walk("C:\subDIRS"):
if(len(files) != 0):
if(os.path.isfile(previous[0] + "\\" + previous[1]) and
os.path.splitext(files[0])[1].upper() == ".PNG" and
os.path.splitext(previous[0] + "\\" + previous[1])[1].upper() == ".JPG"):
shutil.move(base + "\\" + files[0], previous[0])
os.removedirs(base)
os.remove(previous[0] + "\\" + previous[1])
previous = base, files[0]

ODI - Call SQLLDR via Jython on Windows Shell

I'm testing some interfaces with Oracle Data Integrator 11g on Windows 7.
All the interfaces use the LKM MSSQL to Oracle (BCP/SQLLDR), while running them I got an error on the "Call SQLLDR via Jython" command. After some invesetigation I found that the root of the problem was the following line of code:
exitCode = os.system(sqlldr + " control=" + tempSessionFilePrefix + ".ctl log=" + tempSessionFilePrefix + ".log " + "userid=" + "<% out.print(odiRef.getInfo("DEST_USER_NAME")); %>" + "/" + "<% out.print(odiRef.getInfo("DEST_PASS")); %>" + tnsnameOption + " > " + tempSessionFilePrefix +".out" );
It should run on the Windows Shell a string in the form of:
sqlldr control=control_file.ctl log=log_file.log userid=ODI_STAGE/ODI_STAGE > shell_output.out
I did run the string generated directly on the command prompt and it worked without any problem.
So after playing a bit with the code, I couldn't make the os.system working so I replaced it with subprocess.call. I also have to remove the last part of the string where it attempts to save the ouput of the command prompt (> shell_output.out) to make the whole thing work:
exitCode = subprocess.call([sqlldr, "control=" + tempSessionFilePrefix + ".ctl", "log=" + tempSessionFilePrefix + ".log", "userid=" + "<% out.print(odiRef.getInfo("DEST_USER_NAME")); %>" + "/" + "<% out.print(odiRef.getInfo("DEST_PASS")); %>" + tnsnameOption], shell=True);
This one works smoothly.
Regarding the shell output, I suspect that the problem is the string part that starts with the '>' charcater that is parsed as part of the arguments of SQLLDR instead of a command to the prompt.
Now, while I can live without it, I would like to ask if someone knows any simple workaround to get also the shell output.
Ok I was finally able to get also the shell output.
I edited the "Call SQLLDR via Jython" command with the following:
from __future__ import with_statement
import subprocess
...
with open(tempSessionFilePrefix + ".out", "w") as fout:
exitCode = subprocess.call([sqlldr, "control=" + tempSessionFilePrefix + ".ctl", "log=" + tempSessionFilePrefix + ".log", "userid=" + "ODI_STAGE" + "/" + "<#=snpRef.getInfo("DEST_PASS") #>" + tnsnameOption], stdout=fout, shell=True);
Now everything work as intended.

Understanding the output log's auto layout data

I'm debugging a crash that I believe is auto layout related. When the crash occurs, I get an enormous dump of information on the output area that begins like this:
2015-06-04 13:23:44.158 SpeedySend[22084:861374] Objective: {objective
0x7f99e06b3730: <500:242.5, 250:18443.5> +
<500:1>*0x7f99e061e570.negError{id: 4899} +
<500:1>*0x7f99e061e570.posErrorMarker{id: 4898} + <500:1,
250:-1>*0x7f99e061f940.negError{id: 4913} + <500:1,
250:1>*0x7f99e061f940.posErrorMarker{id: 4912} + <500:1,
250:-1>*0x7f99e061fb40.negError{id: 4915} + <500:1,
250:1>*0x7f99e061fb40.posErrorMarker{id: 4914} + <500:1,
250:-2>*0x7f99e0620890.negError{id: 4807} + <500:1,
250:2>*0x7f99e0620890.posErrorMarker{id: 4806} +
<500:2>*0x7f99e06496f0.posErrorMarker{id: 4916} +
<500:2>*0x7f99e0649f40.posErrorMarker{id: 4920} + <50 ...
and then runs on for a very long time and ends like this:
... 250:-1>*0x7f99e1d77ec0.negError{id: 5023} + <800:1,
250:1>*0x7f99e1d77ec0.posErrorMarker{id: 5022} + <500:1,
250:-1>*0x7f99e1d78150.negError{id: 5025} + <500:1,
250:1>*0x7f99e1d78150.posErrorMarker{id: 5024} +
<500:1>*0x7f99e1d78310.negError{id: 5027} +
<500:1>*0x7f99e1d78310.posErrorMarker{id: 5026} +
<500:1>*0x7f99e1d78620.negError{id: 5045} +
<500:1>*0x7f99e1d78620.posErrorMarker{id: 5044} +
<500:1>*0x7f99e1d788c0.negError{id: 5031} +
<500:1>*0x7f99e1d788c0.posErrorMarker{id: 5030} +
<500:1>*0x7f99e1d78d30.negError{id: 5033} +
<500:1>*0x7f99e1d78d30.posErrorMarker{id: 5032} +
<500:1>*0x7f99e1d790a0.negError{id: 5035} +
<500:1>*0x7f99e1d790a0.posErrorMarker{id: 5034} +
<500:1>*0x7f99e1d79460.negError{id: 5037} +
<500:1>*0x7f99e1d79460.posErrorMarker{id: 5036} +
<500:1>*0x7f99e1d79840.negError{id: 5039} +
<500:1>*0x7f99e1d79840.posErrorMarker{id: 5038} +
<500:1>*0x7f99e1d79c50.negError{id: 5041} +
<500:1>*0x7f99e1d79c50.posErrorMarker{id: 5040} +
<500:1>*0x7f99e1d7a080.negError{id: 5043} +
<500:1>*0x7f99e1d7a080.posErrorMarker{id: 5042} +
<500:1>*0x7f99e1d7aa60.negError{id: 5047} +
<500:1>*0x7f99e1d7aa60.posErrorMarker{id: 5046} +
<500:-7.45058e-08>*0x7f99e1f7ae60.negError{id: 3600}}
I would like to understand this data better as an aid to debugging my problem.
Is there a document or a posting that I can access that explains the format and meaning of this data?
Like, for instance, what does something like <500:1,250:-1> represent?
What is a negError?
And, most importantly, can something like {id: 3600} be tied back to a specific control that auto layout is laying out for me?
I'm particularly interested in the last questions because I've read here that very small numbers, when seen in these dumps, can indicate a crash due to accumulated loss of floating point precision in the auto layout engine.
You'll note that I have such a number on the very last line of my output data. So, if I can relate {id: 3600} back to one of my controls, I hope that will put me close to the origin of the problem.

Hidden SPAM script in Joomla footer

I got my Joomla site www.semignu.dk and there is suddenly some hidden SPAM script in my footer? How do I remove this?
If you are referring to the following code:
//<!--
document.getElementById('cloak6482').innerHTML = '';
var prefix = 'ma' + 'il' + 'to';
var path = 'hr' + 'ef' + '=';
var addy6482 = 'Kontakt' + '#';
addy6482 = addy6482 + 'semignu' + '.' + 'dk';
var addy_text6482 = 'Kontakt' + '#' + 'semignu' + '.' + 'dk';
document.getElementById('cloak6482').innerHTML += '<a ' + path + '\'' + prefix + ':' + addy6482 + '\'>'+addy_text6482+'<\/a>';
//-->
Then this is not spam. It's part of the email cloaking that you possibly have turned on.
Open the footer module in the Joomla Module Manager and look for:
{emailcloak=on}

QUrl containing parentheses

Our application is a 32 bit application. When it is installed in windows 7 64bit, typically it installs at “C:\Program Files (x86)”, instead of “C:\Program Files”. We are constructing a Url based on the install location and pass it around as part of a web service. We are constructing the Url like this:
ppmPath = "http://" + ipAddress + ":13007/" + folder + ".ppm" + "?filePath="
+ applicationDirPath + "/" + FIRMWARE;
QUrl ppmURL( ppmPath, QUrl::TolerantMode );
ppmPath = QString( ppmURL.toEncoded() );
The variable types and meaning are usual.
Since “applicationDirPath” for Windows 7 64 bit contains one closing bracket “)” - in the “(x86)” substring – apparently the URL is broken. If we install it to any other location, it works perfectly, even though the location has any other special character.
How to deal with “)” character in the URL, so that is is not broken?
From the documentation it doesn't look like parentheses are automatically encoded by QUrl, even in tolerant mode. If you first wrap your URL in a QString and then replace all ( characters with "%28" and all ) characters with "%29" then it should behave like you expect.
QString ppmPath = QString("http://" + ipAddress + ":13007/" + folder + ".ppm" + "?filePath="
+ applicationDirPath + "/" + FIRMWARE);
QUrl ppmURL( ppmPath, QUrl::TolerantMode );
ppmPath = QString( ppmURL.toEncoded() );
ppmPath.replace(QChar('('), "%%28");
ppmPath.replace(QChar(')'), "%%29");
I'm not 100% sure the double-% needs to be there, but I remember having trouble with that in the past. Try it both ways.
Alternatively, you could try playing with QUrl::toPercentEncoding() and skip the constructor altogether. It appears to convert parentheses.
QUrl ppmURL(QString("http://" + ipAddress + ":13007/" + folder + ".ppm"), QUrl::TolerantMode );
QString filepath = QUrl::toPercentEncoding(applicationDirPath + "/" + FIRMWARE);
ppmUrl.addEncodedQueryItem("filepath", filepath.toLocal8Bit());
ppmPath = QString( ppmURL.toEncoded() );

Resources