What is the Difference between "\" and "/"? - path

For Example This Both are Opening same path
C:\Users\XYZ\Pictures
C:/Users/XYZ/Pictures/

Actually,It's a historical problem.Traditional NT and DOS operating system uses "\" as an internal expression in VFS path.But UNIX-like system uses "/".Also,many complier considers backslash as escape character e.g."\n \r".So to facilitate the porting of different platforms and the communication across computer systems, Windows now also supports splash as a path separator.

More programs use the backslash.

Related

Why is CP850 the default encoding in Windows 10 terminal?

I was working on a Ruby program and had issues that I finally found out were caused by the default encoding in Windows 10 terminal, which apparently is CP850, an encoding so old it doesn't even include the € symbol. I read that, of course, if I try to change this other programs around the computer will give issues.
Wikipedia indicates that CP850 has theorically been "largely replaced" by Windows-1252 and, later, Unicode, and yet it's here, right in the OS's terminal.
Picture attached as proof. It's in italian language but you'll see it under "Tabella codici corrente", aka "Current code table".
How's that possible?
This is historical.
DOS had cp437, and later cp850 (and e.g. also cp852) as standard code page.
Terminal in Windows was also known as "DOS prompt": so a way to run DOS programs in Windows, so they keep the code page of DOS. Microsoft dislikes non-backward compatible changes, so your DOS program should works also on Windows terminal without problem.
Windows-1252, as the name stress it out, was done for Windows, so no compatibility problem, and for Windows programs, but so, in order to gain graphical interface market, but keeping compatibility with many business applications, Microsoft maintained two different code page.

In which operating systems must I use 'single dot followed by slash' when specifying a path name?

I know that in Windows I don't have to do so.
For example, ./dir/file.ext and dir/file.ext are equivalent.
Are these two forms possibly different on any other OS, e.g., Linux?
Or is it possibly application-dependent, in which case they might be treated differently even on Windows?
I am asking because I keep bumping into the usage of ./ at the beginning of path names (mostly but not only in NodeJS), and I would like to be sure that I can omit it safely (i.e., avoid turning my code platform-dependent).
The ./ you're referring to is specific to UNIX-like operating systems (OSX and Linux are the major examples) and not program specific. On those platforms, it is used to execute the file being referred to, while in Windows merely typing an executable's filename will execute it. I don't know if the code you're referring to determines which OS you're on, but if it's true that Windows ignores the period, then this is a useful cross-platform method to execute an executable.

How to display version of Electron environment in an Electron app?

I would like to find out which version of Electron an Electron desktop app like Signal Desktop or Visual Studio Code is using. Is there a simple way - like entering a command in the Development Console?
Thanks! Johannes
(Why? I would like to see if it is affected by bugs like https://www.trustwave.com/Resources/SpiderLabs-Blog/CVE-2018-1000136---Electron-nodeIntegration-Bypass/)
You can, if the App enabled developer tools and enabled nodeIntegration. take VS Code as an example:
open the Developer Tools, in the console tab, type
process.versions.electron
documentation here: https://electronjs.org/docs/api/process
or try parsing version from userAgent string
navigator.userAgent.match(/Electron\/([\d\.]+\d+)/)[1]
Open the Developer tools and in the Console tab type:
navigator.userAgent
For example in the Discord app I'm getting:
Mozilla/5.0 ... Electron/9.3.5 ...
Under a Unix-like or Linux system (and possibly under Windows using Cygwin or MSYS shells or WSL, but this is untested there), you can use the strings program even for progams that are built without the developer tools enabled.
Basically, you're just searching for a user-agent string in the binary itself.
Currently, I have been able to do the following:
$ strings example-electron-app-binary-file | grep '^Chrome/[0-9.]* Electron/[0-9]'
Chrome/98.0.4758.141 Electron/17.4.7
That regular expression searches for strings starting with Chrome/, followed by any number of numerical digit and dot characters, a single space, and then Electron/ with any numerical digit after it.
This won't work in all likelihood if your system uses UTF-16 strings, but since browsers tend to use UTF-8 internally there's still a chance it'd work on a Windows electron binary.

Other scriptable editors?

I'm just wondering what editors you know which are "scriptable". E.g take an Emacs, one can really say you can do everything from within the editor: writing,reading, programming. All with the "scripting language" Emacs-Lisp. What other editors you know are out there as scriptable?
Do you know let's say an editor scriptable in Perl, Ruby or any other more C-like language?
On the Windows platform, the Zeus editor is scriptable in the Lua, Python, Java Script, VB Script and TCL languages.
Yi is the Haskell equivalent to Emacs. It is specifically designed along the same lines as Emacs: everything is scriptable in Haskell, the editor itself is more or less just a Haskell script, and there is only a very small, very generic, non-scriptable core. In contrast to most Emacs implementations, however, which use a different language for the core than for the scripts, Yi's core is also implemented in Haskell.
Vim has Vimscript for writing plugins and extending functionality.
Redcar is a text editor written in (mostly) Ruby, which is fully scriptable in Ruby. It is not nearly as flexible as Emacs, but more on the level of TextMate.
UltraEdit and UEStudio have the feature to record many of its commands during a manual execution to a macro and run this macro again later. The macro can be also edited to add a loop or simple conditions.
And UltraEdit / UEStudio support also scripts. Those scripts are parsed with the JavaScript core engine. Therefore everything supported by JavaScript core like variables, arrays, string manipulations, calculations of integers or floats, nested loops, etc. can be also used in those scripts plus lots of commands of UltraEdit / UEStudio itself.
UltraEdit is available for Windows, Linux and Mac and as portable application for Windows.

Why ActionScript is said scripting language even after grown up so much and having compiled language?

From the Wikipedia defination,
Programming language is
Scripting languages are languages that allow you to send commands directly to a system that executes these commands. These commands are read line by line and executed-interpreted, but not compiled.
Whilst, Scripting language is
Programming languages are languages that allow you to create a program by writing structured code that is read all at once by the system, checked for errors, and translated into an unreadable format that the machine can then execute(compiled).
ActionScript is now quite developed language(Which runs after compilation not interpreted) and after ActionScript 3,Flex and Air, Its hard to believe ActionScript is still dubbed as Scripting language.
The line between a programming language and a scripting language is blurry. Once upon a time, a "programming language" was a compiled language like C or C++, because only those languages were really efficient enough to write non-trivial programs in. Scripting languages were languages that were typically not compiled and thus slower; their relative inefficiency relegated them to systems maintenance tasks or "gluing" parts of a compiled program together. Now, computers are getting faster and language interpreters are getting more advanced, so even a traditional "scripting" language like Python or Tcl can be used to write a full-fledged application. However, once a language is dubbed a scripting language, it's hard to shirk off the title.
Don't believe everything in the Wikipedia.
PHP for example is compiled into bytecode at runtime, while java is compiled into bytecode at compilation time. The php interpreter executes the bytecode, and the java VM executes its bytecode both doing about the same thing.
A bash script is not compiled at all and is interpreted run line by line.
C is compiled into machine code that is read directly by the hardware.
According to the wiki entry, only the bash is truly a script which is a misnomer.
It is much more nuanced than the wiki entry implies.
JavaScript is a scripting language in browsers because it scripts the browser.
Bash is a scripting language because it scripts the OS.
Python and ActionScript are called scripting languages because they share things in common with real scripting languages (dynamically typed, sometimes interpreted, higher-level than C). I think "scripting language" as a term is far too over-used, and is mainly used to put down dynamically typed languages.
Reading the definitions above, the machine can't execute the format that the Flex compiler creates, therefore ActionScript is a scripting language.
Of course, anything that compiles to a VM would be considered a scripting language by that definition, including Java. Forth, being a threaded interpreted language, would also be a scripting language.
So forget Wikipedia. These distinctions used to make more sense than they do now.
JavaScript is getting faster monthly, and will probably soon be faster than ActionScript, if it isn't already.
I'd say a better definition for "scripting language" is, "a scripting language controls an application or enclosed environment, like a browser or a word processor or Flash."
But with the Chrome OS, even that definition is in peril, as the browser (including Flash, which Google has embraced) threatens to become an OS.

Resources