Hi i want to filter the explicit images when i run my application(in local and server).
how to i restrict the images which are containing adult images what should i do for restrict images using google custom search engine please anyone help me.
i am using below code but its not working.
<script type="text/javascript">
google.load('search', '1');
function initialize() {
var searchControl = new google.search.SearchControl();
searchControl.addSearcher(new google.search.ImageSearch());
searchControl.draw(document.getElementById("searchcontrol"));
searchControl.execute("sunset");
}
google.setOnLoadCallback(initialize);
</script>
You can use following code from this guide
var searcher = new google.search.ImageSearch();
searcher.setRestriction(
google.search.Search.RESTRICT_SAFESEARCH,
google.search.Search.SAFESEARCH_STRICT);
imageSearch.setSearchCompleteCallback ...
imageSearch.execute....
Also notice:
Adult filtering works only for few languages (please see it here)
This API marked as deprecated. Probably in future you should use some sort of this API. I am still using deprecated API, but in any time Google can disable this one.
Related
Good evening, I'm working with Google Custom Search Engine: https://cse.google.it/cse/ and I need to add, only for some URLs (in total 10 URLs) a parameter at the end of each search results URL. For example: if the domain is www.dominio-test.com then the URL to show is www.dominio-test.com/123456 the CSE searches on the web without restriction.
The code I use is the following:
<script async src = "https://cse.google.com/cse.js cx=014431187084467459449:v2cmjgvgjr0"> </script>
<div class = "gcse-search"> </div>
I thought of proceeding with reading the DOM with getElementsByClassName (), extracting the content and adding it to a variable, at this point add the if / else / replace controls and output again.
But I don't know how to proceed, can you please support me?
Thanks and good job
Search Element callbacks might work for you: https://developers.google.com/custom-search/docs/element#callbacks
On the DataTables website there are a number of examples given for functions on a table. In some they use:
table = $('#example').dataTable();
in others...
table = $('#example').DataTable();
It took me a while to notice that some functions work only on the former, while others only on the later. This is really confusing and I haven't been able to find any clarification on the difference between the two.
Currently I am at a standstill as I require two functions that only work on one or the other:
table.fnAdjustColumnSizing
and
table.column(x).search(this.value).draw();
Anyone have an idea for how to build the table so both of the above can work?
DataTable (uppercase first letter) indicates a method from the new api. The latest versions of DataTables still support the old methods, but you should use the new api when possible.
http://datatables.net/manual/api#Accessing-the-API
This is probably what you need for your question:
table.columns.adjust().draw();
https://datatables.net/reference/api/columns.adjust()
See the upgrade facts -> http://www.datatables.net/upgrade/1.10-faqs
Q. I get an error message when trying to access one of the old fn*
style API methods A. This is the inverse of the above issue.
DataTables 1.9 attached a number of functions (all starting with fn)
to the jQuery object. The old API is still available, but you must use
$().dataTable() to access the jQuery object.
Simply use
$(window).bind('resize', function () {
$('#example').dataTable().fnAdjustColumnSizing();
});
see demo -> http://jsfiddle.net/uL5x4dg1/ if you want to use the old API functions along with the new DataTable() API. dataTable() does not reinitialise the table, it just returns the oldstyle jQuery object.
I work for a Google Apps Reseller and I implement gadgets for our clients.
We have several gadgets that use Google Visualization API to query a spreadsheet (with a dynamic id) and display the result in a table.
We are using this piece of code:
function drawVisualization() {
var oldSpreadsheetUrl = "https://docs.google.com/spreadsheet/tq?key=<ss_id>";
var newSpreadsheetUrl = "https://docs.google.com/spreadsheets/d/<ss_id>/gviz/tq";
var query = new google.visualization.Query(oldSpreadsheetUrl);
query.setQuery("SELECT A,B");
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if(response.isError()) {
console.log(response.getMessage());
} else {
console.log("NUMBER OF COLUMNS: " + response.getDataTable().getNumberOfColumns());
}
}
And testing with this sample spreadsheet (New Google Spreadsheet)
SPREADSHEET ID: 1qMvY3y4MkwoK1UvCA9A8dW4BbmhH1iMwWqGLEM5vjJk
As long as we query an old spreadsheet everything works ok, but if we query a new spreadsheet (with the standard url - oldSpreadsheetUrl) the request fails with a timeout exception and we get a 404 exception.
This is the message we get in the Browser Console:
http://i.imgur.com/h4DjyQ6.png
We were able to make the query work anyway, by using this new url in the datasource:
"https://docs.google.com/spreadsheets/d/<spreadsheet_id>/gviz/tq"
But with this notation the setQuery directive is ignored and all of the three columns are returned instead of the first two ("SELECT A,B").
We are using this in several gadgets and therefore want to know:
How can we overcome the setQuery bug?
Is there a programmatic way to know if a spreadsheet is a new version or an old version?
Thank you in advance.
Regards,
Riccardo
I ran into this same problem a few weeks ago when we did some testing with the new Google Sheets. Basically, the old Google Sheets expect a URL with the following format:
https://spreadsheets.google.com/tq?key={key}
While the new Google Sheets expects a URL with this format:
https://docs.google.com/spreadsheets/d/{key}/gviz/tq
You should be able to use the domain to distinguish between old and new Google Sheets. Failing that, you could always look for /gviz/ to tell if the new Google Sheets are being used. You can find additional information in this bug report.
In regards to your other point about setQuery, I've just noticed this morning while debugging my own issue that column IDs are being returned by the Visualization API as "Col 0", "Col 1" etc. instead of "A", "B" etc. So that's likely why your ("SELECT A,B") query isn't working. I've also just logged a bug for this issue.
Hope that helps.
I've used Joel Krooswyk's Print All Backlog Story Cards solution for printing all stories in a backlog.
What I'd like to do is to extend this to have each card print the name of the parent feature that the card belongs to so I can print them all up and lay them on a table for a collaborative estimation session.
The issue is, I'm having trouble finding how to do it.
A snippet of his code in question:
queryArray[0] = {
key: CARD_TYPE,
type: 'hierarchicalrequirement',
query: '((Iteration.Name = "") AND (Release.Name = ""))',
fetch: 'Name,Iteration,Owner,FormattedID,PlanEstimate,ObjectID,Description,UserName',
order: 'Rank'
};
I can't seem to find the element to fetch!
Parent was listed on an example queries page(intended for use in the browser query functionality), with Parent.Name containing the actual text but so that hasn't worked - trying to find a reference that is clear about it seems to be eluding me.
I've looked at the type definition located at:
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/?fetch=ObjectID&pagesize=100&pretty=true
Going to the hierarchical requirement's type definition from that page indicates it has a Parent field in one form or another.
I'm not even sure that that one will solve what I'm looking at.
A bit stuck, and I'm not sure what I'm trying to do is even possible with the hierarchical requirement object type.
Note: I assume even if I do find it I'll need to add some code to deal parentless stories- not worried about that though, that's easy enough to deal with once I find the actual value.
Many thanks to anyone who can help :)
I modified Joel's app to include PI/Feature's FormattedID to the cards when a story has a parent PI/Feature.
You may see the code in this github repo.
Parent field of a user story references another user story.
If you want to read a parent portfolio item of a user story, which is a Feature object, use Feature attribute or PortfolioItem attribute. Both will work:
if (data[i].PortfolioItem) {
//feature = data[i].PortfolioItem.FormattedID; //also works
//feature = data[i].Feature.Name; //also works
feature = data[i].Feature.FormattedID;
} else {
feature = "";
}
as long as the version of API is set in the code to 1.37 or above (up to 1.43).
PrintStoryCards app is AppSDK1 app.
1.33 is the latest version of AppSDK1.x
1.29, which the app is using is not aware of PortfoilioItems.
PortfolioItem was introduced in Rally in WS API version 1.37.
See API versioning section in the WS API documentation .
If you want to access Portfolio Items, or other features introduced in later versions of WS API up to 1.43 this syntax will allow it.
<script type="text/javascript" src="/apps/1.33/sdk.js?apiVersion=1.43"></script>
This has to be used with caution. One thing that definitely will break is around calculations of timebox start and end dates. That's why many legacy Rally App Catalog apps are still at 1.29.
This is due to changes in API Version 1.30.
Note that this method of setting a more advanced version of WS API for AppSDK1 does not work with v2.0 of WS API.
You should be able to add PortfolioItem to your fetch. Parent is the field used if the parent is a story. PortfolioItem is the field used if the parent is a Feature (or whatever your lowest level PI is).
Then in the results you can just get it like this:
var featureName = (story.PortfolioItem && story.PortfolioItem.Name) || 'None';
I have to implement a page with multiple google-powered search forms. We have a license from Google for CSE, and this is the situation:
I have a search form that's present at the top of every page that performs a simple search and displays the results in a separate page. This works.
I have a particular page that, in addition, shows another two search forms: one should filter articles by category, another should filter articles by category and restrict the result to a certain month. I have added a meta key with the publication date to each article for this.
I have gotten a bit lost in the documentation, though: if I add
<gcse:searchbox-only resultsUrl="/[site]/stat/search/google_search_results.html"></gcse:searchbox-only></div>
to the page, I can't filter the results. If I start to meddle with a CustomSearchObject, I don't see an option to show results on a different page.
For category-based filtering, I've tried appending
more:pagemap:metatags-taxonomies:news
to the query argument in the results page URL, and it does work, but I don't understand how to inject this to the form.
For restricting based on dates, I tried adding
&sort=more:pagemap:metatags-pubdate:r:YYYYMMDD:YYYYMMDD
but haven't been able to make it work. Getting the XML does work:
http://www.google.com/search?q=intitle:[mysite]%20more:pagemap:metatags-taxonomies:News&sort=metatags-pubdate:r:20120401:20120830&cx=[mykey]client=google-csbe&output=xml
returns correct results.
Is there documentation that doesn't assume so much? All I find are code snippets without context. I've checked Filtering and sorting, Custom Search Element Control API, and of course this site, but I can't put all the pieces together.
I managed to implement what I wanted. In the search page, I built simple forms pointing to my results pages (this might not be doable if you must implement google branding), and in the results page I put the following:
(in the <head>)
<script src="http://www.google.com/jsapi"></script>
<script>
// This function extracts the query from the URL (if GET) or builds a search query.
// Code removed to simplify the example.
function buildQuery () {
return '<?php echo $_POST['q'];?> more:pagemap:metatags-taxonomias:News'); // injecting the taxonomy metatag filter
}
google.load('search', '1', {language : 'es'});
google.setOnLoadCallback(function() {
var customSearchOptions = {};
customSearchOptions[google.search.Search.RESTRICT_EXTENDED_ARGS] = {'sort':'metatags-pubdate:d,metatags-pubdate:r:<?php echo $_POST['startdate'];?>:<?php echo $_POST['enddate'];?>'}; // these come from the POST request, are processed earlier in the script.
var customSearchControl = new google.search.CustomSearchControl('XXXXXXXXXXX', customSearchOptions); // Put your own App key here.
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var drawOptions = new google.search.DrawOptions();
drawOptions.enableSearchResultsOnly(); // I don't want the search box here
customSearchControl.draw('cse-results-press', drawOptions);
var query = parseQuery();
if (query) {
customSearchControl.execute(query);
}
}, true);
</script>
In the <body>:
<div id="cse-results-press">Loading...</div>