Get file size by ExtJS - file

how can I get size of a specific file by ExtJS, without using ActiveXObject (as recommended at some website), because my program just only run on Firefox?
Thank you so much!
(More detail: the file I want to get size in on my local, not on remote server)

Your code runs in a sandbox, without extensions like ActiveX you are not allowed access to the file system.

You can use a Flash object. Have a look into SWFUload

Related

Unable to save file changes while using VS Code Remote Container due to "read-only file system"

I'm experimenting with using dev-containers for development by trying to follow along with this simple example: https://github.com/microsoft/vscode-remote-try-python
The setup works fine and I am able to build and connect to the container, and run the app just fine. However, if I try to edit anything and save it, I get an error:
Failed to save 'app.py': Unable to write file 'vscode-remote://dev-container+2f55736572732f62726164656e2e6b696e6172642f706572736f6e616c2f7673636f64652d72656d6f74652d7472792d707974686f6e/workspaces/vscode-remote-try-python/app.py' (Unknown (FileSystemError): Error: EROFS: read-only file system, open '/workspaces/vscode-remote-try-python/app.py')
If I open a secondary window with the local folder open, I can save changes and those are reflected in the remote container window. But due to the file system being set to read-only, I can't edit anything from within the remote container. Any ideas on why I am stuck in read-only?
One potentially important note is that I am using using Colima (version 0.2.2) rather than Docker Desktop, thought I haven't found anything to indicate that this would be an issue.
I found the answer to my own problem. Turns out the issue was using Colima as a runtime. I came across the discussion around issue #102 on the Colima Github page. According to the developer, the default mount "Used to be read-only, but changed to writable in version 0.3.0.". I was using v0.2.2.
I updated colima to the most recent version (v0.4.4) and it fixed the issue for me.

Serilog in UWP is not writing the log in D drive

I am using Serilog in my UWP application. I can write the log in App LocalState folder without any issue.
But now I want to write the logs in D: drive specific folder. I have added the broadFileSystemAccess restricted capability and enabled the full access from the settings.
But still it is not creating the file in the specified location and not raising any error.
Anyone know the fix for this? Thanks in advance.
var file = #"D:\Logs\Serilog.txt";
Serilog.Log.Logger = new LoggerConfiguration().WriteTo.File(file).CreateLogger();
There is a very important information about broadFileSystemAccess capability on the File access permissions document. I'm not sure if you note it.
This broadFileSystemAccess capability only works for APIs in the Windows.Storage namespace.
This point is very important. So, your issue actually is you need to check the LoggerConfiguration().WriteTo.File(file).CreateLogger() relevant method if it write to files by using the Windows.Storage APIs.
By my checking, it uses the StreamWriter method to write to files. But this method is not included in the Windows.Storage APIs. So, the issue was very obvious. You need to submit this issue to Github and let the officials to modify this method and make it work in UWP.
Or, if you're interested in serilog-sinks-file source code, you could download it and make the change by yourself, Then, you could compile a custom serilog library version for your UWP project.

Saving Files in CodenameOne

I'm trying to save some screen dumps to internal storage for debugging purposes, but I can't seem to get access to them. When I call FileSystemStorage.getInstance().getAppHomePath(), I get a path that looks something like this:
/data/data/com.mycompany.myapp/files/
But I can't see this folder in the Android File Transfer tool, so I can't drag the files to my Mac. I also tried attaching them to an email using the Message class, but for some reason the attachments never showed up. I notice that a lot of applications store data in folders like this:
/Android/data/com.doubletwist.androidplayer/
If I try to create a folder like this, I run into two problems. First, it's not platform independent. (This doesn't matter much because I'm just doing this for debugging.) Second, it doesn't work. I get an error telling me I need to use the directory returned by FileSystemStorage.getInstance().getAppHomePath()
Is there any way I can save files to a folder that I can actually retrieve them from? It would be more helpful if I had a platform-independent way, but any way that works is fine for now.
File system is a very "unportable" notion. By default app home is a private folder which some mobile OS's including Android 4+ keep private and inaccessible.
Android has a concept of "sdcard" which used to be a physical storage where you could write anything in any directory without a problem. This is no longer applicable for later versions of Android but you can read from the sdcard directory and detect it.
FileSystemStorage has an API to get roots and their types, if you have an sdcard type you can read from there. You can use the FileTree to see the file hierarchy as exposed to your application which can be useful for debugging.

How Can I View/Open This File?

i am trying to open and edit a file that contains some type of custom protection.
file game :gameguard.des
its from lineage2/interlude/system file.
this is not the original version though, it has been modified to block some packets sent to the server.
i've used VS2010 to open it and it shows me the memory and the contents in hex, like viewing computer memory.
here is the file attached. http://www20.zippyshare.com/v/88173717/file.html
so my question is, how can i open it viewing the code in a higher level and edit it? what tools i need to use to do that?
regards, George
This is a Win32 program. You can try to disassemble it, but it's itself a binary file and what the VS2010 is showing you is correct, because it's showing it most probably in HEX format to you.
You need to first figure out which compiler was used to compile this application, then maybe it helps you to refactor the executable.
The fact that you can not directly run this application might be just the extension, maybe if you change the extension to .exe, it runs under windows. I don't recommend it though.

Grabbing windows file information

In C following this article (http://blogs.msdn.com/oldnewthing/archive/2006/12/21/1340571.aspx), we have succesfully been able to grab the file version information out of windows files however there are some files that seem to have a different mechanism for storing the version information that is not addressed in the article and was wondering if anyone had any ideas here.
One example of a file would be system32/oledlg.dll. Going through the file byte by byte we come to a chunk where the version information SHOULD be stored:
F^#i^#l^#e^#V^#e^#r^#s^#i^#o^#n^#^#^#^#^1.0 (x^#p^#s^#p^#.^#0^#8^#0^#4^#1^#3
^#-^#2^#1^#0^#8^#)^#^#^#^#^#.^#^G^#^A^#I^#n^#t^#e^#r^#n^#a^#l^#N^#a^#m^#e
That we can see is 1.0. However, when you look at the file information in windows the version is actually 5.1.2600.5512. The method in the article works for most files but there are a few instances I have come across where I am running into the above problem. Anyone have any experience with this? I only have access to standard C.
Based on the follow up article posted in the comment, does that mean there is no way to grab the actual file version from a file with a corrupted file info block?
I should also add that I am grabbing the files from a windows box, and then examining them on linux with a C program to grab the file info.
IT turns out the wrong peice of info for that file was being used to get the version, didn't actually need the File Version block but the "VS_VERSION_INFO" block.

Resources