ImportRange and Concatenate don't work - google-sheets

I like to do this:
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/xxxxxx";=CONCATENAR(F26;"!I23"))
=CONCATENAR(F26;"!I23") is not working on the function.
I was tried some "" and ' ' '
but it doesn't work!. how can i do it?.

I've fix your code as below ant it works in my environment.
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/xxxxxx/edit#gid=0",CONCATENATE(F26,"!I23"))

Related

Groovy execute command with quotes

Looking for a way how to run the simple command in groovy (using in jenkins) with quotes inside.
My code is:
"grep 'text ' /tmp/test.txt".execute()
I want to grep all lines with text (and space after it).
But as a result I'm always getting grep of "text" only (without the space). Actually groovy for some reason drops my quotes.
Groovy doesn't handle quotes well. Instead you can use the array form:
['grep', 'text ', '/tmp/test.txt'].execute().text
Try the following:
def res = ['grep', 'text ', 'test.txt'].execute( null, new File( '/tmp/' ) ).text

Using a slash in Slim

I have the following code that's causing a Slim::Parser::SyntaxError:
p
code.inline /charge
I expect this to output <code class="inline">/charge</code> but it's just causing Slim to get upset.
Why?
Solved it using the escape character ', like so:
p
code.inline
'/charge
Hacky, but whatever .. it works.

How to log SQL script lines in Delphi from TStringList to file

I use this code to log the many lines (SQL.Add) making complex scripts i have to build:
Ex:
[...]
SQL.Add('ENTITY_ID, PRO_CODE, PHASE_CODE, TASK_CODE, PERIOD_REF');
SQL.Add('from ' + trim(SourceJrnl) + ' where');
SQL.Add('MASTER_ID = ' + IntToStr(TranID) + ' and');...
[...]
{ for debugging only }
for i := 0 to SQL.Count-1 do
ShowMessage('Line #' + IntToStr(i+1) + ' : '+ SQL.Strings[i]);
Any simple way (function) to have the lines written to a file out of a stringlist or memo.
[EDIT] Sorry. NO memo or stringlist but a simple log file.
Calling SQL.SaveToFile will write the query to a file, but it will clobber the previous file contents, so you can only see one query and no other logs. Instead, read the SQL.Text property to get all the lines in a single string, and then write it to your log file using whatever logging technique you have for the rest of your program. In a pinch, a simple way to write a line of text to a file is to call Writeln, but people have asked about real logging libraries before.

regexp matching in rails app

I have the following string that needs to be replaced by an empty character in rails. Followed many tutorials and docs. Please help me achieve this.
String:
/home/<someword>/dbdumps/backup.sql
To be replaced as:
backup
To get the file name from a path, I'd use File#basename
File.basename('/home/<someword>/dbdumps/backup.sql', '.sql')
#=> 'backup'
if "someword" is the only thing that changes you dont even need regex.
Assume
path = "/home/<someword>/dbdumps/backup.sql"
then
path.split("/").last.split(".").first
returns
=> "backup"
The easiest solution would be a gsub (string substitution) like so:
string = "home/<someword>/dbdumps/backup.sql"
new_string = string.gsub(%r{home/(.*)/dbdumps/backup.sql}, 'backup' )
This is a simple example of string substitution.
In a rails app i do a Net:SSH:start( ) and run ssh.exec!('ls /home//dbdumps/.sql'). I am ?sending the output to a string and then i have to display the list of the files. For that I am taking the output into a string and trying to do a gsub. Is this the right approach?
I would not consider it pretty (naive code, no error checking, loops with requests) but something like this could do the job for you. It depends if you want to end up with just the backup names or the full path.
ssh.exec!("ls -l /home/") do |channel, stream, data|
directories << data if stream == :stdout
end
directories.each do |dir|
ssh.exec!("ls -l /home/" + dir + "dbdumps") do |channel, stream, data|
backup_names << /home/" + dir + "/" + data if stream == :stdout
end
end
hope this helps

Help with grep in BBEdit

I'd like to grep the following in BBedit.
Find:
<dc:subject>Knowledge, Mashups, Politics, Reviews, Ratings, Ranking, Statistics</dc:subject>
Replace with:
<dc:subject>Knowledge</dc:subject>
<dc:subject>Mashups</dc:subject>
<dc:subject>Politics</dc:subject>
<dc:subject>Reviews</dc:subject>
<dc:subject>Ratings</dc:subject>
<dc:subject>Ranking</dc:subject>
<dc:subject>Statistics</dc:subject>
OR
Find:
<dc:subject>Social web, Email, Twitter</dc:subject>
Replace with:
<dc:subject>Social web</dc:subject>
<dc:subject>Email</dc:subject>
<dc:subject>Twitter</dc:subject>
Basically, when there's more than one category, I need to find the comma and space, add a linebreak and wrap the open/close around the category.
Any thoughts?
Wow. Lots of complex answers here. How about find:
,
(there's a space after the comma)
and replace with:
</dc:subject>\r<dc:subject>
Find:
(.+?),\s?
Replace:
\1\r
I'm not sure what you meant by “wrap the open/close around the category” but if you mean that you want to wrap it in some sort of tag or link just add it to the replace.
Replace:
\1\r
Would give you
Social web
Email
Twitter
Or get fancier with Replace:
\1\r
Would give you
Social web
Email
Twitter
In that last example you may have a problem with the “Social web” URL having a space in it. I wouldn't recommend that, but I wanted to show you that you could use the \1 backreference more than once.
The Grep reference in the BBEdit Manual is fantastic. Go to Help->User Manual and then Chapter 8. Learning how to use RegEx well will change your life.
UPDATE
Weird, when I first looked at this it didn't show me your full example. Based upon what I see now you should
Find:
(.+?),\s?
Replace:
<dc:subject>\1</dc:subject>\r
I don't use BBEdit, but in Vim you can do this:
%s/(_[^<]+)</dc:subject>/\=substitute(submatch(0), ",[ \t]*", "</dc:subject>\r", "g")/g
It will handle multiple lines and tags that span content with line breaks. It handles lines with multiple too, but won't always get the newline between the close and start tag.
If you post this to the google group vim_use and ask for a Vim solution and the corresponding perl version of it, you would probably get a bunch of suggestions and something that works in BBEdit and then also outside any editor in perl.
Don
You can use sed to do this either, in theory you just need to replace ", " with the closing and opening <dc:subject> and a newline character in between, and output to a new file. But sed doesn't seem to like the html angle brackets...I tried escaping them but still get error messages any time they're included. This is all I had time for so far, so if I get a chance to come back to it I will. Maybe someone else can solve the angle bracket issue:
sed s/, /</dc:subject>\n<dc:subject>/g file.txt > G:\newfile.txt
Ok I think I figured it out. Basically had to put the replacement text containing angle brackets in double quotes and change the separator character sed uses to something other than forward slash, as this is in the replacement text and sed didn't like it. I don't know much about grep but read that grep just matches things whereas sed will replace, so is better for this type of thing:
sed s%", "%"</dc:subject>\n<dc:subject>"%g file.txt > newfile.txt
You can't do this via normal grep. But you can add a "Unix Filter" to BBEdit doing this work for you:
#!/usr/bin/perl -w
while(<>) {
my $line = $_;
$line =~ /<dc:subject>(.+)<\/dc:subject>/;
my $content = $1;
my #arr;
if ($content =~ /,/) {
#arr = split(/,/,$content);
}
my $newline = '';
foreach my $part (#arr) {
$newline .= "\n" if ($newline ne '');
$part =~ s/^\s*(\S*(?:\s+\S+)*)\s*$/$1/;
$newline .= "<dc:subject>$part</dc:subject>";
}
print $newline;
}
How to add this UNIX-Filter to BBEdit you can read at the "Installation"-Part of this URL: http://blog.elitecoderz.net/windows-zeichen-fur-mac-konvertieren-und-umgekehrt-filter-fur-bbeditconverting-windows-characters-to-mac-and-vice-versa-filter-for-bbedit/2009/01/

Resources