Uploading a file using TCL - tcl

I'm a newbie working on OpenACS architecture and need to upload a .xml file through TCL. I went through the documentation and tried to work around with the code mentioned here: http://wiki.tcl.tk/13675
However, I'm unable to understand the code and the copy-paste won't work. Could someone please suggest a easier working way to upload a file in TCL? A working code would be of great help.
I need to upload a file through a HTTP form(with input type file parameter) and I'm asking for server-side code.

OpenACS already has file uploading built in (assuming you're using the OpenACS form builder aka ad_form, template::form - it has many names!). The specific widget you need to use is template::widget::file
A worked example is in the General Comments package (see file-ae.adp, file-add.tcl and file-add-2.tcl):
http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-ae.adp?r=1.6
http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-add.tcl?r=1.4
http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/general-comments/www/file-add-2.tcl?r=1.6
Specifically, look out for the 2 ad_page_contract parameters, and follow those variables down through the code:
upload_file:notnull
upload_file.tmpfile:tmpfile

Re-inventing network protocols is not so much worth in most cases, so I'd like to recommend using proven community libs. From my personal experience, I'm pretty glad to deal with libcurl (see http://curl.haxx.se/libcurl/tcl)

Related

Convert custom tiny-YOLOv3 to a tensorflow format

After having tried all solutions I have found on every github, I couldn't find a way to convert a customly trained YOLOv3 from darknet to a tensorflow format (keras, tensorflow, tflite)
By custom I mean:
I changed the number of class to 1
I set the image size to 576x576
I set the number of channels to 1 (grayscale images)
So far I am happy with the results on darknet, but for my application I need TFlite and I can't find working method for conversion that suits my case.
Anyone have succeed in doing something similar?
Thank you.
Do you have the resulting .weights file for your custom model?
If so, the following project by peace195 may help:
https://github.com/peace195/tensorflow-lite-YOLOv3
EDIT:
In the above link, use convert_weights_pb.py file to convert your .weights file to a .pb file.
Then use the .pb file as a saved model and convert it to a .tflite model using the following command.
tflite_convert --saved_model_dir=saved_model/ --output_file yolo_v3.tflite --saved_model_signature_key='predict'
Thanks Anton Menshov for your suggestion on improving the answer.
This is the most simplest and easy repo. Author has done a wonderful job and it works well with yolov3, yolv3-tiny and yolov-4. Please don't forget to change the coco.names under classes if you are training on custom classes.
Git link for the code

'refactor' move files in VSCode - es6

If I move ComponentFoo.js from folder X to folder Y, than a bunch of import statements break. Looking into this it seems there are many solutions for typescript, but what about js / es6? If I move a file in the editor, it should find all the import statements and update them to the new location. Is this possible?
Old post, but this might help some Googlers. This feature can be enabled and disabled in User Settings. For Javascript and Typescript, it's called "Updated Imports On File Move".
I had apparently disabled it and just figured the feature was broken :X
VS Code has built-in support for this for both javascript and typescript since VS Code 1.24.
For JavaScript specifically, you need to make sure VS code's language support can find all the references to the file so that imports referring symbols in that can be updated properly. Definitely create a jsconfig.json for your project, and also consider enabling semantic checking for JavaScript so that VS Code shows when imports are not being properly resolved
If your project is configured properly but files are not being updated, make sure you are running the latest VS Code insiders build and report an issue if it still doesn't work
for flutter developers you should move files one by one. vscode doesn't support multi file moving with refactor yet.
Just use IntelliJ. It handles all kinds of refactoring perfectly. I'm a huge fan of VS Code, but refacotoring is definetly not one of it's stengths. Some imports don't get detected, and the imports can get modified in a weird way. For example, I had an import like this:
import { myStore} from 'src/common/stores/myStore';
When moving the file of myStore.ts to a different folder, VS Code constructed this bull**it:
import { myStore} from 'src/common/composables/myStoreStore';
The line above is no typo!
Btw I'm using vetur, maybe thats causing it, I don't know ...

Is there an example of how to do a XAdES-BES enveloped signature with the XAdES4j library?

I'm trying to use the XAdES4j library to sign xml with an enveloped signature. From everything I've read it looks like it is possible to do exactly what I'd like to do, but I've not been able to find a simple example to help me to understand the workflow better. The library is found here:
https://github.com/luisgoncalves/xades4j
It includes a wiki, but the wiki does not give a clear example. It refers you to the unit tests in the code. However, in the code for the unit tests, there are numerous methods that do not exist in the main code stream. I'm looking for a simple example for a XAdES-BES enveloping signature to be added to xml given these variables:
The path to my xml file: /path/to/xml/myXmlFile.xml
The root element in my xml file: invoice
The path to my cert: /path/to/cert/myCert.p12
Password to my cert: "myPassword"
Can anybody help me out with a clear example?
Thanks so much in advance :)
Here's a full example provided by another user within an issue in GitHub. It illustrates both XAdES-BES and XAdES-T.
On the project's wiki you have detail instructions on which classes need to be used and pointers to more detailed information.
Regarding the unit tests, there are some common/helper methods on the base classes that can be useful in other scenarios, namely on SignatureServicesTestBase and SignerTestBase
Hope this helps.

Class file editor : Source not found error for ILock, ClassPathSuite classes

I am getting Class file editor : Source not found error for the classes in junit / hazelcast packages. Previously i got this error for all built in java classes. But after adding the Source zip file, i am able to see String.class and all. What i need to do for these classes. Please find the screenshot
Thanks in Advance!
Interestingly enough, your question contains all the concepts you need to know in order to answer it.
In order for your IDE to show you source code for any library you are using, the corresponding library needs to come with source code attached to it.
In other words: you managed to point your IDE to the ZIP file containing the source code for your JRE/JDK - thus your IDE knows what to show you when want to open up String.class
Now it seems that you are using other libraries as well. Maybe maybe, other libraries, have other, different source code ZIP files?!
Long story short: you need to add "source code" ZIPs for each and any additional library you are using and that you want to "peek into".
Within eclipse, you achieve that for example as described in that SO q/a. Side note: that is also something to keep in mind: you should do prior research before coming up with "new" questions. Especially when you are a beginner, you can be very sure that "your" question was asked here before.

How to setup limeJS in a totally offline workspace

I'm trying to setup limeJS, the issue is the Internet connection is a problem. I had closure library, box2d, closure compiler and closure templates downloaded separately as .rar files, but I can't find a guide anywhere to set it up like this, everyone just uses(and with reason!!!) the python bin/lime.py init command to get it working. I managed to figure out(yay!) how to setup box2d and closure library but what about the other two?
My laptop is running 64 bits Windows 7. Any help appreciated
All I need is an advice on directory structure, like where to drop the compiler.jar and soy templates .js files, so that when I run the update/create command it doesn't try to download the compiler or templates like it does right now.
I got it working, after taking a quick look at the lime.py file it told me everything I needed, for example both the SoyJs templates file and the compiler need to be in the /path/to/lime/bin/external folder and for example, the lime.py file was expecting a compiler file named compiler-dateOfLatestCompiler.jar instead of compiler.jar.
In general, If you have LimeJS built up in one machine using Python and all, you can just copy paste the whole package anywhere you want and use it just as ususal.
You don't need network once you have all the files/codes for Lime is downloaded.
Infact, you dont even need python for normal development tasks(Python is required to build your js file once you complete development though)