Extraction - only numbers from address - google-chrome

The address of Japan is written in many sites as 〒000 - 0000.
From this, I would like to extract only numbers using imacros.
In other words, I want to remove 〒 and -.
I want to copy the extracted data, save it on the clipboard and paste it in another place.
Thank you.
(chrome 70.0.3538.102, Win10_x64)

Posting as a separate Solution, as the Input from the Extract is now "a bit" different and changes the Syntax in 'EVAL()' quite a bit, even if I tried to reuse a bit the same Syntax with the same Commands like in Answer_#1. (And that gives a 2nd Code Example...)
SET !EXTRACT "〒 000-0000"
SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.substr(2); y=x.split('-'); z=y[0]+y[1]; z;")
SET !CLIPBOARD {{!VAR1}}
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>Numbers:<SP>_{{!VAR1}}_
(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10_x64.)
And again, there would be more than 10 different ways to implement the same Functionality to get the same Result...

"Nice" to select the 'Chrome' + 'Firefox' Forum Tags but more useful would be if you had mentioned your FCI for both Browsers..., but the following Implementation for example should work in both Browsers for all iMacros Versions:
SET !EXTRACT "〒000 - 0000"
SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.substr(1); y=x.split(' '); z=y[0]+y[2]; z;")
SET !CLIPBOARD {{!VAR1}}
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>Numbers:<SP>_{{!VAR1}}_
(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10_x64.)
"for example" => as you could implement the Functionality that you want in more than 10 ways using all kinds of different Combinations with other JS String Methods...
(I didn't include the Content of '{{!CLIPBOARD}}' in the 'PROMPT' as this is not supported on CR, but a 'Paste' from your OS Clipboard in 'Notepad' for example should still work...)

Related

Numeric variable in json style

I'm stuck in my style settings as I don't know how to put a numeric variable for the "icon-rotate" attribute.
I've tried
"icon-rotate": "{{c}}"
"icon-rotate": "{c}"
"icon-rotate": "${c}"
"icon-rotate": {c}
But nothing works I always got the error
layers[10].layout.icon-rotate: number expected, string found
See https://www.mapbox.com/mapbox-gl-style-spec/. Currently properties like icon-image & text-field support tokens.
But - implementing tokens across all properties is actively being discussed in this issue: https://github.com/mapbox/mapbox-gl-style-spec/issues/249

Sublime Text 2, faster alternative to find and replace regex?

$_POST['daily_limit'];
$whatever = $_POST['smoke'];
$_POST['soup'] + $_POST['cake'];
to
$this->input->post('daily_limit');
$whatever = $this->input->post('smoke');
$this->input->post('soup') + $this->input->post('cake');
In this example, is there any faster way to switch from $_POST[] to $this->input->post() without writing up a regular expression find and replace? I don't care if it takes multiple steps. Writing the regex for this (find: \$_POST\[(.*?)\] replace: \$this->input->post\($1\)) takes longer than changing them all manually (maybe I'm just not good at regex). Any ideas?
I'm making a brash assumption here, that you have only one variable within each pair of brackets and that the variables only contain alphanumeric characters. ['soup'+'bacon'] will break this trick, as will ['soup-with-bacon'].
With your cursor, highlight an instance of $_POST[ - nothing else.
Hit Alt+F3 if you're on Windows/Linux (Cmd+ShiftG in Mac?)
Try to scroll through and see if everything that's selected is everything you want to replace.
Type $this->input->post( - nothing else.
Press → to move all cursors to the right of the first quote.
Press Ctrl+→ (this is the only remotely wtfh4xxy part of the process, and only if you're not used to navigating by word with the cursor) to navigate over the variable.
Press → twice to move all cursors to the right of the next quote.
Replace the ]with a ).
#nnnn I did a variation of your version to remove the wtfh4xxy part.
select:$_POST
altf3
type: $this->input->post(
ctrlshiftm
ctrlx
ctrlshiftm
ctrlv
type: )
Sublime text ftw!

vim omni-complete may delete my previous selected word?

I'm writing HTML with gvim, but what annoys me is that the omni-complete always delete my previous word, even my previous selected ones.
For example, assume I'm writing the following code**('_' means the cursor, hereafter)**:
<a style="_" ></a>
After I Press ^X-^O, it pops out the hint list, and I select "color:"
<a style="color:_" >
And I Press ^X-^O again, it does pops out the proper hints("rgb(", "#"), but it deletes the previous word in the meanwhile, like this:
<a style="rgb(_" >
Can anyone give me some help? Thanks a lot. And this is my gvimrc:
set guifont=文泉驿等宽微米黑\ 14
colorscheme neverness_modified
set number
set guioptions-=T
winpos 0 0
set columns=1000
set lines=1000
set fileencodings=utf-8,gb18030
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
filetype on
filetype indent on
syntax on
set cindent
set completeopt+=longest
function Maximize_Window()
silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
endfunction
" ========================
" TagList
" ========================
set tags+=/home/fish47/.vim/tags/STL.tags
" ========================
" TagList
" ========================
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
" ========================
" WinManager
" ========================
let g:winManagerWindowLayout='FileExplorer|TagList'
WMToggle
" ========================
" OmniCppComplete
" ========================
set nocp
filetype plugin on
let OmniCpp_SelectFirstItem=2
let OmniCpp_MayCompleteDot=1
let OmniCpp_MayCompleteArrow=1
let OmniCpp_MayCompleteScope=1
set showcmd
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
This is a bug in the htmlcomplete.vim script. You can work around this by inserting a <Space> between property and value, as romainl has pointed out.
Please submit a bug report (basically a link to this page) to the script's author, Mikolaj Machowski; his email address is in the script's header; the script is located at autoload/htmlcomplete.vim in the Vim install directory.
As the last change was from Apr-2011, there's a good chance the author is still maintaining it. Should you not get a response, please inform the vim_dev mailing list (cp. http://www.vim.org/community.php; you need to register first) about this; hopefully, someone else will pick it up.
Let csscomplete.vim to handle the html completion may be a solution to my problem. You can do that by adding "autocmd FileType html set omnifunc=csscomplete#CompleteCSS" in gvimrc.
It's a bug and a regression for a newer version of vim. This csscomplete.vim plugin was written for an earlier version and you using a newer version, there's an unexpected regression.
If you hack the plugin, you'll see the delete happens because it moves the cursor in reverse looking for the most obvious context, and that reverse cursor movement gets interpreted as an erase by your vim.
For me the bug was in these lines:
...
let compl_begin = col('.') - 2
while start >= 0 && line[start - 1] =~ '\%(\k\|-\)'
let start -= 1
endwhile
So yeh there's yer problem: the variable named start is passed back to vim through omnifunc and vim used to leave the existing text as-is, but newer versions interpret that motion as an erase.
So change the second while clause condition asserting the hyphen, and now you're off to the races. But that exposes a new problem, typing a letter and initiating omnifunc slows down as csscomplete.vim bogs down. But hey, one problem at a time huh.
It's like buying a car with the steering wheel mounted on the roof. It's like yeh that's not going to work bub. But this is Vim, if you're not in this for the low level hacking, then you're in the wrong machine shop.

How do I best display CheckBoxes in SQL Server Reporting Services?

One of the many quirks of Reporting Services we've run across is the complete and utter lack of a CheckBox control or even something remotely similar.
We have a form that should appear automatically filled out based on information pulled from a database. We have several bit datatype fields. Printing out "True" or "False" just looks silly, as this is supposed to look like a form that has been auto-filled out, so we want to have a series of checkboxes and labels that are either checked or unchecked.
We are running SSRS 2005 but I'm not aware of SSRS 2008 having added a CheckBox control. Even if it did, we'd need to have an alternative for the time being. The best we've found so far is:
use Wingdings
use images
use text boxes with borders and print a blank/space or a capital X
All three approaches require IIF expression shenanigans.
The Wingdings approach seemed to work acceptably, and was the most aesthetically pleasing except that for whatever reason it didn't always print correctly. More importantly, PDF exports, also for whatever reason, converted all fonts (generally) to Arial and so we got funky letters instead of the Windings dingbats.
Images, being a pixel-based raster, don't do so well when printed along side vector stuff like text. Unless handled carefully, they tend to stretch, pixelate, and do other unprofessional looking things.
While these methods do work (some with limitations as mentioned above) none of them are particularly elegant.
Are we missing something obvious? Not so obvious? Does someone at Microsoft have a good reason why such a control was not provided in SSRS 2000, let alone 2 versions and 8 years later? This can't be the first time this issue has come up...
I, along with others in my shop, have used images, toggling the hidden attribute based on the field value (true or false). We haven't had any problems with blurring or scaling, unless we tried to increase the scale of the image beyond 100% obviously.
Another option I've used is similar to the wingdings idea, but I just use a plain old "X". On our forms at least, it is not uncommon for someone to use an X in a box instead of a check mark, so it looks completely acceptable. Plus, you don't have to worry about strange characters when printing.
As for why Microsoft does not include a checkbox control, I can't answer that as I've been wondering the same thing myself for a long time now.
I just wanna share the idea on this blog. SSRS: How to Display Checkbox on Report
First create a textbox
Then change the font family to Wingdings
Insert an expression on the textbox and write this expressions.
=IIF(Fields!Active.Value,chr(254),"o")
Fields!Active.Value could be anything from your query that should return a boolean value 1 or 0.
Then click Preview and see the checkbox ;)
More styles can be selected on the blog that I shared above.
Here is an example of my output
What I have used to display a check box (or ballot box):
1- create textbox (that will become your check box)
2- change font to Arial Unicode MS
3- in the expression window use:
ChrW(&H2611) for a filled-in checkbox
ChrW(&H2610) for an empty checkbox
Besides the different methods already presented, as of SQL Server 2008 R2 there's a built-in control that can be used for checkbox-alike functionality: the Indicator!
Have a look here for details on how to use it: https://web.archive.org/web/20190916105459/http://blog.hoegaerden.be/2012/08/04/displaying-checkboxes-in-an-ssrs-report/
To be able to use a field of type bit, you'll have to cast it to int first. This can be done either in the dataset query or by adding a calculated field to the dataset.
If you want the NULLs to come up as yellow, then you'll need to build the expression that way so it takes that requirement into account as well.
Here's a possible expression for a calculated field:
=Switch(
IsNothing(Fields!YourBoolean.Value), 50,
Fields!YourBoolean.Value = False, 0,
Fields!YourBoolean.Value = True, 100)
Depending on the meaning of your fields - is False good or bad - you may need to swap the zero and 100.
Another way to do thisd is go to "Placeholder properties" of TextBox and check Html - Interpret HTML tag as styles
Then in the Value - Expression put this line of code for checked:
="<font face=""Wingdings 2"" color=""green"">" & Chr(81) &"</font>" & "some other text"
Or this code sample for unchecked:
="<font face=""Wingdings 2"" color=""red"">" & Chr(163) &"</font>" & "some other text"
This way you can have checkbox and text in the same textbox.
Later edit:
If you are having problem displaying Wingdings 2 on Azure, then use Wingdings.
Apparently it works.
="<font face=""Wingdings"" color=""green"">" & Chr(253) &"</font>" & "some other text"
Or this code sample for unchecked:
="<font face=""Wingdings"" color=""red"">" & Chr(168) &"</font>" & "some other text"
You can also use a string calculated field like "[X]" or "[ ]". It's less pretty than the textbox with border but you don't have to put a specific control for the value and you can fill table or matrix with this.
At least there is some solution for the checkbox. I'm still looking for full justification for my text (In fact I'm looking for another solution than SSRS know).
ACCESS 97 could make this kind of thing but not SQL SERVER 2012.
I think there is a bug with SSRS and embedding font characters above 128 (some thing todo with ANSI encoding). Basically you can use 1-128 fine, the rest show up as tall rectangular blocks.
I like NY's idea of the textbox with a border and an optional X - this sounds simple and effective.
This is building on Dragos Durlut's answer. I don't have a high enough reputation to comment but I can answer...
I needed a checkbox as part of text that is passed as a parameter. The parameter contains HTML and is used in a placeholder set up just like Dragos suggests: HTML - Interpret HTML tags as styles.
Instead of having to switch between the HTML and the strings, you can use the HTML Escape Codes (& + # + CharCode + ; --> ¨)
="<font face='Wingdings'>¨</font> Empty checkbox"
Since mine is a parameter, it just pass in the string:
<font face='Wingdings'>¨</font> Empty checkbox
If you need the checkbox selected, you would pass in either ý or þ instead:
<font face='Wingdings'>ý</font> filled with an x
<font face='Wingdings'>þ</font> filled with a checkmark

Show tabs with a different character (Emacs)

I'd be happy to have very soft character ">>" instead of white-space, like this:
Mono develop http://primates.ximian.com/~miguel/pictures/Valabinding-classpad.png
How can I achieve that in Emacs?
EDIT: Just realized that blank-mode is superseded by whitespace. Load this and customize whitespace-style to at least contain tabs and tabs-mark. I currently have:
(setq whitespace-style '(trailing tabs newline tab-mark newline-mark))
There is also blank-mode which allows you to achive what you want and it gives you some nice functions to cleanup the whitespace to your likings:
http://www.emacswiki.org/emacs/BlankMode
On my Emacs version (24.3) no additional modules are needed. It's enough to launch
M-x whitespace-mode
To customize go to whitespace-style variable help,
C-h C-h v whitespace-style
This mode has many functionalities. To made it simpler one may choose not to use `Face visualization'.
Use "M-:" (M-x eval-expression) and enter the following expression:
(let ((d (make-display-table)))
(aset d 9 (vector ?> ?>))
(set-window-display-table nil d))
To get back to normal enter:
(set-window-display-table nil nil)
Google search brought up show whitespace-mode. Haven't tried it myself.