How to use jplayer.swf, jplayer.js in a local disk, not in a web page - jplayer

If I put Jplayer.swf, jplayer.js and .mp3 files in a local disk, for example "d:\mypage\MP3.mp3", "d:\mypage\JS\jplayer.js", "d:\mypage\JS\Jplayer.swf" and "d:\mypage\mypage.htm",
swfPath = ¿?
I've tried many many different swfPath, but any of then work neither IE 8 nor FF
Can work in any way this configuration (in a local disk)?

You should be able to use the relative path:
swfPath = ".JS/Jplayer.swf";

Related

Is there a way to use location instead of saving file content when working with Asset\Image?

Im struggling with Asset\Image. Is there a way to prevent given image from saving on disc and read from given location instead?
Currently Im creating Image like so
$asset = new Asset\Image();
$asset->setFilename($location);
$asset->setData(file_get_contents($location));
$asset->setParent(Asset::getByPath("/"));
$asset->save();
And obviously it gets saved on in the public/var folder.
Unfortunatelly I cannot afford to do so, because there is like hundreds of GBs of photos.
Is there a way to use location to save and later read image content from saved location?
I think this is not possible by php. You can achive your goal by saving all assets in another location and than replace the public/var folder with a symlink
mkdir /your/asset/storage
cp public/var/assets /your/asset/storage
Danger zone starts here, be sure to have a good backup of all assets
rm -r public/var/assets
ln -s /your/asset/storage public/var/assets
This is only an example and might differ on your system
What was your idea to save disk space? The file takes space anyway, on the disk directly or on the disk managed by Pimcore.
If you have hundreds Gb then check please if those images are Assets or their versions (created on each save).
If they are versions then you have options:
limit versions amount/time (see System Settings -> Assets) or in pimcore/system.yml
pimcore:
assets:
versions:
days: null
steps: 3
disable versioning before to save
Version::disable();
$asset->save();
Version::enable();
And remember that one day you can grow big and need more then 1 fileserver. Pimcore Assets can already manage that, but how will you synchronise assets files?

Heroku cannot store files temporarily

I am writing a nodejs app which works with fonts. One action it performs is that it downloads a .ttf font from the web, converts it to a base64 string, deletes the .ttf and uses that string in other stuff. I need the .ttf file stored somewhere, so I convert it. This process takes like 1-2 seconds. I know heroku has an ephemeral file system but I need to store stuff for such a short time. Is there any way I can store my files? Using fs.writeFile currently returns this error:
Error: EROFS: read-only file system, open '/app\test.txt']
I had idea how about you make an action, That would get font, convert it and store it on a global variable before used by another task.
When you want to use it again, make sure you check that global variable already filled or not with that font buffer.
Reference
Singleton
I didn't know that you could store stuff in /tmp directory. It is working for the moment but according to the dyno/ephemeral system, it gets cleaned frequently so I don't know if it may cause other problems in the long run.

Force Reponsive FileManager to Use thumbs_base_path

Usually when Responsive FileManager is opened, the thumbnails it uses are retrieved from the $thumbs_base_path folder (configured in config.php). However, in some cases (usually for very small files) the images are taken directly from their original path. This poses some complications for my project. Is it possible to force it to always use $thumbs_base_path?
Figured it out, it's controlled from dialog.php in the root folder of RFM. Here is the "offending" code:
if($img_width<122 && $img_height<91){
$src_thumb=$current_path.$rfm_subfolder.$subdir.$file;
$show_original=true;
}
if($img_width<45 && $img_height<38){
$mini_src=$current_path.$rfm_subfolder.$subdir.$file;
$show_original_mini=true;
}
Commenting this out completely resolves the problem, but of course it's also possible to play with the settings/directories.

WinSCP - Do not synchronize subdirectories

I am writing winscp script in VBA to synchronize certain files from remote to local.
The code I am using is
""synchronize -filemask=""""*.xlsx"""" local C:\Users\xx\Desktop /JrnlDetailSFTPDirect""
There are three xlsx files: 14.xlsx, 12.xlsx, 13.xlsx. However, seems like it is running through all the files even though it is not synchronizing them. Besides, one folder under JrnlDetailSFTPDirect is also downloaded from remote, which is not expected.
Is it possible to avoid looping through all the files, just selecting those three files and downloading them?
Thanks
There are separate masks for files and folders.
To exclude all folders, use */ exclude mask:
synchronize -filemask="*.xlsx|*/" local C:\Users\xx\Desktop /JrnlDetailSFTPDirect
See How do I transfer (or synchronize) directory non-recursively?
I cannot tell anything regarding the other problem, as you didn't show us names of the files. Ideally, append a session log file to your question. Use /log switch like:
winscp.com /log=c:\writablepath\winscp.log /command ...

Where/How to save a preferences file in a *nix command line utility?

I am writing a small command line utility. It should hopefully be able to run on OSX, UNIX and Linux.
It needs to save a few preferences somewhere, like in a small YAML config file.
Where would one save such a file?
Language: Python 2.7
OS: *nix
Commonly, these files go somewhere like ~/.rc (eg: ~/.hgrc). This could be the path to a file, or to a directory if you need lots of configuration settings.
For a nice description see http://www.linuxtopia.org/online_books/programming_books/art_of_unix_programming/ch10s03.html
I would avoid putting the file in the ~ directory only because it has gotten totally flooded with crap. The recent trend, at least on ubuntu, is to use ~/.config/<appname>/ for whatever dot files you need. I really like that convention.
If your application is named "someapp" you save the configuration in a file such as $HOME/.someapp. You can give the config file an extension if you like. If you think your app may have more than one config file you can use the directory $HOME/.someapp and create regular-named (not hidden) files in there.
Many cross-platform tools use the same path on OS X as on linux (and other POSIX/non-Windows platforms). The main advantage of using the POSIX locations isn't saving a few lines of code, but saving the need for Mac-specific instructions, and allowing Mac users to get help from the linux users in the community (without any need to translate their suggestions).
The other alternative is to put them in the "Mac-friendly" locations under ~/Library instead. The main advantage of using the Mac locations is basically "Apple says so"—unless you plan to sandbox your code, in which case the main advantage is that you can do so.
If you choose to use the Library locations, you should read About the OS X File System and OS X Library Directory Details in the File System Programming Guide, but here's the short version:
Almost everything: Create a subdirectory with your app's name or bundle ID (unless you're going out of your way to set a bundle ID, you'll get org.python.python, which you don't want…) under ~/Library/Application Support. Ideally you should use APIs like -[NSFileManager URLForDirectory:inDomain:appropriateForURL:create:error:] to get the path; if not, you have to deal with things like localization, sandbox containers, etc. manually.
Anything that can be easily re-created (so it doesn't need to be backed up, migrated, etc.): An identically-named subdirectory of ~/Library/Caches.
Preferences: Use the NSUserDefaults or CFPreferences APIs instead. If you use your own format, the "old" way of doing things is to create a subdirectory under ~/Library/Preferences named with your app's name or bundle ID, and put your files in that. Apple no longer recommends that, but doesn't really recommend an alternative (short of "use CFPreferences, damnit!"); many apps (e.g., Aquamacs) still do it the old way, but others instead pretend they're not preferences and store them under Application Support.
In Python, this works as follows (leaving out the error handling, and assuming you're going by name instead of setting a bundle ID for yourself):
from Foundation import *
fm = NSFileManager.defaultManager()
appsupport = (fm.URLForDirectory_inDomain_appropriateForURL_create_error_(
NSApplicationSupportDirectory, NSUserDomainMask, None, True, None)[0].
URLByAppendingPathComponent_isDirectory_(
appname, True))
caches = (fm.URLForDirectory_inDomain_appropriateForURL_create_error_(
NSCachesDirectory, NSUserDomainMask, None, True, None)[0].
URLByAppendingPathComponent_isDirectory_(
appname, True))
prefs = NSUserDefaults.persistentDomainForName_(appname)

Resources