How we can write in a file through a j2me code? - java-me

How we can write in a file through a j2me code ?

Does your J2ME support JSR-75? If so, see here

http://developers.sun.com/mobility/apis/articles/fileconnection/
this is he JSR75 spec, basically it just means to create a connector (FileConnectoion) and open a stream, once you hve it you can do various operation with hte file like chance to hidden, delete, create open etc..
If JSR-75 does not exists on the device (rare these days) your ownly options for storage is RMS, and if you want just to read files you have in your application you can use class.OpenResourceasStream(resname);

Related

Azure Media Services: Provide custom file names for the asset files

I'm encoding a video file using the built-in adaptive streaming transform. Once the file is successfully processed, an asset container is created with the below files:
Is it possible to provide custom file names at the time a job is created? It seems that the default behavior is to take a certain number of characters from the original file name and prepend them in the above file names. If possible, I'd like to configure this behavior.
P.S. I'm using the .NET SDK.
You can create a custom transform to output file names differently. On https://learn.microsoft.com/en-us/rest/api/media/transforms/createorupdate#definitions search for the Mp4Format section. In that you can specify the filenamePattern with certain macros like {Bitrate} and {Codec}.
See https://learn.microsoft.com/en-us/azure/media-services/latest/custom-preset-cli-howto for an example custom transform and the process by which to create it in Media Services.
I use the macros on my jobs, they work ok. I have a process that takes 3 videos (an intro section, the actual content, and the outro section) and encodes them as one single video. The issue I have with the macros is that it uses the file name of the first video in the inputs. So it ends up using the file name of the intro video which is a generic name. They need to have a way where we can have a little more control.
I suppose I could copy/rename the intro video to a desired name before I encode and it would pick it up, but that seems to be a little bit of overkill.
The Macros are good, but they could use some enhancements I think.

Updating the version info of a CHM file during compile with Inno [duplicate]

I need to add version info and retrieve it from the CHM file to make it possible to make an alert message to a user about a new CHM-file version available and downloaded.
It means, that I should compare versions of CHM on different machines (Server and clients).
The other way is date and time checking, but I should remember about time zones, so this is complicated, because also one should remember about different file systems, according to Windows SDK help about SetFileTime function and FILETIME structure.
If someone knows the trick - please share.
.chm files don't have version information. You will need to find some alternative way to mark the file version.
One way that occurs to me is to include a topic in the help file that contains the version. I imagine that this topic would be hidden, that is not linked by any other topic, not in the table of contents, etc.
All that remains is for your application to be able to read that topic from the help file. I'm sure that can be done with a .chm file parser, if you can obtain one. Perhaps more easily you can get the platform browser to read the topic for you. You can use IHTMLDocument2 to read a URI like this:
mk:#MSITStore:C:\somedir\somefile.chm::/html/SomeTopic.html

Can I write to a text file from a button in xPages?

I have an xPages application that needs to write a text file to a folder on my network. I'm not sure if it's even possible from an xPages application?
If it is, can someone give me an idea how to go about this?
POI4XPages can write views etc to CSV files https://poi4xpages.openntf.org/. I've previously used OpenCSV, and Apache-licensed Java library to import from a CSV file, but it also allows exporting. I use it regularly to preload data for session databases like for my session at Connect 2016. CommonsCSV has subsequently been released, which would replace OpenCSV.
Yes you can. The easiest way is to create a Java class that does what you need (and test it from the command line). In a button, which is server side JavaScript, you can instantiate that class and write out.
You might need to handle security setting (e.g. deploying your class in a jar file into [DominoAppDir]/jvm/lib/ext) to be allowed to have network access. If you rather keep the class in the nsf, you might need harder measures.
Let us know how it goes
I just created a simple class that created the file and wrote to it. Worked like a champ
Thanks all!

File association and thumbnail preview in Windows 10

I have created an application and associated on registry a file extension on Windows 10, so when you double click a file associated with my extension, it opens my app with the file as parameter.
Now, I want the files associated to my application to behave in Windows 10 just like images - I mean, having a thumbnail preview, so when the user selects "large icons", he would be able to see a preview of the file.
I wonder how can I do it. What kind of metadata my file should have so Windows would recognize it and show a preview. Of course, I don't want just large icons, I want a file preview just like image files.
It isn't hard for me to generate a preview bitmap and integrate it to the file format I created (or even to change the file format completely, since I didn't publish anything yet), but how would windows recognize it? Is this even possible?
Thanks in advance
After some research, I found a sample code that does exactly what I need. It creates a thumbnail provider, which have access to the file's contents (binary), and then I can use it to generate the thumbnail of the file.
The sample that creates a IThumbnailProvider can be found here:
https://code.msdn.microsoft.com/windowsapps/CppShellExtThumbnailHandler-32399b35/view/SourceCode#content
The project should generate a dll, that we should register on Windows. It might be done using the following lines:
system32/regsvr32 ThumbnailProviderx64.dll
syswow64/regsvr32 ThumbnailProviderx86.dll
unregistering is like this:
system32/regsvr32 /u ThumbnailProviderx64.dll
syswow64/regsvr32 /u ThumbnailProviderx86.dll
Another nice sample could be found at:
http://www.codemonkeycodes.com/2010/01/11/ithumbnailprovider-re-visited/

play a dynamic sound file in asterisk musiconhold

I have used asterisk MusicOnHold with that I have to point a particlar folder in musiconhold.conf and during the execution all the tone inside that folder are played for all the users.
But now I have to play a specific sound file for each user uploaded by them.My problem is that how can I play this file for user.Because if he uploads a sound file then I have to manually create a class in musiconhold.conf pointing to that folder the do moh reload.
I just want to automate the things to the user just uploads the sound file and during the call of that user in extensions.conf I can point to that sound file and it will be played without reload or adding context in musiconhold.conf everytime.
For ex. the way Playback(pathToSoundfil) works which takes tone path directly is there any function like in musiconhold for directly passing the sound file?
Thanks
You can do as many section in your musiconhold file as you want.
After that you can use thoose class
No, you can't change classes without reload res_musiconhold
However you can use asterisk realtime architecture and put whole config into mysql. Still need do script which will do reload.
If you want 100% realtime solution, you can use conference and play into same conference any file. Just create enother call to conference which play file. This variant require expert level in asterisk.

Resources