Search This Blog
Linux: block outgoing traffic to specific ip or port using iptables or ufw
- Using iptables:
# block outgoing traffic to ip 1.2.3.4 iptables -A OUTPUT -d 1.2.3.4 -j DROP # block outgoing traffic to port 5678 iptables -A OUTPUT -p tcp –dport 5678 -j DROP # block outgoing traffic to 1.2.3.4:5678 iptables -A OUTPUT -p tcp -d 1.2.3.4 –dport 5678 -j DROP
- Using ufw:
# block outgoing traffic to ip 1.2.3.4 ufw deny out to 1.2.3.4 # block outgoing traffic to port 5678 ufw deny out to any port 5678 # block outgoing traffic to 1.2.3.4:5678 ufw deny out to 1.2.3.4 port 5678
see also: Linux Iptables Block Outgoing Access To Selected or Specific IP Address / Port
Linux firewall: ufw
- Installation(on Ubuntu):
- sudo apt-get install ufw
- Configuration script:
-
#!/bin/sh # disable and reset ufw sudo ufw reset --force # deny everything sudo ufw default deny # allow remote ssh connection from host 1.2.3.4 sudo ufw allow proto tcp from 1.2.3.4 to any port 22 # allow remote ssh connection from host 1.2.3.5 sudo ufw allow proto tcp from 1.2.3.5 to any port 22 # trust remote ip 1.2.3.6 sudo ufw allow from 1.2.3.6 sudo ufw allow to 1.2.3.6 # allow https server port sudo ufw allow proto tcp from any to any port 443 # allow tcp connection from 1.2.3.7 to port 6666 sudo ufw allow proto tcp from 1.2.3.7 to any port 6666 # enable ufw sudo ufw enable # list the rules sudo ufw status verbose
Javascript: parse a string of email addresses and contact names
A string contains contact name and email, like below
"Jake Smart", jack@smart.com, "Development, Business"
We want to parse it into an array of objects (the object has name and email attributes):
"Jake Smart"
We want to parse it into an array of objects (the object has name and email attributes):
// the parser function
function parse(s){
var os = [];
var regex = /(?:"([^"]+)")? ?<?(.*?@[^>,]+)>?,? ?/g;
while(m=regex.exec(s)){
os.push({name:m[1],email:m[2]});
}
return os;
}
// the code below is to test the parser function
var str = '"Jake Smart" <jake@smart.com>, jack@smart.com, "Development, Business" <bizdev@smart.com>';
var objects = parse(str);
for(var i=0;i<objects.length;i++){
var object = objects[i];
document.write(object.name + " : " + object.email + "<br/>");
}
See also Javascript: RegEx.exec() method
Blogger: Rename a label
- If you are using the new/updated Blogger interface, you need to switch back to the old interface.
- Activate "Posting" tab, the "Edit posts" subtab
- In the "Labels Actions...", select "New label...", the type the new label that you want to rename to, click "OK" to create the (new) label.
- In the "Labels" sidebar, click the (old) label you want to rename. It will then show all the posts with that (old) label.
- Select all the posts with the (old) label, in "Label Actions..." select that (old) label under "Remove Label" section:
- In "Label actions...", select the (new) label under "Apply Label" section
- After rename the label, you can switch back to the new/updated Blogger interface.
SEE ALSO:
convert a positive number to negative
int a = 1; int b; b = -1 * a; double c = -1.0; int d; d = -1 * c; System.out.println(b); System.out.println(d);
Mac OS X Lion: Virtual Desktops
- add a virtual desktop
- open Mission Control (4 fingers up on touchpad)
- move the mouse to the top right corner of the screen, a + icon will appear there
- click it to add a new desktop
- remove a virtual desktop
- open Mission Control (4 fingers up on touchpad)
- mouse over the desktop you want to delete
- a small cross(delete) icon will appear in a short while
- click it to delete the desktop
See Also: http://www.tuaw.com/2011/07/20/mac-os-x-lion-and-mission-control/
Mac OS X Lion: Shortcuts to open Mission Control
- Use Touchpad: swipe up with 3 or 4 fingers
- Use Magic Mouse: double tapping the mouse surface
- Use Mac Keyboard: Dashboard key (F3 on my MacBook Pro)
- Find Mission Control app from Applications and keep it in Dock
- Find Mission Control app using Spotlight
See Also: http://www.tuaw.com/2011/07/20/mac-os-x-lion-and-mission-control/
Mac OS X: change the default application to open a type of file
- Right Click (or Ctrl + Left Click) the file,
- Select "Open With..." from the popup menu
- Select "Other..." in the submenu
- Select the application and tick "Always Open With" then click "Open" Button
Mac OS X Lion: how to exit Terminal full screen mode
- Use key combo: command + option + F can enter/exit full screen mode when you are using Terminal.
- Alternatively, use the mouse:
- To enter full screen mode: click the top-right corner icon of the terminal window
- To exit full screen mode: mouse over the top for a while, system menu will appear, you can then select "View" -> "Enter Full Screen Mode"
ZTE Tablet V9 blade (Optus Mytab) Resources
ZTE Tablet V9 (Blade) Optus Australia
- Unlock from Optus (Using the following unlock code calculators)
- Official firmware upgrade (Android 2.2)
- Root the phone using z4root (Android 2.2)
See also:
ZTE V9 wiki page at [whirlpool.net.au]Droidhen Defender Game Hack
Droidhen Defender is an free Android game.
Prerequisites:
The game saves files at /data/data/com.droidhen.defender/shared_prefs, named: save0.xml save1.xml save2.xml
The save file is in the following format:
To change the values of gold and magic stone, we need to not only change the value of gold and magicStone, but also goldcheckValue and magicStonecheckValue. How to calculate the checkValue? Use the following fomula:
checkValue = md5(value+"checkChar")
To calculate the checkValue for value 100000000:
You should get the checkValue for 100000000,
Prerequisites:
- Root your device. Do not how to root your device? google
+ root - Install a root file manager app: super manager (free) or root explorer (non-free)
The game saves files at /data/data/com.droidhen.defender/shared_prefs, named: save0.xml save1.xml save2.xml
The save file is in the following format:
<?xml version='1.0' encoding='utf-8' standalone='yes' ?> <map> <int name="magicStone" value="6" /> <string name="magicStonecheckValue">1e0e72ebd00ab9e2535db46431d29e93</string> <int name="singleRetry" value="0" /> <int name="stage" value="2" /> <int name="gold" value="2200" /> <string name="goldcheckValue">a1a566f1d427b549f7b7c8dac5f0cb36</string> <int name="hardMode" value="0" /> </map>
To change the values of gold and magic stone, we need to not only change the value of gold and magicStone, but also goldcheckValue and magicStonecheckValue. How to calculate the checkValue? Use the following fomula:
checkValue = md5(value+"checkChar")
To calculate the checkValue for value 100000000:
- If you are using Mac, run
md5 -s 100000000checkChar
in the Terminal window. - If you are using Linux run
echo -n 100000000checkChar | md5sum
in the terminal window - Or you can open this web page and type 100000000checkChar and click Calculate MD5 button
You should get the checkValue for 100000000,
4293191e6b63499927db54f204f7eb30
- You can copy the file, e.g. save0.xml, to /mnt/sdcard/ using your root file manager: super manager.
- Edit it with text editor
- Modify the gold and magicStone to 100000000
- Modify the goldcheckValue and magicStonecheckValue to 4293191e6b63499927db54f204f7eb30
- You modified save0.xml looks like below:
<?xml version='1.0' encoding='utf-8' standalone='yes' ?> <map> <int name="magicStone" value="100000000" /> <string name="magicStonecheckValue">4293191e6b63499927db54f204f7eb30</string> <int name="singleRetry" value="0" /> <int name="stage" value="2" /> <int name="gold" value="100000000" /> <string name="goldcheckValue">4293191e6b63499927db54f204f7eb30</string> <int name="hardMode" value="0" /> </map>
- Copy the modified save0.xml file back to /data/data/com.droidhen.defender/shared_prefs
- Start the game and load the saved file, you can now use the gold and magic stone to buy and upgrade anything.
See Also
http://forum.xda-developers.com/showthread.php?t=1335611&page=3Java SSH implementation
Install Windows Phone Developer Tools on Windows XP
- Download Windows Phone Developer Tools RTW
- Open "Command Prompt" and type the following command to extract vm_web.exe file:
vm_web.exe /x
- Find baseline.dat file from the extracted files and open it with notepad:
- Find ‘gencomp7788’ section and change this two entries from 1 to 0:
InstallOnLHS=0 InstallOnWinXP=0
- Save the file
- Run setup.exe /web in the extracted folder to start the installation
See also: Windows Phone 7 CTP Windows XP bypass?
Windows Phone 7 Development using Mac
Requires
See also:
- VMWare Fusion
- Windows 7 installation disc/ISO image and proper License
- Create a new Window 7 VM in VMWare Fusion and install Windows 7
- Install Windows Phone 7 SDK in the VM
- XNA applications will not work in the Windows Phone Emulator
- Windows Phone Emulator is slower than that in a physical machine
See also:
Android SDK Dev Guide in PDF
Android SDK Dev Guide in PDF
You can convert the PDF files into EPUB or MOBI format using Calibre so that you can read it on your kindle or other ereaders.
The official Android Developer web site: http://developer.android.com
- Android SDK Dev Guide - Framework Topics
- Android SDK Dev Guide - Developing
- Android SDK Dev Guide - Publishing
- Android SDK Dev Guide - Best Practice
- Android SDK Dev Guide - Appendix
You can convert the PDF files into EPUB or MOBI format using Calibre so that you can read it on your kindle or other ereaders.
The official Android Developer web site: http://developer.android.com
Use OEM BIOS file in VMWare virtual machine
- Create a VM but do not start installation, assume the VM is named "Windows 7"
- Quit VMWare Fusion
- Edit the .vmx file in "/Users/${USER}/Documents/Virtual Machines.localized"
vi /Users/${USER}/Documents/Virtual Machines.localized/Windows\ 7.vmwarevm/Windows\ 7.vmx
- add line:
bios440.filename = "MY_OEM.ROM"
> See also:
How to install your OEM certificate on Windows 7
- Click Start, click All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.
- Click OK.
- At a command prompt, type the following command, and then press ENTER:
- slmgr.vbs -ilc oem-cert.xml
DICOM Value Representation (VR)
VR | Definition | Details |
---|---|---|
AE | Application Entity A string of characters with leading and trailing spaces (20H) being non-significant. The value made of 16 spaces, meaning "no application name specified", shall not be used. |
Character Repertoire Default Character Repertoire excluding control characters LF, FF, CR and ESC. Length 16 bytes maximum Data Type String |
AS | Age String A string of characters with one of the following formats -- nnnD, nnnW, nnnM, nnnY; where nnn shall contain the number of days for D, weeks for W, months for M, or years for Y. Example - "018M" would represent an age of 18 months. |
Character Repertoire "0"-"9", "D", "W", "M", "Y" of Default Character Repertoire Length 4 bytes fixed Data Type String |
AT | Attribute Tag Ordered pair of 16-bit unsigned integers that is the value of a Data Element Tag. Example - A Data Element Tag of (0018,00FF) would be encoded as a series of 4 bytes in a Little-Endian Transfer Syntax as 18H,00H,FFH,00H and in a Big-Endian Transfer Syntax as 00H,18H,00H,FFH. Note - The encoding of an AT value is exactly the same as the encoding of a Data Element Tag as defined in Section 7. |
Character Repertoire Not applicable Length 4 bytes fixed Data Type uint32 |
CS | Code String A string of characters with leading or trailing spaces (20H) being non-significant. |
Character Repertoire Uppercase characters, "0"-"9", the SPACE character, and underscore "_", of the Default Character Repertoire Length 16 byte maximum Data Type String |
DA | Date A string of characters of the format yyyymmdd; where yyyy shall contain year, mm shall contain the month, and dd shall contain the day. This conforms to the ANSI HISPP MSDS Date common data type. Example - "19930822" would represent August 22, 1993. Note - 1. For reasons of backward compatibility with versions of this standard prior to V3.0, it is recommended that implementations also support a string of characters of the format yyyy.mm.dd for this VR. 2. See also DT VR in this table. Note - For reasons specified in the previous column, implementations may wish to support the "." character as well. |
Character Repertoire "0"-"9" of Default Character Repertoire Length 8 bytes fixed Note - For reasons specified in the previous columns, implementations may also wish to support a 10 byte fixed length as well. Data Type String |
DL | Delimitation | |
DS | Decimal String A string of characters representing either a fixed point number or a floating point number. A fixed point number shall contain only the characters 0-9 with an optional leading "+" or "-" and an optional "." to mark the decimal point. A floating point number shall be conveyed as defined in ANSI X3.9, with an "E" or "e" to indicate the start of the exponent. Decimal Strings may be padded with leading or trailing spaces. Embedded spaces are not allowed. |
Character Repertoire "0" - "9", "+", "-", "E", "e", "." of Default Character Repertoire Length 16 bytes maximum Data Type String |
DT | DATE TIME The Date Time common data type. Indicates a concatenated date-time ASCII string in the format: YYYYMMDDHHMMSS.FFFFFF&ZZZZ The components of this string, from left to right, are YYYY = Year, MM = Month, DD = Day, HH = Hour, MM = Minute, SS = Second, FFFFFF = Fractional Second, & = "+" or "-", and ZZZZ = Hours and Minutes of offset. &ZZZZ is an optional suffix for plus/minus offset from Coordinated Universal Time. A component that is omitted from the string is termed a null component. Trailing null components of Date Time are ignored. Non-trailing null components are prohibited, given that the optional suffix is not considered as a component. Note - For reasons of backward compatibility with versions of this standard prior to V3.0, many existing DICOM Data Elements use the separate DA and TM VRs. Standard and Private Data Elements defined in the future should use DT, when appropriate, to be more compliant with ANSI HISPP MSDS. |
Character Repertoire "0" - "9", "+", "-", "." of Default Character Repertoire Length 26 bytes maximum Data Type String |
FL | Floating Point Single Single precision binary floating point number represented in IEEE 754:1985 32-bit Floating Point Number Format. |
Character Repertoire Not applicable Length 4 bytes fixed Data Type float |
FD | Floating Point Double Double precision binary floating point number represented in IEEE 754:1985 64-bit Floating Point Number Format. |
Character Repertoire Not applicable Length 8 bytes fixed Data Type double |
IS | Integer String A string of characters representing an Integer in base-10 (decimal), shall contain only the characters 0 - 9, with an optional leading "+" or "-". It may be padded with leading and/or trailing spaces. Embedded spaces are not allowed. The integer, n, represented shall be in the range: -231 <= n <= (231 - 1).
|
Character Repertoire "0"-"9", "+", "-" of Default Character Repertoire Length 12 bytes maximum Data Type String |
LO | Long String A character string that may be padded with leading and/or trailing spaces. The character code 5CH (the BACKSLASH "\" in ISO-IR 6) shall not be present, as it is used as the delimiter between values in multiple valued Default Character Repertoire and/or as defined by (0008,0005). |
Character Repertoire 64 chars Length 64 chars maximum Note - The length of the VRs for which the Character Repertoire can be extended or replaced are expressly specified in characters rather than bytes because the mapping from a character to the number of bytes used for that character's encoding may be dependent on the character set used. IDL Data Type STRING |
LT | Long Text A character string that may contain one or more paragraphs. It may contain the Graphic Character set and the Control Characters, CR, LF, FF, and ESC. It may be padded with trailing spaces, which may be ignored, but leading spaces are considered to be significant. Data Elements with this VR shall not be multi-valued and therefore character code 5CH (the BACKSLASH "\" in ISO-IR 6) may be used. Default Character Repertoire and/or as defined by (0008,0005). |
Character Repertoire 10240 chars Length 10240 chars maximum Note - The length of the VRs for which the Character Repertoire can be extended or replaced are expressly specified in characters rather than bytes because the mapping from a character to the number of bytes used for that character's encoding may be dependent on the character set used. Data Type String |
OB | Other Byte String A string of bytes where the encoding of the contents is specified by the negotiated Transfer Syntax. OB is a VR which is insensitive to Little/Big Endian byte ordering (see Section 7.3 of Digital Imaging and Communications in Medicine (DICOM) - Part 5: Data Structures and Encoding). The string of bytes shall be padded with a single trailing NULL byte value (00H) when necessary to achieve even length. |
Character Repertoire Not applicable Length See Transfer Syntax definition Data Type byte |
OF | Other Float String A string of 32-bit IEEE 754:1985 floating point words. OF is a VR which requires byte swapping within each 32-bit word when changing between Little Endian and Big Endian byte ordering (see Section 7.3 of Digital Imaging and Communications in Medicine (DICOM) - Part 5: Data Structures and Encoding). |
Character Repertoire Not applicable Length 232-4 maximum Data Type float |
OW | Other Word String A string of 16-bit words where the encoding of the contents is specified by the negotiated Transfer Syntax. OW is a VR which requires byte swapping within each word when changing between Little Endian and Big Endian byte ordering (see Section 7.3 of Digital Imaging and Communications in Medicine (DICOM) - Part 5: Data Structures and Encoding). |
Character Repertoire Not applicable Length See Transfer Syntax definition Data Type int16 |
PN | Person Name A character string encoded using a 5 component convention. The character code 5CH (the BACKSLASH "\" in ISO-IR 6) shall not be present, as it is used as the delimiter between values in multiple valued data elements. The string may be padded with trailing spaces. The five components in their order of occurrence are: family name complex, given name complex, middle name, name prefix, name suffix. Any of the five components may be an empty string. The component delimiter shall be the caret "^" character (5EH). Delimiters are required for interior null components. Trailing null components and their delimiters may be omitted. Multiple entries are permitted in each component and are encoded as natural text strings, in the format preferred by the named person. This conforms to the ANSI HISPP MSDS Person Name common data type. This group of five components is referred to as a Person Name component group. For the purpose of writing names in ideographic characters and in phonetic characters, up to 3 groups of components (see Annex H examples 1 and 2) may be used. The delimiter for component groups shall be the equals character "=" (3DH). The three component groups of components in their order of occurrence are: a single-byte character representation, an ideographic representation, and a phonetic representation. Any component group may be absent, including the first component group. In this case, the person name may start with one or more "=" delimiters. Delimiters are required for interior null component groups. Trailing null component groups and their delimiters may be omitted. Precise semantics are defined for each component group. See section 6.2.1 of Digital Imaging and Communications in Medicine (DICOM) - Part 5: Data Structures and Encoding. Examples: Rev. John Robert Quincy Adams, B.A. M.Div. "Adams^John Robert Quincy^^Rev.^B.A. M.Div." [One family name; three given names; no middle name; one prefix; two suffixes.] Susan Morrison-Jones, Ph.D., Chief Executive Officer "Morrison-Jones^Susan^^^Ph.D., Chief Executive Officer" [Two family names; one given name; no middle name; no prefix; two suffixes.] John Doe "Doe^John" [One family name; one given name; no middle name, prefix, or suffix. Delimiters have been omitted for the three trailing null components.] (for examples of the encoding of Person Names using multi-byte character sets see Annex H of Digital Imaging and Communications in Medicine (DICOM) - Part 5: Data Structures and Encoding) Note - 1. This five component convention is also used by HL7 as defined in ASTM E-1238-91 and further specialized by the ANSI MSDS. 2. In typical American and European usage the first occurrence of "given name" would represent the "first name". The second and subsequent occurrences of the "given name" would typically be treated as a middle name(s). The "middle name" component is retained for the purpose of backward compatibility with existing standards. 3. The "Degree" component present in ASTM E-1238-91 is absorbed into the "Suffix" component. |
Character Repertoire Default Character Repertoire
and/or as defined by (0008,0005) excluding Control Characters LF, FF,
and CR but allowing Control Character ESC. Length 64 chars maximum per component group Note - The length of VRs for which the Character Repertoire can be extended or replaced are expressly specified in characters rather than bytes because the mapping from a character to the number of bytes used for that character's encoding may be dependent on the character set used. Data Type String |
SH | Short String A character string that may be padded with leading and/or trailing spaces. The character code 05CH (the BACKSLASH "\" in ISO-IR 6) shall not be present, as it is used as the delimiter between values for multiple data elements. The string shall not have Control Characters except ESC. Default Character Repertoire and/or as defined by (0008,0005). |
Character Repertoire 16 chars Length 16 chars maximum Note - The length of VRs for which the Character Repertoire can be extended or replaced are expressly specified in characters rather than bytes because the mapping from a character to the number of bytes used for that character's encoding may be dependent on the character set used. Data Type String |
SL | Signed Long Signed binary integer 32 bits long in 2's complement form. Represents an integer, n, in the range:
- 231 <= n <= (231 - 1)
|
Character Repertoire Not applicable Length 4 bytes fixed Data Type int32 |
SQ | Sequence of Items Value is a Sequence of zero or more Items, as defined in Section 7.5 of Digital Imaging and Communications in Medicine (DICOM) - Part 5: Data Structures and Encoding). | Character Repertoire Not applicable Length Not applicable Data Type int32 |
SS | Signed Short Signed binary integer 16 bits long in 2's complement form. Represents an integer n in the range:
-215 <= n <= (215 - 1)
|
Character Repertoire Not applicable Length 2 bytes fixed IDL Data Type int16 |
ST | Short Text A character string that may contain one or more paragraphs. It may contain the Graphic Character set and the Control Characters, CR, LF, FF, and ESC. It may be padded with trailing spaces, which may be ignored, but leading spaces are considered to be significant. Data Elements with this VR shall not be multi-valued and therefore character code 5CH (the BACKSLASH "\" in ISO-IR 6) may be used. Default Character Repertoire and/or as defined by (0008,0005). |
Character Repertoire 1024 chars Length 1024 chars maximum Note - The length of Value Representations for which the Character Repertoire can be extended or replaced are expressly specified in characters rather than bytes because the mapping from a character to the number of bytes used for that character's encoding may be dependent on the character set used. Data Type String |
TM | Time A string of characters of the format hhmmss.frac; where hh contains hours (range "00" - "23"), mm contains minutes (range "00" - "59"), ss contains seconds (range "00" - "59"), and frac contains a fractional part of a second as small as 1 millionth of a second (range "000000" - "999999"). A 24 hour clock is assumed. Midnight can be represented by only "0000" since "2400" would violate the hour range. The string may be padded with trailing spaces. Leading and embedded spaces are not allowed. One or more of the components mm, ss, or frac may be unspecified as long as every component to the right of an unspecified component is also unspecified. If frac is unspecified the preceding "." may not be included. Frac shall be held to six decimal places or less to ensure its format conforms to the ANSI HISPP MSDS Time common data type. Examples - 1. "070907.0705" represents a time of 7 hours, 9 minutes and 7.0705 seconds. 2. "1010" represents a time of 10 hours, and 10 minutes. 3. "021" is an invalid value. Note - 1. For reasons of backward compatibility with versions of this standard prior to V3.0, it is recommended that implementations also support a string of characters of the format hh:mm:ss.frac for this VR. 2. See also DT VR in this table. |
Character Repertoire "0" - "9", "." of Default Character Repertoire Length 16 bytes maximum Data Type String |
UI | Unique Identifier A character string containing a UID that is used to uniquely identify a wide variety of items. The UID is a series of numeric components separated by the period "." character. If a Value Field containing one or more UIDs is an odd number of bytes in length, the Value Field shall be padded with a single trailing NULL (00H) character to ensure that the Value Field is an even number of bytes in length. See Section 9 and Annex B of Digital Imaging and Communications in Medicine (DICOM) - Part 5: Data Structures and Encoding for a complete specification and examples. |
Character Repertoire "0" - "9", "." of Default Character Repertoire Length 64 bytes maximum Data Type String |
UL | Unsigned Long Unsigned binary integer 32 bits long. Represents an integer n in the range: 0 <= n < 232
|
Character Repertoire Not applicable Length 4 bytes fixed Data Type uint32 |
UN | Unknown A string of bytes where the encoding of the contents is unknown (see Section 6.2.2 of Digital Imaging and Communications in Medicine (DICOM) - Part 5: Data Structures and Encoding). |
Character Repertoire Not applicable Length Any length valid for any of the other DICOM VRs Data Type byte |
US | Unsigned Short Unsigned binary integer 16 bits long. Represents integer n in the range:
0 <= n < 216
|
Character Repertoire Not applicable Length 2 bytes fixed Data Type uint16 |
UT | Unlimited Text A character string that may contain one or more paragraphs. It may contain the Graphic Character set and the Control Characters, CR, LF, FF, and ESC. It may be padded with trailing spaces, which may be ignored, but leading spaces are considered to be significant. Data Elements with this VR shall not be multi-valued and therefore character code 5CH (the BACKSLASH "\" in ISO-IR 6) may be used. The text will be interpreted as specified by Specific Character Set (0008,0005). |
Character Repertoire Default Character Repertoire and/or as defined by (0008,0005). Length 2 32 -2 Note - Limited only by the size of the maximum unsigned integer representable in a 32 bit VL field minus one, since FFFFFFFFH is reserved. Data Type String |
Java: substract a year on a given Date
Calendar calendar = Calendar.getInstance(); calendar.setTime(givenDate); calendar.add(Calendar.YEAR, -1);
Turn off code formatting for certain lines in Eclipse 3.6+
Often, we do not want eclipse to auto-format some lines. In Eclipse 3.6+ you can turn off code formatting:
Now in the source code you can
- Preferences -> Java -> Code Style -> Formatter
- Create your own profile if you have not done it yet: New...
- Edit your profile, in the Off/On Tags, Enable Off/On Tags
Now in the source code you can
// @format off ... ... .. // @format on
See also New features in Eclipse 3.6
GWT Developer's plugin for Firefox 10
https://dl.google.com/dl/gwt/plugins/firefox/1.0.10862/gwt-dev-plugin.xpi
See also
- GWT Developer's Plugin for Firefox 19
- GWT Developer's Plugin for Firefox 17
- GWT Developer's Plugin for Firefox 16
- GWT Developer's Plugin for Firefox 15
- GWT Developer's Plugin for Firefox 14
- GWT Developer's Plugin for Firefox 13
- GWT Developer's Plugin for Firefox 12
- GWT Developer's Plugin for Firefox 11
- GWT Developer's Plugin for Firefox 10
Microseconds in Java
SimpleDateFormat in java does not support microseconds. It supports down to milliseconds only.
In some cases, we want to parse Time from string, which includes microseconds, or format a Date/Time to a string (with microseconds).
Here are some sample java code to work around this problem.
See also http://stackoverflow.com/questions/2132247/custom-date-format-cannot-be-parsed-java
In some cases, we want to parse Time from string, which includes microseconds, or format a Date/Time to a string (with microseconds).
Here are some sample java code to work around this problem.
public class DateTimeUtil { public static final String FORMAT_PATTERN = "yyyyMMddHHmmss.SSS000"; public static Date parse(String ds) throws Throwable { String[] tokens = ds.split("\\."); if (tokens.length != 2) { throw new Exception("Invalid date string: " + ds); } int fractionalSecs = Integer.parseInt(tokens[1]) / 1000; return new SimpleDateFormat("yyyyMMddHHmmss.SSS").parse(String.format("%s.%03d", tokens[0], fractionalSecs)); } public static String format(Date date) { return new SimpleDateFormat(FORMAT_PATTERN).format(date); } }
See also http://stackoverflow.com/questions/2132247/custom-date-format-cannot-be-parsed-java
Remote desktop to Windows 7 (or Windows 2008 server) which requires Network Level Authentication using freeRDP
FreeRDP is a free, open source implementation of the RDP protocol, according to the Microsoft Open Specifications. It is released under the Apache License and is available on OS X, Cygwin for Microsoft Windows, FreeBSD, Linux, Solaris.
As of January 2012, FreeRDP adds support for Network Level Authentication. You can then use FreeRDP to connect to Windows 7 or Windows Server 2008 which requires NLA by default.
Note: freeRDP is commonly used on Linux. Since
As of January 2012, FreeRDP adds support for Network Level Authentication. You can then use FreeRDP to connect to Windows 7 or Windows Server 2008 which requires NLA by default.
Note: freeRDP is commonly used on Linux. Since
- Remote Desktop Connection for Mac OS X supports NLA.
- Windows XP SP3 added NLA support and NLA can be enabled by updating some registry values. Linux is the platform that does not have native support for MS therefore, currently you have no other choice but to use FreeRDP.
- sudo add-apt-repository ppa:freerdp-team/freerdp
- sudo apt-get update
- sudo apt-get install freerdp
xfreerdp --plugin cliprdr -g 1024x768 -k no -u {username} -d {domain} {remote-windows-machine}
Enable network level authentication on Windows XP
By default, remote desktop server (Terminal server) on Windows Vista or Windows 7 requires the client to have network level authentication enabled. However, Windows XP does not have network level authentication enabled by default.
You can allow non-NLA client to connect on the server side. I do not recommend to do that because it downgrades the security.
To enable network level authentication on Windows XP, first, you have to make sure you have upgraded to Windows XP Service Pack 3. The NLA is not enabled in Windows XP SP3 by default, you also need to do the following to enable it:
You can allow non-NLA client to connect on the server side. I do not recommend to do that because it downgrades the security.
To enable network level authentication on Windows XP, first, you have to make sure you have upgraded to Windows XP Service Pack 3. The NLA is not enabled in Windows XP SP3 by default, you also need to do the following to enable it:
- Click Start, click Run, type regedit, and then press Enter.
- In the navigation pane, locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
In the details pane, right-click Security Packages, and then click Modify.
In the Value data box, type tspkg. Leave any data that is specific to other SSPs, and then click OK. - In the navigation pane, locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders
In the details pane, right-click SecurityProviders, and then click Modify.
In the Value data box, type credssp.dll. Leave any data that is specific to other SSPs, and then click OK. - Exit regedit and restart the computer
Subscribe to:
Posts (Atom)