learn and do
haoshuang3394 · 共 146 篇文章
用其他名字来命名数组(2)
名字空间别名namespace alias 允许用一个可替代的短的或更一般的名字与一个现 有的名字空间关联起来。例如 // 提供一个更一般化的别名 namespace LIB = IBM_Canada_Laboratory; // 提供一个更短的别名 namespace DFA = Disney_Feature_Animation; 然后,这个别名就可以用作原始名字空间的同义词。例如 #include "IBM_Canada.h" namespace LIB = IBM_Canada_Laboratory; int main() { LIB::Array<int> ia(1024); // …
2009-06-13 22:25 · C++学习 · 评论(0) · 工作 · IBM
principal.py源代码分析
principal = 1000.0 # starting principal,本金 rate = .05 # interest rate,利率 print "Year %21s" % "Amount on deposit"#打印的头 for year in range( 1, 11 ): amount = principal * ( 1.0 + rate ) ** year #计算每年的本息和 print "%4d%21.2f" % ( year, amount ) #打印每年的本息和
2009-06-13 22:07 · python学习 · 评论(0)
release_ok.php源代码分析
<?php include("conn/conn.php"); %包含数据库连接文件 $type=$_POST[type]; %获取类型 $title=$_POST[title]; %获取标题 $content=$_POST[content]; %获取内容 $linkman=$_POST[linkman]; %获取联系人 $tel=$_POST[tel]; %获取电话号码 //$edate=date("Y-m-d h:i:s"); $edate=date("Y-m-d H:i:s"); %获取当前的日期和时间 $sql=mysql_query("insert into tb_info(typ…
2009-06-13 22:00 · php学习 · 评论(0) · PHP · SQL · MySQL
Drawing with Alpha:使用alpha通道来绘图
drawGraphic1(g2d); // Set alpha. 0.0f is 100% transparent and 1.0f is // 100% opaque. float alpha = .7f; g2d.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, alpha)); drawGraphic2(g2d);
2009-06-13 00:17 · java学习 · 评论(0)
用其他名字来命名数组(1)
把代码分发给其他部门的诸多困难中有一个是我们不知道全局名字会有什么样的影响。 例如在Intel 公司有人写了: class Array { ... }; 那么他就不能在相同的程序中既使用上面的Array 类又使用我们实现的那个Array 类。 名字的可视性使这两份实现代码相互排斥。 在C++标准化之前,解决这个问题的传统做法是在全局可见的名字前加上一个唯一的字 符串前缀。例如我们可以这样发行数组Array 类 class Cplusplus_Primer_Third_Edition_Array { ... }; 虽然这个名字可能是惟一的,我们不能保证这一点,但是写起来并不方便。标准C++ 的…
2009-06-12 23:49 · C++学习 · 评论(0) · C · C++ · C# · IBM
for_sum.py源代码分析
sum = 0 #初始化sum为0 for number in range( 2, 101, 2 ): sum += number #2到101之间的相隔2的所有数组成的序列,即2,4,6,。。。100 print "Sum is", sum #打印sum
2009-06-12 23:41 · python学习 · 评论(0)
release_content.php源代码分析
<style type="text/css"> <!-- .style1 {color: #FF0000} --> </style> <link href="css/style.css" rel="stylesheet"> <script language="javascript"> function checkform(form){ for(i=0;i<form.length;i++){ if(form.elements[i].value==""){ alert("请将发布信息填写完整!"); form.elements[i].focus(); return false; %函数检查for…
2009-06-12 23:34 · php学习 · 评论(0) · CSS · 招聘 · PHP · JavaScript
Drawing Anti-Aliased Text and Graphics:绘制反锯齿文字和图形
// Text only g2d.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // Text and graphics g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); drawGraphics(g2d);
2009-06-12 00:44 · java学习 · 评论(0)
for.py源代码分析
for counter in range( 10 ): print counter #打印for语句的每个计算器
2009-06-12 00:04 · python学习 · 评论(0)
release.php源代码分析
<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no…
2009-06-11 23:12 · php学习 · 评论(0) · HTML · C · C++ · CSS · PHP
Getting the Dimensions of Text:获取文本的长和宽
// From within the paint() method. public void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; Font font = new Font("Serif", Font.PLAIN, 12); FontMetrics fontMetrics = g2d.getFontMetrics(); int width = fontMetrics.stringWidth("aString"); int height = fontMetrics.getHeight(); } // From within a …
2009-06-11 00:32 · java学习 · 评论(0)
基于异常的设计(2)
<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no…
2009-06-10 23:47 · C++学习 · 评论(0) · 活动
while.py源代码分析
counter = 0 #初始变量为0 while counter < 10: print counter %打印counter counter += 1 %计数器加1
2009-06-10 23:37 · python学习 · 评论(0)
recruitbusiness_info.php源代码分析
<link href="css/style.css" rel="stylesheet"> <?php include("conn/conn.php"); %包含数据库连接文件 ?> <table width="563" height="587" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="563" height="587" valign="top" bgcolor="#FFFFFF"><table width="563" border="0" cellspacing="0" cellpadding="0"> <tr>…
2009-06-10 23:31 · java学习 · 评论(0) · CSS · PHP · SQL · MySQL
Drawing Rotated Text:画旋转字
//Draw string rotated clockwise 90 degrees. AffineTransform at = new AffineTransform(); at.setToRotation(Math.PI/2.0); g2d.setTransform(at); g2d.drawString("aString", x, y); // Draw string rotated counter-clockwise 90 degrees. at = new AffineTransform(); at.setToRotation(-Math.PI/2.0); g2d.setTrans…
2009-06-10 00:48 · java学习 · 评论(0)