- 浏览: 7377638 次
- 性别:
- 来自: 上海
-
文章分类
- 全部博客 (1546)
- 企业中间件 (236)
- 企业应用面临的问题 (236)
- 小布Oracle学习笔记汇总 (36)
- Spring 开发应用 (54)
- IBatis开发应用 (16)
- Oracle基础学习 (23)
- struts2.0 (41)
- JVM&ClassLoader&GC (16)
- JQuery的开发应用 (17)
- WebService的开发应用 (21)
- Java&Socket (44)
- 开源组件的应用 (254)
- 常用Javascript的开发应用 (28)
- J2EE开发技术指南 (163)
- EJB3开发应用 (11)
- GIS&Mobile&MAP (36)
- SWT-GEF-RCP (52)
- 算法&数据结构 (6)
- Apache开源组件研究 (62)
- Hibernate 学习应用 (57)
- java并发编程 (59)
- MySQL&Mongodb&MS/SQL (15)
- Oracle数据库实验室 (55)
- 搜索引擎的开发应用 (34)
- 软件工程师笔试经典 (14)
- 其他杂项 (10)
- AndroidPn& MQTT&C2DM&推技术 (29)
- ActiveMQ学习和研究 (38)
- Google技术应用开发和API分析 (11)
- flex的学习总结 (59)
- 项目中一点总结 (20)
- java疑惑 java面向对象编程 (28)
- Android 开发学习 (133)
- linux和UNIX的总结 (37)
- Titanium学习总结 (20)
- JQueryMobile学习总结 (34)
- Phonegap学习总结 (32)
- HTML5学习总结 (41)
- JeeCMS研究和理解分析 (9)
最新评论
-
lgh1992314:
[u][i][b][flash=200,200][url][i ...
看看mybatis 源代码 -
尼古拉斯.fwp:
图片根本就不出来好吧。。。。。。
Android文件图片上传的详细讲解(一)HTTP multipart/form-data 上传报文格式实现手机端上传 -
ln94223:
第一个应该用排它网关吧 怎么是并行网关, 并行网关是所有exe ...
工作流Activiti的学习总结(八)Activiti自动执行的应用 -
ZY199266:
获取不到任何消息信息,请问这是什么原因呢?
ActiveMQ 通过JMX监控Connection,Queue,Topic的信息 -
xiaoyao霄:
DestinationSourceMonitor 报错 应该导 ...
ActiveMQ 通过JMX监控Connection,Queue,Topic的信息
package util{
import mx.formatters.DateFormatter;
import mx.utils.ObjectUtil;
import mx.utils.StringUtil;
public class DateUtils {
// Days of week
public static const MONDAY:String = "monday";
public static const TUESDAY:String = "tuesday";
public static const WEDNESDAY:String = "wednesday";
public static const THURSDAY:String = "thursday";
public static const FRIDAY:String = "friday";
public static const SATURDAY:String = "saturday";
public static const SUNDAY:String = "sunday";
// Months of year
public static const JANUARY:String = "january";
public static const FEBRUARY:String = "february";
public static const MARCH:String = "march";
public static const APRIL:String = "april";
public static const MAY:String = "may";
public static const JUNE:String = "june";
public static const JULY:String = "july";
public static const AUGUST:String = "august";
public static const SEPTEMBER:String = "september";
public static const OCTOBER:String = "october";
public static const NOVEMBER:String = "november";
public static const DECEMBER:String = "december";
// Date parts
public static const YEAR:String = "fullYear";
public static const MONTH:String = "month";
public static const WEEK:String = "week";
public static const DAY_OF_MONTH:String = "date";
public static const HOURS:String = "hours";
public static const MINUTES:String = "minutes";
public static const SECONDS:String = "seconds";
public static const MILLISECONDS:String = "milliseconds";
public static const DAY_OF_WEEK:String = "day";
// Numeric value of "last", to get last item for a specific time
public static const LAST:Number = -1;
// Date masks
public static const SHORT_DATE_MASK:String = "MM/DD/YY";
public static const MEDIUM_DATE_MASK:String = "MMM D, YYYY";
public static const LONG_DATE_MASK:String = "MMMM D, YYYY";
public static const FULL_DATE_MASK:String = "EEEE, MMMM D, YYYY";
// Time masks
public static const SHORT_TIME_MASK:String = "L:NN A";
public static const MEDIUM_TIME_MASK:String = "L:NN:SS A";
// TZD = TimeZoneDesignation = GMT + or - X hours, non-standard, requires a slight hack
public static const LONG_TIME_MASK:String = MEDIUM_TIME_MASK + " TZD";
// Internal values for using in date/time calculations
private static const SECOND_VALUE:uint = 1000;
private static const MINUTE_VALUE:uint = DateUtils.SECOND_VALUE * 60;
private static const HOUR_VALUE:uint = DateUtils.MINUTE_VALUE * 60;
private static const DAY_VALUE:uint = DateUtils.HOUR_VALUE * 24;
private static const WEEK_VALUE:uint = DateUtils.DAY_VALUE * 7;
// Internal variable used in date/time formatting
private static var _dateFormatter:DateFormatter;
private static function get dateFormatter():DateFormatter {
if ( !_dateFormatter ) {
_dateFormatter = new DateFormatter;
}
return _dateFormatter;
}
// a generic object for holding day of the week values
private static var _objDaysOfWeek:Object = null;
public static function get objDaysOfWeek():Object {
if ( !_objDaysOfWeek ) {
_objDaysOfWeek = {};
_objDaysOfWeek[ DateUtils.SUNDAY ] = 0;
_objDaysOfWeek[ DateUtils.MONDAY ] = 1;
_objDaysOfWeek[ DateUtils.TUESDAY ] = 2;
_objDaysOfWeek[ DateUtils.WEDNESDAY ] = 3;
_objDaysOfWeek[ DateUtils.THURSDAY ] = 4;
_objDaysOfWeek[ DateUtils.FRIDAY ] = 5;
_objDaysOfWeek[ DateUtils.SATURDAY ] = 6;
}
return _objDaysOfWeek;
}
// a generic object for holding month values
private static var _objMonth:Object = null;
public static function get objMonth():Object {
if ( !_objMonth ) {
_objMonth = {};
_objMonth[ DateUtils.JANUARY ] = 0;
_objMonth[ DateUtils.FEBRUARY ] = 1;
_objMonth[ DateUtils.MARCH ] = 2;
_objMonth[ DateUtils.APRIL ] = 3;
_objMonth[ DateUtils.MAY ] = 4;
_objMonth[ DateUtils.JUNE ] = 5;
_objMonth[ DateUtils.JULY ] = 6;
_objMonth[ DateUtils.AUGUST ] = 7;
_objMonth[ DateUtils.SEPTEMBER ] = 8;
_objMonth[ DateUtils.OCTOBER ] = 9;
_objMonth[ DateUtils.NOVEMBER ] = 10;
_objMonth[ DateUtils.DECEMBER ] = 11;
}
return _objMonth;
}
public function DateUtils() {
}
/**
*
* 添加或减少天数
*/
public static function addDay(date:Date,days:int):Date
{
if(date!=null)
{
date.setDate(days);
}
return date;
}
/**
* 两个日期相差的天数
*
*/
public static function daysOfDates(date0:Date,date1:Date):int
{
var days0:Number=date0.time;
var days1:Number=date1.time;
var days:Number=(days0-days1)/DAY_VALUE;
return days;
}
/**
* 判断时间是否在开始和结束时间之间
*
*/
public static function isBetween(fromdate:Date,todate:Date,current:Date):Boolean
{
if(ObjectUtil.dateCompare(fromdate,current)!==1&&ObjectUtil.dateCompare(todate,current)!=-1)
{
return true;
}
return false;
}
/**
*位于某个时间之后
*/
public static function after(date0:Date,date1:Date):Boolean
{
if(ObjectUtil.dateCompare(date0,date1)==1)
{
return true;
}
return false;
}
/**
*位于某个时间之前
*/
public static function before(date0:Date,date1:Date):Boolean
{
if(ObjectUtil.dateCompare(date0,date1)==-1)
{
return true;
}
return false;
}
/**
*两个时间相等
*/
public static function equals(date0:Date,date1:Date):Boolean
{
if(ObjectUtil.dateCompare(date0,date1)==0)
{
return true;
}
return false;
}
/**
* @private
*
* This function will remove any invalid characters from the date/time mask based upon a pattern
*
* @param mask The string for matching
* @param pattern The valid characters for this mask
* @param defaultValue The default value to return to the calling page should the mask not match the pattern
*
* @return Returns a validated <code>mask</code> based upon the original pattern
*/
private static function removeInvalidDateTimeCharacters( mask:String, pattern:String, defaultValue:String ):String {
// test for invalid date and time characters
if ( mask.replace( new RegExp( pattern, "ig" ), "" ).length > 0 ) {
// if user is passing an invalid mask, default to defaultValue
mask = defaultValue;
}
// temporarily replace TZD with lowercase tzd for replacing later
return mask.replace( new RegExp( "TZD", "i" ), "tzd" );
}
/**
* Formats a date into a certain date/time format
*
* @param date The date to format
* @param mask How the date should be formatted
*
* @return A formatted date
*/
public static function dateTimeFormat( date:Date, mask:String="MM/DD/YYYY L:NN:SS A" ):String {
return buildDateTime( date, mask, "(Y|M|D|E|A|J|H|K|L|N|S|TZD|\\W)+", DateUtils.SHORT_DATE_MASK + ' ' + DateUtils.SHORT_TIME_MASK );
}
/**
* Formats a time into a certain time format
*
* @param date The date to format
* @param mask How the date should be formatted
*
* @return A formatted time
*/
public static function timeFormat( date:Date, mask:String=DateUtils.SHORT_TIME_MASK ):String {
return buildDateTime( date, mask, "(A|:|J|H|K|L|N|S|TZD|\\s)+", DateUtils.SHORT_TIME_MASK );
}
/**
* Formats a date into a certain date format
*
* @param date The date to format
* @param mask How the date should be formatted
*
* @return A formatted date
*/
public static function dateFormat( date:Date, mask:String=DateUtils.SHORT_DATE_MASK ):String {
return buildDateTime( date, mask, "(Y|M|D|E|\\W)+", DateUtils.SHORT_DATE_MASK );
}
/**
* @private
*
* Formats a date into a certain date/time format
*
* @param date The date to format
* @param mask The string for matching
* @param pattern The valid characters for this mask
* @param defaultValue The default value to return to the calling page should the mask not match the pattern
*
* @return A formatted date
*/
private static function buildDateTime( date:Date, mask:String, pattern:String, defaultValue:String ):String {
dateFormatter.formatString = removeInvalidDateTimeCharacters( mask, pattern, defaultValue );
return dateFormatter.format( date ).replace( new RegExp( "TZD", "i" ), buildTimeZoneDesignation( date ) );
}
/**
* @private
*
* Calculates a timeZoneOffset, and converts it to a string, in standard GMT XX:XX format
*
* @param date The date on which to calculate the offset
*
* @return The formatted time zone designation
*/
private static function buildTimeZoneDesignation( date:Date ):String {
if ( !date ) {
return "";
}
var timeZoneAsString:String = "GMT ";
// timezoneoffset is the number that needs to be added to the local time to get to GMT, so
// a positive number would actually be GMT -X hours
if ( date.getTimezoneOffset() / 60 > 0 && date.getTimezoneOffset() / 60 < 10 ) {
timeZoneAsString += "-0" + ( date.getTimezoneOffset() / 60 ).toString();
} else if ( date.getTimezoneOffset() < 0 && date.timezoneOffset / 60 > -10 ) {
timeZoneAsString += "0" + ( -1 * date.getTimezoneOffset() / 60 ).toString();
}
// add zeros to match standard format
timeZoneAsString += "00";
return timeZoneAsString;
}
/**
* Adds the specified number of "date parts" to a date, e.g. 6 days
*
* @param datePart The part of the date that will be added
* @param number The total number of "dateParts" to add to the date
* @param date The date on which to add
*
* @return The new date
*/
public static function dateAdd( datePart:String, number:Number, date:Date ):Date {
var _returnDate:Date = new Date( date );
switch ( datePart ) {
case DateUtils.YEAR:
case DateUtils.MONTH:
case DateUtils.DAY_OF_MONTH:
case DateUtils.HOURS:
case DateUtils.MINUTES:
case DateUtils.SECONDS:
case DateUtils.MILLISECONDS:
_returnDate[ datePart ] += number;
break;
case DateUtils.WEEK:
_returnDate[ DateUtils.DAY_OF_MONTH ] += number * 7;
break;
default:
/* Unknown date part, do nothing. */
break;
}
return _returnDate;
}
/**
* Gets the day of the week
*
* @param date The date for which to get the day of the week
*
* @return A number representing the day of the week, 0 to 6
*/
public static function dayOfWeek( date:Date ):Number {
return date.getDay();
}
/**
* Gets the ordinal value or day of the year
*
* @param date The date for which to get the day of the year
*
* @return A number representing the day of the year, 1 to 365 or 366 for a leap year
*/
public static function dayOfYear( date:Date ):Number {
// add one as it has to include first of year
return DateUtils.dateDiff( DateUtils.DAY_OF_MONTH, new Date( date.fullYear, DateUtils.monthAsNumber( DateUtils.JANUARY ), 1 ), date ) + 1;
}
/**
* Gets the week of the year
*
* @param date The date for which to get the week of the year
*
* @return A number representing the week of the year, 1 to 53 ( as there are slightly more than 52 weeks of days in a year)
*/
public static function weekOfYear( date:Date ):Number {
return Math.ceil( DateUtils.dayOfYear( date ) / 7 );
}
/**
* Converts the day of the week to a Flex day of the week
*
* @param date The human readable day of week
*
* @return The Flex converted day of week or 0 aka Sunday
*/
public static function toFlexDayOfWeek( localDayOfWeek:Number ):Number {
return ( localDayOfWeek > 0 && localDayOfWeek < 8 ) ? localDayOfWeek - 1 : 0;
}
/**
* Gets the Xth day of the month.
* e.g. get the 3rd Wednesday of the month
*
* @param iteration The iteration of the month to get e.g. 4th or Last
* @param strDayOfWeek The day of the week as a string
* @param date The date containing the month and year
*
* @return The date of the xth dayOfWeek of the month
*/
public static function dayOfWeekIterationOfMonth( iteration:Number, strDayOfWeek:String, date:Date ):Date {
// get the numeric day of the week for the requested day
var _dayOfWeek:Number = dayOfWeekAsNumber( strDayOfWeek );
// get the date for the first of the month
var _firstOfMonth:Date = new Date( date.fullYear, date.month, 1 );
// calculate how many days to add to get to the requested day from the first of the month
var _daysToAdd:Number = _dayOfWeek - DateUtils.dayOfWeek( _firstOfMonth );
// if dayOfWeek is before the first of the month, get the dayOfWeek for the following week
if ( _daysToAdd < 0 ) {
_daysToAdd += 7;
}
// set the date to the first day of the week for the requested date
var _firstDayOfWeekOfMonth:Date = DateUtils.dateAdd( DateUtils.DAY_OF_MONTH, _daysToAdd, _firstOfMonth );
// return the date if iteration is 1
if ( iteration == 1 ) {
return _firstDayOfWeekOfMonth;
} else {
// if requesting an iteration that is more than is in that month or requesting the last day of week of month
// return last date for that day of week of month
if ( ( DateUtils.totalDayOfWeekInMonth( strDayOfWeek, date ) < iteration ) || ( iteration == DateUtils.LAST ) ) {
iteration = DateUtils.totalDayOfWeekInMonth( strDayOfWeek, date );
}
// subtract 1 as it starts from the first dayOfWeek of month
return DateUtils.dateAdd( DateUtils.WEEK, iteration - 1, _firstDayOfWeekOfMonth );
}
}
/**
* Gets the days in the month
*
* @param date The date to check
*
* @return The number of days in the month
*/
public static function daysInMonth( date:Date ):Number {
// get the first day of the next month
var _localDate:Date = new Date( date.fullYear, DateUtils.dateAdd( DateUtils.MONTH, 1, date ).month, 1 );
// subtract 1 day to get the last day of the requested month
return DateUtils.dateAdd( DateUtils.DAY_OF_MONTH, -1, _localDate ).date;
}
/**
* Gets the total number of dayOfWeek in the month
*
* @param strDayOfWeek The day of week to check
* @param date The date containing the month and year
*
* @return The number of <code>strDayOfWeek</code> in that month and year
*/
public static function totalDayOfWeekInMonth( strDayOfWeek:String, date:Date ):Number {
var _startDate:Date = DateUtils.dayOfWeekIterationOfMonth( 1, strDayOfWeek, date );
var _totalDays:Number = DateUtils.dateDiff( DateUtils.DAY_OF_MONTH, _startDate, new Date( date.fullYear, date.month, DateUtils.daysInMonth( date ) ) );
// have to add 1 because have to include first day that is found i.e. if wed is on 2nd of 31 day month, would total 5, of if wed on 6th, would total 4
return Math.floor( _totalDays / 7 ) + 1;
}
/**
* Converts the month to a Flex month
*
* @param date The human readable month
*
* @return The Flex converted month or 0 aka January
*/
public static function toFlexMonth( localMonth:Number ):Number {
return ( localMonth > 0 && localMonth < 13 ) ? localMonth - 1 : 0;
}
/**
* Determines whether a value is actually a valid date
*
* @param value The date value
*
* @return <code>true</code> means this is a valid date, <code>false</code> means it is not a valid date
*/
public static function isDate( value:String ):Boolean {
return Date.parse( value ) > 0;
}
/**
* Formats a date to the string version of the day of the week
*
* @param date The date to format
*
* @return A formatted day of week
*/
public static function dayOfWeekAsString( date:Date ):String {
return DateUtils.dateFormat( date, "EEEE" );
}
/**
* Formats a date to the numeric version of the day of the week
*
* @param strDayOfWeek The day of week to convert
*
* @return A formatted day of week or -1 if day not found
*/
public static function dayOfWeekAsNumber( strDayOfWeek:String ):Number {
return ( objDaysOfWeek[ strDayOfWeek ] >= 0 ) ? objDaysOfWeek[ strDayOfWeek ] : -1;
}
/**
* Formats a date to the string version of the month
*
* @param date The date to format
*
* @return A formatted month
*/
public static function monthAsString( date:Date ):String {
return DateUtils.dateFormat( date, "MMMM" );
}
/**
* Formats a month to the numeric version of the month
*
* @param strMonth The month to convert
*
* @return A formatted month or -1 if month not found
*/
public static function monthAsNumber( strMonth:String ):Number {
return ( objMonth[ strMonth ] >= 0 ) ? objMonth[ strMonth ] : -1;
}
/**
* Gets the number of days in the year
*
* @param date The date to check
*
* @return The total number of days in the year
*/
public static function daysInYear( date:Date ):Number {
return DateUtils.dateDiff(
DateUtils.DAY_OF_MONTH,
new Date( date.fullYear, DateUtils.monthAsNumber( DateUtils.JANUARY ), 1 ),
DateUtils.dateAdd( DateUtils.YEAR, 1, new Date( date.fullYear, DateUtils.monthAsNumber( DateUtils.JANUARY ), 1 ) ) );
}
/**
* Determines whether the year is a leap year or not
*
* @param date The date to check
*
* @return <code>true</code> means it is a leap year, <code>false</code> means it is not a leap year.
*/
public static function isLeapYear( date:Date ):Boolean {
return daysInYear( date ) > 365;
}
/**
* Determines the number of "dateParts" difference between 2 dates
*
* @param datePart The part of the date that will be checked
* @param startDate The starting date
* @param endDate The ending date
*
* @return The number of "dateParts" difference
*/
public static function dateDiff( datePart:String, startDate:Date, endDate:Date ):Number {
var _returnValue:Number = 0;
switch ( datePart ) {
case DateUtils.MILLISECONDS:
_returnValue = endDate.time - startDate.time;
break;
case DateUtils.SECONDS:
_returnValue = Math.floor( DateUtils.dateDiff( DateUtils.MILLISECONDS, startDate, endDate ) / DateUtils.SECOND_VALUE );
break;
case DateUtils.MINUTES:
_returnValue = Math.floor( DateUtils.dateDiff( DateUtils.MILLISECONDS, startDate, endDate ) / DateUtils.MINUTE_VALUE );
break;
case DateUtils.HOURS:
_returnValue = Math.floor( DateUtils.dateDiff( DateUtils.MILLISECONDS, startDate, endDate ) / DateUtils.HOUR_VALUE );
break;
case DateUtils.DAY_OF_MONTH:
// TODO: Need to figure out DST problem i.e. 23 hours at DST start, 25 at end.
// Math.floor causes rounding down error with DST start at dayOfYear
_returnValue = Math.floor( DateUtils.dateDiff( DateUtils.MILLISECONDS, startDate, endDate ) / DateUtils.DAY_VALUE );
break;
case DateUtils.WEEK:
_returnValue = Math.floor( DateUtils.dateDiff( DateUtils.MILLISECONDS, startDate, endDate ) / DateUtils.WEEK_VALUE );
break;
case DateUtils.MONTH:
// if start date is after end date, switch values and take inverse of return value
if ( DateUtils.dateDiff( DateUtils.MILLISECONDS, startDate, endDate ) < 0 ) {
_returnValue -= DateUtils.dateDiff( DateUtils.MONTH, endDate, startDate );
} else {
// get number of months based upon years
_returnValue = DateUtils.dateDiff( DateUtils.YEAR, startDate, endDate ) * 12;
// subtract months then perform test to verify whether to subtract one month or not
// the check below gets the correct starting number of months (but may need to have one month removed after check)
if ( endDate.month != startDate.month ) {
_returnValue += ( endDate.month <= startDate.month ) ? 12 - startDate.month + endDate.month : endDate.month - startDate.month;
}
// have to perform same checks as YEAR
// i.e. if end date day is <= start date day, and end date milliseconds < start date milliseconds
if ( ( endDate[ DateUtils.DAY_OF_MONTH ] < startDate[ DateUtils.DAY_OF_MONTH ] ) ||
( endDate[ DateUtils.DAY_OF_MONTH ] == startDate[ DateUtils.DAY_OF_MONTH ] &&
endDate[ DateUtils.MILLISECONDS ] < startDate[ DateUtils.MILLISECONDS ] ) ) {
_returnValue -= 1;
}
}
break;
case DateUtils.YEAR:
_returnValue = endDate.fullYear - startDate.fullYear;
// this fixes the previous problem with dates that ran into 2 calendar years
// previously, if 2 dates were in separate calendar years, but the months were not > 1 year apart, then it was returning too many years
// e.g. 11/2008 to 2/2009 was returning 1, but should have been returning 0 (zero)
// if start date before end date and months are less than 1 year apart, add 1 to year to fix offset issue
// if end date before start date and months are less than 1 year apart, subtract 1 year to fix offset issue
// added month and milliseconds check to make sure that a date that was e.g. 9/11/07 9:15AM would not return 1 year if the end date was 9/11/08 9:14AM
if ( _returnValue != 0 ) {
// if start date is after end date
if ( _returnValue < 0 ) {
// if end date month is >= start date month, and end date day is >= start date day, and end date milliseconds > start date milliseconds
if ( ( endDate[ DateUtils.MONTH ] > startDate[ DateUtils.MONTH ] ) ||
( endDate[ DateUtils.MONTH ] == startDate[ DateUtils.MONTH ] && endDate[ DateUtils.DAY_OF_MONTH ] > startDate[ DateUtils.DAY_OF_MONTH ] ) ||
( endDate[ DateUtils.MONTH ] == startDate[ DateUtils.MONTH ] && endDate[ DateUtils.DAY_OF_MONTH ] == startDate[ DateUtils.DAY_OF_MONTH ] &&
endDate[ DateUtils.MILLISECONDS ] > startDate[ DateUtils.MILLISECONDS ] ) ) {
_returnValue += 1;
}
} else {
// if end date month is <= start date month, and end date day is <= start date day, and end date milliseconds < start date milliseconds
if ( ( endDate[ DateUtils.MONTH ] < startDate[ DateUtils.MONTH ] ) ||
( endDate[ DateUtils.MONTH ] == startDate[ DateUtils.MONTH ] && endDate[ DateUtils.DAY_OF_MONTH ] < startDate[ DateUtils.DAY_OF_MONTH ] ) ||
( endDate[ DateUtils.MONTH ] == startDate[ DateUtils.MONTH ] && endDate[ DateUtils.DAY_OF_MONTH ] == startDate[ DateUtils.DAY_OF_MONTH ] &&
endDate[ DateUtils.MILLISECONDS ] < startDate[ DateUtils.MILLISECONDS ] ) ) {
_returnValue -= 1;
}
}
}
break;
}
return _returnValue;
}
}
}
- dateutils.rar (400.3 KB)
- 下载次数: 74
评论
帮你注明出处
发表评论
-
flex 中As3Commons的使用學習
2009-10-15 12:53 3766學習Java的人,知道java中反射的强大, ... -
flex的国家化的应用
2009-09-23 08:59 2105在项目中需要使用发送短信模板的功能的,根据主题不同,模板不同, ... -
flex的沙箱问题
2009-09-14 17:14 5472在flex与google的地图整合中发现,点击了goog ... -
Flex 常用技巧
2009-09-04 13:00 2608flex是一种异步请求的技术,如果要实现同步必须在传递函 ... -
Flex 開發Google地圖
2009-08-24 13:16 24751 .获取googe的key 2.下载google的fle ... -
查询之order by,group by和having的使用
2009-08-08 15:48 4757在项目中查询常驻酒店的中住的次数最多的前10个酒店: 代码如 ... -
objectProxy的监控对象应用
2009-08-08 13:46 2697在项目中查询根据一个字段发生实现需要特殊的功能,作出相应的动作 ... -
Flex 依赖注入
2009-08-08 13:41 2132了解依赖注入 众所周 ... -
Flex 与外部的数据通信(HTTPService,URLLoader和URLRequest)
2009-08-08 13:36 7464ActionScript 3.0中提供的数据加载请求类主要是H ... -
flex 数据绑定
2009-08-08 13:31 24259.2.1 函数和类级别的绑定 [Bindable]标签打使 ... -
Flex中Entity对象与Display对象之间的数据双向动态绑定
2009-08-08 13:27 2493flex项目中对象的和组 ... -
学习ActionScript 3.0的新特点
2009-08-06 13:05 2044ActionScript3.0 是一种类型 ... -
理解 Flex itemRenderer - 第 1 部分: 内联渲染器
2009-08-05 16:37 3160Flex 提供许多控制, 它们可以按不同方式显示大量数据。Li ... -
flex 中类似Google的提示下拉菜单实现
2009-08-01 16:28 5436项目中使用类似Gooogle输入提示菜单的实现如下 ... -
针对Flex中组件的扩展的应用开发
2009-08-01 16:04 2889在项目中使用一个自定义的CheckboxGroup组件继承自C ... -
Flex类似Google搜索提示的两种做法思路
2009-08-01 15:52 2699做了个简单的搜索提示 ... -
Flex中直接获取某个组件的对象
2009-08-01 15:47 2488Flex中直接获取某个组件的对象方案1: 遍历这些butto ... -
flex 查看类的各种数据的权限
2009-08-01 15:18 1889查看类的一些属性的信息:可读,可写,可读可写。 ... -
flex中getDefinitionByName 函数的使用
2009-08-01 12:40 6763在项目中自定义一个CheckboxGroup,这个控件里面 ... -
Flex 学习中数据类型必须注意的几点
2009-08-01 12:36 2305在字符串转换为int类型必须使用 最好如下: var a:i ...
相关推荐
内容概要:本文详细介绍了基于TMS320F系列芯片的C2000串口读写方案及其编程器——FlashPro2000的功能特点和支持的接口模式。文中不仅涵盖了硬件连接的具体步骤,还提供了代码实例来展示Flash擦除操作,并对比了JTAG和SCI-BOOT两种模式的优缺点。此外,针对不同型号的C2000系列芯片,给出了详细的适配指导以及避免烧录过程中可能出现的问题的方法。 适合人群:从事DSP开发的技术人员,尤其是对TI公司C2000系列芯片有一定了解并希望深入了解其编程和烧录细节的人群。 使用场景及目标:适用于实验室环境下的程序调试阶段,以及生产线上的批量烧录任务。主要目的是帮助开发者选择合适的编程工具和技术手段,提高工作效率,减少因误操作导致设备损坏的风险。 其他说明:文中提供的代码片段和命令行指令可以直接用于实际项目中,同时附带了一些实用技巧,如防止芯片变砖的小贴士和自动化重试脚本,有助于解决常见的烧录难题。
汉字字库存储芯片扩展实验 # 汉字字库存储芯片扩展实验 ## 实验目的 1. 了解汉字字库的存储原理和结构 2. 掌握存储芯片扩展技术 3. 学习如何通过硬件扩展实现大容量汉字字库存储 ## 实验原理 ### 汉字字库存储基础 - 汉字通常采用点阵方式存储(如16×16、24×24、32×32点阵) - 每个汉字需要占用32字节(16×16)到128字节(32×32)不等的存储空间 - 国标GB2312-80包含6763个汉字,需要较大存储容量 ### 存储芯片扩展方法 1. **位扩展**:增加数据总线宽度 2. **字扩展**:增加存储单元数量 3. **混合扩展**:同时进行位扩展和字扩展 ## 实验设备 - 单片机开发板(如STC89C52) - 存储芯片(如27C256、29C040等) - 逻辑门电路芯片(如74HC138、74HC373等) - 示波器、万用表等测试设备 - 连接线若干 ## 实验步骤 ### 1. 单芯片汉字存储实验 1. 连接27C256 EPROM芯片到单片机系统 2. 将16×16点阵汉字字库写入芯片 3. 编写程序读取并显示汉字 ### 2. 存储芯片字扩展实验 1. 使用地址译码器(如74HC138)扩展多片27C256 2. 将完整GB2312字库分布到各芯片中 3. 编写程序实现跨芯片汉字读取 ### 3. 存储芯片位扩展实验 1. 连接两片27C256实现16位数据总线扩展 2. 优化字库存储结构,提高读取速度 3. 测试并比较扩展前后的性能差异 ## 实验代码示例(单片机部分) ```c #include <reg52.h> #include <intrins.h> // 定义存储芯片控制引脚 sbit CE = P2^7; // 片选 sbit OE = P2^6; // 输出使能 sbit
测控装备干扰源快速侦测系统设计研究.pdf
嵌入式八股文面试题库资料知识宝典-【开发】嵌入式开源项目&库&资料.zip
嵌入式八股文面试题库资料知识宝典-百度2022年嵌入式面试题.zip
少儿编程scratch项目源代码文件案例素材-空间站.zip
基于关联规则的商业银行个性化产品推荐.pdf
嵌入式八股文面试题库资料知识宝典-Linux基础使用.zip
内容概要:本文详细介绍了利用MATLAB进行轴棱锥生成贝塞尔高斯光束及环形光束光强图像的仿真研究。首先阐述了实验的背景与目标,强调了MATLAB在光学和计算科学领域的广泛应用。接着,具体描述了实验的方法与步骤,包括材料准备、仿真过程中的参数设定和光束生成代码编写。最后,对实验结果进行了深入分析,展示了贝塞尔高斯光束和环形光束的光强分布特点,验证了其光学性能的预期表现。文章还对未来的研究方向和技术改进提出了展望。 适合人群:从事光学、物理学及相关领域研究的专业人士,特别是对光束生成和光学性能分析感兴趣的科研工作者。 使用场景及目标:适用于需要进行光束生成和性能分析的实验室环境,旨在帮助研究人员更好地理解和优化光束特性和传播行为。 其他说明:本文不仅提供了详细的实验方法和步骤,还附有丰富的实验结果和数据分析,为后续研究提供了宝贵的参考资料。
内容概要:本文探讨了三电平NPC型有源电力滤波器(APF)的模型预测控制(MPC)中存在的开关频率过高问题及其解决方案。传统MPC方法会导致极高的开关频率,增加了系统的能耗和热量。通过引入滞环控制模块,可以在不大幅牺牲性能的情况下有效降低开关频率。具体来说,滞环控制通过在价值函数计算后增加一个判断条件,对状态切换进行惩罚,从而减少不必要的开关动作。实验结果显示,开关频率从4392Hz降至3242Hz,降幅达26.2%,虽然电流总谐波畸变率(THD)略有上升,但仍符合国家标准。此外,文中还提出了动态调整滞环宽度的方法,以进一步优化不同负载条件下的表现。 适合人群:从事电力电子、电力系统控制领域的研究人员和技术人员,特别是关注APF和MPC技术的人群。 使用场景及目标:适用于需要优化APF系统开关频率的研究和工程项目,旨在提高系统效率并降低成本。目标是在不影响系统性能的前提下,显著降低开关频率,减少能量损失和热管理难度。 其他说明:文章不仅提供了理论分析,还包括具体的实现代码片段,有助于读者理解和实践。同时,强调了在实际应用中需要注意的问题,如中点电位漂移等。
内容概要:本文介绍了三维POD DMD程序在处理原网格数据方面的独特优势和技术细节。首先阐述了该程序能读取结构化和非结构化网格数据及其拓扑关系,在生成模态数据过程中保持原始网格形态而不需要进行网格插值操作。接着展示了简化版本的Python代码片段,揭示了读取网格数据和生成模态数据的核心逻辑。最后提到提供的辅助学习资料如代码、视频教程、Word教程和实例数据,帮助用户深入理解并掌握该程序的应用。 适合人群:从事计算流体力学领域的研究人员和技术爱好者,尤其是那些希望提高数据处理效率的人群。 使用场景及目标:适用于需要处理复杂网格数据的研究项目,旨在简化数据处理流程,提升工作效率,同时保持数据的原始特性。 其他说明:文中不仅提供了理论性的讲解,还有具体的代码示例和丰富的学习资源,使读者可以边学边练,快速上手。
融合双向路由注意力的多尺度X光违禁品检测.pdf
嵌入式八股文面试题库资料知识宝典-Linux_Shell基础使用.zip
嵌入式八股文面试题库资料知识宝典-联发科2021武汉嵌入式软件开发.zip
基于有限体积法Godunov格式的管道泄漏检测模型研究.pdf
嵌入式八股文面试题库资料知识宝典-ARM常见面试题目.zip
基于LWR问题的无证书全同态加密方案.pdf
嵌入式八股文面试题库资料知识宝典-符坤面试经验.zip
内容概要:本文详细探讨了三电平逆变器在带不平衡负载条件下的仿真研究。主要内容包括仿真环境的搭建、不同拓扑结构的选择(如T型、I型NPC和ANPC)、延时相消法(DSC)和双二阶广义积分器(DSOGI)的正负序分离控制策略、SVPWM或SPWM调制技术的应用、双闭环PI控制以及直流均压控制。文中通过具体的参数设置(交流电压220V,直流侧电压750V)进行了详细的仿真实验,并展示了各个控制策略的效果。最终,通过仿真实验验证了所提出方法的有效性,确保了交流侧三相电压波形的对称性和电流波形的自适应调节。 适合人群:从事电力电子、电机驱动、新能源发电等领域研究的技术人员和研究人员。 使用场景及目标:适用于需要理解和掌握三电平逆变器在复杂负载条件下控制策略的研究人员和技术人员。目标是提高对三电平逆变器及其控制策略的理解,优化实际应用中的性能。 其他说明:本文不仅提供了理论分析,还包含了具体的仿真步骤和代码实现,有助于读者更好地理解和应用相关技术。