装机常用软件

我装机的常用软件,链接到官网。
注:[A]表示官网下载的A软件需要注册。

聊天


腾讯QQ
Gtalk
Yahoo Message
飞信
Windows Live Messenger

视频

暴风影音
Adobe Flash Player
射手音乐播放器
QuickTime
itudou

浏览器

Firefox
Chrome
Opera

音乐

itunes
Winamp

下载

VeryCD
迅雷
快车

游戏

植物大战僵尸
VS对战平台
QQ对战平台


图形图像

Picasa
[Photoshop]
[ACDsee]
Google Map

安全杀毒

小红伞
[卡巴斯基]
[Eset Nod32]

输入法

搜狗输入法
谷歌输入法

股票网银

文字处理

WPS
[Office]
Adobe Reader
[PDF转换器]
[文本比较]
[Editplus]
[UltraEdit]
Zoundry Raven

翻 译

灵格斯词霸
有道词典

压缩刻录

[Daemon]
7-zip
7-zip图标界面美化工具
[Winrar]


系统工具

[Windows优化大师]
一键GHOST还原
磁盘清理
Fence
文件恢复

编程开发

[VS 2008]
Eclipse
Netbeans
Cfree
Adobe Dreamweaver
phpMyAdmin
JDK
Apache
Tomcat
建站集成软件包
Topcoder
RadASM

数码

诺基亚PC套件


邮件

Foxmail
Gmail Notifier

学习

金山打字通


网络应用

远程协助
Dropbox
dropboxen
CuteFTP

代理软件

自-由-门
逍-遥-游
Dynapass
GappProxy
无-界
Puff
[Hotspot Shield Launch]

其它



Technorati : , ,
Del.icio.us : , ,
Zooomr : , ,
Flickr : , ,

比墙更令人无奈的是人

小时候

上一辈老喜欢这么说:现在的社会,比过去好多了。

当我做了件”大逆不道”的事情:这样的事,要是发生在过去,铁定要被吊起来打/要被抓去的/要被枪毙。

当我饭吃得少:过去吃不饱、穿不暖;现在好了,有房子住、有肉吃,我们应该知足啊/是某某某领导的好啊,你还这么挑三拣四的。

生活遭遇造就了他们这种淳朴、易于满足的性格。

他们从来不会想,是谁让他们有着全世界做多的工作时间,却依然骨瘦如柴;长期剥削他们的主人一旦说要赏他们一口汤,立即感恩戴德、谢主隆恩;隔壁的邻居实在看不下去了,议论了下他们主人,顿时凶神恶煞起来:我们的事不要你来管。

是啊,白求恩滚回加拿大,我们的事不要你来管。

现在

A

前两天博客被IDC果断拿下,原因是:

那天博客无法访问,合租同志小菊花联系空间商并给了他的博客地址。

空间商立马作出以下结论:1、主机没有问题 2、博客被墙 3、小菊花博客中有不和谐内容(两张还我儿子的图片,请自行辨别该照片是否和谐)。

并更加果断地删除数据、拒不退款、踢出群组、QQ拉黑,可谓滴水不漏。

过了一个小时后,发现根本就是网通线路问题,此时数据已经被删,而且无款可退,主机商拒不承认自己过失。

B

偶尔上一下微博看一下时事:你不行啊,反|动啊,愤青啊。

得了呗,感情我要天天瞅着CCTV,感受祖国江山一片大好,国家富强人民安康?再要不咱每日上强国论坛自由、平等地发表自己的真实观点,顺便挣点外快?还是要到各个门户看最新下发的红头文件,与领导的思想作亲密接触?

从前我不喜欢学校的文史哲,基本都是谎言。而现在,关心政治,只是为了使自己的命运不被比自己愚蠢得多的人左右。

C

这几天看袁腾飞的视频,摘录两段:

我小时候上学的老师给我们讲,全世界2/3的人还生活在水深火热之中,等着我们去解放,等打开国门一看,感情2/3是我们自个儿。美帝国主义,生活水平领先我们80多年;日本帝国主义,领先我们半个世纪;连国民党反动派,至少也有30年。这真没想到,人家出门都坐出租了咱们连自行车都买不起……

土崩瓦解,当然无存。没有外敌入侵,没有天灾,自己就完蛋了,自行完蛋。这是恶有恶报,恶贯满盈的下场。生于不义,死于耻辱,就这么一个下场。(评论苏联瓦解)。

java打开文件对话框

背景:

使用软件的时候,会要求你选择一个路径,像下面这张图:

写入路径或点击”Open a File…”以后弹出选择路径的框:

然后导入文件,运算后保存文件。

实现这样的功能,需要借助JFileChooser

学习了这个方法后写了个从网页源文件中提取email联系人的小程序,用于豆瓣dropbox分享小组提取联系人。

重点小结:

1.JFileChooser的使用

2.FileInputStream/FileOutputStream二进制方式输入、输入文件

3.String类indexOf函数

代码:

package name.wxl;
 
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
 
import javax.swing.*;
 
 
public class Douban extends JFrame
                                                                implements ActionListener       {
        JPanel db;
        JButton openfile;
        JButton savefile;
        JFileChooser fc;
        JTextArea log , mailList;
        JTextField path , path2;
        File file;
        Label lb;
 
        String[] list = new String[1001];
        byte[] b;
        int n;
 
 
 
        public Douban() {
 
                setTitle("获得邮件联系人--wxl.name");
                setLayout(new BorderLayout());
                setLocation(300, 200);
                setSize(360 , 300);
                setVisible(true);
 
         fc = new JFileChooser();
 
        mailList = new JTextArea(5 , 5);
        mailList.setMargin(new Insets(5 , 5 , 5 , 5));
        mailList.setEditable(false);
        mailList.append("获取小组邮件联系人的小程序,做得比较挫。\n\n");
        mailList.append("使用方法:\n");
        mailList.append("1.将 \"https://www.dropbox.com/share/Share/豆瓣\" 这个页面\n的源文件"豆瓣.htm"下载下来。\n\n");
        mailList.append("2.点击 \"Open a File...\" 按钮并打开"豆瓣.htm"。\n\n");
        mailList.append("3.点击 \"Save the List...\" 按钮并保存邮件联系人列表。\n\n");
 
        JScrollPane logScrollPane = new JScrollPane(mailList);
        add(logScrollPane, BorderLayout.CENTER);
 
 
        JPanel northPanel = new JPanel();
 
        path = new JTextField(15);
                path.setVisible(true);
                northPanel.add(path);
 
                openfile =  new JButton("Open a File ...");
                openfile.addActionListener(this);
                northPanel.add(openfile);
 
 
                JPanel southPanel = new JPanel();
                add(northPanel , BorderLayout.PAGE_START);
                path2 = new JTextField(15);
                path2.setVisible(true);
                southPanel.add(path2);
 
 
                savefile =  new JButton("Save the List...");
                savefile.addActionListener(this);
 
                southPanel.add(savefile);
                add(southPanel , BorderLayout.PAGE_END);
 
 
 
 
        }
 
        void findList(String s) {
 
                int i = 0 , id;
                String b;
 
                n = 0;
                while ((id = s.indexOf("mailto:" , i)) != -1 )  {
 
                        i = id + 7;
                        b = "";
                        while ( s.charAt(i) != '\'')
                                b += s.charAt(i ++);
                        list[n ++] = new String(b);
                }
        }
 
 
        @Override
        public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
 
                Object ob = e.getSource();
                if ( ob == openfile )   {
 
                        fc = new JFileChooser(path.getText());
                        int returnVal = fc.showOpenDialog(Douban.this);
                        if (returnVal == JFileChooser.APPROVE_OPTION ){
                                file = fc.getSelectedFile();
                                path.setText(file.getAbsolutePath());
 
                                mailList.setText("");
                           b = new byte[(int) file.length()];
                           try {
                                    FileInputStream fileinput = new FileInputStream(file);
                                    fileinput.read(b);
                                    fileinput.close();
                                    String s = new String(b);
 
                                    findList(s);
 
                                    for (int i = 0;i < n;i ++)  {
                                        mailList.append(list[i]+";\n");
                                    }
 
                           } catch (Exception ex) {
                            // TODO Auto-generated catch block
                                   ex.printStackTrace();
                           }
 
                        }
                }       else    {
 
                        fc = new JFileChooser(path2.getText());
                        int returnVal = fc.showSaveDialog(null);
                    if (returnVal == JFileChooser.APPROVE_OPTION){
                                File fout = fc.getSelectedFile();
                            path2.setText(fout.getAbsolutePath());
 
                                try {
                                        FileOutputStream fileout = new FileOutputStream(fout);
                                        String c = mailList.getText();
 
                                        b = c.getBytes();
                                        fileout.write(b);
                                        fileout.close();
                                } catch (FileNotFoundException e1) {
                                        // TODO Auto-generated catch block
                                        e1.printStackTrace();
                                } catch (IOException ex) {
                                        // TODO Auto-generated catch block
                                        ex.printStackTrace();
                                }
                    }
 
                }
        }
 
        public static void main(String args[])  {
 
                Douban db = new Douban();
                db.setVisible(true);
 
        }
}

点击 douban_获取邮件联系人.jar 下载体验。

我的豆瓣——喜欢的音乐

Sleeping Sun (2005 Version) – Highest Hopes: The Best Of Nightwish

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

星空 – 许巍:时光漫步

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

Fucking In Heaven – You’ve Come a Long Way Baby

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

Suspicious Minds – What My Heart Wants To Say

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

Homecoming – American Idiot

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

Jesus Of Suburbia – American Idiot

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

Over My Head – Does This Look Infected

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

The Funeral Of Hearts – Love Metal

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

She Is My Sin – Wishmaster

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

Creep – Pablo Honey

音频片段:需要 Adobe Flash Player(9 或以上版本)播放音频片段。 点击这里下载最新版本。您需要开启浏览器的 JavaScript 支持。

Java计算器(第二版)

重写的计算器,代码比上一个容易看许多。

主要改变:

1.代码主体分成两部分,几个按钮相应的ActionListener分别监听不同功能按钮。

2.修正了一些bug,如+/-号,小数点等使用的一些问题。

需要改进:

1.参与运算的数值用double存储,精度低。

2.菜单项功能,计算器功能(如:寄存数据,多进制运算)不完善。

这也是下一版的努力方向。

学到点什么:

1.将几个class打包成一个jar

2.定义几个类继承ActionListener,实现监听。

其他:

连续发这样低技术含量的文章确实水。但对于像我这样的初学者,一些循序渐进式的例子可能会有一定帮助。如果对您没什么用,一笑哂之便是。

代码:

点击这里下载感受。

calc.java:

package cc.wxl;
 
public class calc {
 
        /**
         * @param args
         */
        public static void main(String[] args) {
                // TODO Auto-generated method stub
                calcFrame calc = new calcFrame();
                calc.setVisible(true);
        }
 
}

calcFrame.java:计算器界面

package cc.wxl;
 
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.*;
 
public class calcFrame  extends JFrame {
 
        //菜单
        JMenuBar bar;
        JMenu help , edit , view;
        JMenuItem helptheme , about , copy , paste;
 
        //按钮
        JButton empty1 ,empty2,  Backspace , CE , C;
        JButton num7, num8 , num9 , div , sqrt;
        JButton num4, num5 , num6 , mut , mod;
        JButton num1 , num2  ,num3 , sub , rec;
        JButton num0 , opp , dot , add , equ;
 
        //面板
        Container container;
        JPanel jp1 , jp2 , jp3;
        JTextField jtf;
 
        //存储状态
        memory mem;
 
        public calcFrame()      {
 
                this.setTitle("MadFroG's Second Calc");
                this.setLocation(300 , 280);
                this.setSize(295 , 220);
                this.setVisible(true);
 
                //菜单
                bar = new JMenuBar();
                help = new JMenu("帮助");
                edit = new JMenu("编辑");
                view = new JMenu("查看");
                copy = new JMenu("复制");
                paste = new JMenu("粘帖");
                helptheme = new JMenuItem("帮助主题");
                about = new JMenuItem("关于");
                help.add(helptheme);
                help.add(about);
                edit.add(copy);
                edit.add(paste);
                bar.add(edit);
                bar.add(view);
                bar.add(help);
                this.setJMenuBar(bar);
                bar.setVisible(true);
 
 
                //面板
                container = this.getContentPane();
 
                //分块
                jp1 = new JPanel();
                jp2 = new JPanel();
                jp3 = new JPanel();
 
                jp1.setLayout(new GridLayout(1 , 6));
                jp2.setLayout(new GridLayout(1 , 6));
                jp3.setLayout(new GridLayout(4 , 6));
 
 
                container.add(jp1 , "North");
                container.add(jp2 , "Center");
                container.add(jp3 , "South");
 
                //显示条
                jtf = new JTextField(25);
                jtf.setHorizontalAlignment(JTextField.RIGHT);
                jtf.setEditable(false);
                jtf.setVisible(true);
                jtf.setBackground(new Color(255,255,255));
                jp1.add(jtf);
                init();
 
                //按钮
 
                empty1 = new JButton();
                jp2.add(empty1);
                empty1.setVisible(false);
 
                Backspace = new JButton("Backspace");
                Backspace.addActionListener(new otherListener());
                jp2.add(Backspace);
 
                CE = new JButton("CE");
                CE.addActionListener(new otherListener());
                jp2.add(CE);
 
                C = new JButton("C");
                C.addActionListener(new otherListener());
                jp2.add(C);
 
                num7 = new JButton("7");
                num7.addActionListener(new digitListener());
                jp3.add(num7);
 
                num8 = new JButton("8");
                num8.addActionListener(new digitListener());
                jp3.add(num8);
 
                num9 = new JButton("9");
                num9.addActionListener(new digitListener());
                jp3.add(num9);
 
                div = new JButton("/");
                div.addActionListener(new operatorListener());
                jp3.add(div);
 
                sqrt = new JButton("sqrt");
                sqrt.addActionListener(new otherListener());
                jp3.add(sqrt);
 
                num4 = new JButton("4");
                num4.addActionListener(new digitListener());
                jp3.add(num4);
 
                num5 = new JButton("5");
                num5.addActionListener(new digitListener());
                jp3.add(num5);
 
                num6 = new JButton("6");
                num6.addActionListener(new digitListener());
                jp3.add(num6);
 
                mut = new JButton("*");
                mut.addActionListener(new operatorListener());
                jp3.add(mut);
 
                mod = new JButton("%");
                mod.addActionListener(new operatorListener());
                jp3.add(mod);
 
                num1 = new JButton("1");
                num1.addActionListener(new digitListener());
                jp3.add(num1);
 
                num2 = new JButton("2");
                num2.addActionListener(new digitListener());
                jp3.add(num2);
 
                num3 = new JButton("3");
                num3.addActionListener(new digitListener());
                jp3.add(num3);
 
                sub = new JButton("-");
                sub.addActionListener(new operatorListener());
                jp3.add(sub);
 
                rec = new JButton("1/x");
                rec.addActionListener(new otherListener());
                jp3.add(rec);
 
 
                num0 = new JButton("0");
                num0.addActionListener(new digitListener());
                jp3.add(num0);
 
                opp = new JButton("+/-");
                opp.addActionListener(new digitListener());
                jp3.add(opp);
 
                dot = new JButton(".");
                dot.addActionListener(new digitListener());
                jp3.add(dot);
 
                add = new JButton("+");
                add.addActionListener(new operatorListener());
                jp3.add(add);
 
                equ = new JButton("=");
                equ.addActionListener(new operatorListener());
                jp3.add(equ);
 
 
 
                mem = new memory();
        }
 
        public void init()      {
 
                jtf.setText("0.");
        }
        class digitListener implements ActionListener   {
 
                @Override
                public void actionPerformed(ActionEvent e) {
                        // TODO Auto-generated method stub
 
 
 
 
                        Object o = e.getSource();
 
 
                        if (o == opp)   {
                                if (!mem.typing)        return;
                                double temp = -Double.parseDouble(jtf.getText());
                                jtf.setText(String.valueOf(temp));
                                return;
                        }
 
                        if (mem.needtoclean)    {
                                jtf.setText("");
                                mem.needtoclean = false;
                        }
                        if (o == dot)   {
 
                                if (!mem.havedot){
                                        mem.havedot = true;
 
                                        if (jtf.getText().equals("") ){
                                                jtf.setText("0.");
                                        }       else    {
                                                jtf.setText(jtf.getText() + ".");
                                        }
                                }
 
                        }
 
 
                        if (o == num0)  {
 
                                if (jtf.getText().equals("") || Double.parseDouble(jtf.getText()) != 0 || mem.havedot)  {
                                        jtf.setText(jtf.getText()+"0");
                                }
                        }
 
                        if (o == num1)  {
                                jtf.setText(jtf.getText()+"1");
                        }
                        if (o == num2){
                                jtf.setText(jtf.getText()+"2");
                        }
                        if (o == num3){
                                jtf.setText(jtf.getText()+"3");
                        }
                        if (o == num4){
                                jtf.setText(jtf.getText()+"4");
                        }
                        if (o == num5)  {
                                jtf.setText(jtf.getText()+"5");
                        }
                        if (o == num6)  {
                                jtf.setText(jtf.getText()+"6");
                        }
                        if (o == num7){
                                jtf.setText(jtf.getText()+"7");
                        }
                        if (o == num8){
                                jtf.setText(jtf.getText()+"8");
                        }
                        if (o == num9){
                                jtf.setText(jtf.getText()+"9");
                        }
 
                        mem.typing = true;
                }
 
        }
 
        class operatorListener implements ActionListener        {
 
                @Override
                public void actionPerformed(ActionEvent e) {
                        // TODO Auto-generated method stub
 
                        Object o = e.getSource();
 
                        if (o == equ || mem.operator != mem.none ){
 
                                        double a = mem.num;
                                        double b = Double.parseDouble(jtf.getText());
 
 
 
                                        if (mem.operator == mem.add)    {
                                                jtf.setText(String.valueOf(a + b));
                                        }
 
                                        if (mem.operator == mem.sub)    {
                                                jtf.setText(String.valueOf(a - b));
                                        }
 
                                        if (mem.operator == mem.mut)    {
                                                jtf.setText(String.valueOf(a * b));
                                        }
 
                                        if (mem.operator == mem.div)    {
                                                jtf.setText(String.valueOf(a / b));
                                        }
 
                                        if (mem.operator == mem.mod)    {
                                                jtf.setText(String.valueOf(a % b));
                                        }
 
                                        mem.operator = mem.none;
                        }
 
                        mem.num = Double.parseDouble(jtf.getText());
 
                        if (o == add){
                                mem.operator = mem.add;
                        }
                        if (o == sub){
                                mem.operator = mem.sub;
                        }
                        if (o == mut){
                                mem.operator = mem.mut;
                        }
                        if (o == div)   {
                                mem.operator = mem.div;
                        }
                        if (o == mod)   {
                                mem.operator = mem.mod;
                        }
                        if (o != equ){
                                mem.needtoclean = true;
                                mem.havedot = false;
                        }
 
                        mem.typing = false;
                }
 
        }
 
        class otherListener implements ActionListener   {
 
                @Override
                public void actionPerformed(ActionEvent e) {
                        // TODO Auto-generated method stub
 
                        Object o = e.getSource();
 
                        if (o == C){
                                mem.init();
                                jtf.setText("0.");
                        }
 
                        if (o == CE){
                                jtf.setText("0.");
                        }
 
                        if (o == sqrt){
 
                                double a = Double.parseDouble(jtf.getText());
                                jtf.setText(String.valueOf(Math.sqrt(a)));
                        }
 
                        if (o == rec){
                                double a = Double.parseDouble(jtf.getText());
                                jtf.setText(String.valueOf(1 / a));
                        }
 
 
 
                        if (o == Backspace && mem.typing){
                                String a = jtf.getText();
                                String b;
                                if (a.length() == 1)    b = "0";
                                else b = a.substring(0,a.length() - 1);
 
                                double c = Double.parseDouble(b);
                                if (c != 0){
                                        jtf.setText(b);
                                }       else    {
                                        jtf.setText("0.");
                                        mem.needtoclean = true;
                                }
                                mem.typing = true;
                                return;
                        }
 
                        mem.typing = false;
                }
 
        }
}

memory.java:保存计算器内部数据和操作符

package cc.wxl;
 
public class memory {
 
        public double num , num1;
        public int operator;
        public boolean needtoclean;
        public boolean havedot;
        public boolean typing;
        public int savedoperator;
 
        public final int add = 1;
        public final int sub = 2;
        public final int mut = 3;
        public final int div = 4;
        public final int mod = 5;
        public final int none = 0;
 
 
        public memory() {
                init();
        }
 
        public void init()      {
                num = 0.0;
                num1 = 0.0;
                operator = none;
                savedoperator = none;
                needtoclean = true;
                havedot = false;
                typing = false;
        }
}

Java计算器(第一版)

第一个Java计算器,运算方式全部调用库函数。

只能进行简单的+,-,×,/,开方等运算。

没有进行排错,基本上算是个入门代码。

既然是”(第一版)”,就会有后续的作品出来。

点击这里在网页上体验。

傻瓜代码拿出来献丑:

package cc.wxl;
 
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.*;
 
public class Cal extends JFrame implements ActionListener {
 
        /**
         * @param args
         */
 
        JFrame frame;
 
        JTextField jtf;
        Container ct;
        boolean needclean;
        boolean havedot;
        int operator;
        double save , now;
 
        private JButton add = new JButton("+");
        private JButton sub = new JButton("-");
        private JButton mut = new JButton("*");
        private JButton div = new JButton("/");
        private JButton dot = new JButton(".");
        private JButton cle = new JButton("C");
        private JButton equ = new JButton("=");
        private JButton dao = new JButton("1/x");
        private JButton sqrt = new JButton("sqrt");
        private JButton mod = new JButton("%");
        private JButton O = new JButton("0");
        private JButton cha = new JButton("+/-");
        private JButton one = new JButton("1");
        private JButton two = new JButton("2");
        private JButton thr = new JButton("3");
        private JButton fou = new JButton("4");
        private JButton fiv = new JButton("5");
        private JButton six = new JButton("6");
        private JButton sev = new JButton("7");
        private JButton eig = new JButton("8");
        private JButton nin = new JButton("9");
 
 
        private JButton cleannow = new JButton("CE");
        private JButton cleanall = new JButton("C");
 
 
        public Cal()    {
 
                setTitle("MadFroG's Calculator");
                setVisible(true);
                setSize(300 , 200);
                setLocation(250 , 300);
 
                jtf = new JTextField(25);
                jtf.setText("0.");
                jtf.setBackground(new Color(255,255,255));
                jtf.setVisible(true);
                jtf.setEditable(false);
                jtf.setHorizontalAlignment(JTextField.RIGHT);
 
                ct = getContentPane();
                JPanel jp1 = new JPanel();
                JPanel jp2 = new JPanel();
                JPanel jp3 = new JPanel();
 
                jp1.setLayout(new GridLayout(2 , 5));
                jp2.setLayout(new GridLayout(1 , 4));
                jp3.setLayout(new GridLayout(4 , 5));
 
 
 
                jp1.add(jtf);
                jp2.add(cleannow);
                jp2.add(cleanall);
 
                jp3.add(sev);jp3.add(eig);jp3.add(nin);jp3.add(div);jp3.add(sqrt);
                jp3.add(fou);jp3.add(fiv);jp3.add(six);jp3.add(mut);jp3.add(mod);
                jp3.add(one);jp3.add(two);jp3.add(thr);jp3.add(sub);jp3.add(dao);
                jp3.add(O);jp3.add(cha);jp3.add(dot);jp3.add(add);jp3.add(equ);
 
                ct.add(jp1 , "North");
                ct.add(jp2 , "Center");
                ct.add(jp3 , "South");
 
                cleanall.addActionListener(this);
                cleannow.addActionListener(this);
                sev.addActionListener(this);
                eig.addActionListener(this);
                nin.addActionListener(this);
                div.addActionListener(this);
                sqrt.addActionListener(this);
                fou.addActionListener(this);
                fiv.addActionListener(this);
                six.addActionListener(this);
                mut.addActionListener(this);
                mod.addActionListener(this);
                one.addActionListener(this);
                two.addActionListener(this);
                thr.addActionListener(this);
                sub.addActionListener(this);
                dao.addActionListener(this);
                O.addActionListener(this);
                cha.addActionListener(this);
                dot.addActionListener(this);
                add.addActionListener(this);
                equ.addActionListener(this);
 
                needclean = true;
                operator = -1;
                havedot = false;
 
        }
        public static void main(String[] args) {
                // TODO Auto-generated method stub
                        Cal win = new Cal();
                        win.setVisible(true);
        }
        @Override
        public void actionPerformed(ActionEvent a) {
                // TODO Auto-generated method stub
 
                Object temp = a.getSource();
                if (needclean)  jtf.setText("");
 
                if (temp == cleanall){
 
                        operator = -1;
                        jtf.setText("0.");
                        save = 0.0;
                        needclean = true;
                        havedot = false;
                }       else if (temp == cleannow){
 
                        jtf.setText("0.");
                        needclean = true;
                }       else if (temp == one)   {
                        jtf.setText(jtf.getText()+"1");
                        needclean = false;
                }       else if (temp == two)   {
                        jtf.setText(jtf.getText()+"2");
                        needclean = false;
                }       else if (temp == thr)   {
                        jtf.setText(jtf.getText()+"3");
                        needclean = false;
                }       else if (temp == fou)   {
                        jtf.setText(jtf.getText()+"4");
                        needclean = false;
                }       else if (temp == fiv)   {
                        jtf.setText(jtf.getText()+"5");
                        needclean = false;
                }       else if (temp == six)   {
                        jtf.setText(jtf.getText()+"6");
                        needclean = false;
                }       else if (temp == sev)   {
                        jtf.setText(jtf.getText()+"7");
                        needclean = false;
                }       else if (temp == eig)   {
                        jtf.setText(jtf.getText()+"8");
                        needclean = false;
                }       else if (temp == nin)   {
                        jtf.setText(jtf.getText()+"9");
                        needclean = false;
                }       else if (temp == dot)   {
                        if (jtf.getText() == "")        jtf.setText("0.");
                        if (!havedot && jtf.getText() != "0.")  jtf.setText(jtf.getText() +".");
                        havedot = true;
                        needclean = false;
                }       else if (temp == O)     {
                        jtf.setText(jtf.getText()+"0");
                        needclean = false;
                }       else if (temp == cha){
                        needclean = false;
                        jtf.setText(String.valueOf(-Double.parseDouble(jtf.getText())));
                }       else if (temp == equ || operator != -1) {
 
                        now = Double.parseDouble(jtf.getText());
 
                        switch (operator){
                                case 1:now += save;break;
                                case 2:now = save - now;break;
                                case 3:now *= save;break;
                                case 4:now = save / now;break;
                        }
                        operator = -1;
                        havedot = true;
                        jtf.setText(String.valueOf(now));
                }
 
 
                if (temp == add)        {
                        needclean = true;
                        havedot = false;
                        operator = 1;
                        save = Double.parseDouble(jtf.getText());
                }       else if (temp == sub){
                        needclean = true;
                        havedot = false;
                        operator = 2;
                        save = Double.parseDouble(jtf.getText());
                }       else if (temp == mut){
                        needclean = true;
                        havedot = false;
                        operator = 3;
                        save = Double.parseDouble(jtf.getText());
                }       else if (temp == div)   {
                        needclean = true;
                        havedot = false;
                        operator = 4;
                        save = Double.parseDouble(jtf.getText());
                }
 
                if (temp == dao)        {
                        needclean = false;
                        now = Double.parseDouble(jtf.getText());
                        if (now == 0.0) jtf.setText("0.");
                        else jtf.setText(String.valueOf(1/now));
                        operator = -1;
                }       else if (temp == sqrt){
                        needclean = false;
                        now = Double.parseDouble(jtf.getText());
                        if (now < 0.0) jtf.setText("0.");
                        else jtf.setText(String.valueOf(Math.sqrt(now)));
                        operator = -1;
                }
 
        }
 
}

JavaEE课程相关下载

下载列表

软件类:

Apache_2.2.14

Tomcat 6.0.26

Editplus-v3.10H

JDK1.6

课件类:

第一章:web开发和j2ee简介

第二章: Web前端开发(XHTML+CSS+JS)

第三章:Servlet简介

第四章:JSP简介-精简版

实验程序类:

第一次实验:lab1-XHTML+CSS+JS

第二次实验:Lab2-Servlet

第二章程序: 对照ppt上的程序

教程:

Tomcat与eclipse开发web应用程序

课程作业:Spring MVC 入门-完整版

Eclipse安装等资料

持续更新,部分文件保存在优秀网盘dropbox中。

计算几何模板:多边形

1.两个凸多边形的并

2.两个简单多边形的并

#define MAXN 501
const double PI = acos(-1.00);
const double eps = 1e-6;
struct TPoint
{
    double x,y;
};
struct TPoint operator-(TPoint a,TPoint b)
{
    a.x-=b.x;
    a.y-=b.y;
    return a;
}
int sign(double d)
{
    if(fabs(d) <  eps) return 0;
    return (d   > 0) ? 1 : -1;
}
 
double cross(const TPoint & a, const TPoint & b)
{ return (a.x * b.y - a.y * b.x); }
//********
double cross(const TPoint & a, const TPoint & b, const TPoint & c)
{ return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); }
//**************
TPoint seg_inter_pnt(TPoint & a, TPoint & b, TPoint & c, TPoint & d)
{
    double s1 = cross(a, b, c), s2 = cross(a, b, d);
    TPoint tmp;
    tmp.x = (c.x * s2 - d.x * s1) / (s2 - s1);
    tmp.y = (c.y * s2 - d.y * s1) / (s2 - s1);
    return tmp;
}
//************8888
double area_poly(TPoint p[], int n)
{
    double res = 0; p[n] = p[0];
    for(int i = 0;i <  n;++ i) res += cross(p[i], p[i+1]);
    return fabs(res)/2.00;
}
//**************两个凸包的并
double convex_poly_inter_area(TPoint p1[], TPoint p2[], int n1, int n2)
{
    TPoint tmp[MAXN];
    int tn, i = 0, j, k, next, now;
    p1[n1] = p1[0]; p2[n2] = p2[0];
    for(i = 0;i < n1 && n2 > 2;++ i) {
        now = sign(cross(p1[i+1] - p1[i], p2[0] - p1[i+1]));
        for(j = tn = 0;j < n2;++ j, now = next) {
            if(now >= 0) tmp[tn++] = p2[j];
            next = sign(cross(p1[i+1] - p1[i], p2[j+1] - p1[i+1]));
            if(now * next < 0)
                tmp[tn++] = seg_inter_pnt(p1[i], p1[i+1], p2[j], p2[j+1]);
        }
        for(j = 0;j < tn;++ j) p2[j] = tmp[j];
        n2 = tn; p2[n2] = p2[0];
    }
    if(n2 < 3) return 0.00;
    return area_poly(p2, n2);
}
 
//********两个简单多边形的并
double simple_polygon_inter_area(TPoint p1[], int n1, TPoint p2[], int n2)
{
    TPoint tp1[10]={0}, tp2[10]={0};
    double ret = 0.00, flag, flag0;
    for(int i = 0;i < n1;++ i) {
        tp1[1] = p1[i]; tp1[2] = p1[i+1]; flag0 = 1.00;
        if(cross(tp1[1] - tp1[0], tp1[2] - tp1[1]) < -eps)
            flag0 = -1.00, swap(tp1[1], tp1[2]);
        for(int j = 0;j < n2;++ j) {
            tp2[1] = p2[j]; tp2[2] = p2[j+1]; flag = flag0;
            if(cross(tp2[1] - tp2[0], tp2[2] - tp2[1]) < -eps)
                flag *= -1.00, swap(tp2[1], tp2[2]);
            ret += flag * convex_poly_inter_area(tp1, tp2, 3, 3);
        }
    }
    return ret;
}


持续更新中。

Java在ACM中的使用

例一:大数的基本运算、输入输出、从小到大排序。

这道题为例:

import java.util.*;
import java.math.*;
 
/*
 *      大整数的输出要先转化为字符串(toString)。
 *      常用成员函数:加(add)减(sub)乘(multiply)除(divide)模(mod)比较(compareTo)
 *      Arrays.sort(a),对数组类的对象a进行从小到大的排序。
 * */
 
class Main{
 
 
        public static void main(String args[])  {
 
                Scanner jin = new Scanner(System.in);
 
                BigInteger M , c; 
                int i , j , n , ans;
 
                while ((n = jin.nextInt()) != 0)        {
                        BigInteger bi[] = new BigInteger[n];
                        M = jin.nextBigInteger();
                        for (i = 0;i < n;i ++){
                                bi[i] = jin.nextBigInteger();
                        }
                        Arrays.sort(bi);
 
 
                        ans = 0;
                        for (i = 0;i < n;i ++)  {
 
                                int h = i + 1 , r = n - 1 , mid;
 
                                while ( h<=r)   {
                                        mid = (h + r) >> 1;
                                        c = bi[i].multiply(bi[mid]);
                                        if (c.compareTo(M)<0){
                                                h = mid + 1;
                                        }       else    {
                                                r = mid - 1;
                                        }
                                }
 
                                if (r <= i)     break;
                                ans += r - i;
 
                        }
 
                        System.out.println(ans);
                }
 
        }
}

例二:重写排序规则

类似C/C++中的cmp函数:

import java.math.*;
import java.util.*;
 
 
/*
自定义Comparator接口格式(相当于C/C++的cmp函数)
以BigInteger为例:
 
class cmp implements Comparator
<biginteger/>     {
         //下面这个方法必须实现,其他变量可自行定义
         public int compare(BigInteger b1 , BigInteger b2)      {
         }
}
*/
class cmp implements Comparator
<biginteger/> {
 
        int state;
        public static int sortUp = 1;
        public static int sortDown = -1;
 
        public cmp(){   state = sortUp; }
        public cmp(int _state){
                state = _state;
        }
 
        public int compare(BigInteger b1 , BigInteger b2)       {
 
                return state * (b1.compareTo(b2));
        }
 
}
 
 
class Main      {
 
        public static void main(String args[])  {
 
                int n , i;
 
                Scanner jin = new Scanner(System.in);
 
                n = jin.nextInt();
                BigInteger bi[] = new BigInteger[n];
                for ( i =  0 ;i &lt; n ; i ++ )    {
                        bi[i] = jin.nextBigInteger();
                }
 
                Arrays.sort(bi ,0 , 2 ,  new cmp(cmp.sortUp));
                //对下表为[0,2)的元素进行升序排序
 
 
                Arrays.sort(bi , new cmp(cmp.sortDown));
                //对整个对象bi进行降序排序
        }
}

更新中。

coins——HDU2010 省赛集训队选拔赛(校内赛)

HDU2010 省赛集训队选拔赛(校内赛)

coins

给一定数量1,5,10,50,100面额的纸币,求最少/最多的张数的纸币组成价值恰好为P。

类似的题目,有的可以贪心(HDU 2021),有的必须DP,如何判断?

模型一:纸币数量无限,有最小单位(面额为1的纸币)。

就像一个桶,为了把它填满,你可以尽量放最大的石块,然后次大的……最后一定能用沙子填满。

最少的纸币量:贪心从大到小填入。

最多的纸币量:P。

模型二:纸币数量无限,无最小单位。

13由2、5两种纸币组成,模型一的方法无解。

最少的纸币量:DP(无穷背包)。

最多的纸币量:DP(无穷背包)。

模型三:纸币数量有限,有最小单位。

对于最小的纸币量,依旧可以用模型一的贪心,仅仅作了个数的限制。

最少的纸币量:DP(多重背包)。

最多的纸币量:DP(多重背包)。

模型四:纸币数量有限,无最小单位。

都是DP(多重背包)。

特殊数据也有特殊解法:

coins的纸币面额:1,5,10,50,100。

这样的面额,求最小纸币量可以贪心,只是加了个数限制。

注意到其后一项总能被前一项整除。

更新:求最多纸币量正确的解法:

最多情况中先枚举用哪几种纸币。

然后在这几种纸币中,总是放入尽量多的小面额纸币。

如:

136 33 1 0 1 1

这组数据如果只用面额为1,5,50的纸币将不能得到解。

当枚举到面额为1,5,100的纸币时,

step1.将1个1填补136%5的零头1。

step2.从剩下的32个单位纸币抽取5的倍数张的纸币,数目尽量多,这里可以抽取30张

step3.剩下的105运用同样的原理贪心填入。

求最多纸币部分的代码:

/*<br/>        c[]             :       1 , 5 , 10 , 50 , 100<br/>        cnum[]  :       对应面额的纸币数目<br/>        P       : 待组成的量<br/>        num     :       已经使用的纸币量<br/>*/<br/>void dfs(int P , int num , int idx)<br/>{<br/>        if (idx == 4)   {<br/>                if (P % c[4] == 0 &amp;&amp; P / c[4] &lt;= cnum[4]<br/>                                        &amp;&amp; MaxN &lt; P / c[4] + num )      {<br/>                                MaxN = P / c[4] + num;<br/>                        }<br/>                return;<br/>        }<br/>        for ( int i = idx + 1; i &lt; 5; i ++ ) {
<br/>             int mod = P % c[i];<br/>                if ( mod % c[idx] || mod / c[idx] &gt; cnum[idx] ) continue;
<br/>             int cr = cnum[idx] - mod / c[idx];<br/>                int ratio = c[i] / c[idx];
<br/>             int _P = P - mod - cr / ratio * ratio * c[idx];<br/>                if (_P &lt; 0)     _P = 0;<br/>                int _num = num + (P - _P) / c[idx];
<br/>             dfs( _P , _num , i);<br/>        }<br/>}

更进一步,最小面额可以不必是1。它是不同面额纸币的最大公约数。

2,4,10,30,这样面额的纸币,2就是最小面额,将P和所有面额都除以2则可运用上述模型。