Autocomplete Search Boxes For Large Datasets on Google App Engine - google-app-engine

I'm completely new to Google App Engine, and I want to verify my understanding of some things. The project that I'm working on involves providing a type ahead autocomplete search box, e.g. JQuery autocomplete, for a very large dataset.
Now, if GAE wasn't in the picture, my general idea is to store the dataset in a NoSQL database, have a distributed cache in front of that, and have the web page run against the cache.
I like the one stop shop approach of GAE, but is the appengine datastore appropriate for a couple million entries or is it more appropriate to use the standalone datastore service?
The memcache included with appengine only seems to support "gets" with the exact key. I'm used to being able to submit a query similar to "like A%" which will return all of the items that begin with "A". In other words, if the user types "A" in the search box, I want to a (reasonably limited) list of all the items starting with "A" not the one entry that exactly matches "A". Is memcache going to work for this? If not, will datastore be fast enough without a cache?
I have a prototype running on my local machine using the SDK. Everything works great. When I deploy the code to App Engine, it doesn't seem like typing in the autocomplete box is actually sending anything that is being received by the app. In the Google Cloud Shell, I can clearly see the app receiving GET and PUT when I click on Form buttons or go to a new URL, but when I type in the autocomplete box, nothing happens. HTML code shown. Ideas?
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Demo</title>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/minified/jquery-ui.min.css" type="text/css" />
</head>
<body>
<center>
<form action='demo' method='post' >
<form action='' method='post' >
<p><label>Product Name: </label><input type='text' name='product' value='' class='auto'></p>
<input type='submit' value='Search'/>
</form>
</center>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function() {
//autocomplete
$(".auto").autocomplete({
source: "demo",
minLength: 1
});
});
</script>
</body>
</html>

Related

AngularJS app title rendering as {{metaTitle}} when link is pasted in Skype

I am building an AngularJS based web app. I am populating the title tag dyanmically, so that it changes for every page. When I host the app online & share the link to it over Skype with my friends (via Skype instant messaging), instead of rendering the parsed value of metaTitle, Skype renders it as {{metaTitle}}. So my friends are getting to see the curly braces with the metaTitle as text inside of it.
What can be done to render the parsed value of metaTitle in Skype and other native applications that actually show you a preview of the link that has been pasted, as a part of the chat messages?
Here is my code:
<html ng-app="myApp">
<head>
<title>{{metaTitle}}</title>
</head>
<body ng-controller="myController">
Custom content
</body>
</html>
If you want the real, dynamic title, you'll need to render the page at server-side for these robots (or serve a static cache of the page), because they don't execute the JavaScript that allows populating the title.
Otherwise, you can use
<title ng-bind="metaTitle">Static title for Skype</title>
Skype doesn't execute/interpret the JavaScript (in this case AngularJS) within the page. All Skype knows is the static HTML content.
You might want to look into server-side rendering or having a static landing page for your app.
Edit: As per #JB Nizet answer, you can also use the following syntax.
<title ng-bind="metaTitle">Static title for Skype</title>
Since you mention that you are populating metaTitle from your controller, you need to move your controller declaration to html tag:
<html ng-app="myApp" ng-controller="myController">
<head>
<title>{{metaTitle}}</title>
</head>
<body>
Custom content
</body>
</html>

How to share the article content using facebook share button from a custom module in drupal7

Hi Iam very new to drupal
Iam creating a custom module for facebook like and share buttons(i.e Referring the facebook share and like module).I have successfully created the facebook like and its functionality.But I have a problem with facebook share button..
when Iam sharing the content using the facebook share button,Its just sharing the link of my article instead of content of the article(i.e Title,description..etc)
This is the code which I have used
<iframe src="//www.facebook.com/plugins/share_button.php?<?php print $sharesrc;?>" scrolling="no" frameborder="0" style="border:none; overflow:hidden;" allowTransparency="true" style="height:22px;"></iframe>
Here $sharesrc is
"href=articleurl&layout=button_count&width=450&font=arial&height=80&colorscheme=light&locale=en_US&"
I have even checked with existing facebook share modules like
https://www.drupal.org/project/facebookshare
https://www.drupal.org/project/sharethis
https://www.drupal.org/project/service_links
I have implemented ogp also
<meta property="og:type" content="Article">
<meta property="og:title" content="Another Test article">
<meta property="og:url" content="urlofmyarticle">
But none of them is sharing the article content using facebook share button.Please help with this.
Thankyou
Make sure you copy the code from the Button Generator correctly: https://developers.facebook.com/docs/plugins/share-button
You are missing the "href" parameter:
<iframe src="//www.facebook.com/plugins/share_button.php?href=<?php echo $sharesrc;?>&layout=button_count&appId=xxx" scrolling="no" frameborder="0" style="border:none; overflow:hidden;" allowTransparency="true"></iframe>
Btw, it is recommended to ALWAYS use an App ID.
Edit: Ok, you are adding href to the variable already. But you should remove send=false and action_type. Those are flags for the Like Button, not the Share Button. And maybe it´s just not documented, but there is no colorscheme for the Share Button in the docs either.
Of course you need to make sure to have all the necessary Open Graph tags too: http://ogp.me/
...and if it STILL does not work, put the link in the debugger and refresh the OG data: https://developers.facebook.com/tools/debug/
I had the same issue after implementing openGraph meta tags.
<meta property="og:type" content="">
<meta property="og:title" content="">
<meta property="og:url" content="">
And it turned out to be caching from facebook side. Just try to share another article you have not shared before.

ADF accessing 2 different projects(Mobile Browser and Desktop Browser) in one appliction via the same url

Does anyone have an idea how to solve this problem? The idea is - application consists of two projects one of them is for mobile browser another is for desktop they have common model, user have to access two different projects via the same url depending on device he uses.
#{requestContext.agent.type == 'desktop'? 'richmobile': 'mobile'}
This kind of EL is used to change skinning depending on device. As I understand server should do approximately the same?
Initially I created model(contains java files with core logic) and TrinidadViewController(contains .jsf pages(built using trinidad components), validation and locale bundles) projects. After I got a task to add ADF browser project(to expose the same logic using ADF faces). Later I was asked to make an access to both projects using one URL.
Solution:
To manage redirect operation index.html file has been added to the project. If browser gets this kind of URL - 127.0.0.1:7101/adf-mobile-browser-poc-TrinidadViewController-context-root/, it automatically redirects to index.html page. Index.html contains redirect operation code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript">
function redirect() {
if (!isMobile()) {
window.location="/adf-mobile-browser-poc-big-context-root/faces/first.jspx";
}else {
window.location="/adf-mobile-browser-poc-TrinidadViewController-context-root/faces/first.jsf";
}
}
function isMobile() {
return (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/iPhone|iPad|iPod/i) || navigator.userAgent.match(/Opera Mini/i) || navigator.userAgent.match(/IEMobile/i))
};
</script>
</head>
<body onload="redirect()">
</body>
</html>
isMobile() –checks if current platform is mobile or desktop. Redirect() –redirects to a specific page. The whole thing looks like:
accessing URL -
127.0.0.1:7101/adf-mobile-browser-poc-TrinidadViewController-context-root/
user gets to index.html
depending on current device javascript
loads particular page.

How to Render Internet Explorer 9 in WPF Frame Control

I have a frame control in a WPF app which has an HTML page as a source. The HTML page uses HTML5 features, mostly for a video.
However I can't seem to get it to work in the frame control. I already checked this question here on StackOverflow which points to this page.
If I'm understanding correctly, the default behaviour for frame controls is to render in IE7 mode which explains why the video doesn't work. I've tried adding the application to the registry as described in the second page I've linked but somehow I'm either doing it wrong or it doesn't work for me.
I've set the name of my application as a DWORD key and the value to 0x00002328 in the registry for both:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
and
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION
This at least seems to get the rendered browser into IE9 mode - according to a little script I use to detect the browser. Still no video, though. When I run the same HTML page in an IE9 browser the video displays correctly.
Does anybody have any idea on how to solve this or whether it is solvable at all?
Someone helped solving the issue in the MSDB forums: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/87e41b0d-145d-4438-958e-c8b3a0a969d3
The important thing seems to be adding this meta information to the html:
<meta http-equiv='X-UA-Compatible' content='IE=9' />
That seems to do the trick.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=unicode' />
<meta http-equiv='X-UA-Compatible' content='IE=9' />
<title></title>
</head>
<body>
<div>
<video autoplay='autoplay' preload='metadata'>
<source src='test_video.mp4' type='video/mp4' />
</video>
</div>
</body>
</html>

How to create form in google app engine and need to store the data in datastore?

I need to create a form in google app engine for my user to key in information and the information need to be save in the datastore? So how do I do it?
Your question is a bit weak, but I'll try and help you out. I will go step by step:
1/ need to create a form.
My guess is: you are talking about a HTML form to submit data to your application. this has nothing to do with app engine you just need to create a standar HTML page with a form and the fields you would like to store onto the data store, as follow:
<html>
<head>
</head>
<body>
<form action="MAPPING_URL" method="POST">
input: <input type="text" name="user" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
Basically here I just created a simple form with one input "text" field and a Submit button to send out the "action" paramenter using the "method" parameter. For more information about forms, please take a look at: http://www.w3schools.com/html/html_forms.asp
2/ information need to be save in the datastore.
To make this happen you need to do a couple of this:
Create a Model for the entity you would like to save on the Datastore.
Create a handler that would received the request and save the entity.
Please take your time and read up the getting started guide: http://code.google.com/appengine/docs/python/gettingstarted/ this will clear out your doubts and give you a better understanding on how to build applications on App Engine.
Best,
Jose Montes de Oca

Resources