Wednesday, August 18, 2010

穷养儿子富养女

转载
最近读了一篇《穷养儿子富养女》的文章,本人感觉很有道理,把它贴出来,让有兴趣的家长也读一读,或许能得到一点启发。
“穷养儿子富养女”是民间一句古训,对古训的理解,不能一概而论,要从哲学和广义上去领会,不能从狭隘的角度去接受。否则,每条谚语与古训都有偏正。古训,通常言简意赅,寓意深刻,需要我们时刻品味!不能小看! 也有人说男孩放养猛如虎,女孩家养秀如花。我以为,穷是磨练,男孩是泥土身,将来得成长为男人,所以得经摔经得起风雨。富是呵护,女孩是莲藕身,磕不起,得娇贵着点养。穷与富非物质之比,实乃轻重之分。

从来富贵多淑女,自古纨绔少伟男,应当“穷养儿子富养女”。富养的女儿不贪小 利, 气 质非凡;生活的磨砺让穷养的儿子意志更坚强;男孩子以后要走上社会,承担社会责任与家庭责任,所以要穷养以励其志,否则大手大脚,纨绔子弟一个,如何上奉父母,下养妻儿!

富 养的女孩,从小会被带着出入各种场合,增加阅世能力,等到花般年纪,再到尘世里艰难成长,便不易被各种浮华和虚荣所迷惑,一个没见过大世面的女孩,在纨绔 子弟的糖衣炮弹下,很可能被花言巧语所击败。富养的女孩,因为见识多,独立,有主见,明智,很清楚自己真正追求的东 西. 富养女,其实是一种教育投资,教育的富足;穷养男,更是一种挫折教育,男儿当自强,而没有经历过失败挫折的男孩是长不大的。

男生将来是要奋斗的,必须让他知道钱来之不易;女孩是要嫁人的,必须培养她鉴别事物的眼光,别将来被人的一块蛋糕就给哄走了。

富 养女更浪漫。女孩称为千金,估计也有这方面的渊源。虽说相貌由天而生,可也需要后天的精心呵护,需要平日的精致雕琢,这显然需要一定的物质基础。从另一个 角度来说,除了给予较好的物质条件外,更需要开阔女孩的视野与见识。富也是“丰富”的意思。懂得美,懂得欣赏,懂得辨别,也就懂得了自我保护,而不会被外 界的种种所诱惑。

穷 养男更实在。做个真正的男人,这一生要蒙受的磨难、冷眼、屈辱、挫折不知要多少。古人说,天将降大任于斯人,必先劳其筋骨,饿其体肤,苦其心志,如此才能 修身齐家治国平天下。男孩从小就应培养艰苦朴素、吃苦耐劳的作风,仁义孝道的思想,尤其在物质上不能过多给予,否则容易成为又一个纨绔子。

富养20年,芙蓉出水;穷养20载,宝剑出炉。

女孩子不那么担心物质条件,才容易培养出从容的气质,男孩子对物质条件上心一点,才不会散漫。跟天性有关?女孩子天生善于注重细节,再灌输“小气”的思想就容易市侩了。男孩子反之。这是生活的智慧吧?

男孩要意志坚定,女孩要知书达礼。穷养富养大概是这个意思吧。

家养小子,就要从小培养孩子坚强不屈的性格,吃苦耐劳的精神,孝义德善的品质。否则,树木不刷不成材,一味的娇惯、放任、纵容,只会培养出一个不成气的纨绔子弟来。
家有娇女,就要从小多给于疼爱、适度满足物质需求,以达到丰富内心与意识品德。这样,使其懂得美善、学会辨别和自我保护,走上社会才不至于受种种物欲诱惑,避免上当受骗。

这 个题目不是说穷的家庭才养儿子,富家才养女儿,而是指男孩要“穷”养:吃苦受罪,历尽沧桑,日后方能有所作为有担当;女孩要“富”养:生活精致、无忧无 虑,优越的生活就像一针强劲的免疫针,使她以后会对抗诱惑,明辨真伪,成为知情识趣优雅美丽的女子

Friday, August 6, 2010

Tomcat file structure in Eclipse

  • WebContent.
    Regular Web files (HTML, JavaScript, CSS, JSP, images, etc.)
  • WebContent/some-subdirectory
    Web files in subdirectory.
  • WebContent/WEB-INF
    web.xml (used for servlet mappings)
  • WebContent/WEB-INF/lib
    JAR files specific to application.
  • src/(default package)
    Unpackaged (default package) Java code. Using the default package is generally a bad choice in Web apps.
  • src/somePackage
    Java code in somePackage package.
  • Note:
    You can cut/paste or drag/drop existing files into appropriate locations, but it is hard to drag files into a Java package until you create at least one class first.

Thursday, August 5, 2010

XSSearchEngine do not go to result page (open search)

In the skin file of the search module reference, setup a proper result page id.

Monday, July 19, 2010

log error in DotNetNuke

(new DotNetNuke.Services.Log.EventLog.EventLogController())
.AddLog("Exception", ex.ToString(), DotNetNuke.Entities.Portals.PortalSettings.Current,
-1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT);


or


catch (Exception ex)
{
DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
//throw;
}

Generate a self-signed certificate

makecert -pe -n "cn= www.domain.co.nz " -ss my -sr LocalMachine -r " www.domain.co.nz " -sky exchange

Thursday, July 8, 2010

Dotnetnuke Logging to the EventLog

First, create an instance of the EventLogViewer...

Dim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController

Next, log the event you wish to trap...

objEventLog.AddLog("Sample Message", "Something Interesting Happened!", PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT)

Friday, July 2, 2010

Blackra1n ASL. dll Error

Go to: C:\ program files\common files\apple\apple application support


Than copy blackra1n into that folder.

Iphone restore error 3194 fix

Navigate to “c:\windows\system32\drivers\etc\” and open the ‘hosts’ file in notepad. To do so, right click on the file and select Open With->Notepad. At the end of the document, add this string “74.208.10.249 gs.apple.com”.

Wednesday, June 30, 2010

DNN programmatically login user

PortalSettings currentPortal = PortalController.GetCurrentPortalSettings();

UserLoginStatus loginStatus = new UserLoginStatus();

UserInfo objUser = UserController.ValidateUser(
currentPortal.PortalId,
ConfigurationSettings.AppSettings["DnnLoginUser"],
ConfigurationSettings.AppSettings["DnnLoginPassword"],
"DNN", "",
currentPortal.PortalName, HttpContext.Current.Request.UserHostAddress, ref loginStatus);

if (loginStatus == UserLoginStatus.LOGIN_SUCCESS)
{
UserController.UserLogin
(currentPortal.PortalId,
objUser, currentPortal.PortalName,
HttpContext.Current.Request.UserHostAddress, false);
}

Monday, June 28, 2010

disable enter key

<asp:TextBox onKeyPress="return disableEnterKey(event)" runat="server" name="txtUserName" ID="txtUserName" MaxLength="20" Width="135px"></asp:TextBox>

function disableEnterKey(e) {
var key;
if (window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
return (key != 13);
}

Monday, June 14, 2010

Setup Ubuntu as web server

http://www.securenetwork.it/ricerca/whitepaper/download/Debian-Ubuntu_hardening_guide.pdf

SELinux for Ubuntu Server:
http://selinuxproject.org/files/2008_selinux_developer_summit/2008_summit_brindle_ubuntu.pdf

The installation is as simple as:
Sudo apt-get install selinux

SELinux disables AppArmour

Wednesday, June 2, 2010

POST in asp.NET page without nesting forms

if (!IsPostBack)
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "postback", "function doExternalPost(targetUrl) { theForm.__VIEWSTATE.value = ''; theForm.encoding = 'application/x-www-form-urlencoded'; theForm.action = targetUrl; theForm.submit(); }", true);
}

litText.Text = string.Format("<input name="postInfo" value="{0}" type="hidden"><a onclick="\"javascript:doExternalPost('{1}');\"">clickme</a>", "prodABC" , "postURL");

Tuesday, June 1, 2010

reference jQuery in Visual Studio

<%if (false) { %>

<script language="javascript" type="text/javascript" src="../../Resources/Shared/scripts/jquery/jquery-1.4.2.js"></script>

<script language="javascript" type="text/javascript" src="../../Resources/Shared/scripts/jquery/jquery-1.4.2-vsdoc.js"></script>

<%} %>

<script language="javascript" type="text/javascript"><br /><br /> $(document).ready(function() {<br /><br /> });<br /><br /></script>

Saturday, May 22, 2010

iPhone unlock

Firmware: current version 3.1.3, can be jailbroken easily now. Unlock has nothing to do with jailbreak. If update the firmware, baseband will be automatically updated.

Baseband: control the GSM frequency. This is how Apple lock iPhone to stop people use it under other GSM network rather than AT&T. Due to T-mobile has similar frequency, locked iPhone can be used under T-mobile some how. The latest baseband 5.12.01 hasn't been unlocked yet (except some videos on YouTube), so hacker need to downgrade it to 5.11 to unlock iPhone. However, the latest bootloader 5.9 has fix the bug which allows people downgrade baseband from 5.12.01.

Bootloader: it is a hardware, can't be upgrade/downgrade unless modify the iPhone hardware, just like the camera. Only the bootloader before 5.9 has the bug to allow people downgrade baseband. However, most of the new iPhone 3G/3GS is using the bootloader 5.9.

Friday, May 7, 2010

Loading UserControl Dynamically in UpdatePanel

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>

<asp:updatepanel id="pnl1" runat="server">
<contenttemplate>
<asp:placeholder id="plh1" runat="server"></asp:PlaceHolder>
</contenttemplate>
</asp:UpdatePanel>

private string LastLoadedControl
{
get
{
return ViewState["LastLoaded"] as string;
}
set
{
ViewState["LastLoaded"] = value;
}
}

private void LoadUserControl()
{
string controlPath = LastLoadedControl;

if (!string.IsNullOrEmpty(controlPath))
{
plh1.Controls.Clear();
UserControl uc = (UserControl)LoadControl(controlPath);
plh1.Controls.Add(uc);
}
}

protected void Page_Load(object sender, EventArgs e)
{
DotNetNuke.Framework.AJAX.RegisterScriptManager();

string controlPath = string.Empty;

if (Settings.ContainsKey("ddl1"))
controlPath = Settings["ddl1"] + ".ascx";
else
controlPath = "Expired.ascx";

LastLoadedControl = controlPath;
LoadUserControl();
}

Comparison of Android vs iPhone vs Nokia vs BlackBerry vs Windows Mobile 7

Android (Open Handset Alliance)
* open platform
* can compile custom firmwares - good for hackers and other
* good framework, extended on each new firmware
* supports multitasking
* nice GUI - Eclipse
* development SDK is free
* easy to debug, can send logs to developers
* Android uses a version of Linux as its kernel (albeit tweaked by Google to fit Android needs and separated from the main Linux kernel tree), but it is not a conventional Linux distribution; it does not have a native X Window System, neither does it support the full set of standard GNU libraries like its system libraries (GNU C Library). This makes it difficult to reuse existing Linux applications or libraries on Android. Android does not use established Java standards, i.e. Java SE and ME. This prevents compatibility among Java applications written for those platforms and those for the Android platform. Android only reuses the Java language syntax, but does not provide the full-class libraries and APIs bundled with Java SE or ME. However, Myriad's J2Android, launched on 19 March 2010, allows seamless conversion of Java MIDlets into Android applications.
* programming language is Java but bridges from other languages exist (C# .net - Mono, etc)
* Android supports Java 1.5 and translates the byte code to its own custom Dalvik byte code optimized for mobile devices.
* for the hardcore programmers, Android offers the possibility of programming in C using the native dev kit NDK
* can run script languages like LUA, Perl, Python, etc
* can install third party applications from sdcard, random sites - not locked to a specific market
* applications can hook and override everything - email interface, SMS sending, custom keyboards, etc
* supports widgets
* can publish applications on the Android market instantly - initial one time registration fee is 25E
* user has access to the sdcard and can use it as a USB disk
* native Adobe Flash support after 2.1

Symbian (Nokia)
* opened Symbian and says the future will be QT and WRT - they will cut support to any other environment including J2ME
* Qt is a cross-platform application and UI framework. Using Qt, you can write web-enabled applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code. (C++)
* One Developer License Qt Desktop Single Operating System $3 695
* QT runs on Maemo, MeeGo, BlackBerry, Symbian, Windows Mobile, desktop PC, consumer electronics, car entertainment, etc
* QT is available stand along IDE, or Integration/Add-in for Eclipse and Visual Studio
* WRT - web runtime - a cool feature that allows users to write applications in HTML, JS and CS. You build the app like a normal web page, and you interact with the phone platform/hardware using the WRT bridge. Just HTML, JS and CS. Very important: JS can call native code, but also the other way around. It seems you can call WRT JS with native code.
* supports Adobe Flash Lite
* nice GUI - Eclipse
* development SDK is free

MeeGo (Nokia and Intel)
* MeeGo applications are written in C++ using the MeeGo SDK, including Qt.
* nice GUI - Eclipse
* development SDK is free


iPhone (Apple)
* closed platform
* development kit costs
* programming language only allow Objective C (appeared in 1986)
* applications are not allowed to duplicate the iPhone functionality - ie no custom email interface, etc
* NO sd card
* third party applications can only be installed from the Apple store. publishing on the store is a very lengthy and tiresome process. Apple has many and bizarre rules. Many applications were rejected for strange reasons.
* no Adobe Flash support

WebOS (HP)
* hope HP will not kill the brilliant WebOS
* web program (Html, CSS, JavaScript)

BlackBerry (Research In Motion)
* Java native (J2ME) and web development
* the new OS 6 is coming


Windows Mobile 7 (Microsoft)
* break compatibility with WM 6.x
* programming environment is Silverlight and XNA
* no native programming ie no hooking and overriding keyboard, etc - they removed PInvoke
* nice GUI - Visual Studio 2010
* MS marketplace
* no Adobe Flash support


Windows Mobile 6.x (Microsoft)
* native C, C# with PInvoke

Bada (Samsung)
* The Bada operating system has a kernel configurable architecture, which allows the use of either the Linux kernel, or another Real-time operating system (RTOS) kernel. The Linux kernel is the preferred choice for smartphones, while RTOS is used for cheaper feature-phones, due to its smaller memory footprint.



Ref: http://adrianvintu.com/blogengine/post/Comparison-of-Android-vs-IPhone-vs-Nokia-vs-BlackBerry-vs-Windows-Mobile-7.aspx
http://en.wikipedia.org/wiki/Android_(operating_system)

GRUB 2 modification

/etc/default/grub

sudo update-grub




+++++++++++++++++++++++
http://ubuntuforums.org/showthread.php?t=1195275

Find kernel:
uname -a : print all information

uname -r : print the kernel release

uname -v : print the kernel version

uname -o : print the operating system

In Synaptic package manager, search "linux-image"

===================================

How to add a splashmage in GRUB2
http://members.iinet.net/~herman546/p20/GRUB2%20Splashimages.html

sudo apt-get install grub2-splashimages
sudo cp /usr/share/images/grub/*.tga /boot/grub/
gksudo gedit /etc/grub.d/05_debian_theme
scroll down in the file and find line 16 or 17
change the following code in line 16 or 17 from:
for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga} ; do

to replace 'moreblue-orbit-grub' with the name of the splashimage of your choice)
for i in {/boot/grub,/usr/share/images/desktop-base}/Windbuchencom.{png,tga} ; do

Ubuntu Sudo command

========sudo open file browser, and then Ctrl+H to show hidden files
gksu nautilus

========Clean up past installation of Flash:
sudo apt-get remove -y --purge flashplugin-nonfree gnash gnash-common mozilla-plugin-gnash swfdec-mozilla libflashsupport nspluginwrapper
sudo rm -f /usr/lib/mozilla/plugins/*flash*
sudo rm -f ~/.mozilla/plugins/*flash*
sudo rm -f /usr/lib/firefox/plugins/*flash*
sudo rm -f /usr/lib/firefox-addons/plugins/*flash*
sudo rm -rfd /usr/lib/nspluginwrapper


========install flash (Shockwave flash 10)
When you go to a site by firefox that requires flash you will see a bar appear with a button on the right side labeled “Install Missing Plugins”.Choose the Adobe version and click Next. You will then be warned that the Adobe Flash Player will download and install another application. This is okay. You will be required to enter your user password to continue.

OR

sudo apt-get install flashplugin-nonfree

========map iphone
mkdir /mnt/iPhone
mount.fuse.ifuse --afc2 /dev/hda /mnt/iphone/ -s

========current running kernel version
uname -r

========create symbolicLink dir1 into dir2
ln -s /dir1 /dir2

========list all of the usb devices
lsusb


========.tar.gz Source Installation/Compilation
tar -xzvf /home/bob/compressedfile.tar.gz
./configure
make
su
make install

========Binary install tar.gz
tar -xzvf /home/bob/compressedfile.tar.gz

========.Binary install tar.bz2
tar -xjvf /home/bob/compressedfile.tar.bz2


========Support RAR
sudo apt-get install unrar

========Install DEB OpenOffice
sudo apt-get remove openoffice*.*
tar -vxzf filename
cd OOo_inst_folder/DEBS
sudo dpkg -i *.deb
cd desktop-integration
sudo dpkg -i *.deb

Install Netbook remix to Desktop Ubuntu

sudo gedit /etc/apt/sources.list

ADD:
deb http://ppa.launchpad.net/netbook-remix-team/ubuntu intrepid main
deb-src http://ppa.launchpad.net/netbook-remix-team/ubuntu intrepid main
Save and exit the file.

sudo apt-get update
sudo apt-get install go-home-applet human-netbook-theme maximus netbook-launcher window-picker-applet

run:
netbook-launcher
maximus