combine google maps javascripts into one - performance

When I run my website through Pingdom Tool test, it says I have to many external JavaScript, and these should be combined into as fewer as possible.
Is there a way to combine the following scripts into one (or as fewer as possible)?
https://maps.googleapis.com/maps-api-v3/api/js/29/12/common.js
https://maps.googleapis.com/maps-api-v3/api/js/29/12/controls.js
https://maps.googleapis.com/maps-api-v3/api/js/29/12/geocoder.js
https://maps.googleapis.com/maps-api-v3/api/js/29/12/infowindow.js
https://maps.googleapis.com/maps-api-v3/api/js/29/12/map.js
https://maps.googleapis.com/maps-api-v3/api/js/29/12/marker.js
https://maps.googleapis.com/maps-api-v3/api/js/29/12/onion.js
https://maps.googleapis.com/maps-api-v3/api/js/29/12/util.js
https://maps.googleapis.com/maps/api/js/Authent ... htAKU6FT4fAM4&callback=_xdc_._7duho1&token=81040
https://maps.googleapis.com/maps/api/js/Geocode ... htAKU6FT4fAM4&callback=_xdc_._ja54gz&token=80119
https://maps.googleapis.com/maps/api/js/Viewpor ... 0000&7b0&8e0&callback=_xdc_._vi8nk4&token=113027
https://maps.googleapis.com/maps/api/js/Viewpor ... 00000&7b0&8e0&callback=_xdc_._xp4b9k&token=35277
https://maps.googleapis.com/maps/api/js?key=AIzaSyAA1E2Rcxs8vYcJArt1GKhtAKU6FT4fAM4
https://maps.googleapis.com/maps/vt?pb=!1m4!1m3 ... !4e3!12m1!5b1&callback=_xdc_._7rk4vn&token=43082
https://maps.googleapis.com/maps/vt?pb=!1m4!1m3 ... !4e3!12m1!5b1&callback=_xdc_._7z4nki&token=24193

Related

How to load value from dynamically specified parameter in NiFi

I have several processes with almost same flow like "Get some parameters, extract data from database according to them and upload them to target". The parameters vary slightly across processes as well as targets but only a bit. Most of the process is the same. I would like to extract those differences to parameter-context and dynamically load them. My idea is to have parameters defined following way and then using them.
So core of question is:
How to dynamically choose which parameter group load and use?
Having several parameter contexts with same-named/different-valued parameters and dynamically switching them would be probably the best, but it is not possible as far as I know.
Also duplicating flows is out-of-the-table. Any error correction would be spread out over several places and maintenance would be a nightmare.
Moreover, I know I can do it like "In GenetrateFlowFile for process A set value1=#{A_value1} and in GenetrateFlowFile for process B set value1=#{B_value1}. But this is tedious, error-prone and scales kinda bad. Not speaking of situation when I can have dozens of parameters and several processes. Also it is a kind of hardcoding, not configuring...
I was hoping for something like defining group=A and then using it like value1=#{ ${ group:append('_value1') } } but this does not work - it is evaluated as parameter literally named ${ group:append('_value1') }.
TL;DR: Use evaluateELString().
The actual solution is to set in GenetrateFlowFile processor group=A and in next UpdateAttribute processor set the following:
value1=${ group:prepend('hash{ '):append('_value1 }'):replace('hash', '#'):evaluateELString() }
The magic being done here is "Take value of group slap around it #{ and _value1 } to make it valid NiFi Expression Language statement and then evaluate it." (Notice - the word hash and function replace is there since I didnĀ“t manage to escape the # char right before {.)
If you would like to have your value1 at the beginning of the statement then you can use following code. The result is same, it is easier to use (often-changed value value1 is at the beginning of the statement) and is less readable "what is really going on?"-wise.
value1=${ literal('value1'):prepend('_'):prepend(${ group }):prepend('hash{ '):append(' }'):replace('hash', '#'):evaluateELString() }

Use same list in less and in scss

In a project, I have quite a big list that stores various settings for different items. In scss I then loop over all the items of that list to generate different css code.
We would now like to include a less version to the project package so that every user can decide himself which preprocessor he uses. The problem is, that we would have to copy that huge list and translate it into less.
This is not very maintainable, so I'm wondering if there is a possibility to write a list in a format that can be read by both, scss and less.
$exampleList: (
(foo1, bar1, lorem1, ipsum1, ...),
(foo2, bar2, lorem2, ipsum2, ...),
.
.
.
)
#each $foo, $bar, $lorem, $ipsum, $... in $exampleList {
// Code
}

How to write a report script in Oracle

My knowledge on SQL and Oracle does not go beyond querying I'm afraid, but what I'm looking to do is run some kind of script which will produce multiple reports from one execution. I have a whole bunch of code and at the moment I'm rerunning it about 30 times, each time replacing the following in the WHERE clause with a different "SUBJECT_ID":
SELECT ...
FROM ...
WHERE ...
AND (v.SUBJECT_ID LIKE 'B%')
...
I'm thinking I should be able to run some kind of loop script and output all the 30 reports in one go...? I am hoping to get some kind of training on this quite soon, but any help would be greatly appreciated!
Assuming by
each time replacing the following in the WHERE clause with a different "SUBJECT_ID"
you mean v.subject_id like '<some value>', where is different for each loop round the code, I would do the following if I were you:
replace the v.subject_id like '<some value>' with v.subject_id like '&&subj_id.' (the . is necessary to say that's the end of the parameter name) and create that as it's own script, eg. report.sql.
Then I'd create a new script and do:
define subj_id set <some value>;
##report.sql
define subj_id set <some other value>;
##report.sql
...

How do I remove HTML encoded characters from a string?

I have a string which contains some HTML encoded characters and I want to remove them:
"<div>Hi All,</div><div class=\"paragraph_break\">< /></div><div>Starting today we are initiating PoLS.</div><div class=\"paragraph_break\"><br /></div><div>Please use the following communication protocols:<br /></div><div>1. Task Breakup and allocation - Gravity<br /></div><div>2. All mail communications - BC messages<br /></div><div>3. Reports on PoC / Spikes: Writeboard<br /></div><div>4. Non story related tasks: BC To-Do<br /></div><div>5. All UI and HTML will communicated to you through BC.<br /></div><div>6. For File sharing, we'll be using Dropbox.<br /></div><div>7. Use Skype for lighter and generic desicussions. However, in case you need any approvals, data for later reference, etc, then please use BC. PoLS conversation has been created on skype.</div><div class=\"paragraph_break\"><br /></div><div>You'll have been given necessary accesses to all these portals. Please start using them judiciously.</div><div class=\"paragraph_break\"><br /></div><div>All the best!</div><div class=\"paragraph_break\"><br /></div><div>Thanks,<br /></div><div>Saurav<br /></div>"
What you want to do is doable many ways. Perhaps looking at why you might want to do that will help. Usually when I want to remove encoded HTML, I want to recover the contents of the HTML. Ruby has some modules that make it easy.
require 'cgi'
require 'nokogiri'
html = "<div>Hi All,</div><div class=\"paragraph_break\">< /></div><div>Starting today we are initiating PoLS.</div><div class=\"paragraph_break\"><br /></div><div>Please use the following communication protocols:<br /></div><div>1. Task Breakup and allocation - Gravity<br /></div><div>2. All mail communications - BC messages<br /></div><div>3. Reports on PoC / Spikes: Writeboard<br /></div><div>4. Non story related tasks: BC To-Do<br /></div><div>5. All UI and HTML will communicated to you through BC.<br /></div><div>6. For File sharing, we'll be using Dropbox.<br /></div><div>7. Use Skype for lighter and generic desicussions. However, in case you need any approvals, data for later reference, etc, then please use BC. PoLS conversation has been created on skype.</div><div class=\"paragraph_break\"><br /></div><div>You'll have been given necessary accesses to all these portals. Please start using them judiciously.</div><div class=\"paragraph_break\"><br /></div><div>All the best!</div><div class=\"paragraph_break\"><br /></div><div>Thanks,<br /></div><div>Saurav<br /></div>"
puts CGI.unescapeHTML(html)
which outputs:
<div>Hi All,</div><div class="paragraph_break">< /></div><div>Starting today we are initiating PoLS.</div><div class="paragraph_break"><br /></div><div>Please use the following communication protocols:<br /></div><div>1. Task Breakup and allocation - Gravity<br /></div><div>2. All mail communications - BC messages<br /></div><div>3. Reports on PoC / Spikes: Writeboard<br /></div><div>4. Non story related tasks: BC To-Do<br /></div><div>5. All UI and HTML will communicated to you through BC.<br /></div><div>6. For File sharing, we'll be using Dropbox.<br /></div><div>7. Use Skype for lighter and generic desicussions. However, in case you need any approvals, data for later reference, etc, then please use BC. PoLS conversation has been created on skype.</div><div class="paragraph_break"><br /></div><div>You'll have been given necessary accesses to all these portals. Please start using them judiciously.</div><div class="paragraph_break"><br /></div><div>All the best!</div><div class="paragraph_break"><br /></div><div>Thanks,<br /></div><div>Saurav<br /></div>
If I want to take it a step farther and remove the tags, retrieving all the text:
puts Nokogiri::HTML(CGI.unescapeHTML(html)).content
Will output:
Hi All,Starting today we are initiating PoLS.Please use the following communication protocols:1. Task Breakup and allocation - Gravity2. All mail communications - BC messages3. Reports on PoC / Spikes: Writeboard4. Non story related tasks: BC To-Do5. All UI and HTML will communicated to you through BC.6. For File sharing, we'll be using Dropbox.7. Use Skype for lighter and generic desicussions. However, in case you need any approvals, data for later reference, etc, then please use BC. PoLS conversation has been created on skype.You'll have been given necessary accesses to all these portals. Please start using them judiciously.All the best!Thanks,Saurav
Which is where I usually want to get when I see that sort of string.
Ruby's CGI makes encoding and decoding HTML easy. The Nokogiri gem makes it easy to remove the tags.
I think the easiest way to do this is, Assuming you want to use the html in the string.
raw CGI.unescapeHTML('The string you want to manipulate')
If you have assigned that string to a variable s, is this the result you want?
puts s.gsub(/<[^&]*>/, '')
I would suggest:
clean = str.gsub /<.+?>/, ''

URLRewriter.net with multiple querystring separated by /

I have been looking around the site a bit, but I didn't find any replies on how to do it the way I want.
What I want is an URL like this:
www.example.com/Projects/"querystring1 - text only"/"querystring2 - 4 digits only"/
to show the page with this URL:
www.example.com/Projects.aspx?Region=querystring1&Zip=querystring2
What I have been trying is the following:
<rewrite url="~/Leje-og-udlejning-arbejdskraft/(.+)/(.+)" to="~/Workers.aspx?Region=$1&zip=$2"/>
But it just takes both of them as one querysting and put them in the Region-querystring.
I'd need to see the rest of your rewrite rules to be sure, but if you have multiple rewrites (i.e. to handle situations where users only specify one of the two query strings) neglecting to add processing="stop" at the end will cause one rule to override the other.
For example, I use the following setup in my web.config file:
<rewriter>
<rewrite url="~/(.+)/(.+)" to="~/Default.aspx?ref=$1&page=$2" processing="stop"/>
<rewrite url="~/(.+)" to="~/Default.aspx?ref=$1" processing="stop"/>
</rewriter>
This will first check to see if 2 query variables are present. If they are, it rewrites them appropriately and stops processing other rules. This is the biggie. Without processing="stop" at the end, I end up passing both as the ref query string. This might be the conflict you're running in to.

Resources