vim plugins for bash edit [closed] - shell

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I want to write bash in a comfortable environment.
I've tried http://www.vim.org/scripts/script.php?script_id=365
But it lacks:
function list
function parameter hint
function description hint
Is there any vim plugin which you use when writing shell script?

Don't forget that Vim is not an IDE (though through its great integration capabilities and plugins, it can appear like one). It is first and foremost a (very powerful) text editor. (There are various blog posts and discussions around that topic, so I spare you further arguments.)
How are function parameter hints supposed to work in Bash scripts? Arguments are simply passed as positional untyped parameters $1 etc., and must be parsed and assigned to variables inside the function.
Likewise, a function description would require some sort of commenting conventions (e.g. tags like Doxygen or Javadoc use); this is not generally used, so don't expect an existing solution.

Related

Recommended convention / coding style [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am in a process of refactoring some unix shell scripts
and find many inconsistencies and different styles in our code
For example:
somevar="${item1},${item2}"
somevar=${item1}","${item2}
somevar="$item1,$item2"
Is there a coding style guide for unix shell scripts? or a formatter like clang-format for C++
[Edit] Please note I am not asking for personal style preferences or personal opinion! I am looking for an industry standard document, a widely used style guide or a popular tool.
I've worked in a few companies that have their own style guides but most now use Google's style guide. If you don't have a home grown style guide then Google's is good and is published here: https://google.github.io/styleguide/shell.xml
I personally check my shell scripts with the shellcheck plugin for vim but it's available on the web and for other editors. You can use it and get the downloads here: https://www.shellcheck.net/
Since word splitting won't happen in the context of a variable assignment you could just use:
somevar=${item1},${item2}
I personally prefer to use
somevar="${item1},${item2}"
The quotes doesn't hurt and - imo - increase readability.
About ${var} vs. $var. That matters when the variable name may contain an underscore, like "$foo_bar". What does it mean? The variable $foo plus the literal string _bar? Or the expansion of the variable $foo_bar? I would consequently use ${var} to avoid such situations.

Ruby program to retrieve OpenStreetMap data using OSM API [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
How can I retrieve data from OpenStreetMap (OSM) using the OSM API (http://wiki.openstreetmap.org/wiki/API) and Ruby? Is there any ruby gem available which serves my purpose? I have been searching for a good solution for my purpose but nothing served me exactly what I need.
As for example : Given the country name as input, I need to get the list of all streets of that country etc.
Any kind of link/code sample or starting point is fine. I can then explore more to find out what I need exactly. Thanks!
As the question as posed is off topic for Stack Overflow, I will answer the question of "How to find something I can use" rather than give any kind of recommendation on a tool itself.
I am not familiar with any gems for OpenStreetMap.
So I do this command from the terminal:
gem list --remote | grep street
And my terminal answers me with this:
openstreetmap (0.2.1)
And then I pull up my trusty browser, and open up ruby-toolbox.org and search for openstreetmap.
This produces a page that shows 30 results. In there, I see the mentioned gem, but also I see Rosemary which seems promising, as it is an "OpenStreetMap API client for ruby" and it was last updated only 4 months ago.
So, hopefully this helps in future searches. You have a lot of tools available to get started on your search to get to the point you are asking for in this question, so that you can get down to the business of doing what you need.
The main API you want to use is not suitable for such queries. It is mainly for editing and retrieving small amounts of map data within a small region. For larger queries better use the Overpass API which is much faster and also allows very complex query conditions if needed.
The Overpass API uses XML as input and serves either XML or JSON as output format. So it should be rather easy to use in any common scripting language.

EAN/GTIN Barcode Product Identifier - Barcode to Product Name [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
Does anyone know of a good online API that can translate EAN/GTIN barcodes to the product name (and if possible anything extra such as category?)
I have been unable to find one that has a good success rate, below are some barcodes from items just scanned around my house (nothing rare or obscure)
Example barcodes:
5010186014550
20411336
21048753
5449000000996
5051413363249
try this: http://openean.kaufkauf.net/
here is the API link for it: http://openean.kaufkauf.net/api.php
or this: http://www.codecheck.info/
Both are in german but the language doesn't matter, EAN is EAN :).
try your barcodes there, maybe the database contains your EAN's.
This database seems even larger:
ean-search.org
They also have a REST API.
Here is a comprehensive one from Norway:
http://glnservice1.gs1.no/GS1GepirClient/GepirClient.aspx
Regards
Arnfinn

Is there any language that allows spaces in its variable names [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
Is there (or was there ever) any non-trivial language that allows spaces in its variable names?
I am aware of the language Whitespace, but I'm interested in a language that was actually used for something besides demonstration.
I ask this out of pure curiosity.
In a way, yes. Several languages's variable names are really just keys to a higher-level object. Both Coldfusion and Javascript come to mind. In Javascript, you can write foo=bar, but what you've really said is:
window['foo'] = bar;
You could just as easily write
window['i haz a name'] = bar;
The various scopes in Coldfusion can also be treated as either a (dict|hash|associative array) or a name.
Of course, once you've created a name with whitespace, it's harder to access without using the hash lookup syntax.
TSQL will allow you to use whitespace in table and column names aslong as you have it between square braces [ ]
Theres a fantastic article on just what sql will let you get away with here http://www.sqlservercentral.com/blogs/philfactor/archive/2009/08/14/evil-code.aspx

Printing source code on Windows [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
What is the best Windows program to print out source code (more generally, text files)? I'd like the following features:
Includes line numbers
Option of printing 2 or 4 pages on a single sheet of paper.
Header includes filename and timestamp.
Notepad++ is an excellent tool for this (and it's free!). You can print the code out both in normal text, as well as marked-up with colour as you see it on the screen!
I tried the suggested Notepad++ and Codex, but I find them too limiting.
I could not print two columns per sheet in either one of them.
I like to maximize the amount of code per sheet.
A decade ago I would use pcps to print multiple columns of source code, but that software is just too old and cumbersome in this day and age.
For now, I would suggest this, if you want multi column output: http://www.lerup.com/printfile/
UltraEdit works pretty well for all three of those.
www.ultraedit.com
I use Context for most of my non-Visual Studio development, and it does what you asked for and is free. I don't know how well it does color, but the source code colors print in a couple of varying boldnesses, which makes it pretty readable in black and white.
I just use the printer dialog to set the multi-pages per sheet option.
I'm using Codex: http://www.snapfiles.com/get/codex.html
Works pretty good, can both print and publish (export to HTML).
Crimson Editor looks great too!

Resources