w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
strstr not able to search the string inside the data in octal format
A C style string is a number of characters terminated by a zero-character (NUL character - the value zero, not the character '0'). This means that strstr will stop as soon as it hits such a byte. One solution that is quite plausible is to simply write a function that searches through binary data based on it's length, not on a "terminating character". Something like this (this still assumes that the str is a C style string): char *find_str_in_data(const char *str, const char *data, int length) { int pos = 0; int slen = strlen(str); while(pos < length-slen) { int i = 0; while(i < slen && str[i] = data[pos+i]) { i++; } if (i == slen) return data + pos; } return NULL; }

Categories : C++

How do I get the checkbox "Allow access to file URLs" to show up next to my app? I have file write permissions in manifest
To get this to work you need either: permissions: [ "<all_urls>" ] or a scheme starting with file:///. If you try *://*/* that will not work as it only represents http or https

Categories : Google Chrome

FBSession.activeSession.permissions does not appear to accurately depict the valid granted permissions
If you were using iOS SDK 3.0, then this was due to a bug in the SDK. See the bug report for more details. Symptom summary: After authorizing user with openActiveSessionWithPermissions method, the sessions variable in callback method contains extended permissions that were not allowed by a user.

Categories : IOS

XSLT format a xml data file to multiple table display using HTML format
When this stylesheet is executed, it starts by applying templates to the root node, /. This fires your xsl:template match="/". While that template is being applied, the context node is /. So when it processes <xsl:apply-templates select="testsuites"/> <xsl:apply-templates select="testsuite"/> <xsl:apply-templates select="testcase"/> <xsl:apply-templates select="failure"/> each of those XPath expressions is evaluated relative to /. So for the first one, you're asking it to apply templates to /testsuites (immediate child[ren] of the root node named testsuites). That's fine, because there is such a node. But for the second one, you're asking it to apply templates to /testsuite (immediate children of the root node, named testsuite). No such node exists. Th

Categories : HTML

Perl how can I print a character in octal?
You want two things: ord takes a string, and returns the numeric value of that string's first character. That is, ord "P" is 80. Then, you want printf or sprintf. sprintf "%o", $num will take a number and return a string that is the octal representation of that number, printf will print the octal representation instead of returning it. Together, printf "%o ", ord "P" will print "120".

Categories : Perl

File permissions are not being preserved while after zip
It looks like you will need to try a different archive format. Perhaps tar --preserve-permissions. The other option would be to save the permissions separately and the reapply them upon decompression. You could add a .saved_permissions file to the archive. There are some examples of scripts that can do this on StackOverflow.

Categories : Java

copy OSX file with permissions
you can use cp -p -p Cause cp to preserve the following attributes of each source file in the copy: modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be preserved.

Categories : Osx

Google API file permissions
I was never able to set up Google and Ubuntu to allow me to run the Google custom search client from multiple users, so I created a workaround. :) I set up a web page under apache that calls each of the search scripts I wanted to run. Any user must use the web page to run the script. That way all searches run under the www-data user id. I just have to be careful not to try to run the custom search client any other way (from the command line).

Categories : PHP

Directory permissions to a php file
try this <?php chmod("/somedir/somefile", 755); // decimal; probably incorrect chmod("/somedir/somefile", "u+rwx,go+rx"); // string; incorrect chmod("/somedir/somefile", 0755); // octal; correct value of mode ?> here /somedir/somefile is your file path and read this article

Categories : PHP

Changing permissions on a file
The only people that can change the permissions of files are the people that own the files (in your case, jim) and the root user. This is to prevent users from doing something malicious, like changing the permission of someone else's file to r/w and then deleting everything in the file, or something similar.

Categories : Linux

File permissions and security
That depends. To modify the file, an attacker must be able to execute some kind of code on the server, e.g. have shell access. If this is the case, the permission is your smallest problem. If you are on a shared hosting environment (other customers you don't know use your webserver) these other users possibly can change the file too, if your provider did not setup their security right and they know the path. It is just not considered best practice to set 666 permissions. However most of these kind of attacks happen over your webserver, so restriscting the permission do not solve the problem, as the server needs to have write access. So what you can do: Change the mode to 664 and change the group to that of the webserver is running in - other users may still have write access by using t

Categories : File

Format file size in Unix in readable format
Using sed: $ ls_output='-rw-r--r-- 1 jboss admin 26644936 Sep 1 21:23 MyBig.war' $ echo $ls_output | sed -e :a -e 's/(.*[0-9])([0-9]{3})/1,2/;ta' -rw-r--r-- 1 jboss admin 26,644,936 Sep 1 21:23 MyBig.war Above sed command repeatedly replace the last 4 digits #### with #,###. -e :a: Make a label named a for t command. ta: Jump to a if substitution was successful.

Categories : File

How can a character be represented by a bit pattern containing three octal digits?
The first octal digit is only allowed to go to 3 (two bits), not 7 (three bits), if we're talking about eight bit bytes. If we're talking about ASCII (7 bit values), the first digit can only be zero or one. If K&R says otherwise, their description is either incomplete or incorrect.

Categories : C

Remove all default file permissions
Impersonation may be help you to solve this out. The term "Impersonation" in a programming context refers to a technique that executes the code under another user context than the user who originally started an application, i.e. the user context is temporarily changed once or multiple times during the execution of an application. click Here to see implimentation

Categories : C#

How can I copy permissions from a file that already exists?
The stat() and fstat() functions retrieve a struct stat, which includes a member st_mode indicating the file mode, where the permissions are stored. You can pass this value to chmod() or fchmod() after masking out the non-file-permission bits: struct stat st; if (stat(file1, &st)) { perror("stat"); } else { if (chmod(file2, st.st_mode & 07777)) { perror("chmod"); } }

Categories : C

set file permissions in one directory to match another
It could be easy as using get/setfacl (check the generated file has relative paths): cd dir-a && getfacl -R . > /permissions.acl cd dir-b && setfacl --restore=/permissions.acl

Categories : Python

How to get file ownership and permissions in android
You can create a Process object and execute the command. You could append the path of the File object as parameter. After that you can read the result from the InputStream. Please comment if you need an example.

Categories : Java

NSIS batch file permissions
Is the NSIS installer being ran with administrator permissions? If so, any process that the installer starts will also have administrator permissions. Check out Ander's answer on how to request admin rights for your installer: http://stackoverflow.com/a/8735349/1030416

Categories : Batch File

permissions issue accessing a file
Just because you have the rights to read a file doesn't mean you can actually REACH that file. You need permissions to access all of the parent directories of wherever that file is. Consider it the equivalent of giving you permissions take a $1 bill from me, but that $1 bill is inside a safety deposit box in a bank's vault. You have the rights to the money, but no rights to walk into the vault and open the box.

Categories : Linux

Getting/Setting File Permissions From Rebol
At the moment, no, you have to use call. It is planned to add back the port mode getting and setting capabilities, but the API needs a revamp first and we haven't started the discussion for that yet. The port model is mostly different in Rebol 3, so the port mode model is going to have to be different too. Feel free to get the discussion started.

Categories : Misc

figuring out if a number is decimal, hexadecimal, or octal in python
As a starting point, you can try to use the int() function with a 0 argument to let it figure out the conversion: >>> int('-0xFF', 0) -255 >>> int('077', 0) 63 >>> int('125', 0) 125 That said, a regular expression is your best bet for distinguishing your exact specifications. For example, here is a hex recognizer: >>> import re >>> is_hex = re.compile( r'^[+-]?' # optional sign '0' # start with a zero '[xX]' # upper or lower case "x" '(0|' # single zero or '([1-9A-Fa-f][0-9A-Fa-f]*))$' # a non-zero hexadecimal digit and a # sequence of zero or more hexadecimal d

Categories : Python

Error in getOctD(x, offset, len) : invalid octal digit
Are you doing this with a firewall perhaps? In my case the company's firewall was filtering the download, and ultimately, wget http://cran.fhcrc.org/src/contrib/gdata_2.17.0.tar.gz was downloading an html page from the firewall saying the download was blocked, but install.packages wasn't aware, it just knew that the file was not a valid tarball.

Categories : R

ksh + printf: force input argument to be decimal, not octal
Update to a current ksh version: $ echo $KSH_VERSION Version JM 93u+ 2012-02-29 $ M=008 $ MBR=$( printf %02d ${M} ) $ echo $MBR 08 Alternatively, strip off the leading 0's $ /usr/bin/printf "%02d " $(echo ${M} | sed 's/^00*//') 08 or without any external commands: $ typeset -LZ M ... $ M=008 $ MBR=$( printf %02d ${M} )

Categories : Shell

Apache server file permissions and url accessibility
Maybe you could add the user that is running apache / php to the group that owns the file. And set config to read and write for owner and owner group, and no permission at all for others. (-rwxrw---- 0r 0760) Never tested it, but it should work.

Categories : PHP

Unknown file permissions for executable bit - Linux
What's unknown about them? From the ls man page: The next three fields are three characters each: owner permissions, group permissions, and other permissions. Each field has three character positions: 1. If r, the file is readable; if -, it is not readable. 2. If w, the file is writable; if -, it is not writable. 3. The first of the following that applies: S If in the owner permissions, the file is not exe- cutable and set-user-ID mode is set. If in the group permissions, the file is not executable and set-group-ID mode is set. s If in the owner permissions, the file is exe- cutable and set-user-ID mode is set. If in the

Categories : Linux

Checking file access permissions for specified user in C / *nix
setuid() sets the real and effective user ID of the process, but does not modify the group access list, for that you have to call setgid(), initgroups() or setgroups(). So your program runs with the used ID 1002 and with the original group ID and group access list, and not with the group access list of the user 1002. That explains why the process does not have read permission to the directory. Note that access() is considered a "security hole", (see for example access() Security Hole). It is generally better just to try to open a file or directory instead of checking the read permissions beforehand.

Categories : C

compare windows file (or folder) permissions
You cannot use Equals() since this method is inherited from Object. You need to find a identifying attribute on that DirectorySecurity class. I think String GetSecurityDescriptorSddlForm() should do your job. You can invoke Equals() on that. Edit: Well sorry, this method needs a parameter for invocation. Try finding another attribute on the DirectorySecurity which is better for comparison. Edit2: I'm not familar with .NET Security Framework and Right-Management, but something like this should be your approach. You can do != resp: == on FileSystemAccessRule.FileSystemRights because that attribute is an enum (internally an int). ArrayList notIdenticalList = new ArrayList(); DirectorySecurity parentFolderAccessControl = Directory.GetAccessControl(null); DirectoryS

Categories : C#

How can I change file permissions so only a certain program can access it?
Hmmm.. the bottom-line answer here is that there is no way that you can prevent a determined and skilled user from accessing the data - the only thing you can do is make it difficult for him/her. Here are some possible strategies you might consider for this: Each of these methods requires a different level of skill for the user to obtain the data. The first is almost certainly the hardest to crack. Encrypt the file - use the .NET ProtectedData class As in dasblinkenlight's answer, create the file under a different user account Use Protected Storage

Categories : C#

How to write a file with the permissions of the owner in perl
You can run 'chown' to changes the owner (and group) of a list of files in perl. Example: #!/usr/bin/perl $cnt = chown $uid, $gid, 'foo', 'bar'; chown $uid, $gid, @filenames;

Categories : Perl

AjaxFileUpload file not inheriting folder permissions
thanx chris I had the same problem and I am not going to drop ajaxfileUpload control now , so I found workaround 1- download the source code from codeplex 2- open "source code directory"ServerAjaxControlToolkitAjaxFileUploadAjaxFileUpload.cs and add static property name it UploadRootPath public static string UploadRootPath { get; set; } 3- modify BuildRootTempFolder function : public static string BuildRootTempFolder() { var rootTempFolder = ""; if (UploadRootPath == "") { rootTempFolder = Path.Combine(Path.GetTempPath(), TemporaryUploadFolderName); } else { rootTempFolder = Path.Combine(UploadRootPath, TemporaryUploadFolderName); } if (!Directory.Exists(rootTempFolder))

Categories : Asp Net

Wordpress Linux file permissions and group
This is how I solved it: Create users in a group "users". Create a script in /etc/cron.hourly that fixes permissions on all wp-config.php-files like this: for f in locate wp-config.php do chgrp www-data $f chmod 640 $f done Works like a charm.

Categories : Linux

Setting file permissions on contents of tarfile
You can easily change the permissions on the files prior to your tar command, although I generally recommend people NEVER use 777 for anything except /tmp on a unix system, it's more productive to use 755 or worst case 775 for directories. That way you're not letting the world write to your directories, which is generally advisable. Most unix users don't like to set the permissions recursively because it sets the execute bit on files that should not be executable (configuration files for instance) to avoid this they invented a new way to use chmod some time ago, called symbolic mode. Reading the man page on chmod should provide details, but you could try this: cd $targetdir; chmod -R u+rwX,a+rX .; tar zcvf $destTarFile . Where your $targetdir is the directory you are tarring up and

Categories : Unix

tcl file copy on linux, permissions errors
As long as you have read permission on the file (and both read and execute permissions on all the directories containing it up to the root directory) you should be able to file copy it. You also must have write permission on the destination. (Obviously!) Setting the permissions on a file requires that you be the owner of the file, or root, and setting the ownership of a file requires even more elevated privileges (it's pretty much only ever done by root or by code that is setuid root). Internally, file copy tries to copy the these features of the file as well as the contents, but it does not throw an error if it fails. While it's possible to do setuid work (via the TclX extension's id command) this requires a pretty unusual configuration. It's actually much easier to use sudo to launch th

Categories : Linux

Change permissions of file in the download folder
Some file systems including SD cards do not allow permission changes. The generic download folder most probably is on one of that kind. Try changing the USB computer connection to Mass storage, that should fix the problem.

Categories : Android

Unix File Permissions - Does Write Imply Read?
A file can be a lot of things in unix-like systems. It might, for example be a pipeline, where a user might submit data to, but not receive data from. So no, a write permission does not imply read. Another example might be a directory where the user can deposit data (potentially destroying existing data), but not read what others have deposited.

Categories : Unix

How to set file permissions in windows through the command prompt mode?
>attrib /? Displays or changes file attributes. ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename] [/S [/D]] + Sets an attribute. - Clears an attribute. R Read-only file attribute. A Archive file attribute. S System file attribute. H Hidden file attribute. [drive:][path][filename] Specifies a file or files for attrib to process. /S Processes matching files in the current folder and all subfolders. /D Processes folders as well.

Categories : Windows

Moved a git repo - now every file has an unstaged change.. (permissions?)
A massive thanks to @qqx who jumped on this in the comments section and asked what git diff shows. (Surprisingly, I had checked git status but git diff hadn't occured to me! The output for every file was: old mode 100644 new mode 100755 Meaning it was indeed file permissions. Something I did not think was possible with .git - doh! If anyone is interested, the way I rectified this was: git config core.filemode false

Categories : GIT

Change file permissions to Google Drive with Javascript
According to this post, you need to assign the reader permission to the role anyone.

Categories : Javascript

Cannot write to text file using StreamWriter - Problems with permissions
You need to give the user who executes the AppPool in your IIS persmission to write to the folder you want the file to be written. If you are running a Windows 2008 or newer server with default IIS configuration then your AppPool will run under AppPoolIdentity. Here is a discussion on StackOverflow on how to grant AppPoolIdentity access to filesystem.

Categories : Asp Net Mvc

How to remove file permissions on linux from an external hard drive?
To make the partition accessible under Linux run: sudo chmod -R 777 /media/<drive-name>/ this should make the mac drive accessible for you. Changing ownership would do about the same, but you need not worry about it.

Categories : Linux



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.