DFdou's Blog Life is short,Be yourself.

3004/090

Flash-关于AS和强制类型转换

内容来自Actionscript3.cn
Now,let's begin,what's the differenct between "objectA as BaseClass" and "BaseClass(objectA)"?
This answer from comment 6#:

objectA as BaseClass:
如果一个物件(objectA)属于一种型别(BaseClass),那么返回这个物件,否则返回Null.
if objectA is a type of BaseClass,then return objectA,else return Null.

BaseClass(objectA)为强制转换:
如果一个物件(objectA)属于一种型别(BaseClass),那么返回这个物件,否则报错.
if objectA is a type of BaseClass,then return objectA,else throw an error.

example:
var objectA:MovieClip = new MovieClip();
trace(objectA as MovieClip);//输出:[object MovieClip]
trace(objectA as Shape);//输出: null
trace(MovieClip(objectA));//输出:[object MovieClip]
trace(Shape(objectA));//输出:TypeError: Error #1034: 强制转型失败
Tagged as: , No Comments
2904/092

AS3-图像复制BitmapData.copyPixels()

Press your mouse on the Flash Demo and drag pls:


How to play with this Flash? AH,click your mouse,and then draw an rectangle as selectebox,the image in the selectbox will appears in the top, left corner.

2804/090

Time to Patch Google Chrome or IE?

This article learned from readwriteweb.com and written by Sarah Perez.

Earlier this month, a problem was discovered in Google's new web browser, Google Chrome, that would have allowed an attacker to launch and run scripts on a compromised machine. The issue, originally discovered by Roi Saltzman of the IBM Rational Application Security Research Group, had been given a security rating of "high." Interestingly enough, although the attack takes advantage of security issues in Google Chrome, the initial entry point for the malicious code would have taken place in Internet Explorer.

Goolge has now released a patch for this issue. If you want to make sure your browser is up-to-date, click through for the instructions.

About the Security Issue(s)

According to researcher, Roi Saltzman, a malicious attacker can use three separate issues in parts of Chrome to create attacks that endanger users who surf to a malicious web site using Internet Explorer. Chrome program manager, Mark Larson, explains that the flaw could have caused Google Chrome to "launch, open multiple tabs, and load scripts that run after navigating to a URL of the attacker's choice." (Yes, it seems that to get the malicious code working, a user would still need to be surfing with IE.)

How to Fix Your Copy of Chrome

Now that a patch is available, you can update Google Chrome on your own. Even if you never run IE, it's always a good idea to have the latest version of Chrome installed. Although Google says that the browser will update itself automatically, on my machine, the update had not yet taken place on my ever-open copy of Chrome - I had to force the update manually.

If you want to do the same, you'll need to first click on the Settings menu in Chrome. This is the menu to the right of the address bar which is identified with an icon resembling a wrench. In that menu, click the option "About Google Chrome." If you need the update, it will begin automatically. Once complete, you'll be prompted to close and then reopen the browser for the update to finish installing.

about_google_chrome.png

To be extra sure that the update took, you can return to that menu option after relaunching Chrome and make sure that the version number reads 1.0.154.59.

--------------------------------------------------------------------------------------------------
Chrome爆出一个搞笑的漏洞,可以在Chrome多进程里加载外部Script代码,然后对中招的人进行攻击,但是这个攻击还需要使用者打开IE才能完成……也就是说,使用Chrome会被人使用这个漏洞攻击,但是这个又是基于IE的……好无语啊我……啊哈,Google translate “好无语啊我” to “Ah well I am speechless”……Just for fun~

2704/090

AIR-Application minimize,drag and exit

I installed Flash CS4 today,found that it's easy to create AIR Application in CS4!! Between Flex and Flash,I like Flash IDE best!
Because if u use Flex IDE,u should know MXML and AS3,but if use Flash,only AS3 is good enough.OK,it's the time to goto the subject.
When we create an AIR Application,we may want to minimize it,drag it and exit it by some MC(movieclip) or Button,then how can we do it?
Core Class Main.as here:

package {
	import flash.desktop.NativeApplication;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;

	public class Main extends MovieClip {
		public var closeBt:MovieClip;
		public var minBt:MovieClip;
		public var recordBox:MovieClip;

		public function Main():void {
			btn_close.addEventListener(MouseEvent.CLICK, closeApp);
			btn_min.addEventListener(MouseEvent.CLICK, minApp);
			btn_drag.addEventListener(MouseEvent.MOUSE_DOWN, dragApp);
		}
		//drag Application with btn_drag
		private function dragApp(_evt:MouseEvent):void {
			stage.nativeWindow.startMove();
		}
		//close Application
		private function closeApp(_evt:MouseEvent):void {
			NativeApplication.nativeApplication.exit();
		}
		//minimize Application
		private function minApp(_evt:MouseEvent):void {
			stage.nativeWindow.minimize();
		}
	}
}

Then,import this Main.as in your Application,everything is OK~It's so easy work,isn't it?

2404/090

OpenID

OpenID
最近正在看关于OpenID的资料,就转一篇吧,内容来自:http://openid.net.cn/,具体原文请参阅:http://openid.net/

2304/090

GAME-Quake Live

Quake
Quake Live:http://www.quakelive.com
无比强大的Flash版本,游戏正规容量应当在800M左右的效果做在了10M左右的Flash里边,强大的地方,有兴趣的可以去参观一下。

2204/090

Google Analytics Desktop Reporting Takes Stats Offline

From http://www.techcrunch.com/2009/04/21/google-analytics-api-now-in-public-beta-desktop-reporting-takes-stats-offline/

Moments ago, Google released the public beta version of the Google Analytics API after running a private beta program with hundreds of developers for about a year.

When Google announced a great deal of updates to Google Analytics last October, the company already said the API was ‘coming soon’, but obviously it took them another 6 months to effectively start rolling out.

With the Google Analytics data API, developers can develop client applications that access Google Analytics data and subsequently present it in new, innovative ways. By combining a wide variety of metrics and dimensions, an API-based client application can deliver custom reports, more refined data or new visualizations that in turn provide new ways to analyze the performance of websites and web applications.

From the blog post announcing the release:

The Analytics API is a Google Data API. This is the same API protocol for Google Calendar, Finance and Webmaster Tools. If you’ve used any of these APIs, the Google Analytics Data Export API will look very familiar to you.

For the JavaScript and Java programming languages, we’ve provided client libraries to abstract and simplify the process. We’re also working on supporting more programming languages. In the meantime, for any programming language you want to use you can make requests directly to the API over HTTP and access the data in XML.

One of the applications that was built using the API and which is being featured on the launch website is Polaris, one of the products built by Desktop Reporting, which aims to bring Google Analytics to the desktop. The full suite, a full-featured Adobe AIR-powered GA reporting tool called Dopac, is still a couple of weeks away from launching, but Polaris already brings some of the data to the desktop in the form of cross-platform widgets and is definitely worth checking out. There are 8 standard reports available, and the app is completely free if used for only one website (an annual $15 fee is required to extend it to more websites). It’s targeted to marketers, project and account managers who are looking for an intuitive way to check out basic stats for a website they’re tracking from their desktops.

Desktop Reporting was pioneered by just one guy, Nicolas Lierman from Belgium. (Disclosure: the startup was one of the presenting finalists at my conference Plugg, held last month in Brussels)

Lierman has been working on bringing Google Analytics offline for quite a while (in fact, we covered one of the first iterations of his desktop application back in September 2007), and besides the full reporting suite and the now launched Polaris, he also has two other GA-related products in the pipeline (check his website for more info).

Also worth chekcing out is Actual Metrics’ Android application for Google Analytics.

It will be interesting to see what other third-party developers come up with now that the API is finally out there. Google already put some examples online in this gallery, but if you have anything cool to announce in the future, you know where to find us.

The company also set up a Google Analytics API Notify email group so you can get the key announcements on feature updates, code changes and other service related news that relate to the API that way, and / or you can join the Google Analytics APIs Group.

2104/090

Flex-12 very simple,basic but useful function source in Flex

This article comes from http://ntt.cc,Yes,let's share.
No.1 Copy content to clipboard拷贝到剪贴板:

System.setClipboard(strContent);

No.2 Clone an ArrayCollection复制ArrayCollection:

//dummy solution( well, it works )
var bar:ArrayCollection = new ArrayCollection();
for each ( var i:Object in ac ){
bar.addItem( i );
}
// fantastic ! //
var bar:ListCollectionView = new ListCollectionView( ListCollectionView( ac ).list );

No.3 Open URL:

navigateToURL(new URLRequest('http://ntt.cc'), '_blank');

No.4 Page reload页面重新载入,通过JS:

navigateToURL(new URLRequest("javascript:location.reload();"),"_self");

No.5 Close browse关闭页面,也是通过JS:

navigateToURL(new URLRequest("javascript:window.close()"),"_self");
Tagged as: , Continue reading
2004/090

CSS Tools-Reset CSS

关于Reset CSS的详细内容请参阅这里:http://ued.taobao.com/blog/2009/03/31/reset_css_a/
因为本人对CSS不怎么了解,所以从头看到了尾,才算有点明白了。。
介绍一个Reset CSS模型,来自http://meyerweb.com/eric/tools/css/reset/index.html

/* v1.0 | 20080212 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-size: 100%;
	vertical-align: baseline;
	background: transparent;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}

/* remember to define focus styles! */
:focus {
	outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
	text-decoration: none;
}
del {
	text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
	border-collapse: collapse;
	border-spacing: 0;
}

听总攻说,Reset CSS的模型很多,大家不妨找一个适合自己的。

Tagged as: , , No Comments
1904/090

杭州的几个UED团队Blog介绍

From http://www.cnbeta.com/articles/82049.htm 差不多都是杭州的UED团队,而且我看了下,几乎全是用WordPress搭建的啊……
淘宝UED:http://ued.taobao.com/blog/个人觉得这个UED团队最活跃,尤其是他们的招聘广告哈哈。
163UED:http://www.ued163.com/,这个怎么说呢,163或许可以说是上海的?……
19Lou UED:http://ued.dukuai.com/blog/
口碑UED:http://ued.koubei.com/
刚好看到163UED转了别人一个有趣的帖子,转几张图贴贴:
163ued

1804/090

Flex-Alert.show()的Flags参数

来自http://bbs.actionscript3.cn/thread-25144-1-1.html
Alert.show()里面有多个属性,其中排在第三是flags,这个属性作用是在弹出的Alert提示框里面显示那一个或多个按钮,文档和书籍一般只写该属性可以自由组合 Alert.OK, Alert.CANCEL,Alert.YES ,Alert.NO四个选项,并用“|”分隔,其实也可以用数字编号代替的,用数字编号更为简便,以下是编号对应的按钮组合表,一共有16个数字编号(其实只有15种组合)。
1- Alert.YES
2- Alert.NO
3- Alert.YES | Alert.NO
4- Alert.OK
5- Alert.OK | Alert.YES
6- Alert.OK | Alert.NO
7- Alert.OK | Alert.YES | Alert.NO
8- Alert.CANCEL
9- Alert.YES | Alert.CANCEL
10- Alert.NO | Alert.CANCEL
11- Alert.YES | Alert.NO | Alert.CANCEL
12- Alert.OK | Alert.CANCEL
13- Alert.OK | Alert.YES | Alert.CANCEL
14- Alert.OK | Alert.NO | Alert.CANCEL
15- Alert.OK | Alert.YES | Alert.NO | Alert.CANCEL
16- Alert.OK (和4一样)
17开始返回到1重新按顺序循环………..而flags属性不填写的话一般默认值为Alert.OK,也就是4或16。

1704/093

WordPress-10 Exceptional WordPress Hacks

This article is reproduced from Smashingmagazine.com

One of the reasons people love WordPress so much is its great flexibility. You can change the software's appearance with themes. You can enhance its functionality with plug-ins. And, last but not least, you can totally unleash WordPress' power with hacks. Some time ago, we wrote a post showing 10 Killer WordPress Hacks.

Today, let's do it again with 10 new and totally killer WordPress hacks to make your blog stand out from the crowd. As usual, we won't just list the hacks alone. In each entry, you'll find an explanation of the code as well as the kinds of problems that the hack solves.

You may be interested in the following related posts:

1604/090

WordPress Themes-Evidens, wordpress theme release

Evidens
Designdisease的又一个新作,个人非常喜欢Designdisease,每个Theme都很精彩。废话不多说,地址如下:http://designdisease.com/blog/evidens-wordpress-theme-release/提供了White和Dark两个版本。

1504/092

PHP-轻松实现多态

原文链接http://bbs.verylab.com/viewthread.php?tid=34,请尊重原创。
以下内容节选自作者的部分内容+豆腐的碎碎念:
PHP 5.x 虽然支持抽象类和接口, 但并不支持多态,那如何实现多态呢?可以借助接口来实现。
1. 建立 ITest.php 接口

< ?php
interface ITest
{
    public function test($a, $b);
}
?>

2. 建立 TestLibary 文件夹, 在这个文件夹下定义的所有类都实现 ITest 接口, 以下是一些例子。
PerformanceTest.php

<?php
class PerformanceTest implements ITest
{
    public function __construct()
    {
        //构造方法
    }
    public function test($a, $b)
    {
        //接口方法的实现
        echo '我是 PerformanceTest 类';
    }
}

DataTest.php

<?php
class DataTest implements ITest
{
    public function __construct()
    {
        //构造方法
    }
    public function test($a, $b)
    {
        //接口方法的实现
        echo '我是 DataTest 类';
    }
}

以下省略,有兴趣的请参阅原文。个人觉得这是个不错的实现方法。

1404/090

IIS-Service Unavailable

今天服务器不知道怎么回事,忽然抽筋,访问上边的全部网站都显示“Service Unavailable”。
打开错误日志,发现是AppOffline DefaultAppPool,默认的应用程序池当掉了。
试着新建了一个,依然是“Service Unavailable”,而DefaultAppPool重新启动之后则会被自动关闭。
估计是哪个网站连接数超了,可是重新启动了IIS和服务器都不能重置链接数?
后来也不知道怎么弄的,关闭DU Meter之后忽然就好了,而这个时候服务器那边说他们关掉了WP的Rewrite模块,。
SO,我也搞不清楚到底是DU Meter的问题还是WP的Rewrite模块的问题…方正能用就好了……

Page 1 of 212