Saturday, April 26, 2014

Notes on Chrome Extension Development


DO-Share plugin

We can import other js libs:

<script src="libs/jquery-1.8.0.min.js"></script>
<script src="libs/jquery-ui-1.8.23.custom.min.js"></script>
<link rel="stylesheet" type="text/css" href="jqueryui_css/ui-lightness/jquery-ui-1.8.19.custom.css">

jsapi_for_google_plus.js
From EverNote Clearly

chrome.app.runtime.onLaunched.addListener(function() {
  chrome.app.window.create('main.html', {"id": "analyticsWinID"}, function() {});
});

chrome.tabs.query({ 'windowId': chrome.windows.WINDOW_ID_CURRENT, 'active': true }, function (_selected_tabs)
if (_selected_tab.incognito) { return; }
chrome.tabs.update(_selected_tab.id, {'url': 'chrome-extension://iooicodkiihhpojmmeghjclgihfjdjhj/blank.html'});
chrome.tabs.sendMessage(_selected_tab.id, { '_type': 'inject' });

chrome.app.runtime.onLaunched.addListener(function () {
  chrome.app.window.create("window.html", {
    id: "mainwin",
    bounds: {width:600, height:400}
  });
});

Saturday, April 19, 2014

Test pym.js


Thursday, April 17, 2014

Test Lang Tool


Java Miscs

Remote debugging in Java
http://hellotojavaworld.blogspot.com/2010/11/remote-debugging-in-java.html
For JVMs prior to 1.5:
-Xdebug
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

For JVMs 1.5 and 1.6:
-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n

Tuesday, April 15, 2014

Notes on GAE

cd ${mypp}\${mypp-ear}
mvn -f ..\pom.xml clean install && mvn appengine:update
mvn -f ..\pom.xml clean install && mvn appengine:devserver

appcfg rollback .

GAE maven:
https://developers.google.com/appengine/docs/java/tools/maven
mvn archetype:generate
Type: com.google.appengine.archetypes:skeleton-archetype
Select: appengine-skeleton-archetype


*URL with multiple parameters in cron.xml*
https://code.google.com/p/googleappengine/issues/detail?id=6328
XML treats & < > ' and " as special characters in XML text and attributes, except within CDATA sections.
Option 1.
Replace your & with &#38; or &#x26;
Option 2.
Prefix your URL with <![CDATA[ and suffix it with ]]>
http://en.wikipedia.org/wiki/CDATA
<url><![CDATA[/cron/?action=Update&n=yes]]></url>

GAE cron
every N (hours|mins|minutes) ["from" (time) "to" (time)]
<timezone>America/New_York</timezone>
<timezone>Asia/Shanghai</timezone>
every 5 minutes from 10:00 to 14:00

every N (hours|mins|minutes) ["from" (time) "to" (time)]

Validate your task schedule and get a human-readable description:
appcfg cron_info war.path

appcfg.py cron_info app-dir (Python)

GAE robots
http://stackoverflow.com/questions/13472174/robots-txt-in-appengine-java
<static-files>
<include path="/favicon.ico" />
<include path="/robots.txt" />
<include path="/img/**.png" />
<include path="/img/**.gif" />
<include path="/css/**.css" />
</static-files>
User-agent: *

Disallow: /

Monday, April 14, 2014

Algorithm Resources

http://stackoverflow.com/questions/tagged/algorithm

http://stackoverflow.com/help/searching

[algorithm]
[algorithm] answers:10

http://stackoverflow.com/search?q=%5Balgorithm%5D+answers%3A10+is%3Aquestion

http://www.topcoder.com/tc?d1

http://www.careercup.com/page?pid&n=1
http://www.careercup.com/page?pid=amazon-interview-questions

http://www.programcreek.com/category/java-2/algorithms/

http://thereq.com/q/best-java-software-interview-questions/facebook
http://xlinux.nist.gov/dads//

Example: Using Boilerpipe

Boilerpipe Demo
Welcome to the Web API for the boilerpipe Java library.
boilerpipe provides algorithms to detect and remove the surplus "clutter" (boilerplate, templates) around the main textual content of a web page.

Original Demo is at http://boilerpipe-web.appspot.com/, but it's too popular, and we often meet got "Over Quota" error, so I made s simple demo here for anyone who is interested in Boilerpipe.




Result:  

Friday, April 4, 2014

Example: Using YQL and JQuery

maximize

Thursday, April 3, 2014

Testing IFrames

maximize

Cross-domain requests with jQuery


Loading external content using YQL and JQuery and How to Send Post Data
select * from html where url="http://cnn.com" and xpath="//a" select content from html where url="http://cnn.com" and xpath="//a" *Post Data* select * from htmlpost where url='http://isithackday.com/hacks/htmlpost/index.php' and postdata="foo=foo&bar=bar" and xpath="//p" http://icant.co.uk/articles/crossdomain-ajax-with-jquery/using-yql.html http://christianheilmann.com/2010/01/10/loading-external-content-with-ajax-using-jquery-and-yql/ https://developer.yahoo.com/blogs/ydntwoblog/scraping-html-documents-require-post-data-yql-7775.html

Visual Page Monitor

Visual Page Monitor, powered by lifelongprogrammer.blogspot.com

Get Alerts when Webpage Change


Tuesday, April 1, 2014

JQuery Tips

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

$("#current").text(msg);

$("#current").html(html);

JQuery Request
$.get( "ajax/test.html", function( data ) {
  $( ".result" ).html( data );
  alert( "Load was performed." );

});

$.ajax({
  type: "POST",
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

$.post( "ajax/test.html", function( data ) {
  $( ".result" ).html( data );
});
http://www.w3schools.com/jquery/ajax_post.asp
$("button").click(function(){
  $.post("demo_test.asp",function(data,status){
    alert("Data: " + data + "\nStatus: " + status);
  });
});
$("input").keyup(function(){
  txt=$("input").val();
  $.post("demo_ajax_gethint.asp",{suggest:txt},function(result){
    $("span").html(result);
  });
});

Ready function
$(document).ready(function(){
});
$(function() {
});
Get Radio Button value using jQuery
var selValue = $('input[name=rbnNumber]:checked').val(); 

jQuery.type( /test/ )

Chrome:
console.dir()
console.log()
console.log(JSON.stringify(functor));

HTML Tips

select selected attribute
<select>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="vw">VW</option>
  <option value="audi" selected>Audi</option>
</select>