- 博客(58)
- 资源 (1)
- 收藏
- 关注
转载 如何包装才能不拆包
商店的糖果有3kg和5kg两种包装,数量极为充足,保证供应.求证:凡购买8kg以上的糖果时,都可以不用拆包.解:如果是9的倍数,全用3克kg的。如果除以3余1,则用2个5kg的,剩下的用3kg的。如果除以3余2,则用1个5kg的,剩下的用3kg的。
2013-04-30 18:15:27 662
转载 Junit测试
package org.liulixin;public class Calculator { private int a; private int b; public int getA() {return a;} public void setA(int a) {this.a = a;} public int getB() {return b
2013-04-30 07:35:08 399
转载 生出随机数
import java.util.Random; /** * This example explains how to generate random numbers and values. */public class RandomNumberGenerator { public RandomNumberGenerator() { super(); }
2013-04-30 03:08:34 522
转载 form中的选择框是否被选中
Submitting Check Boxes Submitting Check Boxes Checkbox 1 Checkbox 2
2013-04-29 21:49:43 543
转载 宏定义
#include #define height 100#define number 3.14#define letter 'A'#define letter_sequence "ABC"#define backslash_char '\?'void main(){ printf("value of height : %d \n", height ); print
2013-04-28 22:55:54 435
转载 根据ID查询
Database Lookup Database Lookup Please enter the ID of the publisher you want to find:
2013-04-28 22:38:36 1068
转载 spring AOP之二
package com.kruders.spring.aop; public class BusinessImpl implements BusinessService { public void doSomeThing() { System.out.println("Do Something Here"); int x = 5/0; }}<
2013-04-28 19:07:45 403
转载 Spring AOP
围绕着某些方法的调用,为这些方法加入一些新的功能,而又不修改这些方法本身。package com.mkyong.customer.services;public class CustomerService { private String name; private String url; public void setName(String name) { this.name
2013-04-28 18:13:14 671
转载 采用注释的spring
package testbean;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;import writer.IWriter;@Servicepublic class MySpringBeanWithDependen
2013-04-28 07:27:24 426
转载 C语言中函数的写法
#include// function prototype, also called function declarationfloat square ( float x );// main function, program starts from hereint main( ){ float m, n ; printf ( "\nEnter som
2013-04-28 06:39:28 1952
转载 共用体Union的例子
共用内存,只能看到最后的分量。#include #include union student{ int id; char name[20]; float percentage;};int main(){ union student record; record
2013-04-28 06:35:07 600
转载 JSP读写磁盘
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Reading Binary Data Reading Binary Data This page reads b
2013-04-28 06:26:08 527
原创 从数据库中导出表的结构以及数据
用mysqldump.注意,这本身就是一个命令行窗口的可执行程序,不能在mysql的提示符下运行。从MySQL的安装路径C:\Program Files\MySQL\MySQL Server 5.5\bin下把mysqldump.exe这个文件考到d盘根目录下。这是为了用起来方便。拷贝完了以后,可以在命令提示符窗口试试这个:d:/dumpmysql --help会看到一堆用法的
2013-04-28 06:04:03 870
原创 查看数据库驱动程序是否安装
public class LookForDriver { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { String className = "com.mysql.jdbc.Driver";
2013-04-28 03:25:01 1492
转载 带泛型的HashMap
import java.util.HashMap;import java.util.Map; /** * Example of HashMap to demonstrate basic use. * */public class HashMapExample { public HashMapExample() { super(); } p
2013-04-28 02:54:37 482
转载 Spring基础之Junit测试
注意这个工程中有3个source folder:src,resources,test。在Eclipse中,它们的图标与普通文件夹是不同的。实际上,这3个文件夹相当于同一个文件夹。application-ctx.xml<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3
2013-04-28 02:31:26 544
转载 Map类型
import java.util.HashMap;import java.util.Iterator;import java.util.Map;import java.util.Set;public class MapExample { public static void main(String[] args) { Map mp = new HashMap(); //
2013-04-27 19:49:41 427
转载 斐波那契数列
#include #include main(){ int fib[24]; int i; fib[0] = 0; fib[1] = 1; for(i = 2; i < 24; i++) fib[i] = fib[i-1] + fib[i-2]; for (i =
2013-04-27 19:26:43 408
转载 JDBC读出blob
import java.awt.event.ActionEvent;import java.sql.*;import java.awt.Graphics;import java.awt.event.ActionListener;import java.awt.image.BufferedImage;import java.io.File;import java.io.FileInput
2013-04-27 03:15:29 477
转载 JDBC上传图片文件到MySQL数据库的blob字段
package net.codejava.upload;import java.io.IOException;import java.io.InputStream;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.SQLE
2013-04-27 01:12:48 1496
转载 从数据库中读出记录
CREATE TABLE users( username varchar(15) NOT NULL, name varchar(255) NOT NULL, pass varchar(15) NOT NULL, CONSTRAINT users_pkey PRIMARY KEY (username));insert into users values ('Binod','Binod Ku
2013-04-26 22:30:53 526
转载 spring 基础1
story-configuration.xml<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> Hello World! U
2013-04-26 20:54:29 574
转载 数据库操作语言HQL
package net.roseindia.hqlexamples;import java.util.Iterator;import java.util.List;import org.hibernate.Query;import org.hibernate.Session;import org.hibernate.SessionFactory;import org.hiberna
2013-04-26 19:02:00 502
转载 关键字typedef
// Structure using typedef:#include #include typedef struct student{ int id; char name[20]; float percentage;} status;int main(){ status record; record.id=1; strcpy(record.name,
2013-04-26 03:25:16 459
转载 监听delete键
import java.awt.event.KeyEvent;import java.awt.event.KeyListener;import javax.swing.JFrame;public class TestKeyEvent extends JFrame implements KeyListener{ @Override public void keyPressed(KeyEv
2013-04-26 01:42:54 956
转载 监听键盘事件
import java.awt.*;import java.awt.event.*;public class KeyListenerTester extends Frame implements KeyListener { private static final long serialVersionUID = 1L; TextField t1; Label l1; public
2013-04-26 00:28:37 582
转载 创建窗口
#include const char g_szClassName[] = "myWindowClass";// Step 4: the Window ProcedureLRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ switch(msg) { ca
2013-04-25 22:56:15 511
原创 64位的机子上生成了32位的dll
Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\gvlib\gvlib.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform最近想玩JNA,在64位机子上装了一个vc6++,结果生成的是32位的dllimport com.sun.jna.NativeLibr
2013-04-25 03:14:00 1725
转载 调用c的printf
import com.sun.jna.Library;import com.sun.jna.Native;import com.sun.jna.Platform;/** Simple example of JNA interface mapping and usage. */public class HelloWorld { // This is the standard, s
2013-04-25 01:28:07 572
转载 输出运行时输入的参数
#include #include int main(int argc, char *argv[]) { int x; printf("%d\n", argc); for (x = 0; x < argc; x++) printf("%s\n", argv[x]); return 0;}
2013-04-23 07:07:50 513
转载 结构体
#include #include struct rec { int i; float f; char c;};int main() { struct rec *p; p = (struct rec *) malloc(sizeof(struct rec)); (*p).i = 10; (*p).f = 3.14; (*p).c = 'a'; printf("%d
2013-04-23 07:02:07 396
转载 分配内存
#include #include int main() { int *p; p = (int *) malloc(sizeof(int)); if (p == 0) { printf("错误:内存不足n"); return 1; } *p = 5; printf("%d\n", *p); free(p); return 0;}
2013-04-23 06:59:30 460
原创 获得qq聊天窗口的句柄并使好友窗口获得焦点
为往群里面频繁发送粘贴板内容做些准备,win7,64位下通过。import com.sun.jna.Native;import com.sun.jna.platform.win32.WinDef.HWND;import com.sun.jna.win32.StdCallLibrary;public class Show_QQ_Window { public interface Use
2013-04-23 04:14:21 4298 1
转载 苏一辰高精度乘法
#include "stdio.h"main() { char a[100], b[100]; int c[200] = { 0 }, i, j, x, y; gets(a); gets(b); x = strlen(a); y = strlen(b); for (i = 0; i < x; i++) a[i] = a[i] - 48; for (i = 0; i < y;
2013-04-22 02:40:02 995
转载 在java程序中如何能获取到另一个程序的windows句柄,又如何使用这个句柄向这个窗口发送消息
import com.sun.jna.Native;import com.sun.jna.Pointer;import com.sun.jna.platform.win32.WinDef.HWND;import com.sun.jna.platform.win32.WinUser;import com.sun.jna.platform.win32.WinUser.WNDENUMPROC;
2013-04-20 00:38:13 17836 2
转载 机器人自动打开浏览器,输入网址,自动访问
import java.awt.AWTException;import java.awt.Robot;import java.awt.event.KeyEvent;import java.io.IOException;public class RobotSample { public static void main(String[] args) throws IOException
2013-04-19 23:37:06 1325
原创 Java获得鼠标位置
需要jna.jar和platform.jar每隔3秒移动一下鼠标看console中的输出import com.sun.jna.Native;import com.sun.jna.win32.StdCallLibrary;public class mouse_position { public interface USER32 extends StdCallLibrary{ U
2013-04-19 06:37:16 1284 1
转载 快速排序
作者:西工大附中 8年级 文筠飞 指导老师:新曙光培训 刘霞#include int b[1000] = { 0 };void paixv(l, r) int l, r; { int k, i, j, y; i = l; j = r; k = l; while (i < j) { if (b[i] > b[j]) { if (k == i) k = j;
2013-04-19 03:14:14 964
转载 junit test
import static org.junit.Assert.*;import junit.framework.TestCase;import org.junit.Test;public class SimpleTest extends TestCase { private java.util.List emptyList; /** * Sets up
2013-04-18 01:35:41 532
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人