Skip to content

Instantly share code, notes, and snippets.

View ngnguyen1's full-sized avatar

Nga Nguyen ngnguyen1

  • FPT - Silicon Labs
  • Hà Nội
  • 14:18 (UTC +07:00)
  • LinkedIn in/nga-nguyen
View GitHub Profile
import javax.swing.*;
import java.awt.event.*;
public class PopUpMenu{
JPopupMenu Pmenu;
JMenuItem menuItem;
public static void main(String[] args) {
PopUpMenu p = new PopUpMenu();
}
@ngnguyen1
ngnguyen1 / CheckNumber.cs
Last active December 29, 2015 07:19
Cấu phần kết nối các loại CSDL.
using System;
namespace COP {
class CheckNumber {
public bool isNguyenTo(int a) {
if (a == 0 || a == 1)
return false;
for(int i = 2; i <= Math.Sqrt(a); i++) {
if (a % i == 0)
return false;
<?php
$conn = mysql_connect('localhost', 'root', '');
mysql_select_db('NhacTrucTuyen');
?>
<pre>
<?php
$returnValue = unserialize('a:10:{i:1;a:4:{s:6:"cropId";s:1:"3";s:6:"lookId";s:1:"0";s:1:"x";s:3:"187";s:1:"y";s:3:"169";}i:2;a:4:{s:6:"cropId";s:1:"3";s:6:"lookId";s:1:"0";s:1:"x";s:3:"228";s:1:"y";s:3:"293";}i:3;a:4:{s:6:"cropId";s:1:"3";s:6:"lookId";s:1:"0";s:1:"x";s:3:"255";s:1:"y";s:3:"373";}i:4;a:4:{s:6:"cropId";s:1:"3";s:6:"lookId";s:1:"0";s:1:"x";s:2:"50";s:1:"y";s:3:"291";}i:5;a:4:{s:6:"cropId";s:1:"3";s:6:"lookId";s:1:"0";s:1:"x";s:2:"69";s:1:"y";s:3:"207";}i:6;a:4:{s:6:"cropId";s:1:"3";s:6:"lookId";s:1:"0";s:1:"x";s:3:"120";s:1:"y";s:3:"197";}i:7;a:4:{s:6:"cropId";s:1:"3";s:6:"lookId";s:1:"0";s:1:"x";s:3:"196";s:1:"y";s:3:"283";}i:8;a:4:{s:6:"cropId";s:1:"3";s:6:"lookId";s:1:"0";s:1:"x";s:3:"181";s:1:"y";s:3:"394";}i:9;a:4:{s:6:"cropId";s:1:"3";s:6:"lookId";s:1:"0";s:1:"x";s:3:"149";s:1:"y";s:3:"436";}i:10;a:4:{s:6:"cropId";s:1:"3";s:6:"lookId";s:1:"0";s:1:"x";s:3:"129";s:1:"y";s:3:"343";}}');
print_r ($returnValue);
$b = serialize($returnValue);
echo "<br /><br />";
print_r($b);
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@ngnguyen1
ngnguyen1 / Xdefault
Created June 26, 2014 06:49
.Xdefault
! vim: set filetype=xdefaults :
URxvt.perl-ext-common : default,keyboard-select,url-select,clipboard
URxvt.keysym.M-x : perl:keyboard-select:activate
URxvt.keysym.M-u : perl:url-select:select_next
URxvt.keysym.M-c : perl:clipboard:copy
URxvt.keysym.M-v : perl:clipboard:paste
URxvt.keysym.M-s : perl:keyboard-select:search
URxvt.keysym.M-C-v : perl:clipboard:paste_escaped
var fs = require("fs"),
a;
fs.stat("filename.txt", function(err, stat) {
a = stat.size;
console.log(a);
});
@ngnguyen1
ngnguyen1 / error.log
Created October 21, 2014 10:42
Error soap request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>DATA_EMPTY</faultcode>
<faultstring>Không tìm thấy danh sách địa điểm!</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
@ngnguyen1
ngnguyen1 / cmd.sh
Created October 21, 2014 12:48
info request
#!/bin/sh
curl --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:GetServices" --data @soap_getservices.xml http://bus.hlink.vn/webservice/Server.php
@ngnguyen1
ngnguyen1 / log.txt
Created October 24, 2014 17:23
log
/home/abc/loopback-connector-soap/node_modules/soap/lib/wsdl.js:538
this.parts[part.$name].namespace = nsName.namespace;
^
TypeError: Cannot set property 'namespace' of undefined
at MessageElement.postProcess (/home/chris/.Trash/test/test/loopback-connector-soap/node_modules/soap/lib/wsdl.js:538:40)
at OperationElement.postProcess (/home/chris/.Trash/test/test/loopback-connector-soap/node_modules/soap/lib/wsdl.js:619:13)
at PortTypeElement.postProcess (/home/chris/.Trash/test/test/loopback-connector-soap/node_modules/soap/lib/wsdl.js:639:11)
at BindingElement.postProcess (/home/chris/.Trash/test/test/loopback-connector-soap/node_modules/soap/lib/wsdl.js:653:14)
at ServiceElement.postProcess (/home/chris/.Trash/test/test/loopback-connector-soap/node_modules/soap/lib/wsdl.js:688:15)
at /home/chris/.Trash/test/test/loopback-connector-soap/node_modules/soap/lib/wsdl.js:978:26