How to find the right domain name using the query - javascript

I have a requirement in my website to auto open new tab of google query search based on a query.
Example: If my query is libro signora in giallo, the google search page should be https://www.google.it/search?q=libro signora in giallo
And if my query is goteros para niños, the search page would be https://www.google.com.mx/search?goteros para niños
Similarly, there are different such marketplaces like in, jp etc etc
My code has to append query to https://www.google.com/search?q= and auto pop
But my concern is how do i find out the right country tld or domain name based on the query so that the auto popup tab searches in the right tld?
This would be in frontend or javascript?
Is there any built in library or functionality to pick the right TLD?

Related

Tableau: Hyperlink auto open webpage based on Key ID

I was wondering if it's possible to create a hyperlink on Unique IDs I have on tableau to open a webpage that pre-enters the Unique ID on the web page's search bar and load it?
For example let's say i have a unique ID ABCD12345, when I click on it, I want it to load a web page on Internet Explorer(workplace still uses IE unfortunately...)
that will automatically enter the UNIQUE ID ABCD12345 into its search bar and open the web page based on that Unique ID.
Note: unfortunately the webpage's search page URL does not contain any components of the unique ID, so embedding is out of question I'm afraid...
Any help would be much appreciated!

How to search on any website in Website Scraping

I am working on a project to scrape data from a website using DOM parsing. It can extract data from a particular website using that page url.
I want to add functionality to pass a php variable to that website's search box. and search that query. When a user manually enters a value in the website search box and presses search, the result comes out and we select that result. I want to do this programmatically.
How I can pass my php variable to a website search box and search on that website?
You will have to check and see how the form works - to which endpoint the data is posted. Then just do the same in your script and process the result (which might be servied in various different formats - JSON, HTML, XML etc.). Sometimes there might be added security, in particular if it's a .NET site that uses viewstate.
A somewhat straight forward suggestion would be to run a script on submission of the form that searches the text in each of the web pages in your working directory to find a match, then display a page with links to the found matches.
I will use PHP for my description of how this is done.
With this in mind, first learn how to read entire pages (i.e. webpages) into a string:
http://php.net/manual/en/function.file-get-contents.php
//YOU WILL HAVE TO LINE THIS UP WITH YOUR WORKING FILE NAMES
$home = file_get_contents('./home.php', FILE_USE_INCLUDE_PATH);
or I suppose you could just search for the actual webpage/URL like so:
$home = file_get_contents('http://www.example.com/');//IMAGINE THIS IS REALLY HOME.PHP
$homePageName = "home.php";//JUST HERE TO SHOW AN EXAMPLE
Example:
///YOUR FORM/INPUT BOX
<form action="search.php" method="post">
<input type="text" name="findMe" placeholder="Search...">
</form>
Now search.php
$search = $_POST['findMe'];
//$search = "example";//THIS WOULD WORK, BUT I WAS SHOWING HOW TO USE FORM
//IF WORD FOUND IN HOME PAGE
if (stripos($home, $search) !== false) {//USING EXAMPLE.COM TO SHOW IT WORKS
echo ''.$homePageName.'';
}
Then if you want to be simplistic and not use an array to store the found pages, take the same code above and use it for every page you want searched (i.e. home, about, products, etc..).
Now a user can search your site (or the pages you want indexed), to find all pages that have matching text. If you want specific keywords to be searched, just add them to the page metadata and the process I have described will still work as it searches everything that makes up the page.
<meta name="keywords" content="keyword1, keyword2, keyword3 " />

ICD 10 dropdown for a Spring application with mysql database in the background

I am currently working on a Spring healthcare application where the doctor can enter the diagnosis codes in the input tag of a page. What I want is that the doctor should be able to select the codes from a drop-down menu, the problem with ICD10 codes records is that there are a lot of them. Can anyone suggest a tool or a javascript library that can make my life easier?
You can use a search feature for this. You could have a text input with a search button. When the user types some of the initial text of the ICD-10 code and clicks the search, you perform a search request to the backend, and with the results, you can load a regular select.
Of course you would have to create a search endpoint in your backend, and possibly your select would need to be paginated. You could even display the results in a table instead of a select and add a select button to the rows.
If you just want to display the codes in your HTML, the resulting page will be heavy, no matter how many pagination features you add. If all your ICD-10 codes are sent to the client right away, we could be talking about MBs to render your page, that's why I'll move the retrieval of codes to the backend and limit it there with some "limit + offset" feature.
So, a search box. When the user clicks the search button, you perform a request telling the backend the term to search, a limit, like 10, and an initial offset, probably 0. You display those results in a table and, if there are more, a pagination. When the user clicks another page, you perform the same request specifying a different offset, and so on.

How to open a spreadsheet at specific cell/row with an URL

I would like to have an URL which opens an editable Google Spreadsheet and have specified cells selected so that the user does not have to find the data in a long sheet before editing. The cells to be selected should be given in the URL. It is also good if a specific row is filtered.
It was super easy with the old Google spreadsheets. I know it is possible without editing possibility, but I need it to open the editable version.
Also I know that I could create a filter view and share that as a link, but I cannot make a filter view for each row and get the URL for it.
I have also went into web scripts (HTTP Get in Google Spreadsheet, "e undefined"), which can take variables from URL, but cannot open the sheet on the client side (I have not found it yet).
You can create a Google Script webapp that would store url values as User Properties which could then be used in an onOpen trigger. To make this work there is a couple of things to be aware of. Firstly, like other Properties Services stored values are bound to the script. This means that if you write two different scripts and set a User Property in one script you can’t get it in another:
The Properties Service lets you store simple data in key-value pairs
scoped to one script, one user of a script, or one document in which
an add-on is used. … Properties are never shared between scripts. –
Google Script Properties Service Guide
A way around this is you have a library which is used to store and return properties. I've written a blog post which explains this in more detail. As part if this I've created a webapp anyone can use using the following url and parameters
To open your sheet at a row for editing direct users to the following url replacing the values as indicated:
https://script.google.com/macros/s/AKfycbzG9_2mWd6x7zFf9V6PH33ORRzZWcVGi_pQs500nbs5Pbdkwy26/exec?id=YOUR_SHEET_ID&sheet=YOUR_SHEET_NAME&row=YOUR_ROW_NUMBER
Optionally if you wish to include a header row when the sheet opens use &header=NUMBER_OF_ROWS_FOR_HEADER. Anyone is welcome fork/modify this code to get your required functionality.
its not possible in new sheets because they removed the listview feature from old sheets.
your only option is the one mentioned in the linked blog post you provided:
"Comment at a specific cell, and, in that comment "plus someone" - that is, type "+" and then the person's email or name NOTE: you will get a list of people in your domain as soon as you type the "+", filtered as you start typing their name/email the person you "plussed" will get an email with both the contents of the cell and your comment the link in that email will take them DIRECTLY TO THE TARGET CELL with the comment activated"
*** Update THR 20181004: In today's current version of Google Sheets, you can right-click a cell and select the "Get link to this cell" menu item, which copies a URL to the clipboard that will open the spreadsheet with the indicated cell in the upper left corner, subject to the limit of the existing rows and columns filling to the bottom and right edges respectively of the page. The URL is the same format as in the previous feature before this exposure in the Sheets UI, appending &range=<cell-A1-address> to the #gid=<tab-GID> fragment spec, eg:
https://docs.google.com/spreadsheets/d/1QSAJzpdM6z4haa-ah1HKqdy8U1vUxWmPIwplej-9fsI/edit#gid=907876553&range=C7
In today's (THR 20180607) current version of Google Sheets, you can open a sheet with a specified cell shown in the top left visible corner, by specifying the cell address as the range in the URL's fragment component. For example, cell C7 in Google's [Template] Google Sheets: Project plan sheet:
https://docs.google.com/spreadsheets/d/1QSAJzpdM6z4haa-ah1HKqdy8U1vUxWmPIwplej-9fsI/edit#gid=907876553&range=C7
Of course this same technique positions the top left cell of a multicell range in the top left visible corner of the sheet.
Note that the specified cell will be positioned in the window's scrolling viewport after any frozen rows/columns are applied to the view. You can get the complete URL, including the cell's fragment tuple, by right-clicking the cell, and in the popup context menu selecting "Get link to this cell".
The URL can be constructed programmatically, so any object in the sheet that can anchor a hyperlink URL can be linked to any cell/range for navigation to it. Therefore this technique is usable via the GUI, by cell formula/style, or by script - or by any external application/page.
It's disappointing that Google hasn't included in the basic Sheets GUI a field in which the user can enter a cell or range address to jump to that range by URL. Every serious spreadsheet application has had this basic feature since the 1980s.

Show user information on mousehover

On Mouse-over i wish to show user information such as User Id, User Name, User Location, User Age etc. All this info would be coming from database. As well, this information would be in a rectangular block that would actually come-up on Mouse-over.
I am aware that JavaScript could be use to show div (in mouse-over) but don't know how to fetch from database?
Plus the application is a Windows Based Asp.net Application. I am not aware whether that could be possible in Windows based as i'm web based developer.
Thanks for all your inputs.
You could use the jQuery qtip plugin that can display dynamic content, see a documentation at
http://craigsworks.com/projects/qtip/docs/tutorials/#dynamic
and a demo at
http://craigsworks.com/projects/qtip/demos/content/loading
The url parameter should point at an aspx page that show the text that is loaded from database.

Categories