yuanrui / blog Goto Github PK
View Code? Open in Web Editor NEWSome notes.
Home Page: http://yuanrui.github.io
Some notes.
Home Page: http://yuanrui.github.io
tfs2018支持创建git代码库,使用vs2017克隆,遇到一个奇怪的问题。
使用网上的一些教程,始终无法有效的克隆代码。tfs2018提供在命令行中配置ssh的方式克隆代码库,参考msdn教程,基本解决问题。
需要说明的是,如果ssh URL中存在中文会将中文进行编码处理。
安装msdn教程设置ssh key.
https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops
完成后使用git clone命令克隆代码,命令如下:
git clone ssh://url....
在Windows资源管理器中,显示的文件夹名称是编码后的中文,可以重命名为中文。
20190816更新:
在更新到最新版本的VS后,出现拉取代码失败的情况。
Warning: Pulling without specifying how to reconcile divergent branches is
Git failed with a fatal error.
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
正在从 origin 提取
提取时遇到错误: Git failed with a fatal error.
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
未能从远程存储库提取。请参见输出窗口了解更多详细信息。
Warning: Pulling without specifying how to reconcile divergent branches is
Git failed with a fatal error.
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
解决办法:
1、从Git官网下载32位便携版。
2、替换C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git,替换前注意备份。
3、重启VS和电脑。
20210323更新:
最近更新git后又出现了新的问题,clone提示秘钥交换算法不一致。
Unable to negotiate with fe80::8436:e651:6655:2e81%11 port 22: no matching key e
xchange method found. Their offer: diffie-hellman-group1-sha1,diffie-hellman-gro
up14-sha1
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
解决方法:
1、设置Git全局配置
git config --global user.name "yourname"
git config --global user.email "[email protected]"
2、在Git安装目录下找到ssh-keygen.exe,重新生成RSA秘钥对。
ssh-keygen.exe -t rsa -C "[email protected]"
3、在TFS的"SSH 公钥"处添加 C:\Users\当前登录用户.ssh\id_rsa.pub文件的内容。
4、编辑.ssh目录下的config文件,如果不存在则用记事本创建一个(注意该文件无后缀),添加如下内容
Host *
KexAlgorithms +diffie-hellman-group1-sha1
20240513更新:
安装git-2.45 64位版本后,出现这个问题
Unable to negotiate with 192.168.1.75 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
Git failed with a fatal error.
Git failed with a fatal error.
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
在config文件中添加如下配置:
Host 192.168.1.75
Port 22
IdentityFile C:\Users\YuanRui\.ssh\id_rsa.pub
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
Host *
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
由于本地没有安装nodejs,导致出现如下问题。
.git/hooks/pre-push: line 32: node: command not found
临时办法,在项目文件夹中删除 pre-push
将名称复制到注释中
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
' get the current active model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model "
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model. "
Else
ProcessFolder mdl
End If
' This routine copy name into comment for each table, each column and each view
' of the current folder
Private sub ProcessFolder(folder)
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
if trim(tab.comment)="" then'如果有表的注释,则不改变它.如果没有表注释.则把name添加到注释里面.
tab.comment = tab.name
end if
Dim col ' running column
for each col in tab.columns
if trim(col.comment)="" then '如果col的comment为空,则填入name,如果已有注释,则不添加;这样可以避免已有注释丢失.
col.comment= col.name
end if
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut and trim(view.comment)="" then
view.comment = view.name
end if
next
' go into the sub-packages
Dim f ' running folder
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
将注释复制到名称中
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
' get the current active model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model "
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model. "
Else
ProcessFolder mdl
End If
Private sub ProcessFolder(folder)
On Error Resume Next
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
tab.name = tab.comment
Dim col ' running column
for each col in tab.columns
if col.comment="" then
else
col.name= col.comment
end if
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
view.name = view.comment
end if
next
' go into the sub-packages
Dim f ' running folder
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
title: Oracle常用sql(第二部分)
date: 2016-08-19 15:50:00
tags:
- Oracle
Sql大部分从《Expert Oracle Database Architecture》一书拷贝而来,http://www.apress.com/9781430229469
create or replace procedure show_space
( p_segname in varchar2,
p_owner in varchar2 default user,
p_type in varchar2 default 'TABLE',
p_partition in varchar2 default NULL )
-- this procedure uses authid current user so it can query DBA_*
-- views using privileges from a ROLE and so it can be installed
-- once per database, instead of once per user that wanted to use it
authid current_user
as
l_free_blks number;
l_total_blocks number;
l_total_bytes number;
l_unused_blocks number;
l_unused_bytes number;
l_LastUsedExtFileId number;
l_LastUsedExtBlockId number;
l_LAST_USED_BLOCK number;
l_segment_space_mgmt varchar2(255);
l_unformatted_blocks number;
l_unformatted_bytes number;
l_fs1_blocks number; l_fs1_bytes number;
l_fs2_blocks number; l_fs2_bytes number;
l_fs3_blocks number; l_fs3_bytes number;
l_fs4_blocks number; l_fs4_bytes number;
l_full_blocks number; l_full_bytes number;
-- inline procedure to print out numbers nicely formatted
-- with a simple label
procedure p( p_label in varchar2, p_num in number )
is
begin
dbms_output.put_line( rpad(p_label,40,'.') ||
to_char(p_num,'999,999,999,999') );
end;
begin
-- this query is executed dynamically in order to allow this procedure
-- to be created by a user who has access to DBA_SEGMENTS/TABLESPACES
-- via a role as is customary.
-- NOTE: at runtime, the invoker MUST have access to these two
-- views!
-- this query determines if the object is a ASSM object or not
begin
execute immediate
'select ts.segment_space_management
from dba_segments seg, dba_tablespaces ts
where seg.segment_name = :p_segname
and (:p_partition is null or
seg.partition_name = :p_partition)
and seg.owner = :p_owner
and seg.segment_type = :p_type
and seg.tablespace_name = ts.tablespace_name'
into l_segment_space_mgmt
using p_segname, p_partition, p_partition, p_owner, p_type;
exception
when too_many_rows then
dbms_output.put_line
( 'This must be a partitioned table, use p_partition => ');
return;
end;
-- if the object is in an ASSM tablespace, we must use this API
-- call to get space information, else we use the FREE_BLOCKS
-- API for the user managed segments
if l_segment_space_mgmt = 'AUTO'
then
dbms_space.space_usage
( p_owner, p_segname, p_type, l_unformatted_blocks,
l_unformatted_bytes, l_fs1_blocks, l_fs1_bytes,
l_fs2_blocks, l_fs2_bytes, l_fs3_blocks, l_fs3_bytes,
l_fs4_blocks, l_fs4_bytes, l_full_blocks, l_full_bytes, p_partition);
p( 'Unformatted Blocks ', l_unformatted_blocks );
p( 'FS1 Blocks (0-25) ', l_fs1_blocks );
p( 'FS2 Blocks (25-50) ', l_fs2_blocks );
p( 'FS3 Blocks (50-75) ', l_fs3_blocks );
p( 'FS4 Blocks (75-100)', l_fs4_blocks );
p( 'Full Blocks ', l_full_blocks );
else
dbms_space.free_blocks(
segment_owner => p_owner,
segment_name => p_segname,
segment_type => p_type,
freelist_group_id => 0,
free_blks => l_free_blks);
p( 'Free Blocks', l_free_blks );
end if;
-- and then the unused space API call to get the rest of the
-- information
dbms_space.unused_space
( segment_owner => p_owner,
segment_name => p_segname,
segment_type => p_type,
partition_name => p_partition,
total_blocks => l_total_blocks,
total_bytes => l_total_bytes,
unused_blocks => l_unused_blocks,
unused_bytes => l_unused_bytes,
LAST_USED_EXTENT_FILE_ID => l_LastUsedExtFileId,
LAST_USED_EXTENT_BLOCK_ID => l_LastUsedExtBlockId,
LAST_USED_BLOCK => l_LAST_USED_BLOCK );
p( 'Total Blocks', l_total_blocks );
p( 'Total Bytes', l_total_bytes );
p( 'Total MBytes', trunc(l_total_bytes/1024/1024) );
p( 'Unused Blocks', l_unused_blocks );
p( 'Unused Bytes', l_unused_bytes );
p( 'Last Used Ext FileId', l_LastUsedExtFileId );
p( 'Last Used Ext BlockId', l_LastUsedExtBlockId );
p( 'Last Used Block', l_LAST_USED_BLOCK );
end;
使用方式
SQL> set serveroutput on;
SQL> exec show_space('table_name');
set echo on
drop table run_stats;
create global temporary table run_stats
( runid varchar2(15),
name varchar2(80),
value int )
on commit preserve rows;
grant select any table to ops$tkyte;
create or replace view stats
as select 'STAT...' || a.name name, b.value
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
union all
select 'LATCH.' || name, gets
from v$latch
union all
select 'STAT...Elapsed Time', hsecs from v$timer;
delete from run_stats;
commit;
create or replace package runstats_pkg
as
procedure rs_start;
procedure rs_middle;
procedure rs_stop( p_difference_threshold in number default 0 );
end;
/
create or replace package body runstats_pkg
as
g_start number;
g_run1 number;
g_run2 number;
procedure rs_start
is
begin
delete from run_stats;
insert into run_stats
select 'before', stats.* from stats;
g_start := dbms_utility.get_cpu_time;
end;
procedure rs_middle
is
begin
g_run1 := (dbms_utility.get_cpu_time-g_start);
insert into run_stats
select 'after 1', stats.* from stats;
g_start := dbms_utility.get_cpu_time;
end;
procedure rs_stop(p_difference_threshold in number default 0)
is
begin
g_run2 := (dbms_utility.get_cpu_time-g_start);
dbms_output.put_line
( 'Run1 ran in ' || g_run1 || ' cpu hsecs' );
dbms_output.put_line
( 'Run2 ran in ' || g_run2 || ' cpu hsecs' );
if ( g_run2 <> 0 )
then
dbms_output.put_line
( 'run 1 ran in ' || round(g_run1/g_run2*100,2) ||
'% of the time' );
end if;
dbms_output.put_line( chr(9) );
insert into run_stats
select 'after 2', stats.* from stats;
dbms_output.put_line
( rpad( 'Name', 30 ) || lpad( 'Run1', 12 ) ||
lpad( 'Run2', 12 ) || lpad( 'Diff', 12 ) );
for x in
( select rpad( a.name, 30 ) ||
to_char( b.value-a.value, '999,999,999' ) ||
to_char( c.value-b.value, '999,999,999' ) ||
to_char( ( (c.value-b.value)-(b.value-a.value)), '999,999,999' ) data
from run_stats a, run_stats b, run_stats c
where a.name = b.name
and b.name = c.name
and a.runid = 'before'
and b.runid = 'after 1'
and c.runid = 'after 2'
-- and (c.value-a.value) > 0
and abs( (c.value-b.value) - (b.value-a.value) )
> p_difference_threshold
order by abs( (c.value-b.value)-(b.value-a.value))
) loop
dbms_output.put_line( x.data );
end loop;
dbms_output.put_line( chr(9) );
dbms_output.put_line
( 'Run1 latches total versus runs -- difference and pct' );
dbms_output.put_line
( lpad( 'Run1', 12 ) || lpad( 'Run2', 12 ) ||
lpad( 'Diff', 12 ) || lpad( 'Pct', 10 ) );
for x in
( select to_char( run1, '999,999,999' ) ||
to_char( run2, '999,999,999' ) ||
to_char( diff, '999,999,999' ) ||
to_char( round( run1/decode( run2, 0, to_number(0), run2) *100,2 ), '99,999.99' ) || '%' data
from ( select sum(b.value-a.value) run1, sum(c.value-b.value) run2,
sum( (c.value-b.value)-(b.value-a.value)) diff
from run_stats a, run_stats b, run_stats c
where a.name = b.name
and b.name = c.name
and a.runid = 'before'
and b.runid = 'after 1'
and c.runid = 'after 2'
and a.name like 'LATCH%'
)
) loop
dbms_output.put_line( x.data );
end loop;
end;
end;
/
调用示例
/*
exec runStats_pkg.rs_start;
exec runStats_pkg.rs_middle;
exec runStats_pkg.rs_stop;
*/
set echo off
set verify off
column diff format a18
select a.name, b.value Value, to_char(b.value-&V,'999,999,999,999') diff
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
and lower(a.name) like '%' || lower('&S')||'%'
/
set echo on
最近在把玩.net core, 顺便学习下用VS Code开发。
记录下开发步骤
1、安装.net core sdk. 地址:https://www.microsoft.com/net/download/core
2、下载并安装VS Code, 地址:https://code.visualstudio.com/
3、验证dotnet
安装完.net core sdk后,在命令行中用dotnet -version进行验证
正常情况下会显示对应的版本号
4、创建dotnet项目
使用dotnet new -t Console命令创建控制台项目
创建完成后,对应目录会出现生成的Program.cs和project.json文件
同时执行dotnet restore命令
5、调试项目
备注:如果是第一使用VS Code调试代码,还需要下载OmniSharp和.NET Core Debugger,注意观看控制台中的提示和右下角的Downloading packages. 下载安装完成后才可进行后续调试。提示:下载过程中不要关闭VS Code.
使用Ctrl+Shift+D进行调试项目,会发现默认没有配置
选择.NET Core创建配置,创建完成后还需要对配置进行修改。eg."program": "${workspaceRoot}/bin/Debug/netcoreapp1.1/Test.dll",
修改完成相关配置后,可进行调试,出现经典的Hello World!
done!
项目中遇到一个很奇怪的问题,挂有70TB的磁盘阵列服务器(Windows 2008 R2)的内存使用率97%.
在任务管理器中查看程序运行情况,并没有出现占用很多内存的情况。
使用RamMap.exe查看后显示如下
Metafile占用很高的内存,主要原因是NTFS的文件元数据占用过多。
使用Empty System Working Set。清理内存后显著下降。
另外说一句,VMMap可以查看单个程序的内存使用情况,也能清理程序占用内存。
参考:
https://support.microsoft.com/zh-cn/help/976618/you-experience-performance-issues-in-applications-and-services-when-th
http://woshub.com/fixing-high-memory-usage-by-metafile-on-windows-server-2008-r2/
https://docs.microsoft.com/zh-cn/sysinternals/downloads/sysinternals-suite
https://download.sysinternals.com/files/SysinternalsSuite.zip
想装一些新的软件,发现C盘空间不够用了。记得以前在VS中开启TraceDebugging后,Debug调试文件用不了多久就会把C盘占满。本机没有装几个软件,这次估计也是VS缓存过大引起存储空间不够用。此文档记录下清理文件的过程。
清理nuget相关缓存
使用 dotnet nuget locals all --list 查询nuget包存储位置。
http-cache: C:\Users\YuanRui\AppData\Local\NuGet\v3-cache
global-packages: C:\Users\YuanRui\.nuget\packages
temp: C:\Users\YuanRui\AppData\Local\Temp\NuGetScratch
plugins-cache: C:\Users\YuanRui\AppData\Local\NuGet\plugins-cache
global-packages相对来说占用比较大,有17个G左右,将缓存文件复制到新的目录设置环境变量 NUGET_PACKAGES 指向该目录,然后删除global-packages对应目录。
删除nuget临时缓存
%userprofile%\AppData\Local\Temp\NuGet\TempCache
删除VS Code缓存
%userprofile%\AppData\Roaming\Code\Cache\Cache_Data
%userprofile%\AppData\Roaming\Code\CachedData
删除VS安装包缓存,慎用,可能会导致Visual Studio Installer异常。
%programdata%\Package Cache
TFS用于项目代码和工作过程的管理,长期运行一般需要执行定期备份,避免代码和工作项丢失。
长期以来我们项目组都处于裸奔状态,没有做备份设置。之前尝试配置备份,困扰于文件路径和账户权限问题一直没有成功。今天终于设置成功,在这里做一下简单的记录。
TFS的备份功能在Team Foundation Server管理控制界面。
点击“配置计划的备份”或“重新配置计划的备份”,弹出计划的备份向导界面。在向导界面,选择“浏览”按钮,然后选择共享文件夹。修改保留天数为14天(默认为30天),即两个周。点击“下一步”按钮。
报警设置采用默认设置,点击“下一步”按钮。
在“计划”选项卡界面,选择自定义计划,采用默认设置:星期日完整备份,工作日和周六差异备份。点击“下一步”按钮。
在评审界面,检查备份相关设置,点击“下一步”按钮。
进入就绪检查阶段,会检查备份的路径是否可用,以及TFS账户是否有权限执行备份文件的保存,检查通过后点击“下一步”按钮。
配置阶段没有设置操作,等待进度完成后,点击“下一步”按钮。
配置完成后,提示检查结果为成功,表示设置计划备份完成。
备份过程遇到的问题:
TF400986: 备份路径 \\192.168.1.62\00-TFS_Backup 不存在。请确保该路径存在并且你对其具有访问权限
TF401009: TFS 服务帐户 NT AUTHORITY\LOCAL SERVICE 无法访问网络共享。 请更改为可访问备份路径的帐户。
TF400997: SQL Server 服务正在作为 NT AUTHORITY\LocalService 运行。请将此帐户更改为可被授予对备份路径的权限的帐户。
解决过程:
Updated At: 2021/11/3
执行$PSVersionTable.PSVersion
https://github.com/PowerShell/PowerShell/releases
运行get-executionpolicy,提示Restricted
执行set-executionpolicy remotesigned,并在随后的策略提示中选择“Y”。
Error: 未能加载文件或程序集“System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad36
4e35”或它的某一个依赖项。强名称验证失败。 (异常来自 HRESULT:0x8013141A)
title: Oracle常用sql(第一部分)
date: 2016-07-20 11:44:13
tags:
- Oracle
SELECT
a.TABLESPACE_NAME,
a.BYTES / 1024 / 1024 "Sum MB",
(a.BYTES - b.BYTES) / 1024 / 1024 "Used MB",
b.BYTES / 1024 / 1024 "free MB",
ROUND(((a.BYTES - b.BYTES) / a.BYTES) * 100, 2)
AS "percent_used"
FROM (SELECT
TABLESPACE_NAME,
SUM(BYTES) bytes
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) a,
(SELECT
TABLESPACE_NAME,
SUM(BYTES) bytes,
MAX(BYTES) largest
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) b
WHERE a.TABLESPACE_NAME = b.TABLESPACE_NAME
ORDER BY ((a.BYTES - b.BYTES) / a.BYTES) DESC
相关计算公式:1-('physical reads cache'/('db block gets from cache' + 'consistent gets from cache'))
select name, value from v$sysstat
where name in ('db block gets from cache', 'consistent gets from cache', 'physical reads cache');
SELECT
PARSING_SCHEMA_NAME,
EXECUTIONS,
DISK_READS,
BUFFER_GETS,
ROUND((BUFFER_GETS - DISK_READS) / BUFFER_GETS, 2) Hit_radio,
ROUND(DISK_READS / EXECUTIONS, 2) Reads_per_run,
SQL_TEXT
FROM V$SQLAREA
WHERE EXECUTIONS > 0
AND BUFFER_GETS > 0
AND (BUFFER_GETS - DISK_READS) / BUFFER_GETS < 0.8
ORDER BY 4 DESC;
SELECT sql_id,child_number,sql_text, elapsed_time
FROM (SELECT sql_id, child_number, sql_text, elapsed_time, cpu_time,
disk_reads,
RANK () OVER (ORDER BY elapsed_time DESC) AS elapsed_rank
FROM v$sql)
WHERE elapsed_rank <= 10
SELECT wait_class, event, total_waits AS waits,
ROUND (time_waited_micro / 1000) AS total_ms,
ROUND (time_waited_micro * 100 / SUM (time_waited_micro) OVER (),
2
) AS pct_time,
ROUND ((time_waited_micro / total_waits) / 1000, 2) AS avg_ms
FROM v$system_event
WHERE wait_class <> 'Idle'
ORDER BY time_waited_micro DESC;
(最近一个小时左右), 可以将v$active_session_history替换为dba_hist_active_sess_history以显示更长时间范围内的等待对象。
WITH ash_query AS (
SELECT substr(event,6,2) lock_type,program,
h.module, h.action, object_name,
SUM(time_waited)/1000 time_ms, COUNT( * ) waits,
username, sql_text,
RANK() OVER (ORDER BY SUM(time_waited) DESC) AS time_rank,
ROUND(SUM(time_waited) * 100 / SUM(SUM(time_waited))
OVER (), 2) pct_of_time
FROM v$active_session_history h
JOIN dba_users u USING (user_id)
LEFT OUTER JOIN dba_objects o
ON (o.object_id = h.current_obj#)
LEFT OUTER JOIN v$sql s USING (sql_id)
WHERE event LIKE 'enq: %'
GROUP BY substr(event,6,2) ,program, h.module, h.action,
object_name, sql_text, username)
SELECT lock_type,module, username, object_name, time_ms,pct_of_time,
sql_text
FROM ash_query
WHERE time_rank < 11
ORDER BY time_rank;
SELECT object_name, VALUE row_lock_waits,
ROUND(VALUE * 100 / SUM(VALUE) OVER (), 2) pct
FROM v$segment_statistics
WHERE statistic_name = 'row lock waits' AND VALUE > 0
ORDER BY VALUE DESC;
WITH sessions AS
(SELECT /*+ materialize*/ username,sid,sql_id
FROM v$session),
locks AS
(SELECT /*+ materialize */ *
FROM v$lock)
SELECT l2.type,s1.username blocking_user, s1.sid blocking_sid,
s2.username blocked_user, s2.sid blocked_sid, sq.sql_text
FROM locks l1
JOIN locks l2 USING (id1, id2)
JOIN sessions s1 ON (s1.sid = l1.sid)
JOIN sessions s2 ON (s2.sid = l2.sid)
LEFT OUTER JOIN v$sql sq
ON (sq.sql_id = s2.sql_id)
WHERE l1.BLOCK = 1 AND l2.request > 0
查询消耗PGA内存最多的5个进程和当前正在执行的Sql
WITH pga AS
(SELECT sid,
ROUND(SUM(CASE name WHEN 'session pga memory'
THEN VALUE / 1048576 END),2) pga_memory_mb,
ROUND(SUM(CASE name WHEN 'session pga memory max'
THEN VALUE / 1048576 END),2) max_pga_memory_mb
FROM v$sesstat
JOIN v$statname USING (statistic#)
WHERE name IN ('session pga memory','session pga memory max' )
GROUP BY sid)
SELECT sid, username,s.module,
pga_memory_mb,
max_pga_memory_mb, substr(sql_text,1,70) sql_text
FROM v$session s
JOIN (SELECT sid, pga_memory_mb, max_pga_memory_mb,
RANK() OVER (ORDER BY pga_memory_mb DESC) pga_ranking
FROM pga)
USING (sid)
LEFT OUTER JOIN v$sql sql
ON (s.sql_id=sql.sql_id and s.sql_child_number=sql.child_number)
WHERE pga_ranking <=5
ORDER BY pga_ranking
Combined (PGA+SGA) memory advice report for 11g
WITH db_cache_times AS
(SELECT current_size current_cache_mb,
size_for_estimate target_cache_mb,
(estd_physical_read_time - current_time)
cache_secs_delta
FROM v$db_cache_advice,
(SELECT size_for_estimate current_size,
estd_physical_read_time current_time
FROM v$db_cache_advice
WHERE size_factor = 1
AND name = 'DEFAULT' AND block_size = 8192)
WHERE name = 'DEFAULT' AND block_size = 8192),
pga_times AS
(SELECT current_size / 1048576 current_pga_mb,
pga_target_for_estimate / 1048576 target_pga_mb,
estd_time-base_time pga_secs_delta
FROM v$pga_target_advice ,
(SELECT pga_target_for_estimate current_size,
estd_time base_time
FROM v$pga_target_advice
WHERE pga_target_factor = 1))
SELECT current_cache_mb||'MB->'||target_cache_mb||'MB' Buffer_cache,
current_pga_mb||'->'||target_pga_mb||'MB' PGA,
pga_secs_delta,cache_secs_delta,
(pga_secs_delta+cache_secs_delta) total_secs_delta
FROM db_cache_times d,pga_times p
WHERE (target_pga_mb+target_cache_mb)
<=(current_pga_mb+current_cache_mb)
AND (pga_secs_delta+cache_secs_delta) <0
ORDER BY (pga_secs_delta+cache_secs_delta);
执行结果
BUFFER_CACHE PGA PGA_SECS_DELTA CACHE_SECS_DELTA TOTAL_SECS_DELTA
1760MB->2288MB 1120->560MB 0 -2008 -2008
1760MB->2112MB 1120->560MB 0 -1612 -1612
1760MB->1936MB 1120->560MB 0 -901 -901
1760MB->1936MB 1120->840MB 0 -901 -901
结果分析:给高速缓存区增加528MB(2288MB-1760MB)内存可以节约2008秒的时间。减少PGA内存560MB(1120MB-560MB)未受到影响。
--alter system set workarea_size_policy=manual; --将pga内存管理设置为手动管理
--alter system set workarea_size_policy=auto; --将pga内存管理设置为自动管理
show parameter workarea_size_policy;
NAME TYPE VALUE
workarea_size_policy string AUTO
值为AUTO时表示自动管理,为MANUAL是表示手动管理
SELECT c.owner,
c.constraint_name,
c.table_name,
cc.column_name,
c.status
FROM dba_constraints c, dba_cons_columns cc
WHERE c.constraint_type = 'R'
AND c.owner NOT IN
('SYS',
'SYSTEM',
'SYSMAN',
'EXFSYS',
'WMSYS',
'OLAPSYS',
'OUTLN',
'DBSNMP',
'ORDSYS',
'ORDPLUGINS',
'MDSYS',
'CTXSYS',
'AURORA$ORB$UNAUTHENTICATED',
'XDB',
'FLOWS_030000',
'FLOWS_FILES')
AND c.owner = cc.owner
AND c.constraint_name = cc.constraint_name
AND NOT EXISTS
(SELECT 'x'
FROM dba_ind_columns ic
WHERE cc.owner = ic.table_owner
AND cc.table_name = ic.table_name
AND cc.column_name = ic.column_name
AND cc.position = ic.column_position
AND NOT EXISTS
(SELECT owner, index_name
FROM dba_indexes i
WHERE i.table_owner = c.owner
AND i.index_Name = ic.index_name
AND i.owner = ic.index_owner
AND (i.status = 'UNUSABLE'
OR i.partitioned = 'YES'
AND EXISTS
(SELECT 'x'
FROM dba_ind_partitions ip
WHERE status =
'UNUSABLE'
AND ip.
index_owner =
i.
owner
AND ip.
index_Name =
i.
index_name
UNION ALL
SELECT 'x'
FROM dba_ind_subpartitions isp
WHERE status =
'UNUSABLE'
AND isp.
index_owner =
i.
owner
AND isp.
index_Name =
i.
index_name))))
ORDER BY 1, 2
delete from TargetFrameworks
where PackageKey in (select Key from Packages where id = 'Your.Package.Name');
delete from PackageTypes
where PackageKey in (select Key from Packages where id = 'Your.Package.Name');
delete from PackageDependencies
where PackageKey in (select Key from Packages where id = 'Your.Package.Name');
delete from Packages
where id = 'Your.Package.Name';
从官网(https://jenkins.io), 下载一个稳定版本的软件包,并安装到本地。
安装完成后打开(http://localhost:8080)注意8080端口不能被其他网站端口所占用。
用记事本打开路径为C:\Program Files (x86)\Jenkins\secrets\initialAdminPassword 的文件,复制其中的密码粘贴到界面中的输入框中,并继续。
选择建议版本的插件,并继续。完成安装后,创建管理员账户。
完成创建账户后,出现“Jenkins已就绪!”字样
点击“开始使用jenkins”按钮,出现Jenkins主界面
打开“系统管理”中的“插件管理”
由于项目中使用的是TFS 2010另外还需要从这里(https://github.com/jenkinsci/tfs-plugin/releases/tag/tfs-4.1.0)下载一个 tfs-4.1.0的插件。
1、聊天记录备份。包括:QQ、微信、钉钉、飞秋。对聊天软件进行压缩打包备份(打包时在注释中记录聊天软件安装位置)。
2、C盘个人数据备份。检查“桌面”和“我的文档”。
3、浏览器备份。包括:收藏夹和历史记录,最好整个程序压缩打包。
最近开发一个Redis数据同步程序遇到一个奇怪的问题,在同步大量数据时,Redis中存储的数量和数据表中数量不一致。经过一些简单测试Redis Hash类型每秒大概存储1000条数据左右。一次性查询和提交上百万的数据,会造成内存暴涨和同步耗时过长等问题,因此存储大量数据时,需要对数据进行分批次同步处理。具体处理过程,查询待同步的总数据量,设定批次查询总数量,构造Sql进行分页查询,将查询结果序列化为Json后存储到Redis中。
在设计Redis同步程序时,考虑到程序的通用性和后续业务的扩展,需要同步的数据源主要通过配置的方式,来完成数据从Oracle中同步到Redis中。配置主要涉及到:查询字段、表名称、主键字段、修改时间字段等信息。“同步时应该优先同步变化的数据,然后再同步历史的数据,具体操作主要是在分页语句中对修改时间字段进行逆序查询。” 理想很美好,现实很骨感。测试提了一个bug, Db中数据有100w条左右数据,Redis中只有80w条。
也许你已经想到了,在同步的过程中,数据发生了变化。根据修改时间字段排序时,当时间发生变化时,分页条件查询的数据也会发生相应的变化,导致某些部分数据未同步。解决这个问题也很简单,分页查询根据主键字段进行排序,示例如下:
最终查询结果对比:
总结:在同步大量数据时,在需要做分页处理的情况下,尽可能的使用主键字段等数据变化少的字段,避免查询时有所遗漏。同时单页查询数据量需要特殊考虑,分页查询数量过多过少,对性能的也有所影响。
项目长期以来使用的Oracle数据库,在PowerDesigner中设计的物理数据模型时一般选用的Oracle 11版本。
后来为了降低成本、避免知识产权纠纷,数据库主要切换到开源、免费的版本,MySQL及其分支MariaDB成了项目开发的首选。通过操作:Database -> Change Current DBMS,可以将数据模型切换到MySQL.
数据库类型切换后,大部分常见的数据类型可以转换,某些类型无法转换,比如:numeric(9,0)、numeric(1,0)等。对于无法转换的类型,一般最简单方式是在记事本中进行文本替换。
Oracle类型 | 自动转换类型 | MySQL类型 | 备注 |
---|---|---|---|
INTEGER | int | bigint(20) | Oracle中INTEGER一般在编程中使用long来表示 |
NUMBER(9) | numeric(9,0) | int | |
NUMBER(1) | numeric(1,0) | tinyint(1) | 用于表示布尔类型 |
SYSDATE | CURRENT_TIMESTAMP | Oracle时间类型默认值为'SYSDATE',MySQL中为CURRENT_TIMESTAMP |
Oracle中的数据设计命名风格主要采用大写,而MySQL一般采用小写。幸好PowerDesigner提供名称和代码的转换,在Tools -> Model Options,转换大小写命名方式。
今天同事给我说Trace.WriteLine没有没有起作用,相关信息没有显示到Winform中。第一反应是感觉是不可能,多半是调用或者自定义的TraceListener有问题。
检查了下代码,断点调试确实没有进入重写的WriteLine方法中。觉得很奇怪,项目中Console和Winfrom项目都没有出现这个问题啊。
后面发现是项目属性的生成选项卡里面的设置有问题。生成选项卡中常规栏 定义TRACE常量未勾选上。
用反编译软件ILSpy,查看生成的程序集。当未勾选定义TRACE常量时,调用了Trace类的静态方法都未编译进入程序集中。将定义DEBUG产量的选项设置为未勾选时,调用了Debug相关的静态方法未编译进入程序集。
而以前一直记得,Release模式不会打包Debug静态方法,看来有误。主要的控制选项还是在于是否勾选定义DEBUG和TRACE常量。
其实Debug和Trace的静态方法上打有ConditionalAttribute,这个Attribute包含一个ConditionString,用于指定条件编译符号。Debug的静态方法设置的Attribute是[Conditional("DEBUG")],Trace的静态的静态方法设置的Attribute是[Conditional("TRACE")]. DEBUG和TRACE对应选项卡中默认常量。
Debug模式配置
Release模式配置
项目中有一个同步程序负责往某个文件夹中同步图片,另外一个播放图片的程序负责从文件夹中读取图片文件并播放。
遇到一个奇怪的问题是,同步的时候老是报文件被另外一个进程占用。排查发现图片播放程序调用Image.FromFile方法的时候会导致图片文件一直被占用。
解决的办法是将文件转换为字节数组,加载到内存中再转换为Image对象。
public static Image GetImageFromPath(string path)
{
var bytes = File.ReadAllBytes(path);
var ms = new MemoryStream(bytes);
var img = Image.FromStream(ms);
return img;
}
字典的序列化/反序列化不支持类型“System.Collections.Generic.Dictionary`2[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]”,键必须为字符串或对象。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ArgumentException: 字典的序列化/反序列化不支持类型“System.Collections.Generic.Dictionary`2[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]”,键必须为字符串或对象。
堆栈跟踪:
[ArgumentException: 字典的序列化/反序列化不支持类型“System.Collections.Generic.Dictionary`2[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]”,键必须为字符串或对象。]
System.Web.Script.Serialization.JavaScriptSerializer.SerializeDictionary(IDictionary o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat) +619
--
在asp.net mvc 4中内部使用的JavaScriptSerializer作为序列化器,不能序列化Key为值类型的字典。替代方案是使用Json.Net或将Key值类型修改为String.
title: 为Asp.Net Mvc项目的Js和Css添加版本号处理
date: 2016-08-10 18:22:00
tags:
在项目开发部署过程中,经常会修改样式和脚本文件。在部署时经常会因为浏览器缓存的原因造成加载的样式和执行的脚本还是以前的版本。
解决浏览器缓存最常用的办法是,在服务器端渲染生成资源链接时,加上一个版本号,用于刷新客户端缓存。这个版本号只在第一次请求时重新加载资源文件,在后续的请求中从浏览器缓存中获取文件。
版本号相对来说是固定的,不是随机生成的。随机生成的版本号会造成每次加载页面时都会去服务器端请求数据,这不是我们想要的效果。
生成版本号的方式有几种:
1、从配置文件中读取版本号
2、计算当前文件的hash值,用hash值作为版本号
3、使用程序集(DLL)发布时间作为版本号
第1种,发布部署时可以灵活控制,但是也容易忘记修改版本号,导致版本还是使用的以前的版本。也许可以通过自动发布的方式,自动修改版本号(没有尝试过)。
第2种,如果使用计算hash值的方式来处理,文件每次请求时都会去计算hash值。每次请求都计算hash有点消耗资源,改进办法是将路径和计算后的值放大缓存中,先判断hash值是否存在,不存在则计算并加入到缓存中。
第3种,可以将版本值的计算设计为静态类,并在静态类的静态构造方法中初始化静态变量,静态构造方法只需执行一次。每次发布替换DLL后,静态类会重新初始化。相比1、2种方式,灵活而不失简便。
public static class VersionUtils
{
public readonly static DateTime VersionDate;
public readonly static Int32 VersionNumber;
static VersionUtils()
{
VersionDate = System.IO.File.GetLastWriteTime(typeof(VersionUtils).Assembly.Location);
VersionNumber = Int32.Parse(VersionDate.ToString("yyyyMMddHHmm"));
}
}
public static class HtmlHelperExtension
{
public static MvcHtmlString Script(this HtmlHelper html, string contentPath)
{
return VersionedContent(html, "<script src=\"{0}\" type=\"text/javascript\"></script>", contentPath);
}
public static MvcHtmlString Style(this HtmlHelper html, string contentPath)
{
return VersionedContent(html, "<link href=\"{0}\" rel=\"stylesheet\" type=\"text/css\">", contentPath);
}
private static MvcHtmlString VersionedContent(this HtmlHelper html, string template, string contentPath)
{
contentPath = UrlHelper.GenerateContentUrl(contentPath, html.ViewContext.HttpContext) + "?v=" + VersionUtils.VersionNumber;
return MvcHtmlString.Create(string.Format(template, contentPath));
}
}
public static class UrlHelperExtension
{
public static string ContentVersioned(this UrlHelper urlHelper, string contentPath)
{
return String.Format("{0}?v={1}", urlHelper.Content(contentPath), VersionUtils.VersionNumber);
}
}
<link href="@Url.ContentVersioned("~/Content/Site.css")" rel="stylesheet" type="text/css" />
@Html.Style("~/Content/bootstrap.css");
@Html.Script("~/Scripts/angular.js");
文件描述 | HEX | 文件扩展名 | 文件分类 |
---|---|---|---|
JPEG2000 image files | 00 00 00 0C 6A 50 20 20 | JP2 | Picture |
3GPP multimedia files | 00 00 00 14 66 74 79 70 | 3GP | Multimedia |
MPEG-4 v1 | 00 00 00 14 66 74 79 70 69 73 6F 6D | MP4 | Multimedia |
3rd Generation Partnership Project 3GPP | 00 00 00 14 66 74 79 70 | 3GG|3GP|3G2 | Multimedia |
Windows Disk Image | 00 00 00 00 14 00 00 00 | TBI | Windows |
MPEG-4 video_1 | 00 00 00 18 66 74 79 70 | 3GP5|M4V|MP4 | Multimedia |
MPEG-4 video_2 | 00 00 00 1C 66 74 79 70 | MP4 | Multimedia |
3GPP2 multimedia files | 00 00 00 20 66 74 79 70 | 3GP | Multimedia |
Apple audio and video | 00 00 00 20 66 74 79 70 4D 34 41 | M4A | Multimedia |
3rd Generation Partnership Project 3GPP2 | 00 00 00 20 66 74 79 70 | 3GG|3GP|3G2 | Multimedia |
Windows icon|printer spool file | 00 00 01 00 | ICO|SPL | Windows |
MPEG video file | 00 00 01 B3 | MPG | Multimedia |
DVD video file | 00 00 01 BA | MPG|VOB | Multimedia |
Windows cursor | 00 00 02 00 | CUR | Windows |
Compucon-Singer embroidery design file | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | XXX | Miscellaneous |
QuattroPro spreadsheet | 00 00 02 00 | WB2 | Spreadsheet |
Lotus 1-2-3 (v1) | 00 00 02 00 06 04 06 00 | WK1 | Spreadsheet |
Lotus 1-2-3 (v3) | 00 00 1A 00 00 10 04 00 | WK3 | Spreadsheet |
Lotus 1-2-3 (v4|v5) | 00 00 1A 00 02 10 04 00 | WK4|WK5 | Spreadsheet |
Lotus 1-2-3 (v9) | 00 00 1A 00 05 10 04 | 123 | Spreadsheet |
Quark Express (Intel) | 00 00 49 49 58 50 52 | QXD | Presentation |
Quark Express (Motorola) | 00 00 4D 4D 58 50 52 | QXD | Presentation |
TrueType font file | 00 01 00 00 00 | TTF | Windows |
Microsoft Money file | 00 01 00 00 4D 53 49 53 41 4D 20 44 61 74 61 62 61 73 65 | MNY | Finance |
Microsoft Access 2007 | 00 01 00 00 53 74 61 6E 64 61 72 64 20 41 43 45 20 44 42 | ACCDB | Database |
Microsoft Access | 00 01 00 00 53 74 61 6E 64 61 72 64 20 4A 65 74 20 44 42 | MDB | Database |
Palm Address Book Archive | 00 01 42 41 | ABA | Mobile |
Palm DateBook Archive | 00 01 42 44 | DBA | Mobile |
Netscape Navigator (v4) database | 00 06 15 61 00 00 00 02 00 00 04 D2 00 00 10 00 | DB | Network |
Mbox table of contents file | 00 0D BB A0 | (none) | |
FLIC animation | 00 11 | FLI | Miscellaneous |
BIOS details in RAM | 00 14 00 00 01 02 | (none) | Windows |
Netscape Communicator (v4) mail folder | 00 1E 84 90 00 00 00 00 | SNM | |
Firebird and Interbase database files | 01 00 39 30 | FDB|GDB | Database |
The Bat! Message Base Index | 01 01 47 19 A4 00 00 00 00 00 00 00 | TBI | |
SQL Data Base | 01 0F 00 00 | MDF | Database |
Novell LANalyzer capture file | 01 10 | TR1 | Network |
Silicon Graphics RGB Bitmap | 01 DA 01 01 00 03 | RGB | Picture |
Micrografx vector graphic file | 01 FF 02 04 03 02 | DRW | Picture |
Digital Speech Standard file | 02 64 73 73 | DSS | Multimedia |
MapInfo Native Data Format | 03 | DAT | Navigation |
dBASE III file | 03 | DB3 | Database |
Quicken price history | 03 00 00 00 | QPH | Finance |
Approach index file | 03 00 00 00 41 50 50 52 | ADX | Database |
dBASE IV file | 04 | DB4 | Database |
INFO2 Windows recycle bin_1 | 04 00 00 00 | (none) | Windows |
INFO2 Windows recycle bin_2 | 05 00 00 00 | (none) | Windows |
Generic drawing programs | 07 | DRW | Presentation |
SkinCrafter skin | 07 53 4B 46 | SKF | Miscellaneous |
DesignTools 2D Design file | 07 64 74 32 64 64 74 64 | DTD | Miscellaneous |
dBASE IV or dBFast configuration file | 08 | DB | Database |
ZSOFT Paintbrush file_1 | 0A 02 01 01 | PCX | Presentation |
ZSOFT Paintbrush file_2 | 0A 03 01 01 | PCX | Presentation |
ZSOFT Paintbrush file_3 | 0A 05 01 01 | PCX | Presentation |
MultiBit Bitcoin wallet file | 0A 16 6F 72 67 2E 62 69 74 63 6F 69 6E 2E 70 72 | WALLET | e-money |
Monochrome Picture TIFF bitmap | 0C ED | MP | Picture |
DeskMate Document | 0D 44 4F 43 | DOC | Word processing suite |
Nero CD compilation | 0E 4E 65 72 6F 49 53 4F | NRI | Miscellaneous |
DeskMate Worksheet | 0E 57 4B 53 | WKS | Word processing suite |
Easy CD Creator 5 Layout file | 10 00 00 00 | CL5 | Utility |
Windows prefetch file | 11 00 00 00 53 43 43 41 | PF | Windows |
Lotus Notes database template | 1A 00 00 | NTF | Spreadsheet |
Lotus Notes database | 1A 00 00 04 00 00 | NSF | Spreadsheet |
LH archive (old vers.|type 1) | 1A 02 | ARC | Compressed archive |
LH archive (old vers.|type 2) | 1A 03 | ARC | Compressed archive |
LH archive (old vers.|type 3) | 1A 04 | ARC | Compressed archive |
LH archive (old vers.|type 4) | 1A 08 | ARC | Compressed archive |
LH archive (old vers.|type 5) | 1A 09 | ARC | Compressed archive |
Compressed archive file | 1A 0B | PAK | Compressed archive |
WinPharoah capture file | 1A 35 01 00 | ETH | Network |
WebM video file | 1A 45 DF A3 | WEBM | Multimedia |
Matroska stream file | 1A 45 DF A3 93 42 82 88 | MKV | Multimedia |
Runtime Software disk image | 1A 52 54 53 20 43 4F 4D | DAT | Miscellaneous |
WordStar Version 5.0|6.0 document | 1D 7D | WS | Word processing suite |
GZIP archive file | 1F 8B 08 | GZ | Compressed archive |
VLC Player Skin file | 1F 8B 08 | VLT | Miscellaneous |
Compressed tape archive_1 | 1F 9D 90 | TAR.Z | Compressed archive |
Compressed tape archive_2 | 1F A0 | TAR.Z | Compressed archive |
MapInfo Sea Chart | 21 | BSB | Navigation |
AIN Compressed Archive | 21 12 | AIN | Compressed archive |
Unix archiver (ar)|MS Program Library Common Object File Format (COFF) | 21 3C 61 72 63 68 3E 0A | LIB | Compressed archive |
Microsoft Outlook Exchange Offline Storage Folder | 21 42 44 4E | OST | |
Cerius2 file | 23 20 | MSI | Miscellaneous |
VMware 4 Virtual Disk description | 23 20 44 69 73 6B 20 44 | VMDK | Miscellaneous |
MS Developer Studio project file | 23 20 4D 69 63 72 6F 73 | DSP | Programming |
Adaptive Multi-Rate ACELP Codec (GSM) | 23 21 41 4D 52 | AMR | Multimedia |
Skype audio compression | 23 21 53 49 4C 4B 0A | SIL | Multimedia |
Radiance High Dynamic Range image file | 23 3F 52 41 44 49 41 4E | HDR | Picture |
Brother-Babylock-Bernina Home Embroidery | 23 50 45 43 30 30 30 31 | PEC | Miscellaneous |
Brother-Babylock-Bernina Home Embroidery | 23 50 45 53 30 | PES | Miscellaneous |
SPSS Data file | 24 46 4C 32 40 28 23 29 | SAV | Miscellaneous |
Encapsulated PostScript file | 25 21 50 53 2D 41 64 6F | EPS | Word processing suite |
PDF file | 25 50 44 46 | PDF|FDF | Word processing suite |
Fuzzy bitmap (FBM) file | 25 62 69 74 6D 61 70 | FBM | Picture |
BinHex 4 Compressed Archive | 28 54 68 69 73 20 66 69 | HQX | Compressed archive |
Symantec Wise Installer log | 2A 2A 2A 20 20 49 6E 73 | LOG | Miscellaneous |
RealPlayer video file (V11+) | 2E 52 45 43 | IVR | Multimedia |
RealMedia streaming media | 2E 52 4D 46 | RM|RMVB | Multimedia |
RealAudio file | 2E 52 4D 46 00 00 00 12 | RA | Multimedia |
RealAudio streaming media | 2E 72 61 FD 00 | RA | Multimedia |
NeXT|Sun Microsystems audio file | 2E 73 6E 64 | AU | Multimedia |
Thunderbird|Mozilla Mail Summary File | 2F 2F 20 3C 21 2D 2D 20 3C 6D 64 62 3A 6D 6F 72 6B 3A 7A | MSF | |
MS security catalog file | 30 | CAT | Windows |
Windows Event Viewer file | 30 00 00 00 4C 66 4C 65 | EVT | Windows |
Windows Media Audio|Video File | 30 26 B2 75 8E 66 CF 11 | ASF|WMA|WMV | Multimedia |
National Transfer Format Map | 30 31 4F 52 44 4E 41 4E | NTF | Miscellaneous |
cpio archive | 30 37 30 37 30 | (none) | Compressed archive |
MS Write file_1 | 31 BE | WRI | Word processing suite |
MS Write file_2 | 32 BE | WRI | Word processing suite |
Pfaff Home Embroidery | 32 03 10 00 00 00 00 00 00 00 80 00 00 00 FF 00 | PCS | Miscellaneous |
Tcpdump capture file | 34 CD B2 A1 | (none) | Network |
7-Zip compressed file | 37 7A BC AF 27 1C | 7Z | Compressed archive |
zisofs compressed file | 37 E4 53 96 C9 DB D6 07 | (none) | Compressed archive |
Photoshop image | 38 42 50 53 | PSD | Picture |
Surfplan kite project file | 3A 56 45 52 53 49 4F 4E | SLE | Miscellaneous |
Advanced Stream Redirector | 3C | ASX | Multimedia |
BizTalk XML-Data Reduced Schema | 3C | XDR | Miscellaneous |
AOL HTML mail | 3C 21 64 6F 63 74 79 70 | DCI | |
Windows Visual Stylesheet | 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D | MANIFEST | Programming |
User Interface Language | 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31 2E 30 22 3F 3E | XML | Miscellaneous |
MMC Snap-in Control file | 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31 2E 30 22 3F 3E 0D 0A 3C 4D 4D 43 5F 43 6F 6E 73 6F 6C 65 46 69 6C 65 20 43 6F 6E 73 6F 6C 65 56 65 72 73 69 6F 6E 3D 22 | MSC | Windows |
Csound music | 3C 43 73 6F 75 6E 64 53 79 6E 74 68 65 73 69 7A | CSD | Multimedia |
Adobe FrameMaker | 3C 4D 61 6B 65 72 46 69 | FM|MIF | Presentation |
GPS Exchange (v1.1) | 3C 67 70 78 20 76 65 72 73 69 6F 6E 3D 22 31 2E | GPX | Navigation |
BASE85 file | 3C 7E 36 3C 5C 25 5F 30 67 53 71 68 3B | B85 | Word processing |
Windows Help file_2 | 3F 5F 03 00 | GID|HLP | Windows |
Generic AutoCAD drawing | 41 43 31 30 | DWG | Presentation |
Steganos virtual secure drive | 41 43 76 | SLE | Miscellaneous |
AOL parameter|info files | 41 43 53 44 | (none) | Network |
Harvard Graphics symbol graphic | 41 4D 59 4F | SYW | Presentation |
AOL config files | 41 4F 4C | ABI|ABY|BAG|IDX|IND|PFC | Network |
AOL and AIM buddy list | 41 4F 4C 20 46 65 65 64 | BAG | Network |
AOL address book | 41 4F 4C 44 42 | ABY | Network |
AOL user configuration | 41 4F 4C 44 42 | IDX | Network |
AOL client preferences|settings file | 41 4F 4C 49 44 58 | IND | Network |
AOL address book index | 41 4F 4C 49 4E 44 45 58 | ABI | Network |
AOL personal file cabinet | 41 4F 4C 56 4D 31 30 30 | ORG|PFC | Network |
AVG6 Integrity database | 41 56 47 36 5F 49 6E 74 | DAT | Database |
FreeArc compressed file | 41 72 43 01 | ARC | Compressed archive |
NTFS MFT (BAAD) | 42 41 41 44 | (none) | Windows |
vCard | 42 45 47 49 4E 3A 56 43 | VCF | Miscellaneous |
Speedtouch router firmware | 42 4C 49 32 32 33 | BIN|BLI|RBI | Network |
Bitmap image | 42 4D | BMP|DIB | Picture |
Palmpilot resource file | 42 4F 4F 4B 4D 4F 42 49 | PRC | Mobile |
Better Portable Graphics | 42 50 47 FB | BPG | Multimedia |
bzip2 compressed archive | 42 5A 68 | BZ2|TAR.BZ2|TBZ2|TB2 | Compressed archive |
Puffer ASCII encrypted archive | 42 65 67 69 6E 20 50 75 66 66 65 72 | APUF | Encryption |
Blink compressed archive | 42 6C 69 6E 6B | BLI | Compressed archive |
RagTime document | 43 23 2B 44 A4 43 4D A5 | RTD | Word processing suite |
WordPerfect dictionary | 43 42 46 49 4C 45 | CBD | Word processing suite |
ISO-9660 CD Disc Image | 43 44 30 30 31 | ISO | Miscellaneous |
Compressed ISO CD image | 43 49 53 4F | CSO | Miscellaneous |
Windows 7 thumbnail | 43 4D 4D 4D 15 00 00 00 | DB | Windows |
Corel Binary metafile | 43 4D 58 31 | CLB | Miscellaneous |
COM+ Catalog | 43 4F 4D 2B | CLB | Miscellaneous |
VMware 3 Virtual Disk | 43 4F 57 44 | VMDK | Miscellaneous |
Corel Photopaint file_1 | 43 50 54 37 46 49 4C 45 | CPT | Presentation |
Corel Photopaint file_2 | 43 50 54 46 49 4C 45 | CPT | Presentation |
Win9x registry hive | 43 52 45 47 | DAT | Windows |
Crush compressed archive | 43 52 55 53 48 20 76 | CRU | Compressed archive |
Shockwave Flash file | 43 57 53 | SWF | Multimedia |
Calculux Indoor lighting project file | 43 61 6C 63 75 6C 75 78 20 49 6E 64 6F 6F 72 20 | CIN | Application |
WhereIsIt Catalog | 43 61 74 61 6C 6F 67 20 | CTF | Miscellaneous |
IE History file | 43 6C 69 65 6E 74 20 55 | DAT | Network |
Creative Voice | 43 72 65 61 74 69 76 65 20 56 6F 69 63 65 20 46 | VOC | Multimedia |
DAX Compressed CD image | 44 41 58 00 | DAX | Miscellaneous |
Palm Zire photo database | 44 42 46 48 | DB | Mobile |
Amiga DiskMasher compressed archive | 44 4D 53 21 | DMS | Compressed archive |
Amiga disk file | 44 4F 53 | ADF | Miscellaneous |
DVR-Studio stream file | 44 56 44 | DVR | Multimedia |
DVD info file | 44 56 44 | IFO | Multimedia |
Elite Plus Commander game file | 45 4C 49 54 45 20 43 6F | CDR | Miscellaneous |
VideoVCD|VCDImager file | 45 4E 54 52 59 56 43 44 | VCD | Miscellaneous |
EasyRecovery Saved State file | 45 52 46 53 53 41 56 45 | DAT | Miscellaneous |
DST Compression | 44 53 54 62 | DST | Compressed archive |
MS Document Imaging file | 45 50 | MDI | Word processing suite |
Expert Witness Compression Format | 45 56 46 09 0D 0A FF 00 | E01 | Miscellaneous |
EnCase Evidence File Format V2 | 45 56 46 32 0D 0A 81 | Ex01 | Miscellaneous |
Windows Vista event log | 45 6C 66 46 69 6C 65 00 | EVTX | Windows |
QuickBooks backup | 45 86 00 00 06 00 | QBB | Finance |
MS Fax Cover Sheet | 46 41 58 43 4F 56 45 52 | CPE | Miscellaneous |
Fiasco database definition file | 46 44 42 48 00 | FDB | Database |
NTFS MFT (FILE) | 46 49 4C 45 | (none) | Windows |
Flash video file | 46 4C 56 | FLV | Multimedia |
Audio Interchange File | 46 4F 52 4D 00 | AIFF | Multimedia |
DAKX Compressed Audio | 46 4F 52 4D 00 | DAX | Multimedia |
Shockwave Flash player | 46 57 53 | SWF | Multimedia |
Generic e-mail_2 | 46 72 6F 6D | EML | |
GIF file | 47 49 46 38 | GIF | Picture |
GIMP pattern file | 47 50 41 54 | PAT | Picture |
Show Partner graphics file | 47 58 32 | GX2 | Picture |
Genetec video archive | 47 65 6E 65 74 65 63 20 4F 6D 6E 69 63 61 73 74 | G64 | Multimedia |
SAS Transport dataset | 48 45 41 44 45 52 20 52 45 43 4F 52 44 2A 2A 2A | XPT | Statistics |
Harvard Graphics presentation file | 48 48 47 42 31 | SH3 | Presentation |
TIFF file_1 | 49 20 49 | TIF|TIFF | Picture |
MP3 audio file | 49 44 33 | MP3 | Multimedia |
Sprint Music Store audio | 49 44 33 03 00 00 00 | KOZ | Multimedia |
Canon RAW file | 49 49 1A 00 00 00 48 45 | CRW | Picture |
TIFF file_2 | 49 49 2A 00 | TIF|TIFF | Picture |
Windows 7 thumbnail_2 | 49 4D 4D 4D 15 00 00 00 | DB | Windows |
Install Shield compressed file | 49 53 63 28 | CAB|HDR | Compressed archive |
MS Reader eBook | 49 54 4F 4C 49 54 4C 53 | LIT | Miscellaneous |
MS Compiled HTML Help File | 49 54 53 46 | CHI|CHM | Windows |
Inno Setup Uninstall Log | 49 6E 6E 6F 20 53 65 74 | DAT | Miscellaneous |
Inter@ctive Pager Backup (BlackBerry file | 49 6E 74 65 72 40 63 74 69 76 65 20 50 61 67 65 | IPD | Mobile |
JARCS compressed archive | 4A 41 52 43 53 00 | JAR | Compressed archive |
AOL ART file_1 | 4A 47 03 0E | JG | Picture |
AOL ART file_2 | 4A 47 04 0E | JG | Picture |
VMware 4 Virtual Disk | 4B 44 4D | VMDK | Miscellaneous |
KGB archive | 4B 47 42 5F 61 72 63 68 | KGB | Compressed archive |
Win9x printer spool file | 4B 49 00 00 | SHD | Windows |
KWAJ (compressed) file | 4B 57 41 4A 88 F0 27 D1 | (none) | Compressed archive |
Windows shortcut file | 4C 00 00 00 01 14 02 00 | LNK | Windows |
MS COFF relocatable object code | 4C 01 | OBJ | Windows |
Tajima emboridery | 4C 41 3A | DST | Miscellaneous |
Windows help file_3 | 4C 4E 02 00 | GID|HLP | Windows |
Logical File Evidence Format | 4C 56 46 09 0D 0A FF 00 | E01 | Miscellaneous |
Merriam-Webster Pocket Dictionary | 4D 2D 57 20 50 6F 63 6B | PDB | Miscellaneous |
Mozilla archive | 4D 41 52 31 00 | MAR | Network |
Microsoft|MSN MARC archive | 4D 41 52 43 | MAR | Compressed archive |
MAr compressed archive | 4D 41 72 30 00 | MAR | Compressed archive |
TargetExpress target file | 4D 43 57 20 54 65 63 68 6E 6F 67 6F 6C 69 65 73 | MTE | Miscellaneous |
Windows dump file | 4D 44 4D 50 93 A7 | DMP|HDMP | Windows |
Milestones project management file | 4D 49 4C 45 53 | MLS | Miscellaneous |
Skype localization data file | 4D 4C 53 57 | MLS | Network |
TIFF file_3 | 4D 4D 00 2A | TIF|TIFF | Picture |
TIFF file_4 | 4D 4D 00 2B | TIF|TIFF | Picture |
Yamaha Synthetic music Mobile Application Format | 4D 4D 4D 44 00 00 | MMF | Multimedia |
VMware BIOS state file | 4D 52 56 4E | NVRAM | Miscellaneous |
Microsoft cabinet file | 4D 53 43 46 | CAB | Windows |
Powerpoint Packaged Presentation | 4D 53 43 46 | PPZ | Presentation |
MS Access Snapshot Viewer file | 4D 53 43 46 | SNP | Database |
OLE|SPSS|Visual C++ library file | 4D 53 46 54 02 00 01 00 | TLB | Programming |
Microsoft Windows Imaging Format | 4D 53 57 49 4D | WIM | Picture |
Sony Compressed Voice File | 4D 53 5F 56 4F 49 43 45 | CDR|DVF|MSV | Multimedia |
MIDI sound file | 4D 54 68 64 | MID|MIDI | Multimedia |
Yamaha Piano | 4D 54 68 64 | PCS | Multimedia |
CD Stomper Pro label file | 4D 56 | DSN | Miscellaneous |
Milestones project management file_1 | 4D 56 32 31 34 | MLS | Miscellaneous |
Milestones project management file_2 | 4D 56 32 43 | MLS | Miscellaneous |
Windows|DOS executable file | 4D 5A | COM|DLL|DRV|EXE|PIF|QTS|QTX|SYS | Windows |
MS audio compression manager driver | 4D 5A | ACM | Multimedia |
Library cache file | 4D 5A | AX | Windows |
Control panel application | 4D 5A | CPL | Windows |
Font file | 4D 5A | FON | Windows |
ActiveX|OLE Custom Control | 4D 5A | OCX | Windows |
OLE object library | 4D 5A | OLB | Windows |
Screen saver | 4D 5A | SCR | Windows |
VisualBASIC application | 4D 5A | VBX | Programming |
Windows virtual device drivers | 4D 5A | VXD|386 | Windows |
Acrobat plug-in | 4D 5A 90 00 03 00 00 00 | API | Word processing suite |
DirectShow filter | 4D 5A 90 00 03 00 00 00 | AX | Miscellaneous |
Audition graphic filter | 4D 5A 90 00 03 00 00 00 | FLT | Miscellaneous |
ZoneAlam data file | 4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF | ZAP | Miscellaneous |
MS C++ debugging symbols file | 4D 69 63 72 6F 73 6F 66 74 20 43 2F 43 2B 2B 20 | PDB | Programming |
Visual Studio .NET file | 4D 69 63 72 6F 73 6F 66 74 20 56 69 73 75 61 6C | SLN | Programming |
VMapSource GPS Waypoint Database | 4D 73 52 63 66 | GDB | Navigation |
TomTom traffic data | 4E 41 56 54 52 41 46 46 | DAT | Navigation |
MS Windows journal | 4E 42 2A 00 | JNT|JTP | Windows |
NES Sound file | 4E 45 53 4D 1A 01 | NSF | Multimedia |
National Imagery Transmission Format file | 4E 49 54 46 30 | NTF | Picture |
Agent newsreader character map | 4E 61 6D 65 3A 20 | COD | Miscellaneous |
1Password 4 Cloud Keychain | 4F 50 43 4C 44 41 54 | attachment | Encryption |
Psion Series 3 Database | 4F 50 4C 44 61 74 61 62 | DBF | Database |
Ogg Vorbis Codec compressed file | 4F 67 67 53 00 02 00 00 | OGA|OGG|OGV|OGX | Multimedia |
Visio|DisplayWrite 4 text file | 4F 7B | DW4 | Presentation |
Quicken QuickFinder Information File | 50 00 00 00 20 00 00 00 | IDX | Finance |
Portable Graymap Graphic | 50 35 0A | PGM | Picture |
Quake archive file | 50 41 43 4B | PAK | Compressed archive |
Windows memory dump | 50 41 47 45 44 55 | DMP | Windows |
PAX password protected bitmap | 50 41 58 | PAX | Picture |
PestPatrol data|scan strings | 50 45 53 54 | DAT | Miscellaneous |
PGP disk image | 50 47 50 64 4D 41 49 4E | PGD | Compressed archive |
ChromaGraph Graphics Card Bitmap | 50 49 43 54 00 08 | IMG | Picture |
PKZIP archive_1 | 50 4B 03 04 | ZIP | Compressed archive |
MacOS X Dashboard Widget | 50 4B 03 04 | ZIP | MacOS |
MS Office Open XML Format Document | 50 4B 03 04 | DOCX|PPTX|XLSX | Word processing suite |
Java archive_1 | 50 4B 03 04 | JAR | Programming |
Google Earth session file | 50 4B 03 04 | KMZ | Navigation |
KWord document | 50 4B 03 04 | KWD | Word processing suite |
OpenDocument template | 50 4B 03 04 | ODT|ODP|OTT | Word processing suite |
OpenOffice documents | 50 4B 03 04 | SXC|SXD|SXI|SXW | Word processing suite |
StarOffice spreadsheet | 50 4B 03 04 | SXC | Spreadsheet |
Windows Media compressed skin file | 50 4B 03 04 | WMZ | Windows |
Mozilla Browser Archive | 50 4B 03 04 | XPI | Network |
XML paper specification file | 50 4B 03 04 | XPS | Word processing suite |
eXact Packager Models | 50 4B 03 04 | XPT | Miscellaneous |
Open Publication Structure eBook | 50 4B 03 04 0A 00 02 00 | EPUB | Compressed archive |
ZLock Pro encrypted ZIP | 50 4B 03 04 14 00 01 00 | ZIP | Compressed archive |
MS Office 2007 documents | 50 4B 03 04 14 00 06 00 | DOCX|PPTX|XLSX | Word processing suite |
Java archive_2 | 50 4B 03 04 14 00 08 00 | JAR | Programming |
PKZIP archive_2 | 50 4B 05 06 | ZIP | Compressed archive |
PKZIP archive_3 | 50 4B 07 08 | ZIP | Compressed archive |
Windows Program Manager group file | 50 4D 43 43 | GRP | Windows |
Norton Disk Doctor undo file | 50 4E 43 49 55 4E 44 4F | DAT | Miscellaneous |
Microsoft Windows User State Migration Tool | 50 4D 4F 43 43 4D 4F 43 | PMOCCMOC | Windows |
Puffer encrypted archive | 50 55 46 58 | PUF | Encryption |
Qcow Disk Image | 51 46 49 | QEMU | Miscellaneous |
Quicken data file | 51 57 20 56 65 72 2E 20 | ABD|QSD | Finance |
Shareaza (P2P) thumbnail | 52 41 5A 41 54 44 42 31 | DAT | Network |
WinNT Registry|Registry Undo files | 52 45 47 45 44 49 54 | REG|SUD | Windows |
Antenna data file | 52 45 56 4E 55 4D 3A 2C | AD | Miscellaneous |
Windows animated cursor | 52 49 46 46 | ANI | Windows |
Corel Presentation Exchange metadata | 52 49 46 46 | CMX | Presentation |
CorelDraw document | 52 49 46 46 | CDR | Presentation |
Video CD MPEG movie | 52 49 46 46 | DAT | Multimedia |
Micrografx Designer graphic | 52 49 46 46 | DS4 | Picture |
4X Movie video | 52 49 46 46 | 4XM | Multimedia |
Resource Interchange File Format | 52 49 46 46 | AVI|CDA|QCP|RMI|WAV|WEBP | Multimedia |
WinNT Netmon capture file | 52 54 53 53 | CAP | Network |
WinRAR compressed archive | 52 61 72 21 1A 07 00 | RAR | Compressed archive |
Generic e-mail_1 | 52 65 74 75 72 6E 2D 50 | EML | |
Underground Audio | 53 43 48 6C | AST | Multimedia |
Img Software Bitmap | 53 43 4D 49 | IMG | Picture |
SMPTE DPX (big endian) | 53 44 50 58 | SDPX | Picture |
Harvard Graphics presentation | 53 48 4F 57 | SHW | Presentation |
Sietronics CPI XRD document | 53 49 45 54 52 4F 4E 49 | CPI | Miscellaneous |
Flexible Image Transport System (FITS) file | 53 49 4D 50 4C 45 20 20 3D 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54 | FITS | multimedia |
StuffIt archive | 53 49 54 21 00 | SIT | Compressed archive |
SmartDraw Drawing file | 53 4D 41 52 54 44 52 57 | SDR | Presentation |
StorageCraft ShadownProtect backup file | 53 50 46 49 00 | SPF | Backup |
MultiBit Bitcoin blockchain file | 53 50 56 42 | SPVB | e-money |
SQLite database file | 53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00 | DB | Database |
DB2 conversion file | 53 51 4C 4F 43 4F 4E 56 | CNV | Database |
QBASIC SZDD file | 53 5A 20 88 F0 27 33 D1 | (none) | Compressed archive |
SZDD file format | 53 5A 44 44 88 F0 27 33 | (none) | Compressed archive |
StuffIt compressed archive | 53 74 75 66 66 49 74 20 | SIT | Compressed archive |
SuperCalc worksheet | 53 75 70 65 72 43 61 6C | CAL | Spreadsheet |
Wii-GameCube | 54 48 50 00 | THP | Multimedia |
GNU Info Reader file | 54 68 69 73 20 69 73 20 | INFO | Programming |
Unicode extensions | 55 43 45 58 | UCE | Windows |
UFA compressed archive | 55 46 41 C6 D2 C1 | UFA | Compressed archive |
UFO Capture map file | 55 46 4F 4F 72 62 69 74 | DAT | Miscellaneous |
Visual C PreCompiled header | 56 43 50 43 48 30 | PCH | Programming |
Visual Basic User-defined Control file | 56 45 52 53 49 4F 4E 20 | CTL | Programming |
MapInfo Interchange Format file | 56 65 72 73 69 6F 6E 20 | MIF | Miscellaneous |
Walkman MP3 file | 57 4D 4D 50 | DAT | Multimedia |
WordStar for Windows file | 57 53 32 30 30 30 | WS2 | Word processing suite |
Lotus WordPro file | 57 6F 72 64 50 72 6F | LWP | Word processing suite |
Exchange e-mail | 58 2D | EML | |
Packet sniffer files | 58 43 50 00 | CAP | Network |
XPCOM libraries | 58 50 43 4F 4D 0A 54 79 | XPT | Programming |
SMPTE DPX file (little endian) | 58 50 44 53 | DPX | Picture |
MS Publisher | 58 54 | BDR | Word processing suite |
ZOO compressed archive | 5A 4F 4F 20 | ZOO | Compressed archive |
Macromedia Shockwave Flash | 5A 57 53 | SWF | Multimedia |
MS Exchange configuration file | 5B 47 65 6E 65 72 61 6C | ECF | |
Visual C++ Workbench Info File | 5B 4D 53 56 43 | VCW | Programming |
Dial-up networking file | 5B 50 68 6F 6E 65 5D | DUN | Network |
Lotus AMI Pro document_1 | 5B 56 45 52 5D | SAM | Word processing suite |
VocalTec VoIP media file | 5B 56 4D 44 5D | VMD | Multimedia |
Microsoft Code Page Translation file | 5B 57 69 6E 64 6F 77 73 | CPX | Windows |
Flight Simulator Aircraft Configuration | 5B 66 6C 74 73 69 6D 2E | CFG | Games |
WinAmp Playlist | 5B 70 6C 61 79 6C 69 73 74 5D | PLS | Audio |
Lotus AMI Pro document_2 | 5B 76 65 72 5D | SAM | Word processing suite |
Husqvarna Designer | 5D FC C8 00 | HUS | Miscellaneous |
Jar archive | 5F 27 A8 89 | JAR | Miscellaneous |
EnCase case file | 5F 43 41 53 45 5F | CAS|CBK | Miscellaneous |
Compressed archive file | 60 EA | ARJ | Compressed archive |
UUencoded file | 62 65 67 69 6E | (none) | Compressed archive |
UUencoded BASE64 file | 62 65 67 69 6E 2D 62 61 73 65 36 34 | b64 | Compressed archive |
Binary property list (plist) | 62 70 6C 69 73 74 | (none) | System |
Apple Core Audio File | 63 61 66 66 | CAF | Multimedia |
Virtual PC HD image | 63 6F 6E 65 63 74 69 78 | VHD | Miscellaneous |
Photoshop Custom Shape | 63 75 73 68 00 00 00 02 | CSH | Miscellaneous |
Intel PROset|Wireless Profile | 64 00 00 00 | P10 | Network |
Dalvik (Android) executable file | 64 65 78 0A | dex | Mobile |
Audacity audio file | 64 6E 73 2E | AU | Multimedia |
MS Visual Studio workspace file | 64 73 77 66 69 6C 65 | DSW | Programming |
WinNT printer spool file | 66 49 00 00 | SHD | Windows |
Free Lossless Audio Codec file | 66 4C 61 43 00 00 00 22 | FLAC | Multimedia |
Win2000|XP printer spool file | 67 49 00 00 | SHD | Windows |
GIMP file | 67 69 6d 70 20 78 63 66 | XCF | Picture |
Win Server 2003 printer spool file | 68 49 00 00 | SHD | Windows |
Skype user data file | 6C 33 33 6C | DBB | Network |
MultiBit Bitcoin wallet information | 6D 75 6C 74 69 42 69 74 2E 69 6E 66 6F | INFO | E-money |
SMS text (SIM) | 6F 3C | (none) | Mobile |
1Password 4 Cloud Keychain encrypted data | 6F 70 64 61 74 61 30 31 | (none) | Encryption |
WinNT registry file | 72 65 67 66 | DAT | Windows |
Sonic Foundry Acid Music File | 72 69 66 66 | AC | Multimedia |
RealMedia metafile | 72 74 73 70 3A 2F 2F | RAM | Multimedia |
Allegro Generic Packfile (compressed) | 73 6C 68 21 | DAT | Miscellaneous |
Allegro Generic Packfile (uncompressed) | 73 6C 68 2E | DAT | Miscellaneous |
PalmOS SuperMemo | 73 6D 5F | PDB | Mobile |
CALS raster bitmap | 73 72 63 64 6F 63 69 64 | CAL | Picture |
PowerBASIC Debugger Symbols | 73 7A 65 7A | PDB | Programming |
OpenEXR bitmap image | 76 2F 31 01 | EXR | Picture |
Qimage filter | 76 32 30 30 33 2E 31 30 | FLT | Miscellaneous |
MacOS X image file | 78 01 73 0D 62 62 60 | DMG | MacOS |
eXtensible ARchive file | 78 61 72 21 | XAR | Compressed archive |
ZoomBrowser Image Index | 7A 62 65 78 | INFO | Miscellaneous |
Windows application log | 7B 0D 0A 6F 20 | LGC|LGD | Windows |
MS WinMobile personal note | 7B 5C 70 77 69 | PWI | Mobile |
Rich Text Format | 7B 5C 72 74 66 31 | RTF | Word processing suite |
Huskygram Poem or Singer embroidery | 7C 4B C3 74 E1 C8 53 A4 79 B9 01 1D FC 4F DD 13 | CSD | Miscellaneous |
Corel Paint Shop Pro image | 7E 42 4B 00 | PSP | Presentation |
Digital Watchdog DW-TP-500G audio | 7E 74 2C 01 50 70 02 4D 52 | IMG | Audio |
ELF executable | 7F 45 4C 46 | (none) | Linux/Unix |
Relocatable object code | 80 | OBJ | Windows |
Dreamcast audio | 80 00 00 20 03 12 04 | ADX | Multimedia |
Kodak Cineon image | 80 2A 5F D7 | CIN | Picture |
Outlook Express address book (Win95) | 81 32 84 C1 85 05 D0 11 | WAB | |
WordPerfect text | 81 CD AB | WPF | Word processing suite |
PNG image | 89 50 4E 47 0D 0A 1A 0A | PNG | Picture |
MS Answer Wizard | 8A 01 09 00 00 00 E1 08 | AW | Windows |
Hamarsoft compressed archive | 91 33 48 46 | HAP | Compressed archive |
PGP secret keyring_1 | 95 00 | SKR | Miscellaneous |
PGP secret keyring_2 | 95 01 | SKR | Miscellaneous |
JBOG2 image file | 97 4A 42 32 0D 0A 1A 0A | JB2 | Picture |
GPG public keyring | 99 | GPG | Miscellaneous |
PGP public keyring | 99 01 | PKR | Miscellaneous |
Outlook address file | 9C CB CB 8D 13 75 D2 11 | WAB | |
tcpdump (libpcap) capture file | A1 B2 C3 D4 | (none) | Network |
Extended tcpdump (libpcap) capture file | A1 B2 CD 34 | (none) | Network |
Access Data FTK evidence | A9 0D 00 00 00 00 00 00 | DAT | Miscellaneous |
Quicken data | AC 9E BD 8F 00 00 | QDF | Finance |
Java serialization data | AC ED | (none) | Programming |
BGBlitz position database file | AC ED 00 05 73 72 00 12 | PDB | Miscellaneous |
Win95 password file | B0 4D 46 43 | PWL | Windows |
PCX bitmap | B1 68 DE 3A | DCX | Presentation |
Acronis True Image | B4 6E 68 44 | TIB | Miscellaneous |
Windows calendar | B5 A2 B0 B3 B3 B0 A5 B5 | CAL | Windows |
MS Write file_3 | BE 00 00 00 AB | WRI | Word processing suite |
Palm Desktop DateBook | BE BA FE CA 0F 50 61 6C 6D 53 47 20 44 61 74 61 | DAT | Mobile |
MS Agent Character file | C3 AB CD AB | ACS | Windows |
Adobe encapsulated PostScript | C5 D0 D3 C6 | EPS | Word processing suite |
Jeppesen FliteLog file | C8 00 79 00 | LBK | Miscellaneous |
Java bytecode | CA FE BA BE | CLASS | Programming |
NAV quarantined virus file | CD 20 AA AA 02 00 00 00 | (none) | Miscellaneous |
Java Cryptography Extension keystore | CE CE CE CE | JCEKS | Encryption |
OS X ABI Mach-O binary (32-bit reverse) | CE FA ED FE | (none) | Programming |
Perfect Office document | CF 11 E0 A1 B1 1A E1 00 | DOC | Word processing suite |
Outlook Express e-mail folder | CF AD 12 FE | DBX | |
OS X ABI Mach-O binary (64-bit reverse) | CF FA ED FE | (none) | Programming |
Microsoft Office document | D0 CF 11 E0 A1 B1 1A E1 | DOC|DOT|PPS|PPT|XLA|XLS|WIZ | Word processing suite |
CaseWare Working Papers | D0 CF 11 E0 A1 B1 1A E1 | AC_ | Miscellaneous |
Access project file | D0 CF 11 E0 A1 B1 1A E1 | ADP | Database |
Lotus|IBM Approach 97 file | D0 CF 11 E0 A1 B1 1A E1 | APR | Database |
MSWorks database file | D0 CF 11 E0 A1 B1 1A E1 | DB | Database |
Microsoft Common Console Document | D0 CF 11 E0 A1 B1 1A E1 | MSC | Windows |
Microsoft Installer package | D0 CF 11 E0 A1 B1 1A E1 | MSI | Windows |
Minitab data file | D0 CF 11 E0 A1 B1 1A E1 | MTW | Miscellaneous |
Developer Studio File Options file | D0 CF 11 E0 A1 B1 1A E1 | OPT | Programming |
MS Publisher file | D0 CF 11 E0 A1 B1 1A E1 | PUB | Word processing suite |
Revit Project file | D0 CF 11 E0 A1 B1 1A E1 | RVT | Miscellaneous |
Visual Studio Solution User Options file | D0 CF 11 E0 A1 B1 1A E1 | SOU | Programming |
SPSS output file | D0 CF 11 E0 A1 B1 1A E1 | SPO | Miscellaneous |
Visio file | D0 CF 11 E0 A1 B1 1A E1 | VSD | Miscellaneous |
MSWorks text document | D0 CF 11 E0 A1 B1 1A E1 | WPS | Word processing suite |
WinPharoah filter file | D2 0A 00 00 | FTR | Network |
AOL history|typed URL files | D4 2A | ARL|AUT | Network |
WinDump (winpcap) capture file | D4 C3 B2 A1 | (none) | Network |
Windows graphics metafile | D7 CD C6 9A | WMF | Windows |
Word 2.0 file | DB A5 2D 00 | DOC | Word processing |
Corel color palette | DC DC | CPL | Presentation |
eFax file | DC FE | EFX | Miscellaneous |
Amiga icon | E3 10 00 01 00 00 00 00 | INFO | Miscellaneous |
Win98 password file | E3 82 85 96 | PWL | Windows |
MS OneNote note | E4 52 5C 7B 8C D8 A7 4D | ONE | Miscellaneous |
Windows executable file_1 | E8 | COM|SYS | Windows |
Windows executable file_2 | E9 | COM|SYS | Windows |
Windows executable file_3 | EB | COM|SYS | Windows |
GEM Raster file | EB 3C 90 2A | IMG | Picture |
BitLocker boot sector (Vista) | EB 52 90 2D 46 56 45 2D | (none) | Windows |
BitLocker boot sector (Win7) | EB 58 90 2D 46 56 45 2D | (none) | Windows |
RedHat Package Manager | ED AB EE DB | RPM | Compressed archive |
UTF8 file | EF BB BF | (none) | Windows |
FAT12 File Allocation Table | F0 FF FF | (none) | Windows |
FAT16 File Allocation Table | F8 FF FF FF | (none) | Windows |
FAT32 File Allocation Table_1 | F8 FF FF 0F FF FF FF 0F | (none) | Windows |
FAT32 File Allocation Table_2 | F8 FF FF 0F FF FF FF FF | (none) | Windows |
Bitcoin-Qt blockchain block file | F9 BE B4 D9 | DAT | E-money |
XZ archive | FD 37 7A 58 5A 00 | XZ | Compressed archive |
OS X ABI Mach-O binary (32-bit) | FE ED FA CE | (none) | Programming |
OS X ABI Mach-O binary (64-bit) | FE ED FA CF | (none) | Programming |
JavaKeyStore | FE ED FE ED | (none) | Programming |
Symantex Ghost image file | FE EF | GHO|GHS | Compressed archive |
UTF-16|UCS-2 file | FE FF | (NONE) | Windows |
Windows executable | FF | SYS | Windows |
Works for Windows spreadsheet | FF 00 02 00 04 04 05 54 | WKS | Spreadsheet |
QuickReport Report | FF 0A 00 | QRP | Financial |
Windows international code page | FF 46 4F 4E 54 | CPI | Windows |
Keyboard driver file | FF 4B 45 59 42 20 20 20 | SYS | Windows |
WordPerfect text and graphics | FF 57 50 43 | WP|WPD|WPG|WPP|WP5|WP6 | Word processing suite |
JPEG|EXIF|SPIFF images | FF D8 FF | JFIF|JPE|JPEG|JPG | Pictures |
MPEG-4 AAC audio | FF F1 | AAC | Audio |
MPEG-2 AAC audio | FF F9 | AAC | Audio |
Windows Registry file | FF FE | REG | Windows |
UTF-32|UCS-2 file | FF FE | (NONE) | Windows |
UTF-32|UCS-4 file | FF FE 00 00 | (NONE) | Windows |
MSinfo file | FF FE 23 00 6C 00 69 00 | MOF | Windows |
DOS system driver | FF FF FF FF | SYS | Windows |
数据来源及参考链接:
https://www.garykessler.net/library/file_sigs.html
https://en.wikipedia.org/wiki/List_of_file_signatures
http://mark0.net/soft-trid-deflist-p.html
调试提示:Cause: zip END header not found
解决过程:
从Gradle官网下载最新版本,解压文件到C盘。
使用Help中的Find Action,搜索:gradle,选择设置
在Use Gradle from:选择Specified location后输入gradle路径。
查询用户(ADMIN)当前的默认表空间。
SELECT USERNAME, DEFAULT_TABLESPACE FROM DBA_USERS WHERE USERNAME = 'ADMIN';
SQL> SELECT USERNAME, DEFAULT_TABLESPACE FROM DBA_USERS WHERE USERNAME = 'ADMIN';
USERNAME
DEFAULT_TABLESPACE
--------------------------------------------------------------------------------
------------------------------------------------ ------------------------------
ADMIN
XXX_DB
对查询到的表空间(XXX_DB)不做配额限制
ALTER USER ADMIN QUOTA UNLIMITED ON XXX_DB;
Git克隆所有TFS远程分支到本地,在git bash执行以下命令。
先将代码克隆到本地
git clone ssh://tfs-server75:22/tfs/XXXProject/_git/WorkCode
使用cd命令切换到"WorkCode"目录,然后执行以下命令
git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
查看本地分支情况
git branch
查看远程分支情况
git branch -r
切换分支
git checkout xxxx_branch
参考链接:https://stackoverflow.com/questions/10312521/how-do-i-fetch-all-git-branches
在使用PL/SQL Developer查询数据表时,表中字段类型为timestamp的列,显示的内容类似于“15-5月 -18 10.40.00.380000 上午”,调用to_char函数显示的结果为:“2018-05-18 15:20:00.110000”。对于DBA来说,后一种显示内容更友好些。
对带有timestamp列的表进行查询,如果说每次都转换为char来显示,那么这个操作效率有点低下。可不可以设置参数来控制格式显示呢,答案是可以的。
方式一:
执行:alter session set nls_timestamp_format='yyyy-mm-dd hh24:mi:ss.ff6';
方式二:
在Windows操作系统的系统环境变量中添加变量名:nls_timestamp_format,变量值:yyyy-mm-dd hh24:mi:ss.ff6 然后重启PL/SQL Developer.
重新执行查询,timestamp列中内容显示为“2018-05-18 15:20:00.110000”这样的格式。
需要说明的是ff6表示6位毫秒,一般情况下毫秒位数是3位。所以终极版本格式为:yyyy-mm-dd hh24:mi:ss.ff3
另外由于windows对于大小写是不敏感的 ,所以nls_timestamp_format也可以用大写的变量名NLS_TIMESTAMP_FORMAT
同时执行方式一和方式二时,方式一中session有优先级高于环境变量。举个例子,环境变量中设置格式为:yyyy-mm-dd hh24:mi:ss.ff3,但在程序中执行alter session set nls_timestamp_format='yyyy-mm-dd hh24:mi:ss.ff5'; 那么最终显示的内容是带有5位毫秒的时间”2018-05-18 15:20:00.11000“。
一段简单的代码,新建一个Bitmap对象,向其中绘制一些文字。
var targetBitmap = new Bitmap(500, 600);
using (var graphic = Graphics.FromImage(targetBitmap))
{
graphic.CompositingMode = CompositingMode.SourceCopy;
graphic.CompositingQuality = CompositingQuality.HighQuality;
graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphic.SmoothingMode = SmoothingMode.HighQuality;
graphic.PixelOffsetMode = PixelOffsetMode.HighQuality;
String drawString = "TEST STRING";
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush(Color.Yellow);
RectangleF drawRect = new RectangleF(0, 300, 500, 200);
Pen blackPen = new Pen(Color.Black);
graphic.DrawRectangle(blackPen, 0, 500, 600, 200);
StringFormat drawFormat = new StringFormat();
drawFormat.Alignment = StringAlignment.Far;
graphic.DrawString(drawString, drawFont, drawBrush, drawRect, drawFormat);
}
编译没有问题,走查代码也没有发现问题,但是运行就是会抛异常。异常提示参数无效。
System.ArgumentException
HResult=0x80070057
Message=参数无效。
Source=System.Drawing
StackTrace:
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawString(String s, Font font, Brush brush,
RectangleF layoutRectangle, StringFormat format)
at Program.Main(String[] args) in ...
百思不得其解,后面通过删除代码的方式,逐行定位到问题所在,去掉设置CompositingMode就好了。
PowerDesigner为我们提供一个优秀的常见英文简称表格,可用于数据库设计或程序开发字段(变量)命名。
全称 | 简称 | 中文释义 |
---|---|---|
Account | ACCNT | 账户 |
Address | ADDR | 地址 |
Adjustment | ADJ | 调整,调节 |
Alternate | ALT | 交替,轮流 |
Amount | AMT | 数量,金额,总数 |
Application | APP | 应用程序 |
Approval | APPRVL | 批准 |
Archive | ARC | 归档,存档 |
Attribute | ATTR | 属性 |
Average | AVG | 平均 |
Balance | BAL | 平衡,均衡 |
Beginning | BEG | 开始 |
Benefit | BNFT | 利益,好处 |
Budget | BUDG | 预算 |
Business | BUS、BIZ | 业务,生意,事情 |
Calculation | CALC | 计算,估计 |
Category | CATG | 分类,种类,类别 |
Difference | DIFF | 差异,不同 |
Column | COL | 列 |
Comment | CMT | 注释,评论 |
Company | CO | 公司 |
Conversion | CNV | 转换,换算 |
Corporation | CORP | 公司,企业,法人团体 |
Country | CNTRY | 国家 |
Currency | CURR | 货币 |
Customer | CUST | 客户 |
Date | DT | 日期 |
Day | DY | 天 |
Department | DEPT | 部门 |
Description | DESC | 描述 |
Destination | DEST | 目的地,终点 |
Division | DIV | 除法,划分 |
Document | DOC | 文档 |
Employee | EMP | 雇员 |
Error | ERR | 粗窝 |
Expense | EXP | 支出,花费,开销 |
Extension | EXT | 延期,扩展 |
Federal | FED | 联邦,同盟 |
Financial | FIN | 金融,财政,财务 |
Identifier | ID | 标识,标识符 |
Identification | ID | 识别,鉴定 |
Information | INFO | 信息,资料,知识 |
Inventory | INV | 库存,存货,清单,详细目录,财产清单 |
Location | LOC | 位置,地点 |
Length | LNTH | 长度 |
Maximum | MAX | 最大 |
Minimum | MIN | 最小 |
Month | MO | 月 |
Number | NO | 数字 |
Organization | ORG | 组织,机构,单位名称,团体 |
Option | OPT | 选项 |
Payment | PAY | 付款,支付 |
Percent | PCT | 百分比,百分之 |
Permanent | PERM | 永久的,常驻,永恒的 |
Personal | PERS | 个人的,私人的 |
Position | POST | 位置,职位 |
Previous | PREV | 以前,上一个 |
Price | PRC | 价格,售价 |
Primary | PRI | 主要的 |
Product | PROD | 产品,作品 |
Publication | PUB | 公布,发表,出版 |
Purchase Order | PO | 订单 |
Record | REC | 记录 |
Reduction | RED | 减少,下降,缩小 |
Report | RPT | 报告,报道 |
Required | REQ | 必须的,需要,要求 |
Responsible | RESP | 可靠的,负责的,负责任的 |
Quantity | QTY | 数量 |
Secondary | SEC | 次要的,第二的 |
Section | SECT | 部分,章节 |
Service | SRVC | 服务 |
Social Security Number | SSN | 社会保险号(美国) |
Source | SRCE | 来源 |
Status | STS | 状态 |
Table | TAB | 表格,数据库表 |
Temporary | TEMP | 临时 |
Time | TM | 时间 |
Timestamp | TS | 时间戳 |
Title | TTL | 标题,头衔 |
Total | TOT | 总数,合计 |
Type | TYP | 类型 |
Value | VAL | 值,数值 |
Version | VER | 版本 |
Year | YR | 年 |
YuanRui | YR | :-) |
来源:C:\Program Files (x86)\Sybase\PowerDesigner 15\Resource Files\Conversion Tables\stdnames.csv
项目中的数据库备份还原后,修改数据库字段出现如下错误
查询select * from DBA_USERS
发现用户对应的TEMPORARY TABLESPACE的值为_$deleted$6$0,怀疑TEMPORARY TABLESPACE不存在
查询select * from dba_data_files
尝试创建tims_temp临时表空间,结果失败。恩 有点奇怪。
换个思路重新设置用户临时表空间
ALTER USER timsadmin
DEFAULT TABLESPACE tims_db
TEMPORARY TABLESPACE tims_temp
再次查询 DBA_USERS
显示正常,执行脚本通过
done.
在启动nginx时报如下错误:
nginx: [emerg] CreateFile() "D:\Work\XX项目\nginx-1.20.1/conf/nginx.conf" failed (1113: No mapping for the Unicode character exists in the target multi-byte code page)
原因是启动目录包含中文,在将目录修改为全英文目录后,启动正常。
Update at:2021-06-29
采用nginx进行路径映射,启动报proxy_pass相关错误
nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in D:\Work\nginx-1.20.1/conf/nginx.conf:49
原始的路径转换规则是:
location ~ (^/13.132.175.150:28008).* {
proxy_pass http://13.132.175.150:28008/;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}
这个转换包含正则表达式,去掉正则表达式直接进行路径匹配可以解决该问题。
location /13.132.175.150:28008/ {
proxy_pass http://13.132.175.150:28008/;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}
declare
type ref_cur_type is ref cursor;
cur_list ref_cur_type;
v_sql varchar2(2000);
v_addr_id INTEGER;
v_address varchar2(50);
begin
v_sql := 'select ADDR_ID, ADDRESS from T_DW_ADDR';
open cur_list for v_sql;
loop
fetch cur_list into v_addr_id, v_address;
update T_MON_TERMINAL set addr_id = v_addr_id where address = v_address;
update T_LED_EQUIP set addr_id = v_addr_id where address = v_address;
end loop;
close cur_list;
commit;
end;
title: Oracle批量删除空表的存储过程和函数
date: 2023-05-12 11:00:00
tags:
程序配置的创建分表语句有误,创建了大量的未使用的分表,需要执行sql循环删除空表。这里的空表指的数据表行数为空,保险起见数据表存在记录时不删除该表。
-- 删除空表的存储过程
create or replace procedure SP_DROP_EMPTY_TABLE(owner varchar2, tableName varchar2)
is
v_cnt number;
v_index number := 0;
v_owner varchar(100) := owner;
v_table varchar2(100) := tableName;
v_sql varchar2(200) := '';
cursor cur_tables(c_owner varchar2, c_tableName varchar2) is select TABLE_NAME from all_tables where OWNER = UPPER(c_owner) and TABLE_NAME like UPPER(c_tableName) || '%' ;
begin
dbms_output.enable(buffer_size => null);
open cur_tables(owner, tableName); -- 打开游标
loop
fetch cur_tables into v_table; -- 提取游标
exit when cur_tables%notfound;
v_index := v_index + 1;
v_sql := 'select count(*) from ' || v_table;
execute immediate v_sql into v_cnt;
if v_cnt = 0 then
v_sql := 'drop table '|| v_table;
execute immediate v_sql;
dbms_output.put_line('table:' || v_table || ' is empty, drop success.');
else
dbms_output.put_line('table:' || v_table || ' has records, drop fail. total count=' || v_cnt);
end if;
end loop;
close cur_tables; -- 关闭游标
if v_index = 0 then
dbms_output.put_line('table:' || tableName || ' does not exist.');
end if;
end;
/
call SP_DROP_EMPTY_TABLE('test', 't_table_xxx');
-- 删除空表的函数
create or replace function FUN_DROP_EMPTY_TABLE(owner VARCHAR2, tableName VARCHAR2)
return clob
as
v_result clob := '';
v_cnt number;
v_owner varchar2(100) := owner;
v_table varchar2(100) := tableName;
v_sql varchar2(200) := '';
cursor cur_tables(c_owner varchar2, c_tableName varchar2) is select TABLE_NAME from all_tables where OWNER = UPPER(c_owner) and TABLE_NAME like UPPER(c_tableName) || '%' ;
begin
open cur_tables(owner, tableName); -- 打开游标
loop
fetch cur_tables into v_table; -- 提取游标
exit when cur_tables%notfound;
v_sql := 'select count(*) from ' || v_table;
execute immediate v_sql into v_cnt;
if v_cnt = 0 then
v_sql := 'drop table '|| v_table;
execute immediate v_sql;
v_result := v_result || 'table:' || v_table || ' is empty, drop success.' || chr(13);
else
v_result := v_result || 'table:' || v_table || ' has records, drop fail. total count=' || v_cnt || chr(13);
end if;
end loop;
close cur_tables; -- 关闭游标
if v_result = '' or v_result is null then
return 'table:' || tableName || ' does not exist';
end if;
return v_result;
end;
/
编写删除空表的函数版踩了多个坑。函数执行一般执行使用select FUN_DROP_EMPTY_TABLE('test', 't_table_xxx') from dual,由于存在DDL操作,不能使用select语句,否则会出现如下提示。
> ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML
ORA-06512: at "TEST.FUN_DROP_EMPTY_TABLE", line 19
一度以为函数不可用的时候,发现可以使用begin end包裹语句,在内部调用dbms_output.put_line显示执行结果。
但是又引出另外一个坑,Oracle 12c以前的版本,函数需要返回值。最开始编写这个函数时,把表的删除结果拼接后返回类型为varchar2,当数据表过多时函数执行后会抛出缓冲区过小异常。
> ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "TEST.FUN_DROP_EMPTY_TABLE", line 20
ORA-06512: at line 3
要解决缓冲区问题要么减少返回值,要么将返回类型修改为clob. 函数返回字符串过长时,有可能导致dbms_output.put_line输出异常或不输出...
最后,最好使用存储过程。
begin
-- dbms_output.enable(buffer_size => null);
dbms_output.put_line(FUN_DROP_EMPTY_TABLE('test', 't_table_xxx'));
end;
考虑到部分账户可能没有执行存储过程和函数的权限,这里给出个直接执行sql的版本。
-- 直接执行语句
declare
v_owner varchar(100) := 'admin'; -- 必须输入项: 账户, 即拥有者
v_table varchar2(100) := 'T_XXX_YYMMDD'; -- 必须输入项: 表名或表名前缀
v_cnt number;
v_index number := 0;
v_sql varchar2(200) := '';
cursor cur_tables(c_owner varchar2, c_tableName varchar2) is select TABLE_NAME from all_tables where OWNER = UPPER(c_owner) and TABLE_NAME like UPPER(c_tableName) || '%' ;
begin
dbms_output.enable(buffer_size => null);
open cur_tables(owner, tableName); -- 打开游标
loop
fetch cur_tables into v_table; -- 提取游标
exit when cur_tables%notfound;
v_index := v_index + 1;
v_sql := 'select count(*) from ' || v_table;
execute immediate v_sql into v_cnt;
if v_cnt = 0 then
v_sql := 'drop table '|| v_table;
execute immediate v_sql;
dbms_output.put_line('table:' || v_table || ' is empty, drop success.');
else
dbms_output.put_line('table:' || v_table || ' has records, drop fail. total count=' || v_cnt);
end if;
end loop;
close cur_tables; -- 关闭游标
if v_index = 0 then
dbms_output.put_line('table:' || tableName || ' does not exist.');
end if;
end;
This file controls what Internet media types are sent to the client for given file extension(s). Sending the correct media type to the client is important so they know how to handle the content of the file.
For more information about Internet media types, please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type registry is at ftp://ftp.iana.org/assignments/media-types/.
MIME type | Extension |
---|---|
application/andrew-inset | ez |
application/chemtool | cht |
application/dicom | dcm |
application/docbook+xml | docbook |
application/ecmascript | ecma |
application/flash-video | flv |
application/illustrator | ai |
application/javascript | js |
application/json | json |
application/mac-binhex40 | |
application/mathematica | nb |
application/msword | doc |
application/octet-stream | bin |
application/oda | oda |
application/ogg | ogg |
application/pdf | |
application/pgp | pgp |
application/pgp-encrypted | |
application/pgp-encrypted | pgp gpg |
application/pgp-keys | |
application/pgp-keys | skr pkr |
application/pgp-signature | |
application/pgp-signature | sig |
application/pkcs7-mime | |
application/pkcs7-signature | p7s |
application/postscript | ps |
application/rtf | rtf |
application/sdp | sdp |
application/smil | smil smi sml |
application/stuffit | sit |
application/vnd.corel-draw | cdr |
application/vnd.hp-hpgl | hpgl |
application/vnd.hp-pcl | pcl |
application/vnd.lotus-1-2-3 | 123 wk1 wk3 wk4 wks |
application/vnd.mozilla.xul+xml | xul |
application/vnd.ms-excel | xls xlc xll xlm xlw xla xlt xld |
application/vnd.ms-powerpoint | ppz ppt pps pot |
application/vnd.oasis.opendocument.chart | odc |
application/vnd.oasis.opendocument.database | odb |
application/vnd.oasis.opendocument.formula | odf |
application/vnd.oasis.opendocument.graphics | odg |
application/vnd.oasis.opendocument.graphics-template | otg |
application/vnd.oasis.opendocument.image | odi |
application/vnd.oasis.opendocument.presentation | odp |
application/vnd.oasis.opendocument.presentation-template | otp |
application/vnd.oasis.opendocument.spreadsheet | ods |
application/vnd.oasis.opendocument.spreadsheet-template | ots |
application/vnd.oasis.opendocument.text | odt |
application/vnd.oasis.opendocument.text-master | odm |
application/vnd.oasis.opendocument.text-template | ott |
application/vnd.oasis.opendocument.text-web | oth |
application/vnd.palm | pdb |
application/vnd.rn-realmedia | |
application/vnd.rn-realmedia | rm |
application/vnd.rn-realmedia-secure | rms |
application/vnd.rn-realmedia-vbr | rmvb |
application/vnd.stardivision.calc | sdc |
application/vnd.stardivision.chart | sds |
application/vnd.stardivision.draw | sda |
application/vnd.stardivision.impress | sdd sdp |
application/vnd.stardivision.mail | smd |
application/vnd.stardivision.math | smf |
application/vnd.stardivision.writer | sdw vor sgl |
application/vnd.sun.xml.calc | sxc |
application/vnd.sun.xml.calc.template | stc |
application/vnd.sun.xml.draw | sxd |
application/vnd.sun.xml.draw.template | std |
application/vnd.sun.xml.impress | sxi |
application/vnd.sun.xml.impress.template | sti |
application/vnd.sun.xml.math | sxm |
application/vnd.sun.xml.writer | sxw |
application/vnd.sun.xml.writer.global | sxg |
application/vnd.sun.xml.writer.template | stw |
application/vnd.wordperfect | wpd |
application/x-abiword | abw abw.CRASHED abw.gz zabw |
application/x-amipro | sam |
application/x-anjuta-project | prj |
application/x-applix-spreadsheet | as |
application/x-applix-word | aw |
application/x-arc | |
application/x-archive | a |
application/x-arj | arj |
application/x-asax | asax |
application/x-ascx | ascx |
application/x-ashx | ashx |
application/x-asix | asix |
application/x-asmx | asmx |
application/x-asp | asp |
application/x-awk | |
application/x-axd | axd |
application/x-bcpio | bcpio |
application/x-bittorrent | torrent |
application/x-blender | blender blend BLEND |
application/x-bzip | bz bz2 |
application/x-bzip | bz2 bz |
application/x-bzip-compressed-tar | tar.bz tar.bz2 |
application/x-bzip-compressed-tar | tar.bz tar.bz2 tbz tbz2 |
application/x-cd-image | iso |
application/x-cgi | cgi |
application/x-chess-pgn | pgn |
application/x-chm | chm |
application/x-class-file | |
application/x-cmbx | cmbx |
application/x-compress | Z |
application/x-compressed-tar | tar.gz tar.Z tgz taz |
application/x-compressed-tar | tar.gz tgz |
application/x-config | config |
application/x-core | |
application/x-cpio | cpio |
application/x-cpio-compressed | cpio.gz |
application/x-csh | csh |
application/x-cue | cue |
application/x-dbase | dbf |
application/x-dbm | |
application/x-dc-rom | dc |
application/x-deb | deb |
application/x-designer | ui |
application/x-desktop | desktop kdelnk |
application/x-devhelp | devhelp |
application/x-dia-diagram | dia |
application/x-disco | disco |
application/x-dvi | dvi |
application/x-e-theme | etheme |
application/x-egon | egon |
application/x-executable | exe |
application/x-font-afm | afm |
application/x-font-bdf | bdf |
application/x-font-dos | |
application/x-font-framemaker | |
application/x-font-libgrx | |
application/x-font-linux-psf | psf |
application/x-font-otf | |
application/x-font-pcf | pcf |
application/x-font-pcf | pcf.gz |
application/x-font-speedo | spd |
application/x-font-sunos-news | |
application/x-font-tex | |
application/x-font-tex-tfm | |
application/x-font-ttf | ttc TTC |
application/x-font-ttf | ttf |
application/x-font-type1 | pfa pfb gsf pcf.Z |
application/x-font-vfont | |
application/x-frame | |
application/x-frontline | aop |
application/x-gameboy-rom | gb |
application/x-gdbm | |
application/x-gdesklets-display | display |
application/x-genesis-rom | gen md |
application/x-gettext-translation | gmo |
application/x-glabels | glabels |
application/x-glade | glade |
application/x-gmc-link | |
application/x-gnome-db-connection | connection |
application/x-gnome-db-database | database |
application/x-gnome-stones | caves |
application/x-gnucash | gnucash gnc xac |
application/x-gnumeric | gnumeric |
application/x-graphite | gra |
application/x-gtar | gtar |
application/x-gtktalog | |
application/x-gzip | gz |
application/x-gzpostscript | ps.gz |
application/x-hdf | hdf |
application/x-ica | ica |
application/x-ipod-firmware | |
application/x-jamin | jam |
application/x-jar | jar |
application/x-java | class |
application/x-java-archive | jar ear war |
application/x-jbuilder-project | jpr jpx |
application/x-karbon | karbon |
application/x-kchart | chrt |
application/x-kformula | kfo |
application/x-killustrator | kil |
application/x-kivio | flw |
application/x-kontour | kon |
application/x-kpovmodeler | kpm |
application/x-kpresenter | kpr kpt |
application/x-krita | kra |
application/x-kspread | ksp |
application/x-kspread-crypt | |
application/x-ksysv-package | |
application/x-kugar | kud |
application/x-kword | kwd kwt |
application/x-kword-crypt | |
application/x-lha | lha lzh |
application/x-lha | lzh |
application/x-lhz | lhz |
application/x-linguist | ts |
application/x-lyx | lyx |
application/x-lzop | lzo |
application/x-lzop-compressed-tar | tar.lzo tzo |
application/x-macbinary | |
application/x-machine-config | |
application/x-magicpoint | mgp |
application/x-master-page | master |
application/x-matroska | mkv |
application/x-mdp | mdp |
application/x-mds | mds |
application/x-mdsx | mdsx |
application/x-mergeant | mergeant |
application/x-mif | mif |
application/x-mozilla-bookmarks | |
application/x-mps | mps |
application/x-ms-dos-executable | exe |
application/x-mswinurl | |
application/x-mswrite | wri |
application/x-msx-rom | msx |
application/x-n64-rom | n64 |
application/x-nautilus-link | |
application/x-nes-rom | nes |
application/x-netcdf | cdf nc |
application/x-netscape-bookmarks | |
application/x-object | o |
application/x-ole-storage | |
application/x-oleo | oleo |
application/x-palm-database | |
application/x-palm-database | pdb prc |
application/x-par2 | PAR2 par2 |
application/x-pef-executable | |
application/x-perl | pl pm al perl |
application/x-php | php php3 php4 |
application/x-pkcs12 | p12 pfx |
application/x-planner | planner mrproject |
application/x-planperfect | pln |
application/x-prjx | prjx |
application/x-profile | |
application/x-ptoptimizer-script | pto |
application/x-pw | pw |
application/x-python-bytecode | pyc pyo |
application/x-quattro-pro | wb1 wb2 wb3 |
application/x-quattropro | wb1 wb2 wb3 |
application/x-qw | qif |
application/x-rar | rar |
application/x-rar-compressed | rar |
application/x-rdp | rdp |
application/x-reject | rej |
application/x-remoting | rem |
application/x-resources | resources |
application/x-resourcesx | resx |
application/x-rpm | rpm |
application/x-ruby | |
application/x-sc | |
application/x-sc | sc |
application/x-scribus | sla sla.gz scd scd.gz |
application/x-shar | shar |
application/x-shared-library-la | la |
application/x-sharedlib | so |
application/x-shellscript | sh |
application/x-shockwave-flash | swf |
application/x-siag | siag |
application/x-slp | |
application/x-smil | kino |
application/x-smil | smi smil |
application/x-sms-rom | sms gg |
application/x-soap-remoting | soap |
application/x-streamingmedia | ssm |
application/x-stuffit | |
application/x-stuffit | bin sit |
application/x-sv4cpio | sv4cpio |
application/x-sv4crc | sv4crc |
application/x-tar | tar |
application/x-tarz | tar.Z |
application/x-tex-gf | gf |
application/x-tex-pk | k |
application/x-tgif | obj |
application/x-theme | theme |
application/x-toc | toc |
application/x-toutdoux | |
application/x-trash | bak old sik |
application/x-troff | tr roff t |
application/x-troff-man | man |
application/x-troff-man-compressed | |
application/x-tzo | tar.lzo tzo |
application/x-ustar | ustar |
application/x-wais-source | src |
application/x-web-config | |
application/x-wpg | wpg |
application/x-wsdl | wsdl |
application/x-x509-ca-cert | der cer crt cert pem |
application/x-xbel | xbel |
application/x-zerosize | |
application/x-zoo | zoo |
application/xhtml+xml | xhtml |
application/zip | zip |
audio/ac3 | ac3 |
audio/basic | au snd |
audio/midi | mid midi |
audio/mpeg | mp3 |
audio/prs.sid | sid psid |
audio/vnd.rn-realaudio | ra |
audio/x-aac | aac |
audio/x-adpcm | |
audio/x-aifc | |
audio/x-aiff | aif aiff |
audio/x-aiff | aiff aif aifc |
audio/x-aiffc | |
audio/x-flac | flac |
audio/x-m4a | m4a |
audio/x-mod | mod ult uni XM m15 mtm 669 |
audio/x-mp3-playlist | |
audio/x-mpeg | |
audio/x-mpegurl | m3u |
audio/x-ms-asx | |
audio/x-pn-realaudio | ra ram rm |
audio/x-pn-realaudio | ram rmm |
audio/x-riff | |
audio/x-s3m | s3m |
audio/x-scpls | pls |
audio/x-scpls | pls xpl |
audio/x-stm | stm |
audio/x-voc | voc |
audio/x-wav | wav |
audio/x-xi | xi |
audio/x-xm | xm |
image/bmp | bmp |
image/cgm | cgm |
image/dpx | |
image/fax-g3 | g3 |
image/g3fax | |
image/gif | gif |
image/ief | ief |
image/jpeg | jpeg jpg jpe |
image/jpeg2000 | jp2 |
image/png | png |
image/rle | rle |
image/svg+xml | svg |
image/tiff | tif tiff |
image/vnd.djvu | djvu djv |
image/vnd.dwg | dwg |
image/vnd.dxf | dxf |
image/x-3ds | 3ds |
image/x-applix-graphics | ag |
image/x-cmu-raster | ras |
image/x-compressed-xcf | xcf.gz xcf.bz2 |
image/x-dcraw | bay BAY bmq BMQ cr2 CR2 crw CRW cs1 CS1 dc2 DC2 dcr DCR fff FFF k25 K25 kdc KDC mos MOS mrw MRW nef NEF orf ORF pef PEF raf RAF rdc RDC srf SRF x3f X3F |
image/x-dib | |
image/x-eps | eps epsi epsf |
image/x-fits | fits |
image/x-fpx | |
image/x-icb | icb |
image/x-ico | ico |
image/x-iff | iff |
image/x-ilbm | ilbm |
image/x-jng | jng |
image/x-lwo | lwo lwob |
image/x-lws | lws |
image/x-msod | msod |
image/x-niff | |
image/x-pcx | |
image/x-photo-cd | pcd |
image/x-pict | pict pict1 pict2 |
image/x-portable-anymap | pnm |
image/x-portable-bitmap | pbm |
image/x-portable-graymap | pgm |
image/x-portable-pixmap | ppm |
image/x-psd | psd |
image/x-rgb | rgb |
image/x-sgi | sgi |
image/x-sun-raster | sun |
image/x-tga | tga |
image/x-win-bitmap | cur |
image/x-wmf | wmf |
image/x-xbitmap | xbm |
image/x-xcf | xcf |
image/x-xfig | fig |
image/x-xpixmap | xpm |
image/x-xwindowdump | xwd |
inode/blockdevice | |
inode/chardevice | |
inode/directory | |
inode/fifo | |
inode/mount-point | |
inode/socket | |
inode/symlink | |
message/delivery-status | |
message/disposition-notification | |
message/external-body | |
message/news | |
message/partial | |
message/rfc822 | |
message/x-gnu-rmail | |
model/vrml | wrl |
multipart/alternative | |
multipart/appledouble | |
multipart/digest | |
multipart/encrypted | |
multipart/mixed | |
multipart/related | |
multipart/report | |
multipart/signed | |
multipart/x-mixed-replace | |
text/calendar | vcs ics |
text/css | css CSSL |
text/directory | vcf vct gcrd |
text/enriched | |
text/html | html htm |
text/htmlh | |
text/mathml | mml |
text/plain | txt asc |
text/rdf | rdf |
text/rfc822-headers | |
text/richtext | rtx |
text/rss | rss |
text/sgml | sgml sgm |
text/spreadsheet | sylk slk |
text/tab-separated-values | tsv |
text/vnd.rn-realtext | rt |
text/vnd.wap.wml | wml |
text/x-adasrc | adb ads |
text/x-authors | |
text/x-bibtex | bib |
text/x-boo | boo |
text/x-c++hdr | hh |
text/x-c++src | cpp cxx cc C c++ |
text/x-chdr | h h++ hp |
text/x-comma-separated-values | csv |
text/x-copying | |
text/x-credits | |
text/x-csrc | c |
text/x-dcl | dcl |
text/x-dsl | dsl |
text/x-dsrc | d |
text/x-dtd | dtd |
text/x-emacs-lisp | el |
text/x-fortran | f |
text/x-gettext-translation | po |
text/x-gettext-translation-template | pot |
text/x-gtkrc | |
text/x-haskell | hs |
text/x-idl | idl |
text/x-install | |
text/x-java | java |
text/x-js | js |
text/x-ksysv-log | |
text/x-literate-haskell | lhs |
text/x-log | log |
text/x-makefile | |
text/x-moc | moc |
text/x-msil | il |
text/x-nemerle | n |
text/x-objcsrc | m |
text/x-pascal | p pas |
text/x-patch | diff patch |
text/x-python | py |
text/x-readme | |
text/x-rng | rng |
text/x-scheme | scm |
text/x-setext | etx |
text/x-speech | |
text/x-sql | sql |
text/x-suse-ymp | ymp |
text/x-suse-ymu | ymu |
text/x-tcl | tcl tk |
text/x-tex | tex ltx sty cls |
text/x-texinfo | texi texinfo |
text/x-texmacs | tm ts |
text/x-troff-me | me |
text/x-troff-mm | mm |
text/x-troff-ms | ms |
text/x-uil | uil |
text/x-uri | uri url |
text/x-vb | vb |
text/x-xds | xds |
text/x-xmi | xmi |
text/x-xsl | xsl |
text/x-xslfo | fo xslfo |
text/x-xslt | xslt xsl |
text/xmcd | |
text/xml | xml |
video/3gpp | 3gp |
video/dv | dv dif |
video/isivideo | |
video/mpeg | mpeg mpg mp2 mpe vob dat |
video/quicktime | qt mov moov qtvr |
video/vivo | |
video/vnd.rn-realvideo | rv |
video/wavelet | |
video/x-3gpp2 | 3g2 |
video/x-anim | anim[1-9j] |
video/x-avi | |
video/x-flic | fli flc |
video/x-mng | mng |
video/x-ms-asf | asf asx |
video/x-ms-wmv | wmv |
video/x-msvideo | avi |
video/x-nsv | nsv NSV |
video/x-real-video | |
video/x-sgi-movie | movie |
application/x-java-jnlp-file | jnlp |
application/vnd.openxmlformats-officedocument.wordprocessingml.document | docx |
application/vnd.openxmlformats-officedocument.wordprocessingml.template | dotx |
application/vnd.ms-word.document.macroEnabled.12 | docm |
application/vnd.ms-word.template.macroEnabled.12 | dotm |
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | xlsx |
application/vnd.openxmlformats-officedocument.spreadsheetml.template | xltx |
application/vnd.ms-excel.sheet.macroEnabled.12 | xlsm |
application/vnd.ms-excel.template.macroEnabled.12 | xltm |
application/vnd.ms-excel.addin.macroEnabled.12 | xlam |
application/vnd.ms-excel.sheet.binary.macroEnabled.12 | xlsb |
application/vnd.openxmlformats-officedocument.presentationml.presentation | pptx |
application/vnd.openxmlformats-officedocument.presentationml.template | potx |
application/vnd.openxmlformats-officedocument.presentationml.slideshow | ppsx |
application/vnd.ms-powerpoint.addin.macroEnabled.12 | ppam |
之前写了一个Oracle版删除空表存储过程和函数,现在提供一个MySQL版的。
delimiter //
drop procedure if exists sp_drop_empty_table;
create procedure sp_drop_empty_table(dbname varchar(200), tablename varchar(200))
begin
declare done int default false;
declare v_index int;
declare v_result text;
declare v_cnt int;
declare v_table varchar(200);
declare cur_tables cursor for select table_name from information_schema.tables where lower(table_schema) = lower(dbname) and lower(table_name) like lower(concat(tablename, '%'));
declare continue handler for not found set done = true;
set v_index = 0;
set v_result = '';
open cur_tables;
read_loop: loop
fetch cur_tables into v_table;
if done then
leave read_loop;
end if;
set v_index = v_index + 1;
set @sql_text = concat('select count(*) into @cnt from ', v_table, ';');
prepare querystmt from @sql_text;
execute querystmt;
deallocate prepare querystmt;
set v_cnt = @cnt;
if v_cnt = 0 then
-- if not set foreign_key_checks=0, will be:> 1217 - cannot delete or update a parent row: a foreign key constraint fails
set foreign_key_checks=0;
set @sql_text = concat('drop table ', v_table, ';');
prepare dropstmt from @sql_text;
execute dropstmt;
deallocate prepare dropstmt;
set foreign_key_checks=1;
set v_result = concat(v_result, char(10), concat('table:', v_table, ' is empty, drop success.'));
else
set v_result = concat(v_result, char(10), concat('table:', v_table, ' has records, drop fail. total count=', v_cnt));
end if;
end loop;
close cur_tables;
if v_index = 0 then
set v_result = concat('table:', tablename, ' does not exist.');
end if;
select v_result;
end;
//
delimiter ;
备注:创建函数版本时,出现如下错误。
-- > 1336 - Dynamic SQL is not allowed in stored function or trigger
MySQL处于安全考虑,不允许在函数和触发器动态执行语句。执行删除操作使用的语句如下:
call sp_drop_empty_table('xx_db', 't_xxxx');
update at: 2023/5/30
同事反馈在mysql命令行客户端窗口执行会报脚本异常,发现主要是由分号分隔符导致出错,需要使用delimiter重新指定分隔符。
If you use the mysql client program to define a stored program containing semicolon characters, a problem arises. By default, mysql itself recognizes the semicolon as a statement delimiter, so you must redefine the delimiter temporarily to cause mysql to pass the entire stored program definition to the server.
参考链接:https://dev.mysql.com/doc/refman/5.7/en/stored-programs-defining.html
代码 | 名称 |
---|---|
B11 | 重型普通半挂车 |
B12 | 重型厢式半挂车 |
B13 | 重型罐式半挂车 |
B14 | 重型平板半挂车 |
B15 | 重型集装箱半挂车 |
B16 | 重型自卸半挂车 |
B17 | 重型特殊结构半挂车 |
B21 | 中型普通半挂车 |
B22 | 中型厢式半挂车 |
B23 | 中型罐式半挂车 |
B24 | 中型平板半挂车 |
B25 | 中型集装箱半挂车 |
B26 | 中型自卸半挂车 |
B27 | 中型特殊结构半挂车 |
B31 | 轻型普通半挂车 |
B32 | 轻型厢式半挂车 |
B33 | 轻型罐式半挂车 |
B34 | 轻型平板半挂车 |
B35 | 轻型自卸半挂车 |
D11 | 无轨电车 |
D12 | 有轨电车 |
G11 | 重型普通全挂车 |
G12 | 重型厢式全挂车 |
G13 | 重型罐式全挂车 |
G14 | 重型平板全挂车 |
G15 | 重型集装箱全挂车 |
G16 | 重型自卸全挂车 |
G21 | 中型普通全挂车 |
G22 | 中型厢式全挂车 |
G23 | 中型罐式全挂车 |
G24 | 中型平板全挂车 |
G25 | 中型集装箱全挂车 |
G26 | 中型自卸全挂车 |
G31 | 轻型普通全挂车 |
G32 | 轻型厢式全挂车 |
G33 | 轻型罐式全挂车 |
G34 | 轻型平板全挂车 |
G35 | 轻型自卸全挂车 |
H11 | 重型普通货车 |
H12 | 重型厢式货车 |
H13 | 重型封闭货车 |
H14 | 重型罐式货车 |
H15 | 重型平板货车 |
H16 | 重型集装厢车 |
H17 | 重型自卸货车 |
H18 | 重型特殊结构货车 |
H21 | 中型普通货车 |
H22 | 中型厢式货车 |
H23 | 中型封闭货车 |
H24 | 中型罐式货车 |
H25 | 中型平板货车 |
H26 | 中型集装厢车 |
H27 | 中型自卸货车 |
H28 | 中型特殊结构货车 |
H31 | 轻型普通货车 |
H32 | 轻型厢式货车 |
H33 | 轻型封闭货车 |
H34 | 轻型罐式货车 |
H35 | 轻型平板货车 |
H37 | 轻型自卸货车 |
H38 | 轻型特殊结构货车 |
H41 | 微型普通货车 |
H42 | 微型厢式货车 |
H43 | 微型封闭货车 |
H44 | 微型罐式货车 |
H45 | 微型自卸货车 |
H46 | 微型特殊结构货车 |
H51 | 低速普通货车 |
H52 | 低速厢式货车 |
H53 | 低速罐式货车 |
H54 | 低速自卸货车 |
J11 | 轮式装载机械 |
J12 | 轮式挖掘机械 |
J13 | 轮式平地机械 |
K11 | 大型普通客车 |
K12 | 大型双层客车 |
K13 | 大型卧铺客车 |
K14 | 大型铰接客车 |
K15 | 大型越野客车 |
K21 | 中型普通客车 |
K22 | 中型双层客车 |
K23 | 中型卧铺客车 |
K24 | 中型铰接客车 |
K25 | 中型越野客车 |
K31 | 小型普通客车 |
K32 | 小型越野客车 |
K33 | 轿车 |
K41 | 微型普通客车 |
K42 | 微型越野客车 |
K43 | 微型轿车 |
M11 | 普通正三轮摩托车 |
M12 | 轻便正三轮摩托车 |
M13 | 正三轮载客摩托车 |
M14 | 正三轮载货摩托车 |
M15 | 侧三轮摩托车 |
M21 | 普通二轮摩托车 |
M22 | 轻便二轮摩托车 |
N11 | 三轮汽车 |
Q11 | 重型半挂牵引车 |
Q21 | 中型半挂牵引车 |
Q31 | 轻型半挂牵引车 |
T11 | 大型轮式拖拉机 |
T21 | 小型轮式拖拉机 |
T22 | 手扶拖拉机 |
T23 | 手扶变形运输机 |
Z | 专项作业车 |
Z11 | 大型专项作业车 |
Z21 | 中型专项作业车 |
Z31 | 小型专项作业车 |
Z41 | 微型专项作业车 |
Z51 | 重型专项作业车 |
Z71 | 轻型专项作业车 |
X99 | 其他 |
项目中有一个和其他系统进行经纬度对接的需求,传入的经纬度是float类型,而我们用的decimal进行存储。
最开始的时候使用Convert.ToDecimal进行转换,只取到了小数点的后4位。而float最大可以表示7位小数,转换过程出现了精度丢失的bug.
float input = 106.6509332F;
Console.WriteLine(input);
Console.WriteLine(Convert.ToDecimal(input));
//输出
//106.6509
//106.6509
改进思路,将float类型强制转换为double,再转换成decimal。代码如下
float input = 106.6509332F;
Console.WriteLine(input);
Console.WriteLine(Convert.ToDecimal((double)input));
Console.WriteLine(input.ToString("G9"));
//输出
//106.6509
//106.650932312012
//106.65093
在数值字符串格式时,使用格式G9处理可以保留9位数字,优先保留整数位,小数个数=9-整数位个数。
float input2 = 865569.6509332F;
Console.WriteLine(input2);
Console.WriteLine(input2.ToString("G9"));
//输出
//865569.6
//865569.625
float转decimal出现精度问题,究其原因,float类型使用4字节进行存储,decimal使用16字节进行存储,低字节向高字节之间转换需要进行字节填充,这个填充有可能是不准确的。选用浮点类型进行数值存储时,需要慎重考虑精度丢失问题。
C# 类型/关键字 | 大致范围 | 精度 | 大小 | .NET 类型 |
---|---|---|---|---|
float |
±1.5 x 10−45 至 ±3.4 x 1038 | 大约 6-9 位数字 | 4 个字节 | System.Single |
double |
±5.0 × 10−324 到 ±1.7 × 10308 | 大约 15-17 位数字 | 8 个字节 | System.Double |
decimal |
±1.0 x 10-28 至 ±7.9228 x 1028 | 28-29 位 | 16 个字节 | System.Decimal |
参考链接:
title: 解决Asp.Net Session退出造成Ajax请求无响应的Bug
date: 2016-10-31 16:20:00
tags:
在一般的Web后台管理系统的使用过程中,大多都是在单窗口中操作,用户所有的操作都在同一个标签页面中。
有时候会出现这种情况:
1、用户将当前页面的Url在新的标签页中打开;
2、在新的标签页面中注销当前登陆账户。
3、再返回当前页面进行操作(假设界面上的CRUD操作都是通过Ajax请求处理),这个时候的任何Ajax操作都不会返回正确的结果,如果不刷新页面,页面不会重定向到登陆页面;
解决问题的办法很简单,让用户刷新下页面就行。但是有时候用户是不知道需要刷新的。特别是打开后台管理系统,长期不操作界面,造成服务器端Session过期,需要用户重新登陆系统。
对于追求后台管理系统傻瓜式操作的追求来说,刷新页面并不是我们想要的结果。
浏览器发起Ajax请求后,正常情况下调用目标地址相关方法并返回结果。服务器端的Session过期或失效后,Ajax请求的地址将会被重定向到登陆页面,返回的结果是登陆页面的html。
搞清楚Ajax调用处理过程后,解决问题的主要关键在于,如何判别返回的结果是不是登陆页面。如果返回的结果是登陆页面,则将window.location设置为登陆页的地址,否则不做处理。
一个简单的解决方案是在登陆页中添加一个特殊的Header. 同时在母版页中使用Jquery注册ajaxComplete事件,捕获之前设置的Header, 如果存在跳转到登陆页面,不存在则不做处理。
登陆页相关代码
[HttpGet, AllowAnonymous]
public ActionResult Login(string ReturnUrl)
{
this.HttpContext.Response.AddHeader("__LoginUrl", "/Home/Login");
ViewBag.ReturnUrl = ReturnUrl;
return View();
}
母版页(_Layout.cshtml)中的Js事件处理
<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ajaxComplete(function(event, jqxhr, settings){
if (jqxhr.status == 200) {
var loginPageUrl = jqxhr.getResponseHeader("__LoginUrl");
if(loginPageUrl && loginPageUrl !== ""){
window.location.replace(loginPageUrl);
}
return;
}
});
</script>
之前考虑过,使用ajaxError事件来处理跳转。因为实际使用过程中Ajax传输的数据大多都是Json,重定向到登陆页后,将Html转化为Json时会抛异常同时触发ajaxError事件。使用ajaxError对于ajaxComplete来说,只有Ajax有异常的情况下才处理,不用处理判断每次Ajax请求,相对效率高一点。
由于我们项目的弹窗表单都是采用的Ajax Get请求加载的,返回的是Html,不会触发ajaxError事件。权衡之后,还是使用ajaxComplete.
顺便说一下,这里也可以用Cookie来替代Header, 具体处理方式类似这里不再复述。唯一需要注意的是,如何控制Cookie过期的问题。
参考链接:http://stackoverflow.com/questions/199099/how-to-manage-a-redirect-request-after-a-jquery-ajax-call
统计变更代码行数
git log --pretty=tformat: --since="2022-07-05" --until="2022-07-21" --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "新增行数: %s, 移除行数: %s, 总行数: %s\n", add, subs, loc }'
统计提交次数
git log --since="2022-07-05" --until="2022-07-21" --no-merges | grep -e 'commit [a-zA-Z0-9]*' | wc -l
查看每人代码行数
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done
安装Android Studio后,下载和还原maven包巨慢无比,一直卡在下面这个进度。
Download https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.7.10/kotlin-compiler-embeddable-1.7.10.jar (16.04 MB / 52.52 MB)
尝试过修改项目中的build.gradle的maven仓库设置,重启IDE未生效。
后面发现需要修改全局的Gradle设置,在系统用户目录(C:\Users\YuanRui.gradle)建立一个 init.gradle,配置如下。
allprojects {
repositories {
maven { url 'file:///G:/maven'}
mavenLocal()
maven { url 'https://maven.aliyun.com/repository/central/'}
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
mavenCentral()
}
buildscript {
repositories {
maven { url 'https://maven.aliyun.com/repository/central/'}
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
}
}
}
在Mvc项目中使用Session,会导致请求被锁定。慎用Session.
以下是stackoverflow的一些讨论汇总。
Session lock导致请求延迟
https://stackoverflow.com/questions/8349033/storing-anything-in-asp-net-session-causes-500ms-delays
https://weblogs.asp.net/imranbaloch/concurrent-requests-in-asp-net-mvc
https://github.com/aspnet/AspNetSessionState
https://www.c-sharpcorner.com/UploadFile/ff2f08/session-state-behavior-per-action-in-Asp-Net-mvc/
https://devblogs.microsoft.com/aspnet/introducing-the-asp-net-async-sessionstate-module/
https://stackoverflow.com/questions/2326817/asp-net-mvc-and-ajax-concurrent-requests/2327051
其中一个解决办法,使用Heavysoft.LockFreeSessionState.HashTable. 尝试了一下还是有问题,使用TempData和Session容易丢失数据
https://stackoverflow.com/questions/3629709/i-just-discovered-why-all-asp-net-websites-are-slow-and-i-am-trying-to-work-out/25231036
其他的一些方法
https://stackoverflow.com/questions/3666556/a-non-locking-in-process-asp-net-session-state-store
禁用Session的一些讨论
https://stackoverflow.com/questions/1464203/disable-session-state-per-request-in-asp-net-mvc
MSDN 自定义SessionStateModule
https://docs.microsoft.com/en-us/dotnet/api/system.web.sessionstate.sessionstateutility?redirectedfrom=MSDN&view=netframework-4.8#snippetGroup
:: 判断windows服务是否存在
@echo off
@set serviceName=aspnet_state
@sc query "%serviceName%" > nul
if not errorlevel 1060 (
@echo %serviceName%服务存在
) else (
@echo %serviceName%服务不存在
)
@pause
title: 解决Asp.Net配置异常杂记
date: 2020-01-20 15:06:07
问题描述:在Win10 x64位 IIS 10环境中,部署Asp.Net Mvc 3站点时,报“HTTP 错误 500.19 - Internal Server Error
无法访问请求的页面,因为该页的相关配置数据无效。”
配置错误:不能在此路径中使用此配置节。如果在父级别上锁定了该节,便会出现这种情况。锁定是默认设置的(overrideModeDefault="Deny"),或者是通过包含 overrideMode="Deny" 或旧有的 allowOverride="false" 的位置标记明确设置的。
解决办法
1、在控制面板中打开"程序和功能";
2、在程序和功能中,打开"启用或关闭Windows功能";
3、选择"Internet Infomation Services" -> "应用程序开发功能";
4、排除"CGI"选项
参考链接:http://stackoverflow.com/questions/9794985/iis-this-configuration-section-cannot-be-used-at-this-path-configuration-lock
问题描述:在创建网站后,访问站点出现 您要找的资源已被删除、已更名或暂时不可用 错误
解决过程
后来这个问题是由于本机的asp.net未注册造成的,执行asp.net注册命令即可
32位机器:C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
64位机器:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
将项目Oracle nuget包更新到最新版本后,出现“定义了重复的“oracle.manageddataaccess.client”节 ”的问题。
解决过程
经过排查发现machine.config(位置:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config)中存在老版本的“oracle.manageddataaccess.client”节点。
删除machine.config中"configuration/configSections"定义的“oracle.manageddataaccess.client”,以及"configuration"中的“oracle.manageddataaccess.client”,重启IIS站点。
···
<oracle.manageddataaccess.client>
</oracle.manageddataaccess.client>
···
备注:这个问题推测是在服务器中安装Oracle Client时,勾选了某些开发者选项造成的。
相信大家都有这样的经历,某个安装包在官网已经找不到下载链接了,只好通过第三方渠道进行下载。但是怎么确认文件就是官网原版呢,对文件进行哈希校验是一个比较常用的做法。计算文件的哈希值,然后在互联网上查找是否存在相应的哈希值,一般可以确保文件的完整性。
通过微软文件校验工具fciv.zip,我们很容易实现对文件完整性进行校验。这个校验工具的原始下载链接已经不可考,可以通过文中链接进行下载,通比对MD5或SHA-1值进行判断是否为原版 :-)
fciv.exe程序用法:fciv.exe -both 文件名。
E:\Tools>fciv.exe -both fciv.exe
//
// File Checksum Integrity Verifier version 2.05.
//
MD5 SHA-1
-------------------------------------------------------------------------
e2c6d562bd35352b73c00a744e9c07c6 f5259423eb42664dec7a32ba6a7cf0d85d13e752 fciv.exe
使用fciv校验Oracle 12c安装包值:
D:\Software\Oracle>fciv.exe -md5 -sha1 winx64_12102_database_1of2.zip
//
// File Checksum Integrity Verifier version 2.05.
//
MD5 SHA-1
-------------------------------------------------------------------------
f7bf17b1d45f618c1b8c7261047838c5 ce30b8063b5d4e5ab387192e8e41b9d182ccd467 winx64_12102_database_1of2.zip
D:\Software\Oracle>fciv.exe -md5 -sha1 winx64_12102_database_2of2.zip
//
// File Checksum Integrity Verifier version 2.05.
//
MD5 SHA-1
-------------------------------------------------------------------------
bd6c1c3b4452402a1339e428e9bba353 dfacb3407df341304da35436fc890c5f00954825 winx64_12102_database_2of2.zip
使用-help参数可以查看详细说明:
E:\Tools>fciv.exe -help
//
// File Checksum Integrity Verifier version 2.05.
//
Usage: fciv.exe [Commands] <Options>
Commands: ( Default -add )
-add <file | dir> : Compute hash and send to output (default screen).
dir options:
-r : recursive.
-type : ex: -type *.exe.
-exc file: list of directories that should not be computed.
-wp : Without full path name. ( Default store full path)
-bp : specify base path to remove from full path name
-list : List entries in the database.
-v : Verify hashes.
: Option: -bp basepath.
-? -h -help : Extended Help.
Options:
-md5 | -sha1 | -both : Specify hashtype, default md5.
-xml db : Specify database format and name.
To display the MD5 hash of a file, type fciv.exe filename
Compute hashes:
fciv.exe c:\mydir\myfile.dll
fciv.exe c:\ -r -exc exceptions.txt -sha1 -xml dbsha.xml
fciv.exe c:\mydir -type *.exe
fciv.exe c:\mydir -wp -both -xml db.xml
List hashes stored in database:
fciv.exe -list -sha1 -xml db.xml
Verifications:
fciv.exe -v -sha1 -xml db.xml
fciv.exe -v -bp c:\mydir -sha1 -xml db.xml
一个.net core 2.1的项目升级到.net 6,post请求时出现“The XXX field is required.”的验证错误。
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-36e71dbf52b567b263bc21218b44c679-754419d31dc03116-00",
"errors": {
"Id": [
"The Id field is required."
],
"Name": [
"The Name field is required."
],
"RequestUrl": [
"The RequestUrl field is required."
],
"Description": [
"The Description field is required."
]
}
}
造成这个异常的主要原因是MVC启用了隐式非空属性验证,当字段属于非空类型时,自动启用Required特性验证。模型绑定时当检测到字段值为空时,验证会出现字段是必须的错误。
一种解决的办法是将模型的属性设置成可为空的类型。
public class DemoViewModel
{
public string? Id { get; set; }
public string? Name { get; set; }
public string? RequestUrl { get; set; }
public string? Description { get; set; }
}
另一种办法是在Startup设置MvcOptions.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes属性为true,禁用隐式非空属性验证。
services.AddControllers(options =>
{
options.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = true;
});
参考链接:https://learn.microsoft.com/zh-cn/aspnet/core/mvc/models/validation?view=aspnetcore-6.0
TFS 2018在初始状态下,需求和任务的计划开始日期、完成日期为不可编辑状态。无法设置工作项的计划时间,造成项目管理方面存在缺失,不方便统计工作绩效。
好在VS自带的工作项跟踪管理工具可以修改工作项类型的 XML 定义。
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer>witadmin exportwitd /?
Microsoft(R) 工作项跟踪管理工具。
版权所有(C) Microsoft Corporation。保留所有权利。
导出工作项类型的 XML 定义。
用法: witadmin exportwitd /collection:collectionurl /p:project /n:typename [/f:filename] [/e:编码]
[/exportgloballists]
/collection 指定 Azure DevOps 项目集合。请使用完全指定的 URL,如 http://servername:8080/tfs/Collection0。
/p 指定团队项目的名称。
/n 指定要导出的工作项类型的名称。
/f 为导出工作项类型 XML 指定目标文件。如果未指定,则将 XML 输出到显示器。
/e 指定用于导入 XML 文件的 .NET Framework 2.0 编码的名称。例如,/e:utf-7 将使用 Unicode
(UTF-7)编码。如有可能,自动检测编码。如果无法检测编码,则将使用 UTF-8。
/exportgloballists 导出所引用的全局列表的定义。 如果未指定,则将省略全局列表定义。
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer>witadmin importwitd /?
Microsoft(R) 工作项跟踪管理工具。
版权所有(C) Microsoft Corporation。保留所有权利。
此命令将工作项类型 XML 定义文件导入到 Azure DevOps Server
上的团队项目中。如果已存在具有相同名称的工作项类型,则新的工作项类型定义将覆盖现有的定义。如果工作项类型尚不存在,则将
新建一个工作项类型。
用法: witadmin importwitd /collection:collectionurl [/p:project] /f:filename [/e:编码] [/v]
/collection 指定 Azure DevOps 项目集合。请使用完全指定的 URL,如 http://servername:8080/tfs/Collection0。
/p 指定要在其中导入新工作项类型的团队项目。 此操作是必需的(使用 validation-only 选项时除外)。
/f 指定要导入的工作项类型 XML 定义文件。
/e 指定用于导入 XML 文件的 .NET Framework 2.0 编码的名称。例如,/e:utf-7 将使用 Unicode
(UTF-7)编码。如有可能,自动检测编码。如果无法检测编码,则将使用 UTF-8。
/v 在不导入工作项类型、链接类型或全局工作流的 XML 定义情况下对其进行验证。
witadmin exportwitd /collection:http://192.168.1.108:8080/tfs/XXX项目集合 /p:LED项目 /n:需求 /f:request.xml
witadmin exportwitd /collection:http://192.168.1.108:8080/tfs/XXX项目集合 /p:LED项目 /n:任务 /f:task.xml
<!-- 修改前的xml节点 -->
<Group Label="计划">
<Control Label="开始日期" Type="FieldControl" FieldName="Microsoft.VSTS.Scheduling.StartDate" ReadOnly="True" />
<Control Label="完成日期" Type="FieldControl" FieldName="Microsoft.VSTS.Scheduling.FinishDate" ReadOnly="True" />
</Group>
<!-- 修改后的xml节点 -->
<Group Label="计划">
<Control Label="开始日期" Type="DateTimeControl" FieldName="Microsoft.VSTS.Scheduling.StartDate" />
<Control Label="完成日期" Type="DateTimeControl" FieldName="Microsoft.VSTS.Scheduling.FinishDate" />
</Group>
witadmin importwitd /collection:http://192.168.1.108:8080/tfs/XXX项目集合 /p:YYY项目 /f:request.xml
witadmin importwitd /collection:http://192.168.1.108:8080/tfs/XXX项目集合 /p:YYY项目 /f:task.xml
前段时间一个朋友面试,面试官发了一个Oracle Sql题目给他。他不太会做,让我帮忙做一下。
好吧,题目大致是这样的
下面是我给他的答案,题目2相对来说花费的时间更多一点
--题目1
SELECT CNO,
(SELECT COUNT(*) FROM T_STUDENT_COURSE_SCORE a WHERE scs.CNO = a.CNO and a.SCORE >= 60 AND a.SCORE < 70) AS '60-70',
(SELECT COUNT(*) FROM T_STUDENT_COURSE_SCORE a WHERE scs.CNO = a.CNO and a.SCORE >= 70 AND a.SCORE < 80) AS '70-80',
(SELECT COUNT(*) FROM T_STUDENT_COURSE_SCORE a WHERE scs.CNO = a.CNO and a.SCORE >= 80 AND a.SCORE < 90) AS '80-90',
(SELECT COUNT(*) FROM T_STUDENT_COURSE_SCORE a WHERE scs.CNO = a.CNO and a.SCORE >= 90 AND a.SCORE <= 100) AS '90-100'
FROM T_STUDENT_COURSE_SCORE scs
GROUP BY scs.CNO;
--题目2
DELETE FROM T_STUDENT_SCORE a
WHERE EXISTS (
SELECT 1
FROM (SELECT b.ROWNUM, b.ROWID FROM T_STUDENT_SCORE b
WHERE EXISTS (
SELECT 1 FROM T_STUDENT_SCORE c
WHERE c.SNAME = b.SNAME AND c.SCORE = b.SCORE
GROUP BY c.SNAME, b.SCORE
HAVING COUNT(*) > 1
)
)
) cte
WHERE cte.ROWNUM > 1 AND a.ROWID = cte.ROWID
);
commit
一直觉得题目2的答案解决办法不是最优的,隔天他在网上找了一个另外的版本的Sql答案,看了下相对我的答案来说是要好一点,答案如下
DELETE FROM T_STUDENT_SCORE
WHERE ROWID NOT IN (
SELECT MIN(ROWID)
FROM T_STUDENT_SCORE
GROUP BY NAME,SCORE
);
commit
<?xml version="1.0"?>
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<directoryBrowse enabled="true" />
<staticContent>
<remove fileExtension=".mp3" />
<remove fileExtension=".mp4" />
<remove fileExtension=".webm" />
<remove fileExtension=".ogg" />
<remove fileExtension=".ogv" />
<remove fileExtension=".flv" />
<remove fileExtension=".7z" />
<remove fileExtension=".log" />
<mimeMap fileExtension=".mp3" mimeType="audio/mpeg" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
<mimeMap fileExtension=".ogg" mimeType="audio/ogg" />
<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
<mimeMap fileExtension=".flv" mimeType="video/x-flv" />
<mimeMap fileExtension=".7z" mimeType="application/octet-stream" />
<mimeMap fileExtension=".log" mimeType="text/plain" />
</staticContent>
</system.webServer>
<system.web>
<authentication mode="None" />
<sessionState mode="Off" />
<profile enabled="false" />
<httpModules>
<clear/>
</httpModules>
<httpHandlers>
<clear/>
<add path="*" verb="GET,HEAD,POST" type="System.Web.DefaultHttpHandler" validate="True" />
<add path="*" verb="*" type="System.Web.HttpMethodNotAllowedHandler" validate="True" />
</httpHandlers>
</system.web>
</configuration>
These MySQL Data Types | Can always be converted to these Java types |
---|---|
CHAR, VARCHAR, BLOB, TEXT, ENUM, and SET |
java.lang.String, java.io.InputStream, java.io.Reader, java.sql.Blob, java.sql.Clob |
FLOAT, REAL, DOUBLE PRECISION, NUMERIC, DECIMAL, TINYINT, SMALLINT, MEDIUMINT, INTEGER, BIGINT |
java.lang.String, java.lang.Short, java.lang.Integer, java.lang.Long, java.lang.Double, java.math.BigDecimal |
DATE, TIME, DATETIME, TIMESTAMP |
java.lang.String, java.sql.Date, java.sql.Timestamp |
MySQL Type Name | Return value of GetColumnTypeName |
Return value of GetColumnClassName |
---|---|---|
BIT(1) (new in MySQL-5.0) |
BIT |
java.lang.Boolean |
BIT( > 1) (new in MySQL-5.0) |
BIT |
byte[] |
TINYINT |
TINYINT |
java.lang.Boolean if the configuration property tinyInt1isBit is set to true (the default) and the storage size is 1, or java.lang.Integer if not. |
BOOL , BOOLEAN |
TINYINT |
See TINYINT , above as these are aliases for TINYINT(1) , currently. |
SMALLINT[(M)] [UNSIGNED] |
SMALLINT [UNSIGNED] |
java.lang.Integer (regardless of whether it is UNSIGNED or not) |
MEDIUMINT[(M)] [UNSIGNED] |
MEDIUMINT [UNSIGNED] |
java.lang.Integer (regardless of whether it is UNSIGNED or not) |
INT,INTEGER[(M)] [UNSIGNED] |
INTEGER [UNSIGNED] |
java.lang.Integer , if UNSIGNED java.lang.Long |
BIGINT[(M)] [UNSIGNED] |
BIGINT [UNSIGNED] |
java.lang.Long , if UNSIGNED java.math.BigInteger |
FLOAT[(M,D)] |
FLOAT |
java.lang.Float |
DOUBLE[(M,B)] |
DOUBLE |
java.lang.Double |
DECIMAL[(M[,D])] |
DECIMAL |
java.math.BigDecimal |
DATE |
DATE |
java.sql.Date |
DATETIME |
DATETIME |
java.sql.Timestamp |
TIMESTAMP[(M)] |
TIMESTAMP |
java.sql.Timestamp |
TIME |
TIME |
java.sql.Time |
YEAR[(2/4)] |
YEAR |
If yearIsDateType configuration property is set to false , then the returned object type is java.sql.Short . If set to true (the default), then the returned object is of type java.sql.Date with the date set to January 1st, at midnight. |
CHAR(M) |
CHAR |
java.lang.String (unless the character set for the column is BINARY , then byte[] is returned. |
VARCHAR(M) [BINARY] |
VARCHAR |
java.lang.String (unless the character set for the column is BINARY , then byte[] is returned. |
BINARY(M) |
BINARY |
byte[] |
VARBINARY(M) |
VARBINARY |
byte[] |
TINYBLOB |
TINYBLOB |
byte[] |
TINYTEXT |
VARCHAR |
java.lang.String |
BLOB |
BLOB |
byte[] |
TEXT |
VARCHAR |
java.lang.String |
MEDIUMBLOB |
MEDIUMBLOB |
byte[] |
MEDIUMTEXT |
VARCHAR |
java.lang.String |
LONGBLOB |
LONGBLOB |
byte[] |
LONGTEXT |
VARCHAR |
java.lang.String |
ENUM('value1','value2',...) |
CHAR |
java.lang.String |
SET('value1','value2',...) |
CHAR |
java.lang.String |
参考来源:
https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-type-conversions.html
https://github.com/mysql/mysql-connector-net/blob/8.0/MySQL.Data/src/Types/MetaData.cs
public class AllowCorsAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Origin", "*");
filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Request-Method", "POST,GET,PUT,DELETE,OPTIONS");
filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type,X-Requested-With");
base.OnActionExecuting(filterContext);
}
}
在全局的Filter中注册
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new AllowCorsAttribute());
}
$.fn.datagrid.defaults.view.onBeforeRender = function(target, rows) {
var dgState = $.data(target, 'datagrid');
var opts = dgState.options;
if (opts.rownumbers)
{
var rownumber = 0;
if (opts.pagination) {
rownumber += (opts.pageNumber - 1) * opts.pageSize + rows.length;
}
if (rownumber > 0) {
var rowNumWidth = rownumber.toString().length * 10;
if (rowNumWidth < 30) {
rowNumWidth = 30;
}
$.fn.datagrid.defaults.rownumberWidth = rowNumWidth;
dgState.ss.set(".datagrid-cell-rownumber", (rowNumWidth - 1) + "px");
dgState.ss.set(".datagrid-header-rownumber", (rowNumWidth - 1) + "px");
}
}
};
VS 2019
vs_enterprise.exe --layout D:\vs2019layout --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Microsoft.VisualStudio.Workload.Node --add Component.GitHub.VisualStudio --includeOptional --lang zh-CN
VS 2022
VisualStudioSetup.exe --layout F:\vs2022layout --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Microsoft.VisualStudio.Workload.Node --includeOptional --lang Zh-cn
https://docs.microsoft.com/zh-cn/visualstudio/install/create-an-offline-installation-of-visual-studio?view=vs-2019
https://learn.microsoft.com/zh-cn/visualstudio/install/create-an-offline-installation-of-visual-studio?view=vs-2022
https://learn.microsoft.com/zh-cn/visualstudio/install/install-visual-studio?view=vs-2022
** 第二版学习笔记 YuanRui 2020.02.04 **
等号是主要的赋值操作符。
增量操作符和C语言类似。
Python使用下划线作为变量前缀和后缀时为特殊变量。
Python支持多元赋值,示例如下:
x, y, z = 1, 2, 'Hello World!'
Q:为什么Python中不需要变量名和变量类型声明?
A:Python中无需显式声明类型,变量在第一次赋值时确定类型。
标识符定义规则:第一个字符必须是字母或下划线,剩下的字符可以说字符、数字和下划线。标识符大小写敏感。
所有类型对象的类型都是type,这个概念有点类似于C#中所有类型都是由object派生出的一样。
Python中的特殊类型是None, 表示Null对象或NoneType. None类型类似于C#中的void, 值类似于null. None的布尔值总是为False.
对象值可以使用:>、<、==、>=、<=、!=等操作符进行比较。
对象引用方式根据赋值方式,有所不同。
#示例
#a1和a1引用的相同对象
a1 = a2 = 123
#b1和b2引用的不同对象
b1=123
b2=123
使用is、is not可以比较是否引用的同一对象。
#结果:True
a1 is a1
#结果:False
b1 is b2
布尔类型操作符:not、and、or.
函数 | 功能 |
---|---|
cmp(obj1,obj2) | 比较obj1和obj2,根据比较结果返回整型值 |
repr(obj) | 返回一个对象的字符表示,类似C#中ToString方法 |
str(obj) | 返回可读性好的对象字符串,类似C#中ToString带格式的方法 |
type(obj) | 获取对象的类型,返回相应的type对象 |
数据类型 | 存储类型 | 更新模型 | 访问模型 |
---|---|---|---|
数字 | 标量 | 不可更改 | 直接访问 |
字符串 | 标量 | 不可更改 | 顺序访问 |
列表 | 容器 | 可更改 | 顺序访问 |
元组 | 容器 | 不可更改 | 顺序访问 |
字典 | 容器 | 可更改 | 映射访问 |
标量:一个保存单个字面对象的类型,类似于C#中的值类型和字符串。
容器:可存储多个对象(对象可以有不同的类型)的类型,类似C#集合。
可变类型:允许值被更新,每次修改后新值替换旧值。类似C#引用类型。
不可变类型:不允许值被更改,每次修改后使用新的值替代;旧值被丢弃,等待垃圾回收器处理回收对象。类似C#值类型。
直接访问:对数值直接进行访问,类似C#中栈。
顺序访问:可对容器按索引进行访问元素,类似C#中索引。
映射访问:元素无序存放,通过唯一Key访问,类似C#中哈希。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.