Recent Notes
Displaying notes 1 - 10
Created by Poa88 on June 21, 2011 08:19:33
Last update: June 21, 2011 08:34:28
Got "base64: invalid input" error:
$ base64 -d base64_encoded.txt >original.bin
base64: invalid input
which can be easily dismissed as "input is invalid base64 encoded" or "partial input". But I know it's valid base64 encoded input! The problem was, the input was base64 encoded on Windows! The error goes away after converting to Unix format with poa88
dos2unix < base64_encoded.txt | base64 -d >original.bin
Version of base64 used:
$ base64 --version
base64 (GNU coreutils) 8.5
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Simon Josefsson.
Created by voodoo on June 14, 2010 23:37:46
Last update: November 16, 2011 12:00:33
1. Run
3Right click on "Limit maximum color depth", click "Properties", then select "Client Compatible".
gpedit.msc
2. Find Administrative Templates -> Windows Components -> Terminal Services -> Limit Maximum color depth.
3Right click on "Limit maximum color depth", click "Properties", then select "Client Compatible".
Created by James on February 22, 2009 00:12:50
Last update: February 23, 2009 02:55:31
This note records my struggle to get a checkbox aligned with its label in Firefox and IE.
1. Starting HTML code. Use default attributes. Both checkbox and label float to the left.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 S ...
2. Set width of label to that of the containing DIV:
<style type="text/css">
label {
display: block;
float: left;
clear: none;
width: 350px;
}
</style>
3. Set width of label to be less than the containing DIV:
<style type="text/css">
label {
display: block;
float: left;
clear: none;
width: 300px;
}
</style>
Created by Dr. Xi on December 25, 2009 00:13:19
Last update: December 25, 2009 00:13:19
Use the in operator to find out if a Python array contains an object:
>>> a = [1, 2, 3]
>>> 1 in a
True
>>> 3 in a
True
>>> 5 in a
False
>>> '1' in a
False
>>>
Created by freyo on May 09, 2011 14:15:01
Last update: May 09, 2011 14:17:22
In short, use the PackageManager class to get the PackageInfo:
PackageInfo pkgInfo = getPackageManager().getP ...
To build an APK, make these changes to the greetings app:
1. Change the layout to (res/layout/main.xml):
<?xml version="1.0" encoding="utf-8"?><LinearL ...
2. Change the string values (res/values/strings.xml):
<?xml version="1.0" encoding="utf-8"?>< ...
3. Update AndroidManifest.xml:
<manifes ...
4. Create a new Java class src/com/android/appinfo/GetAppVersion.java:
package com.android.appinfo;
import android.app ...
5. Edit build.xml, change project name to "AppInfo":
package com.android.appinfo;
import android.app ...
6. Install to emulator:
ant install
Created by woolf on December 11, 2011 13:38:58
Last update: December 11, 2011 13:38:58
Configure print server on TP-WR1043ND running OpenWRT
1. install usb.essentials. Package
usbutils
is optional.
# opkg update
# opkg install kmod-usb2
# opkg in ...
2. Install usb printer support:
# opkg install kmod-usb-printer
3. Install p910nd print server:
# opkg install p910nd
4. Edit /etc/config/p910nd:
config p910nd
option device /dev/lp0
option port 0
option bidirectional 1
option enabled 1
5. Configure firewall to allow port 9100 (/etc/config/firewall):
# Allow printer
config rule
option src lan
option proto tcp
option dest_port 9100
option target ACCEPT
If clients are connecting from wan then the first line should be:
option src wan
6. Enable automatic start of print server when router boots:
#/etc/init.d/p910nd enable
7. Restart router:
# reboot
Created by Dr. Xi on January 31, 2009 16:50:57
Last update: January 31, 2009 16:50:57
MinGW uses native windows API and there's no unix compatible sleep function. Windows native Sleep (with capital S) sleeps in milliseconds.
#include <iostream>>
#include <windows.h>
#define ...
Created by Dr. Xi on March 28, 2011 15:54:20
Last update: March 28, 2011 15:54:20
From the nc man page:
The nc (or netcat) utility is used for just about anything under the sun involving TCP or UDP. It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, do port scanning, and deal with both IPv4 and IPv6.
1. To bind to port 8080:
nc -l 8080
2. To connect to the port above
nc localhost 8080
Type something in either window it will be echoed in the other.
3. To get the home page of google:
echo -e -n "GET / HTTP/1.1\r\nHost:www.google. ...
4. To send email via SMTP:
nc -C localhost 25 << EOF
HELO host.example.com ...
5. Port scan of localhost:
$ nc -z localhost 20-8080
Connection to localho ...
Created by freyo on June 28, 2011 11:11:03
Last update: June 28, 2011 11:11:03
This exception occurs when trying to get a private key:
PrivateKey privateKey = (PrivateKey) keyStore.getK...
Stack trace:
Exception in thread "main" java.security.Unrecover...
which was caused by giving a wrong private key password.
The solution is to correct the key password in your code, or change the password in the keystore to match that in your code:
keytool -keypasswd -alias mykey -keypass oldpasswo...
Created by Dr. Xi on June 27, 2011 13:12:36
Last update: June 27, 2011 13:12:36
Parameterized types are considered different at compile time but not at runtime. This program fails compilation because List<Foo> is not the same as List<Bar> :
import java.util.ArrayList;
import java.util.Li...
Error:
$ javac SameErasure.java
SameErasure.java:8: do...
This also fails because List<Foo> and List<Bar> are considered the same:
import java.util.ArrayList;
import java.util.Li...
Error:
$ javac SameErasure.java
SameErasure.java:11: n...