Google drive: Get (root) file and folders with javascript api (get only deleted files on drive) |
Same situation as following question:
google drive api, javascript list files returns nothing
I needed to add to the scope the path 'drive' at authorizing, I had only
drive.file which is intent to create/edit files only. The weird thing is
that the API returns deleted files when you don't have permissions to view
files, I think it's a bug in the API (a serious one).
Post this bug on google drive:
https://productforums.google.com/forum/#!searchin/drive/security$20issue$20permission$20view/drive/pupjKxTz9FU/cUarGIl_Ah0J
|
I am trying to start an office program on a flash drive with a batch file |
I think some of the directory names in %path% contain spaces and since
%path% is not enclosed within ""( double quotes), the script is unable to
find the exe .
You may also want to include a log file so that it becomes easier to debug
in case of any errors.
Try this:
set baseFolder=%~dp0
start "%baseFolder%office6wpp.exe" > "%baseFolder%batchRunLog.log"
|
Understanding flash file system wear in append mode |
Most flash file systems will have built-in wear leveling systems, so that
the same section of flash isn't used over and over again.
And appending shouldn't be a problem as (I hope) the will not "wear" on
writing new data when it stores the information - you only get wear on
"erase" cycles, which only happens when you delete the file [and the
sectors the file was in needs to be rewritten with new data - no point in
erasing the content if it's not going to be replaced].
And to answer your actual question, it is better to use append mode than to
write another new file. At least you are not "wearing" the part of the file
that has already been written - and fragmentation shouldn't be a problem
when it comes to flash - it takes exactly the same amount of time to access
byte 0, 1, 1000 and 10
|
Listing a File System's Root Directories? |
With plain Java NIO:
public static void main(final String[] args)
{
// This will give u all Root Directories. Like: C:, D:, ...
final Iterable<Path> rootDirs =
FileSystems.getDefault().getRootDirectories();
for (final Path rootDir : rootDirs)
{
if (rootDir.startsWith("C:") == false)
continue;
// This will loop through every of this root directories
try (DirectoryStream<Path> stream =
Files.newDirectoryStream(rootDir))
{
for (final Path file : stream)
{
System.out.println(file.getFileName());
}
}
catch (IOException | DirectoryIteratorException x)
{
System.err.println(x);
}
}
}
|
System.Diagnostics.Process unable to launch file from Mapped Drive in Windows Form App |
I tested your code and it runs properly for me. The only way I could
reproduce your error is by running it with an unmapped drive (Changed to
z: ext.txt which is not mapped).
Make sure that the computer RUNNING the program has the specified mapped
drive on their computer. Just because the program may reside on a server
and the server has the required mapped drives, doesn't mean that the
clients running the program have the same mapped drives.
|
How can I add or remove any files into and from initramfs root file system? |
How is your kernel/initramfs build ? Is it Buildroot or ptxdist or similar
tool ?
You need to know what is done during the compilation/build phase, maybe
there is a skeleton elsewhere and you need to add your flash dir into this
skeleton.
|
Preferred location for PID file of system daemon run as non-root user |
Nice question :), I'm having exactly the same at moment. I'm not sure if
this is the correct answer but I hope it helps and I would appreciate
feedback as well.
I've googled around and found that registering the per user daemon as a
dbus service is an elegant solution. dbus could make sure that the service
runs just once. no need for a pidfile.
Another solution (my current) would be to create the PID file in a
directory like:
$HOME/.yourdaemon/pid
After your comment I realized, that you cannot write to home. I would
suggest to look into dbus
Update
I have an idea. What if you are using /tmp, but looking for a pidfile which
is called yourdaemon.pid.UNIQUE_KEY and is owned by the daemon's user? This
should work fine.
UNIQUE_KEY should be random generated (preferred is using tempnam a
|
Where to put USB Flash Drive detection in WPF, MVVM |
I would leave it in MainWindow.xaml.cs. If you need to overwrite WndProc
it's tightly related anyway and it belongs to some "system interface" which
normally doesn't belong to your view-model or model. Also, there's nothing
wrong with using code behind.
Well, it may be only a personal opinion.
|
Python off a Flash Drive, how to start IDLE? |
It can not be guaranteed this is possible unless you have high enough
system privileges that you can change the global path. There is really no
way around this on most computers that you do not own, which I imagine is
the main purpose. In those cases when you have enough privileges (it is
worth a try some systems still allow this for regular users but many others
do not) you can use:
setx PATH "%path%;yourpath"
edit and ps:
You can figure out the drive letter without input, if you know the disk
label, with something like this:
@echo off
set label=DRIVENAME
set cmd=WMIC logicaldisk WHERE volumename^^="%label%" GET caption
FOR /F "tokens=1" %%G IN ('%cmd% ^| find ":"')DO set pydrive=%%G
echo %pydrive%pathtopython
rem do your stuff here
the idle started inside the batch will inherit
|
How to invoke flash messages defined in locales |
Try the I18n.t helper
flash[:error] = t('.my_message')
Or, if that doesn't work, use full path:
flash[:error] = t('post.show.my_message')
|
Installing TFS on a non-system drive |
TFS stores it's data in SQL Server. So wherever SQL Server hosts it's data
files (MDF/LDF) is where the TFS data will be located.
Note: You don't have to "install" SQL to your data drive, you just have to
make sure it's configured to place the SQL Server data files there.
If your databases have already been created you can also move the existing
data files using SSMS.
|
How do I create & edit a spreadsheet file on google drive using Google Drive APIs only from my Android app? |
You should take a look at Google Spreadsheet API 3.0. It supports JAVA
which you can use in your Android application.
|
Gaining access to system drive |
I would try to put the file in the jar as a resource, retrieve an
inputstream to it with Class.getResourceAsStream() and write the stream to
a File.
BTW, interesting idea to include .exe as resource in jar. But they only run
on Windows, so how provide the same functions on other operating systems?
|
Google Drive sdk for android, Getting error 400 Bad Request when uploading file to Google Drive |
You seem to be setting the mime type in the File object, but you need to
set it in the FileContent object.
When you create your file content, you can try passing in the type in
the constructor new FileContent("image/jpeg", localFile); or using the
method setType("image/jpeg"); but in your mediaContent instance, not in
your body instance.
|
Default colorscheme loads prior to user-defined one causing "flash" |
What you see is the visual bell and yes, the colors are reverted. See :help
'visualbell'.
To disable it, put that line in your ~/.gvimrc:
set vb t_vb=
|
How to identify system hard drive using Win32_DiskDrive |
The documentation you linked has the answer:
string SerialNumber;
uint32 Signature;
Your management object will have those properties in it.
If you're getting null for those values then the problem is that you're
using a version of Windows that doesn't support them.
SerialNumber
...
Windows Server 2003 and Windows XP: This property is not available.
In which case you have to use the Signature property, but this requires XP
SP3 I believe.
|
Google Drive SDK System.Net.Http.Primitives Version 1.5.0.0 instead of 2.1.10.0 |
Please follow our instructions in the Build wiki page. I recommend you to
use NuGet to get the 3rd party packages (including Microsoft.Net.Http
package)
|
How to get relative path of files from defined root directory? |
That would be os.path.relpath():
>>> import os
>>> filename = "C:/test/media/blog_images/2013/06/15/yay.gif"
>>> blog_images = "C:/test/media/blog_images/"
>>> os.path.relpath(filename, blog_images)
'2013\06\15\yay.gif'
|
Flash AS3 Loading XML from server (from Flash Pro AND Flash Builder) |
For anyone else having this problem, I was talking to people from beanstalk
and it seems that I was just doing it wrong. I was trying to use the
repository for version control and hosting the assets when really
subversion repositories should only be used for backing up your files and
versioning. I went with Amazon S3 which is basically exactly what I was
looking for, a spot "in the internet" where I could drop my swf, xml,
image, sound files and have a path generated for my games to reference. It
ended up looking something like this:
_xmlPath = "https://s3.amazonaws.com/xmlFiles/1234235/explosion_guy.xml";
|
file system that is platform independent and where i receive any changes made to the file system |
The Java NIO API can do this, and is already platform independent
http://docs.oracle.com/javase/tutorial/essential/io/notification.html
|
PHP Distributed File System, File System for downloading from Network Storage |
Network file system, using PHP and MongoDB
http://verens.com/2014/11/06/distributed-file-storage-using-php-and-mongodb/
|
debootstrap accessing original root system chroot jail |
I need to invoke scripts.py of /home/ubuntu in the jail with restricted
jail user,
You said that scripts.py is located in /home/ubuntu/online_judge, which is
NOT in the /Jail. So, either you have the jail user restricted to /Jail or
not. If the restricted jail user should execute online_judge/scripts.py
you'd have to make it accessible somewhere under /Jail.
The Jail user should never be able to access any of the /home/ubuntu
files except
input_output/input*txt which i can give then execute permission
Hardlinks may help, e.g. "ln /home/ubuntu/online_judge/scripts.py
/Jail/scripts.py", now the restricted jail user has access to scripts.py
via /Jail/scripts.py. Be sure to restrict write-access to that file,
otherwise s/he would modify both "copies".
|
Reading XML Into A DataTable - System.Xml.XmlException: Root element is missing |
The problem I was having is that the Input Stream was empty. I was copying
the stream to a MemoryStream earlier:
MemoryStream memStream = new MemoryStream();
using (Stream s = file.PostedFile.InputStream)
{
s.CopyTo(memStream);
}
In the case of xml docs, this wasn't necessary (it was being used for
excel), so I simply only did this if the uploaded file was xls or xlsx.
|
Windows Phone System.XML.XMLException: Root Element is Missing |
So there is definitely something wrong with the XML formatting. It passed
the XML validator's, I used three different ones, but I still can not get
the older code to work. I used my source control to pull back an older
version and it still doesn't run. I am leaning towards blaming Visual
Studio now, I am running the 2013 preview and that's the only variable I
did not test. I do want to find a way to make the older method work so if
anyone has something that hasn't already been tried happy to keep going.
This method takes a significant longer time to load in terms of user
experience. I did get it working. Here is what I had to resort to as far as
reading the XML.
try
{
XDocument xdoc = XDocument.Load("cards.xml");
var cards = from c in xdoc.Descendants("
|
Open root owned system files for reading with python |
One option would be to do this somewhat sensitive "su" work in a background
process that is disconnected from the web.
Likely running via cron, this script would take the root owned log files,
possibly change them to a format that the web-side code could deal with
easily like loading them into a database, or merely unzipping them and
placing them into a different location with slightly more laxed
permissions.
Then the web-side code could easily have access to the data without having
to jump through the "su" hoops.
From my perspective this plan does not seem to violate your contractual
rules. The web server config, permissions, etc remain intact.
|
Can't override method (Flash Builder) - #1065 Variable Override is not defined |
I solved it myself, kind of an strange error, but oh well. I had to press
the cross icon that says "Remove Launch" and "Remove All Terminated
Launches" next to the stop icon in the console tab. I even restarted my PC,
tried project>clean, and restarted Flash Builder several times but only
that fixed it. I leave this here just in case anyone meets the same error.
|
Cannot convert from 'System.Type' to myself defined interface |
typeof(T) returns a Type object that has meta information about the class
that is represented by T. SomeMethod is looking for an object that extends
IExportable, so you probably want to create an object that is a T which
extends IExportable. You have a few options to do this. The most straight
forward option may be to add the new constraint on your generic paramter
and use T's default constructor.
//Notice that I've added the generic paramters A and T. It looks like you
may
//have missed adding those parameters or you have specified too many types.
public static A SomeAction<A, B, T>(IList<T> data) where T :
IExportable, new()
{
T tType = new T();
IList<B> BLists = SomeMethod(tType);
//...
}
I've explicitly stated the type of tType to better illustrat
|
how to fix openerp error "No such external ID currently defined in the system " |
I presume you are referencing the group base.group_tool_manager in your
code or in a module you depend on. A quick search of my OpenERP 7 install
shows this group is added by the subscription module so if you are going to
use this group, you need to add a dependency to the subscription module in
your module's __openerp__.py depends list.
|
System.Xml.Xsl.XslLoadException: Prefix 'xmlns' is not defined |
You need to remove "xmlns" from the list of "exclude-result-prefixes" here,
as it is not actually a namespace prefix at all. It is a reserved word used
to declare namespaces.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:ms="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="#default msxsl user ms xsl">
From the looks of it, you may need to remove 'user' too.
|
Converting com.google.api.services.drive.model.File to java.io.File |
No, you it doesn't seem like you can convert from
com.google.api.services.drive.model.File to java.io.File. But it should
still be possible to generate a multipart-form POST request using your data
in Drive.
So the com.google.api.services.drive.model.File class is used for storing
metadata about the file. It's not storing the file contents.
If you want to read the contents of your file into memory, this code
snippet from the Drive documentation shows how to do it. Once the file is
in memory, you can do whatever you want with it.
/**
* Download the content of the given file.
*
* @param service Drive service to use for downloading.
* @param file File metadata object whose content to download.
* @return String representation of file content. String is returned here
* b
|
delete a file from local drive after successful upload to ftp using batch file |
You need to redirect the output of the FTP command. Check for a succesful
message and act upon it.
I can't provide an exact script, because it will depend on the FTP command
you actually use, but the idea is like this.
echo open Host Name >%temp%ftpin.txt
echo user_name >>%temp%ftpin.txt
echo password >>%temp%ftpin.txt
echo put user_input.csv >>%temp%ftpin.txt
echo bye >>%temp%ftpin.txt
ftp -n -s:%temp%ftpin.txt >%temp%ftpout.txt
for /f "tokens=* skip=9" %%a in (ftpout.txt) do (
if "%%a"=="226 Transfer complete." (
del user_input.csv
)
)
EDIT: You will have to adjust your BAT to the actual output of your FTP
script. Probably you will need to change the "skip" parameter of the FOR
command.
|
c# convert from System.Reflection.FieldInfo to user defined type |
Use FieldInfo.GetValue() method:
listPt.Add((Point)field.GetValue(this));
|
knockoutjs calling function which is defined in sub-viewModel from root-viewModel |
This is not working because fnTest() is not declared in the "View", but in
its "data". It works using:
self.views()[1].data.fnTest()
See here: http://jsfiddle.net/LJBqp/
|
Multiple File Upload With ProgressBar in Flash Action script with preview of image and individual progress bar for each file |
You have the array of FileReferences, and you do not have an array of
progress bars. So, to answer your questions:
To add a set of progress bars, declare a class (say a MovieClip base, but a
Sprite can do), name it say MyProgressBar, define visuals etc, define a
function that will adjust it, and add an instance of it to a set like this:
var myBars:Vector.<MyProgressBar>;
function fileSelectHandler(event:Event):void {
for (var i:int=0;i<fileRef.fileList.length;i++){
++totalFiles;
var myNextBar:MyProgressBar=new MyProgressBar();
myNextBar.y=i*MyProgressBar.theHeight;
myBarHandler.addChild(myNextBar);
myBars.push(myNextBar);
uploadSingleFile(fileRef.fileList[i]);
}
}
This way each element in fileRef.fileList will
|
System.IO.FileLoadException: Could not load file or assembly 'System.Data.SQLite |
The assembly cannot be located due to a HintPath declaration in your
.csproj file:
<Reference Include="System.Data.SQLite, Version=1.0.88.0,
Culture=neutral, PublicKeyToken=db937bc2d44ff139,
processorArchitecture=x86">
<HintPath>E:Developer
SoftSQLitesqlite-netFx20-binary-bundle-Win32-2005-1.0.88.0System.Data.SQLite.dll</HintPath>
</Reference>
It works on your machine, because you really have the .dll at that
location. However, the other person may want to use the
System.Data.SQLite.dll file you placed in the root of the repository. Since
that is one level up from the .csproj, you can use a relative path, like
this:
<Reference Include="System.Data.SQLite, Version=1.0.88.0,
Culture=neutral, PublicKeyToken=db937bc2d44ff139,
processorArchitecture=x86">
&l
|
System.IO.IOException: "The file exists" when using System.IO.Path.GetTempFileName() - resolutions? |
As Sayse suggested, you might try setting the %TEMP% environment variable
when your app launches.
Environment.SetEnvironmentVariable("TEMP", "<dir>");
|
google drive api - copyfile working only with permission for accessing all files in drive (but jst need to copy) |
According to the documentation, Files.copy() requires at least one of the
following three permissions:
https://www.googleapis.com/auth/drive: "View and manage the files and
documents in your Google Drive" which is the one you want to avoid
https://www.googleapis.com/auth/drive.file: "View and manage Google Drive
files that you have opened or created with this app." Which means you can
freely create any file but only open the files your app created. You can
only copy a file you created, but you cannot copy any other files even if
it is public.
https://www.googleapis.com/auth/drive.appdata: "View and manage its own
configuration data in your Google Drive" Which only lets you control your
application-specific Appdata folder which is probably not what you want.
You can only copy a file with
|
Capture file system system calls on Linux platform |
How about write your own profiling tool using a wrapper? See GCC -wrapper:
-wrapper
Invoke all subcommands under a wrapper program. The name of the wrapper
program and its parameters are passed as a comma separated list.
|
Error while Retriving files from google drive using drive API. “Calling this from your main thread can lead to deadlock |
You should do any code that could take a long time such as I/O or network
activity on a different thread. In your situation your file retrieval would
be best done within an ASyncTask.
The reason for this warning is because when your code is being executed to
retrieve the file from Drive, the code will block until the file retrieval
has completed, this means that nothing else within the program will be able
to respond, i.e. GUI will not update and input from the user trying to do
stuff with the GUI will not be registered. After a few seconds, if the file
retrieval still isn't complete, then the user will be presented with an ANR
(Application Not Responding) message. This will either give the user the
choice of waiting, if their patient, or most likely force closing your app.
|
Monitoring changes in Google Drive files for whole domain using Drive API |
Domain-wide delegation simplifies the authentication portion for your app
but you'll still need to auth as each user to get their files and changes.
It may be possible for your app to "grab" all files and make itself (or a
special user) the owner, then you just have one user account to scan but
the "grab" process would still need to run at regular intervals to find new
files created or uploaded by end users.
I believe most apps that need to scan content at this level do it via cron
jobs or AppEngine task queues which make it easy to chunk up the scans
throughout the day. Generally they expect to scan each user account once
every 24 hours or so.
|