What Are -Moz- and -Webkit-

What are . and .. in Windows' directory?

"." is the current directory.

".." is the parent directory.

This is the same as Unix systems. From your output it looks like Windows is treating them as files.

In the past I've used the "." to make sure that the command (what ever it might be) finds the file in the current directory. The following two statements should be identical:

run some.exe

run ./some.exe

but if you have some weird search rules that looks on the PATH or in C:\Windows first (for example) then they aren't.

I've found these statements:

  • Use a period as a directory component in a path to represent the current directory, for example ".\temp.txt". For more information, see Paths.
  • Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory, for example "..\temp.txt". For more information, see Paths.

on the MSDN page on Naming Files, Paths, and Namespaces but there's no explanation of what they actually are.

The Wikipedia page on Path as a little more information, but again doesn't explain how these are actually stored.

What are = and : in Ruby?

Lexer/Parser Tokens

The symbols you're referencing aren't methods or operators, they are lexer/parser tokens used to interpret the syntax of your source code. The hashrocket is defined as the tASSOC association token, which is used to associate things such as key/value pairs or exception stack traces.

The colon has several uses in Ruby, but IIRC Ruby 2.x introduced the postfix colon as syntactic sugar for tASSOC when the left-hand side is a Symbol. I'm less sure about how the token is defined or parsed in complex cases—assoc is the most likely bet for this example—but for practical purposes you can simply think of a: 1 as semantically equivalent to :a => 1.

You can also use Ripper#sexp to examine your source code to see how the lines will be parsed by the interpreter. For example:

require 'ripper'

pp Ripper.sexp "{a: 1}"
[[:assoc_new, [:@label, "a:", [1, 1]], [:@int, "1", [1, 4]]]]]]]]
#=> [:program, [[:hash, [:assoclist_from_args, [[:assoc_new, [:@label, "a:", [1, 1]], [:@int, "1", [1, 4]]]]]]]]

pp Ripper.sexp "{:a => 1}"
[:symbol_literal, [:symbol, [:@ident, "a", [1, 2]]]],
[:@int, "1", [1, 7]]]]]]]]
#=> [:program, [[:hash, [:assoclist_from_args, [[:assoc_new, [:symbol_literal, [:symbol, [:@ident, "a", [1, 2]]]], [:@int, "1", [1, 7]]]]]]]]

In both cases, you can see that the S-expression is using the colon to build an "assoc_new" subexpression. For further drill-down, you'd have to refer to the Ruby source tree.

See Also

  • lexer.rb
  • parse.y

What are .a and .so files?

Archive libraries (.a) are statically linked i.e when you compile your program with -c option in gcc. So, if there's any change in library, you need to compile and build your code again.

The advantage of .so (shared object) over .a library is that they are linked during the runtime i.e. after creation of your .o file -o option in gcc. So, if there's any change in .so file, you don't need to recompile your main program.
But make sure that your main program is linked to the new .so file with ln command.

This will help you to build the .so files.

What are ^.* and .*$ in regular expressions?

^.* //Start of string followed by zero or more of any character (except line break)

.*$ //Zero or more of any character (except line break) followed by end of string

So when you see this...


It allows any character (except line break) to come between (?=.*[@#$%^&+=]) and the end of the string.

To show that . doesn't match any character, try this:

/./.test('\n');  is false

To actually match any character you need something more like [\s\S].

/[\s\S]/.test('\n') is true

What are :+ and &:+ in Ruby?

Let's start with an easier example.
Say we have an array of strings we want to have in caps:

['foo', 'bar', 'blah'].map { |e| e.upcase }
# => ['FOO', 'BAR', 'BLAH']

Also, you can create so called Proc objects (closures):

block = proc { |e| e.upcase }
block.call("foo") # => "FOO"

You can pass such a proc to a method with the & syntax:

block = proc { |e| e.upcase }
['foo', 'bar', 'blah'].map(&block)
# => ['FOO', 'BAR', 'BLAH']

What this does, is call to_proc on block and then calls that for every block:

some_object = Object.new
def some_object.to_proc
proc { |e| e.upcase }

['foo', 'bar', 'blah'].map(&some_object)
# => ['FOO', 'BAR', 'BLAH']

Now, Rails first added the to_proc method to Symbol, which later has been added to the ruby core library:

:whatever.to_proc # => proc { |e| e.whatever }

Therefore you can do this:

['foo', 'bar', 'blah'].map(&:upcase)
# => ['FOO', 'BAR', 'BLAH']

Also, Symbol#to_proc is even smarter, as it actually does the following:

:whatever.to_proc # => proc { |obj, *args| obj.send(:whatever, *args) }

This means that

[1, 2, 3].inject(&:+)


[1, 2, 3].inject { |a, b| a + b }

What are & and | used for in this color generation code?

The | in java is the bitwise or operator: Bitwise operations
Without watching the whole video, I guess what he is trying to do is put
all color values (RGB) into one 32Bit integer. Since rr,gg,bb can only have values
from 0-255, which only need 8bits, he can put them into just one variable by using shift and or operations. For example:

rr:       00000000 00000000 00000000 10101010
rr<<16: 00000000 10101010 00000000 00000000

gg: 00000000 00000000 00000000 11110000
gg<<8: 00000000 00000000 11110000 00000000

bb: 00000000 00000000 00000000 00001111

value = rr << 16 | gg << 8 | bb

rr<<16: 00000000 10101010 00000000 00000000
gg<<8: 00000000 00000000 11110000 00000000
bb: 00000000 00000000 00000000 00001111

value: 00000000 10101010 11110000 00001111
^ ^ ^
rr gg bb

So now we have all three color values in one single integer variable.

What are `.` and `*` means in a c macro?

Its a linker script. The section merging and placement is done by the linker. A programmer can control how the sections are merged and at what locations they are placed in memory through a linker script file. The file you referred to was doing just that.

The .(dot) refers to the link section and the wild card character * is used instead of individually specifying multiple file names containing the same named link section.

Refer: http://sources.redhat.com/binutils/docs-2.10/ld_3.html

what are $ and * operands in haskell

As I am the one who showed you these operators, I'll give a brief explanation as to why I used them.

To review, a functor is a type constructor that lets you use the fmap function to apply a function to a "wrapped" value. In the specific case of the Either type constructor (partially applied, in this case, to String), you can apply a function to a Right value, but ignore the function if applied to a Left value (your error). It provides a way of error propagation without having to check for the error.

fmap f (Right x) = Right (f x)
fmap f (Left y) = Left y

An applicative functor is similar, except the function itself can be wrapped just like the argument it is applied to. The <*> operator unwraps both its operands, unlike fmap which only unwraps its right operand.

Right f <*> Right x = Right (f x)
Left f <*> _ = Left f
_ <*> Left y = Left y

Typically, you don't wrap functions yourself: they result from using fmap to partially apply a function to a wrapped value:

fmap (+) (Right 3) == Right (+ 3)
fmap (+) (Left "error") == Left "error"

So, when we are working with Either values, the use of <$> (infix fmap) and <*> let us pretend we are working with regular values, without worrying about whether they are wrapped with Left or Right. Right values provide the expected Right-wrapped answer, and Left values are preserved. In the case of a binary operator, only the first Left value is returned, but that is often sufficient.

(+) <$> Left "x undefined" <*> Left "y undefined" == Left "x undefined" <*> Left "y undefined"
== Left "x undefined"

(+) <$> Left "x undefined" <*> Right 9 == Left "x undefined" <*> Right 9
== Left "x undefined"

(+) <$> Right 3 <*> Left "y undefined" == Right (+ 3) <*> Left "y undefined"
== Left "y undefined"

(+) <$> Right 3 <*> Right 9 == Right (+3) <*> Right 9
== Right 12

In the end, using the Applicative instance of Either String lets us combine the results of evaluating two subexpressions without having to explicitly check if either recursive call of eval actually succeeded. Successful recursive calls result in success; an error in either call is used as the same error for the top-level call.

What are and how to use '#' in URLs

They are generally called URL fragments and are used as bookmarks on a page to navigate to different sections of that page. When clicked they will scroll down the currently loaded page to the matching tag name. I would recommend against using them as paths to different pages.

You can use them as bookmarks by specifying the fragment in the Htmlhelper:

@Html.ActionLink("My Photos", "Action", "Controller", null, null, "Photos", null, null)

Then in your Photos partial that represents the Photos sub-page, set the html id attribute to "Photos" in the div or label or whatever represents the beginning of the Photos partial. The link created with the @Html.ActionLink will look for a html element ID that matches the word you typed into the fragment.

See LinkExtensions.ActionLink Method for more details.

Related Topics

Leave a reply