How to upload files? - fckeditor

I just wanted to know how to configure FCKEditor to upload files and images to the server where the website is hosted.
The relevant part for it's config file(i think) looks like this:
FCKConfig.LinkUpload = true ;
FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension ;
FCKConfig.LinkUploadAllowedExtensions = ".(7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip)$" ; // empty for all
FCKConfig.LinkUploadDeniedExtensions = "" ; // empty for no one
FCKConfig.ImageUpload = true ;
FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension + '?Type=Image' ;
FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png|bmp)$" ; // empty for all
FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one
Could it be a folder permission problem? Is this part of the config.js alright?

You don't state what language you are using. The fileupload functionality in FCKeditor has ASP, .NET, Coldfusion and PHP uploaders, amongst others. It would help if you said what server (IIS/Linux?) and serverside language you are using.
With limited information its a long shot but there's settings in fckconfig.js for configuring your file browser (around line 276) Make sure you have the right language selected:
var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py
You'll also have to set write permissions on the folder structure you are uploading to (which might be the cause of the "invalid request" error, but process to edit file permissions is different depending if you are using windows or linux.
Its not well documented, but its also possible to debug the file manager settings by going to the following URLs in a browser:
/fckeditor/editor/filemanager/connectors/test.html
and
/fckeditor/editor/filemanager/connectors/uploadtest.html
The upload test scripts are very useful and can help diagnose many problems - you can see errors easier for a start. Give them a try and you should have a better idea what the problem is.

It's solved, thanks anyway. I just had to add the "Files" type to some variable at the config.aspx file. It only had "Images", so that's why I couldn't upload files

Related

Using schema update option in beam.io.writetobigquery

I am loading a bunch log files into BigQuery using apache beam data flow. The file format can change over a period of time by adding new columns to the files. I see Schema Update Option ALLOW_FILED_ADDITION.
Anyone know how to use it? This is how my WriteToBQ step looks:
| 'write to bigquery' >> beam.io.WriteToBigQuery('project:datasetId.tableId', ,write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND)
I haven't actually tried this yet but digging into the documentation, it seems you are able to pass whatever configuration you like to the BigQuery Load Job using additional_bq_parameters. In this case it might look something like:
| 'write to bigquery' >> beam.io.WriteToBigQuery(
'project:datasetId.tableId',
write_disposition=beam.io.BigQueryDisposition.WRITE_APPEND,
additional_bq_parameters={
'schemaUpdateOptions': [
'ALLOW_FIELD_ADDITION',
'ALLOW_FIELD_RELAXATION',
]
}
)
Weirdly, this is actually in the Java SDK but doesn't seem to have made its way to the Python SDK.

IDL batch processing: fully automatic input selection

I need to process MODIS ocean level 2 data and I obtained an external plugin for ENVI https://github.com/dawhite/EPOC/releases. Now, I want to batch process hundreds of images for which I modified the code like the following code. The code is running fine, but I have to select the input file every time. Can anyone please help me to make the program fully automatic? I really appreciate and thanks a lot for your help!
Pro OCL2convert
dir = 'C:\MODIS\'
CD, dir
; batch processing of level 2 ocean chlorophyll data
files=file_search('*.L2_LAC_OC.x.hdf', count=numfiles)
; this command will search for all files in the directory which end with
; the specified one
counter=0
; this is a counter that tells IDL which file is being read-starts at 0
While (counter LT numfiles) Do begin
; this command tells IDL to start a loop and to only finish when the counter
; is equal to the number of files with the name specified
name=files(counter)
openr, 1, name
proj = envi_proj_create(/utm, zone=40, datum='WGS-84')
ps = [1000.0d,1000.0d]
no_bowtie = 0 ;same as not setting the keyword
no_msg = 1 ;same as setting the keyword
;OUTPUT CHOICES
;0 -> standard product only
;1 -> georeferenced product only
;2 -> standard and georeferenced products
output_choice = 2
;RETURNED VALUES
;r_fid -> ENVI FID for the standard product, if requested
;georef_fid -> ENVI FID for the georeferenced product, if requested
convert_oc_l2_data, fname=fname, output_path=output_path, $
proj=proj, ps=ps, output_choice=output_choice, r_fid=r_fid, $
georef_fid=georef_fid, no_bowtie=no_bowtie, no_msg=no_msg
print,'done!'
close, 1
counter=counter+1
Endwhile
End
Not knowing what convert_oc_l2_data does (it appears to be a program you created, there is no public documentation for it), I would say that the problem might be that the out_path variable is not defined in the rest of your program.

DotNetZip zipping files with Arabic names

When creating a zip file out of many Arabic named files, I have as prompted in DotNetZip's FAQ changed the code page to the following:
Using zip As New ZipFile()
zip.AddDirectoryByName("Files")
zip.AlternateEncoding = Encoding.UTF8
zip.AlternateEncodingUsage = Ionic.Zip.ZipOption.Always
Dim row As Integer
For row = 0 To ds.Tables("d").Rows.Count - 1
fileToDownload = Server.MapPath("~/.../Resources/Attachments/" + ds.Tables("d").Rows(row).Item(1).ToString)
zip.AddFile(fileToDownload, "Files")
Next
Response.Clear()
Response.BufferOutput = False
Dim zipName As String = [String].Format(gvRow.Cells(8).Text.Trim + ".zip")
Response.ContentType = "application/zip"
Response.AddHeader("content-disposition", "attachment; filename=" + zipName)
zip.Save(Response.OutputStream)
Response.[End]()
End Using
I have used several listed Arabic encoding codes, but most of them produce '???' whereas this one produces names as the following: '¦ßs-¦ µ+++ ¦ß+pß.docx'
What is the correct code to be used? Or am I missing something?
Use UTF8 Encoding and pass it as parameter to the constructor:
IO.File.Delete("D:/testZip.zip")
Using zip As New Ionic.Zip.ZipFile(Encoding.UTF8)
zip.AddDirectory("d:/out")
zip.Save("D:/testZip.zip")
End Using
this code works with me with Arabic file names (windows 7).
EDIT #1 : you must force DotNetZip to use the specified encoding by using Always option instead of AsNesseary :
IO.File.Delete("D:/testZip.zip")
Using zip As New Ionic.Zip.ZipFile()
zip.AlternateEncoding = Encoding.UTF8
zip.AlternateEncodingUsage = Ionic.Zip.ZipOption.Always
zip.AddDirectory("d:/out")
zip.Save("D:/testZip.zip")
End Using
EDIT #2 : based on your comment, I think your operating system does not support Arabic UI,for windows 7 professional 32 bit, go to Control Panel -> Region and Language -> Administrative [tab] -> click "change System locale" button -> choose "Arabic Egypt" for Example -> OK -> OK (restart computer is needed) , Don't worry, the language of windows 7 still English.
EDIT #3 : As I mentioned in EDIT #2, your system must support Arabic UI, for example, create a file called (ملف جديد) then add it to archive using WinZip or Winrar, then open the generated archive, if you can read file names correctly , then try to use one of the following encodings in your code :
Encoding.Unicode
Encoding.UTF7
Encoding.UTF8
Encoding.UTF32
If you are unable to read Arabic file names inside the generated archive, you must configure your system to support Arabic UI.
Also, please use the following order for these lines, put the Encoding, then add files or folders :
zip.AlternateEncoding = Encoding.UTF8
zip.AlternateEncodingUsage = Ionic.Zip.ZipOption.Always
zip.AddDirectoryByName("Files")
After using what seemed like a myriad of trials using code pages, simply replacing this:
zip.AlternateEncoding = Encoding.UTF8
with this:
zip.AlternateEncoding = Encoding.GetEncoding(720)
worked.

XSL::Apache FOP java server connection

Got a project with Apache FOP, have to make a server based application which will use Apache FOP and pick XML+XSLT files, convert it to XSL:FO and then output an PDF file.
Everything works fine until it comes to XSL:FO=>PDF, Im getting a error in my console which tells me:
"could not connect to java server at line 15"
I'm a newbie programmer, and this might be a simple task to complete but I just can't figure it out how to run this bloody java server ... so my code might be working. Any help would be great. (FYI Im working on Windows)
Here is the Perl Code:
use XML::LibXSLT;
use XML::LibXML;
use XML::ApacheFOP;
my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();
my $source = $parser->parse_file('books.xml');
my $style_doc = $parser->parse_file('books.xsl');
my $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform($source);
my $Fop = XML::ApacheFOP->new();
$Fop->fop( xml => "books.xml", xsl => "books.xsl", outfile => "temp.pdf" )
or die "cannot create pdf: " . $Fop->errstr;
Would be glad to get some help.
Cheers.
You need to run JavaServer by this command
/path/to/java -classpath \
/path/to/JavaServer.jar\
:/usr/local/xml-fop/build/fop-0.20.5-RFC3066-patched.jar\
:/usr/local/xml-fop/lib/avalon-framework-cvs-20020806.jar\
:/usr/local/xml-fop/lib/batik.jar\
:/usr/local/xml-fop/lib/xalan-2.4.1.jar\
:/usr/local/xml-fop/lib/xercesImpl-2.2.1.jar \
com.zzo.javaserver.JavaServer
This works for me but with fop 0.20 with fop-0.20.5-RFC3066-patched.jar

WebLogic - Using environment variable / double quotes in "Arguments" in "Server Start"

I have an admin server, NodeManager, and 1 managed server, all on the same machine.
I am trying to enter something similar to this to the arguments field in the Server Start tab:
-Dmy.property=%USERPROFILE%\someDir\someJar.jar
But when the managed server is started it throws this exception:
Error opening zip file or JAR manifest missing : %USERPROFILE%\someDir\someJar.jar
It appears that the environment variable is not being translated into it's value. It is just passed on to the managed server as plain-text.
I tried surrounding the path with double quotes (") but the console validates the input and does not allow this: "Arguments may not contain '"'"
Even editing the config.xml file manually cannot work, as the admin server fails to startup after this:
<Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason: [Management:141266]Parsing failure in config.xml: java.lang
.IllegalArgumentException: Arguments may not contain '"'.>
I also tried using %20 to no avail, it is just passed as %20.
I thought that perhaps this had something to do with the spaces in the value of %USERPROFILE% (which is "C:\documents and settings.."), but the same thing happens with other env. variables which point to other directories with no spaces.
My question:
Is there any supported way of :
using double quotes? what if i have to reference a folder with spaces in it's name?
reference an environment variable? What if i have to rely on it's value for distributed servers where i do not know in advance the variable's value?
Edit based on comments:
Approach 1:
Open setDomainEnv.cmd and search for export SERVER_NAME in Linux or for set SERVER_NAME in Windows. Skip to next to next line (i.e skip current and the next line)
On the current line, insert:
customServerList="server1,server2" #this serverList should be taken as input
isCurrServerCustom=$(echo ${customServerList} | tr ',' '\n' | grep ${SERVER_NAME} | wc -l)
if [ $isCurrServerCustom -gt 0 ]; then
# add customJavaArg
JAVA_OPTIONS="-Dmy.property=${USERPROFILE}/someDir/someJar.jar"
fi
Save the setDomainEnv.sh file and re-start servers
Note that I have only given logic for Linux , for Windows similar logic can be used but with batch scripting syntax.
Approach 2:
Assuming domain is already installed and user provides the list of servers to which the JVM argument -Dmy.property need to be added. Jython script (use wlst.sh to execute). WLST Reference.
Usage: wlst.sh script_name props_file_location
import os
from java.io import File
from java.io import FileInputStream
# extract properties from properties file.
print 'Loading input properties...'
propsFile = sys.argv[1]
propInputStream = FileInputStream(propsFile)
configProps = Properties()
configProps.load(propInputStream)
domainDir = configProps.get("domainDir")
# serverList in properties file should be comma seperated
serverList = configProps.get("serverList")
# The current machine's logical name as mentioned while creating the domain has to be given. Basically the machine name on which NM for current host is configured on.
# This param may not be required as an input if the machine name is configured as same as the hostname , in which case , socket module can be imported and socket.getHostName can be used.
currMachineName = configProps.get("machineName")
jarDir = os.environ("USERPROFILE")
argToAdd = '-Dmy.property=' + jarDir + File.separator + 'someDir' + File.separator + 'someJar.jar'
readDomain(domainDir)
for srvr in serverList.split(",") :
cd('/Server/' + srvr)
listenAddr = get('ListenAddress')
if listenAddr != currMachineName :
# Only change current host's servers
continue
cd('/Server/' + srvr + '/ServerStart/' + srvr)
argsOld = get('Arguments')
if argsOld is not None :
set('Arguments', argsOld + ' ' + argToAdd)
else:
set('Arguments', argToAdd)
updateDomain()
closeDomain()
# now restart all affected servers (i.e serverList)
# one way is to connect to adminserver and shutdown them and then start again
Script has to be run from all hosts where the managed servers are going to be deployed in order to have the host specific value of "USERPROFILE" in the JVM argument.
BTW, to answer your question in a line : looks like the JVM arguments have to be supplied with the literal text eventually. But looks like WLS doesn't translate the environment variables if provided as JVM arguments. It gives an impression that it is translating when its done from startWebLogic.cmd (ex: using %DOMAIN_HOME% etc.) but its the shell/cmd executor that translates and then starts the JVM.