octal

How do I convert a decimal number to a list of octal digits in Common Lisp?

眉间皱痕 提交于 2020-01-04 08:11:10
问题 I need to have the result in correct order. It works for numbers less than 100 only. (base8 8) gives (1 0) , (base8 20) gives (2 4) , but (base8 100) gives (414) instead of (144) . I tried for 2 days and can not find the problem. Please help me. (defun base8(n) (cond ((zerop (truncate n 8)) (cons n nil)) (t (reverse (cons (mod n 8) (base8 (truncate n 8))))))) 回答1: The problem is that you are reversing the string a few times. The following will do: (defun base8 (n) (let ((t8 (truncate n 8))

Linux file permissions(in-depth) - numeric to string notation, and vice versa; additional file-permissions

*爱你&永不变心* 提交于 2020-01-03 03:33:47
问题 I figured out how to read/convert the symbolic rwx parts to 421 octal parts, which was pretty straight forward. But I am extremely confused when there's the special characters involved. We know that -r-xr---wx converts to 0543, but what does -r-sr---wt or -r-xr---wt convert to? I believe for under user execute permission there's x, s, S. For group execute permission there's also x, s, S. Then all other user execute permission there's x, t, T. What do all these mean and how are they converted

AJAX Asp.net AutoCompleteExtender interpreting string 0010 as octal

北城以北 提交于 2019-12-31 02:55:18
问题 I'm using the MS AJAX AutoCompleteExtender on a textbox. It's working fine, except when the web service returns strings like "0010" -- in which case, it displays "8". I eventually realised it was interpreting the string "0010" as an octal number (and then proved the point by adding strings like "0100" and "0x10".) How can I prevent this? If the web service returns "0010", I want the autocomplete extender to also display "0010", and not interpret it as octal and display a decimal equivalent.

How to convert decimal into octal in objective c

扶醉桌前 提交于 2019-12-25 18:56:36
问题 just like my question, How can i convert decimal into octal in objective c? can somebody help me? it's make me dizy 回答1: You have to initialize a new NSString object using the right format specifier. Like : int i = 9; NSString *octalString = [NSString stringWithFormat:@"%o", i]; // %O works too. This will create an autoreleased NSString object containing octal string representation of i . In case you start from a NSString containing a decimal number representation, you should first retrieve

Passing octal value to new number function

孤街醉人 提交于 2019-12-25 08:46:06
问题 I've made something like : Number.prototype.foo = function () { //code } // Octal number! (013).foo(); But inspecting this inside of foo function, I get 11 as value... What's wrong? 回答1: What did you expect to happen? Javascript treats all whole numbers that start with a zero as octal[*] so the actual value of 013 is indeed 11 (decimal). The Number class only deals in values, and won't know that you originally passed in an octal constant. [*] There's an exception for whole numbers containing

Python - Convert Octal to non-English Text from file

爱⌒轻易说出口 提交于 2019-12-24 08:22:47
问题 I am trying to convert Non-English file encoded in Octal back into it's native format and store it in another file. The files include: i_file : The input Original File with Octal Encoded text o_file : The output Target File which should contain the Kannada(The non-English Language in question) text. octal_to_text.py : The python program that should take the octal text in in the input file and generate corrusponding non-English text in the target file. Sample i_file \340\262\270\340\263\215-

How to convert an input of 3 octal numbers into CHMOD permissions into Binary?

孤者浪人 提交于 2019-12-23 02:41:05
问题 I am trying to create a program that takes input from the user using the command line of 3 octal number, for example 5, 2, 6 or 5,2,6 and convert them into 3 sets of 3 digit binary numbers, like 101 010 110, and also print out those corresponding CHMOD permissions like r-x -w- rw-. I am having a lot of trouble splicing these numbers apart with substring into 3 separate numbers of 5 2 and 6. I also need the program to convert from the set of binary digits into 3 numerical digits and

What is an Illegal octal digit?

我怕爱的太早我们不能终老 提交于 2019-12-21 09:17:21
问题 I'm trying to make an array of zip codes. array = [07001, 07920] This returns : array = [07001, 07920] ^ from (irb):12 from :0 Never seen this before. Any workarounds? 回答1: Ruby is interpreting numbers that have a leading 0 as being in octal (base 8). Thus the digits 8 and 9 are not valid. It probably makes more sense to store ZIP codes as strings, instead of as numbers (to avoid having to pad with zeroes whenever you display it), as such: array = ["07001", "07920"] 回答2: Numbers that start

Can I customize syntax highlighting in Eclipse to show octal literals differently?

孤人 提交于 2019-12-21 07:07:28
问题 I think octal literals are Very Dangerous Things™, and I'd like them to be glaringly obvious whenever I read source codes. There must be a way to do this in Eclipse, right? So it looks like standard Eclipse cannot be configured to do this? A custom colorer is required? 回答1: No, currently you can only configure a color for all Numbers in Preferences > Java > Editor > Syntax Coloring. May I suggest creating an enhancement request at the Eclipse Bugzilla at http://bugs.eclipse.org/ (correct

how to avoid python numeric literals beginning with “0” being treated as octal?

大兔子大兔子 提交于 2019-12-19 13:48:13
问题 I am trying to write a small Python 2.x API to support fetching a job by jobNumber , where jobNumber is provided as an integer. Sometimes the users provide a jobNumber as an integer literal beginning with 0, e.g. 037537 . (This is because they have been coddled by R, a language that sanely considers 037537==37537 .) Python, however, considers integer literals starting with "0" to be OCTAL, thus 037537!=37537 , instead 037537==16223 . This strikes me as a blatant affront to the principle of