How to erase a section using Jlink script - swd

Currently i use:
erase
loadfile "image.hex"
How can i erase only the section of the image?
the image size is known.

use SetFlashDLNoRMWThreshold 0xFFFFFFFF for read modify write and remove erase from script, this will result in changing only the section we upload an image to

Related

How to add footer to pdf with pdfjam or pdftk?

I am using a shell script to modify many pdfs and would like to create a script that adds the page number (1 of X format) to the bottom of PDFs in a directory along with the text of the filename.
I tried using pdfjam with this format:
pdfjam --pagenumbering true
but it fails saying undefine pagenumbering
Any other recommendations how to do this? I am OK installing other tools but would like this to all be within a shell script.
Thank you
tl;dr: pdfjam --pagecommand '' input.pdf
By default, pdfjam adds the following LaTeX command to every page: \thispagestyle{empty}. By changing the command to an empty command, the default plain page style is used, which consists of a page number at the bottom. Of course you may want to play with other styles or layout options to position the page number differently.

Render the alpha channel into an RGBA .jpg file with 3ds Max and maxscript

I have simple script where I render an object with the following command:
Render camera: $Camera001 outputfile: "test.jpg" outputsize:[1920,1080] vfb:off outputHDRbitmap: true
However, the output file is 24 Bit RGB, I wonder if there is a possibility to render RGBA with the same command or another method with the some simplicity?
I could only find solutions with bitmaps that went over my head.
I would suggest to use PNG with alpha instead of JPG.
The command is totally correct, however as a preparation step you may also need to access PNG settings with maxscript, as you normally do with this PNG configuration dialog:
pngio.setType #true48
pngio.setAlpha true
pngio.setInterlaced false
Complete documentation for pngio you may find here: https://help.autodesk.com/...F08AA370DEB8_htm

Output Items Size GNU Radio Block

I am trying to write a custom GNU Radio block in Python. I have an array of bytes which I am trying to output so it can be written to the file via the file sink block.
When I simply set the output_items to be the data I want to be outputted:
output_items[0] = np.array(data,dtype=np.int8)
It does not work, the file is not the output.
When I do a loop over the size of the output_items, it works fine:
for i in range(len(output_items[0])):
output_items[0][i] = 0
This works. Is there a way to specify the size of the output_items array I want? I thought I could accomplish this by returning the output size of the array but it did not work.
You need to fill in the values in the output buffer, which means overwriting the contents of output_items[0], not overwriting the python element itself.
What'll work is:
output_items[0][:] = np.array(data,dtype=np.int8)

Red has no open function like Rebol?

I want to read 10 lines from the end of a big text file without loading the whole file in memory.
I wanted to try to use Open as explained here for Rebol In Rebol, what is the idiomatic way to read a text file line by line?
But Red doesn't have open function ?
You can try a read/lines/seek/part %yourfile offset blocksize
But I have no clue. You have to test and adapt your offset and blocksize.
Red doesn't have open function yet. Full IO support is planned for 0.7.0. So you have to either wait or use OS calls directly.

Can Mathematica create multi-page PDF files?

When one imports a multi-page pdf file (the file I have in mind contains images of artwork, one per page) into Mathematica 8.0.1 by
book = Import["simple.pdf"]
Mathematica returns a list of graphics objects, one for each page. I have some manipulations I perform on each page, and then want to save the changed pages back into a single PDF file
Export["DistortedSimple.pdf", distortedbook]
the resulting file has all of the images on a single page. Is there a convenient way to export a list of images to PDF, one per page?
It doesn't seem to be possible with Export, no matter how much I play with the Pages element (apart from the notebook-based solutions given by others).
An alternative is to install pdftk (a relatively small command line tool that we'll use to assemble the pages), and use the following Mathematica function:
exportMultipagePDF[name_String, g_List, options___] :=
Module[
{fileNames, quote},
quote[s_] := "\"" <> s <> "\"";
fileNames =
Table[
FileNameJoin[{$TemporaryDirectory, "mmapage" <> IntegerString[i] <> ".pdf"}],
{i, Length[g]}
];
Check[
Export[#1, #2, "PDF", options] & ### Thread[{fileNames, g}],
Return[$Failed]
];
If[
Run["pdftk", Sequence ## (quote /# fileNames), "cat output", name] =!= 0,
Return[$Failed]
];
DeleteFile /# fileNames;
]
On Windows I needed to quote the file names before passing them to PDFtk. I don't know about other platforms, hopefully it won't cause any trouble.
Try it with
exportMultipagePDF["test.pdf", Table[Graphics[{Hue[x], Disk[]}], {x, 0, 1, .2}]]
(Hi Kevin!)
I just evaluated:
Print[ExampleData[#]] & /# Take[ExampleData["TestImage"], 6]
Export["Desktop/Kevin.pdf", EvaluationNotebook[]]
using V8.0.1 for OS X, and the resulting PDF was split into four pages. So I think you best approach is to (programmatically) create a notebook of your modified images, and export that notebook.
Try saving the notebook as PDF rather than Exporting the set of cells as a PDF.
EDIT:
To ensure you have your page breaks where you want, set Screen Environment to Printing (you can do this via a menu command or programmatically), and insert page breaks using the relevant menu command. This guide page might be helpful.
From your comment, it sounds like you need to set the ImageSize option for the transformed image to ensure it is the size you want when displaying onscreen.