https://library.linode.com/linux-tools/utilities/logrotate#sph_understanding-logrotate-conf
All posts by admin
How to get user from local group
NetGroupGetUsers function
Administrators and users group are the group store local users
Safe URL API query
Safe Browsing is a service provided by Google that enables applications to check URLs against Google’s constantly updated lists of suspected phishing and malware pages.
JSON P memory lack
worth read: https://neil.fraser.name/news/2009/07/27/
Not sure if Jquery has built this memory clean up inside
Edit: looks no more memory lack in JSON P in Jquery 1.10.2 , IE8
POE JSON P
use warnings;
use strict;
use Data::Dumper;
use JSON;
use POE qw(Component::Server::TCP Filter::HTTPD);
use HTTP::Response;
# Load HTTP::Request for forming the initial request.
use HTTP::Request;
use POE qw(Wheel::ReadWrite Filter::Stream);
# Create a JSON object
my $json = new JSON;
POE::Component::Server::TCP->new(
Port => 8088,
ClientFilter => ‘POE::Filter::HTTPD’, ### sub {
my ($kernel, $heap, $request) = @_[KERNEL, HEAP, ARG0];
print Dumper($request);
# It’s a response for the client if there was a problem.
if ($request->isa(“HTTP::Response”)) {
my $response = $request;
$request = $response->request;
warn “ERROR: “, $request->message if $request;
$_[HEAP]{client}->put($response);
$_[KERNEL]->yield(“shutdown”);
return;
}
my $uri=$request->{‘_uri’};
my %query = $uri->query_form;
print “query is “.join(” “,keys %query).” \n”;
#$request = $json->utf8->decode();
my $request_fields = ”;
$request->headers()->scan(
sub {
my ($header, $value) = @_;
$request_fields .= (
”
$header$value
”
);
}
);
my @list = ( 1, 2, \%query );
my $json = new JSON;
my $json_text = $json->encode(\@list);
my $returntext=”$query{‘callback’}($json_text )”;
$heap->{‘message’}=$returntext;
my $response = HTTP::Response->new(200);
$response->push_header( ‘Content-type’, ‘text/javascript’ );
$response->content(
$returntext
);
#print $json_text;
#print Dumper($request);
$_[HEAP]{client}->put($response);
},
);
print “Aim your browser at port 8088 of this host.\n”;
POE::Kernel->run();
exit;
HTML
<script type=”text/javascript”>// <![CDATA[
$(document).ready(function(){
$(“button”).click(function(){
alert(“test”);
$.ajax({
url: “http://localhost:8088/abc.php?xxx=bbbxss“,
// the name of the callback parameter, as specified by the YQL service
jsonp: “callback”,
// tell jQuery we’re expecting JSONP
dataType: “jsonp”,
// tell YQL what we want and that we want JSON
data: {
q: “select title,abstract,url from search.news where query=\”cat\””,
format: “json”
},
// work with the response
success: function( response ) {
console.log( response ); // server response
//var _body = document.getElementsByTagName(‘body’) [0];
//_body.appendChild(response);
}
});
})
})
// ]]></script>
<button>Get JSON data</button>
<div> </div>
web socket problem with proxy
Web socket has benefit, but not all proxy server support it, this leave web socket not usable.
Ajax + JSON is the way left
Jquery Sample1 define click
If you click on me, I will disappear.
Click me away!
Click me too!
define _WIN32_WINNT
1. #define _WIN32_WINNT = 0x0501
2. -D _WIN32_WINNT=0x0501
3. Properties>C/C++>Proporcessor heading, _WIN32_WINNT = 0x0501.
it is needed to call winuser API defined for XP above
Mouse/Keyboard monitor
To get the actual key:
SetWindowsHookEx , Anti virus will raise flag.
Or
Raw Input API
To get status
GetMouseMovePointsEx
Windows Open Source Environment
MinGW, a contraction of “Minimalist GNU for Windows”, is a minimalist development environment for native Microsoft Windows applications.
What’s Difference between Cygwin and MinGW?
MinGW,== Native windows apps
Cygwin == Unix on windows
MinGW provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs. (It does depend on a number of DLLs provided by Microsoft themselves, as components of the operating system; most notable among these is MSVCRT.DLL, the Microsoft C runtime library. Additionally, threaded applications must ship with a freely distributable thread support DLL, provided as part of MinGW itself).
MinGW compilers provide access to the functionality of the Microsoft C runtime and some language-specific runtimes. MinGW, being Minimalist, does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows. If you want POSIX application deployment on this platform, please consider Cygwin instead.
Primarily intended for use by developers working on the native MS-Windows platform, but also available for cross-hosted use, (see note below — you may need to follow the “read more” link to see it), MinGW includes:
o A port of the GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers;
o GNU Binutils for Windows (assembler, linker, archive manager)
o A command-line installer (mingw-get) for MinGW and MSYS deployment on MS-Windows
o A GUI wrapper (mingw-get-inst) for the command line installer
MSYS, a contraction of “Minimal SYStem”, is a Bourne Shell command line interpreter system. Offered as an alternative to Microsoft’s cmd.exe, this provides a general purpose command line environment, which is particularly suited to use with MinGW, for porting of many Open Source applications to the MS-Windows platform; a light-weight fork of Cygwin-1.3, it includes a small selection of Unix tools, chosen to facilitate that objective.