当前位置: 首页 > 编程日记 > 正文

Unity3D常用代码总结

1 GUI汇总

function OnGUI() {

GUI.Label(Rect(1,1,100,20),"I'm a Label"); //1

GUI.Box(Rect(1,21,100,20),"I'm a Box"); //2

GUI.Button(Rect(1,41,100,20),"I'm a Button"); //3

GUI.RepeatButton(Rect(1,61,120,20),"I'm a RepeatButton"); //4

GUI.TextField(Rect(1,81,100,20),"I'm a TextFielld"); //5

GUI.TextArea(Rect(1,101,100,40),"I'm a TextArea,\nMultiline"); //6

GUI.Toggle(Rect(1,141,120,20),true,"I'm a Toggle true"); //7

GUI.Toggle(Rect(1,161,120,20),false,"I'm a Toggle false"); //8

GUI.Toolbar(Rect(1,181,160,20),-1,["Toolbar","Tool2","Tool3"); //9

GUI.SelectionGrid(Rect(1,201,190,20),2,["Selection","Grid","select3"],3); //10

GUI.HorizontalSlider(Rect(1,221,180,20),3.0,0,10.0); //11

GUI.VerticalScrollbar(Rect(1,241,20,100),3.0,1,0.0,10.0); //12

//13

GUI.BeginScrollView (Rect (200,10,100,100),Vector2.zero, Rect (0, 0, 220, 200));

GUI.Label(Rect(0,0,100,20),"I'm a Label");

GUI.EndScrollView();

//14

GUI.Window(0,Rect(200,129,100,100),funcwin,"window");

}

function funcwin(windowID:int)

{

GUI.DragWindow(Rect(0,0,10000,2000));

}

2 JS调用DLL

import System;

import System.Runtime.InteropServices;

@DllImport("user32.dll")

public static function MessageBox(Hwnd : int,text : String,Caption : String,iType : int) : int {};

function Start()

{

MessageBox(0, "API Message Box", "Win32 API", 64) ;

}

function Update () {

}

3 物体标签
var target : Transform;  // Object that this label should follow
var offset = Vector3.up;    // Units in world space to offset; 1 unit above object by default
var clampToScreen = false;  // If true, label will be visible even if object is off screen
var clampBorderSize = .05;  // How much viewport space to leave at the borders when a label is being clamped
var useMainCamera = true;   // Use the camera tagged MainCamera
var cameraToUse : Camera;   // Only use this if useMainCamera is false
private var cam : Camera;
private var thisTransform : Transform;
private var camTransform : Transform;
function Start () {
thisTransform = transform;
if (useMainCamera)
cam = Camera.main;
else
cam = cameraToUse;
camTransform = cam.transform;
}
function Update () {
if (clampToScreen) {
var relativePosition = camTransform.InverseTransformPoint(target.position);
relativePosition.z = Mathf.Max(relativePosition.z, 1.0);
thisTransform.position = cam.WorldToViewportPoint(camTransform.TransformPoint(relativePosition + offset));
thisTransform.position = Vector3(Mathf.Clamp(thisTransform.position.x, clampBorderSize, 1.0-clampBorderSize),
Mathf.Clamp(thisTransform.position.y, clampBorderSize, 1.0-clampBorderSize),
thisTransform.position.z);
}
else {
thisTransform.position = cam.WorldToViewportPoint(target.position + offset);
}
}
@script RequireComponent(GUIText)
4 unity3d读取保存xml文件
import System;
import System.Xml;
import System.Xml.Serialization;
import System.IO;
import System.Text;
class CeshiData{
var Ceshi1 : String;
var Ceshi2 : String;
var Ceshi3 : float;
var Ceshi4 : int;
}
class UserData
{
public var _iUser : CeshiData = new CeshiData();
function UserData() { }
}
private var c1 : String;
private var c2 : String;
private var c3 : float;
private var c4 : int;
private var _FileLocation : String;
private var _FileName : String = "CeshiData.xml";
var myData : UserData[];
private var tempData : UserData = new UserData();
var i : int = 0;
var GUISkin1 : GUISkin;
var ShowData : int = 0;
function Awake(){
_Filelocation=Application.dataPath;
}
function Start(){
FirstSave();
}
function FirstSave(){//初始化XML
tempData._iUser.Ceshi1 = "?";
tempData._iUser.Ceshi2 = "?";
tempData._iUser.Ceshi3 = 0;
tempData._iUser.Ceshi4 = 0;
var writer : StreamWriter;
var t : FileInfo = new FileInfo(_FileLocation+"/"+ _FileName);
if(!t.Exists)
{
writer = t.CreateText();
_data = SerializeObject(tempData);
for(i=0;i<10;i++){
writer.WriteLine(_data);
}
writer.Close();
}
}
function Save(sc1 : String,sc2 : String,sc3 : float,sc4 : int){//保存数据到指定的XMl里
tempData._iUser.Ceshi1 = sc1;
tempData._iUser.Ceshi2 = sc2;
tempData._iUser.Ceshi3 = sc3;
tempData._iUser.Ceshi4 = sc4;
var writer : StreamWriter;
var t : FileInfo = new FileInfo(_FileLocation+"/"+ _FileName);
t.Delete();
writer = t.CreateText();
_data = SerializeObject(tempData);
for(i=0;i<10;i++){
writer.WriteLine(_data);
}
writer.Close();
}
function Load(){//读取保存在XML里的数据
var r : StreamReader = File.OpenText(_FileLocation+"/"+ _FileName);
var _info : String ;
for(i=0;i<10;i++){
_info = r.ReadLine();
_data=_info;
myData[i] = DeserializeObject(_data);
}
r.Close();
}
function OnGUI() {
GUI.skin = GUISkin1;
if(GUI.Button(Rect(0,0,100,40),"save")){
Save("ceshi1","ceshi2",1.23,50);//要显示中文需设定中文字体
}
if(GUI.Button(Rect(200,0,100,40),"load")){
Load();
ShowData = 1;
}
if(ShowData == 1){
GUI.Label(Rect(170,170+53*0,150,50),myData[0]._iUser.Ceshi1);
GUI.Label(Rect(370,170+53*0,150,50),myData[0]._iUser.Ceshi2);
GUI.Label(Rect(550,170+53*0,150,50),myData[0]._iUser.Ceshi3 + "");
GUI.Label(Rect(760,170+53*0,150,50),myData[0]._iUser.Ceshi4 + "");
GUI.Label(Rect(170,170+53*1,150,50),myData[1]._iUser.Ceshi1);
GUI.Label(Rect(370,170+53*2,150,50),myData[2]._iUser.Ceshi2);
GUI.Label(Rect(550,170+53*3,150,50),myData[3]._iUser.Ceshi3 + "");
GUI.Label(Rect(760,170+53*4,150,50),myData[4]._iUser.Ceshi4 + "");
}
}
//================================================================================
function UTF8ByteArrayToString(characters : byte[] )
{
var encoding : UTF8Encoding = new UTF8Encoding();
var constructedString : String = encoding.GetString(characters);
return (constructedString);
}
//byte[] StringToUTF8ByteArray(string pXmlString)
function StringToUTF8ByteArray(pXmlString : String)
{
var encoding : UTF8Encoding = new UTF8Encoding();
var byteArray : byte[] = encoding.GetBytes(pXmlString);
return byteArray;
}
// Here we serialize our UserData object of myData
//string SerializeObject(object pObject)
function SerializeObject(pObject : Object)
{
var XmlizedString : String = null;
var memoryStream : MemoryStream = new MemoryStream();
var xs : XmlSerializer = new XmlSerializer(typeof(UserData));
var xmlTextWriter : XmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
xs.Serialize(xmlTextWriter, pObject);
memoryStream = xmlTextWriter.BaseStream; // (MemoryStream)
XmlizedString = UTF8ByteArrayToString(memoryStream.ToArray());
return XmlizedString;
}
// Here we deserialize it back into its original form
//object DeserializeObject(string pXmlizedString)
function DeserializeObject(pXmlizedString : String)
{
var xs : XmlSerializer = new XmlSerializer(typeof(UserData));
var memoryStream : MemoryStream = new MemoryStream(StringToUTF8ByteArray(pXmlizedString));
var xmlTextWriter : XmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
return xs.Deserialize(memoryStream);
}
5 单击物体弹出对话框
static var WindowSwitch : boolean = false;
var mySkin : GUISkin;
var windowRect = Rect (200, 80, 240, 100);
function OnGUI ()
{
if(WindowSwitch ==  true)
{
GUI.skin = mySkin;
windowRect = GUI.Window (0, windowRect, WindowContain, "测试视窗");
}
}
function WindowContain (windowID : int)
{
if (GUI.Button (Rect (70,40,100,20), "关闭视窗"))
{
WindowSwitch = false;
}
}
function OnMouseEnter ()
{
renderer.material.color = Color.red;
}
function OnMouseDown ()
{
Func_GUIWindow.WindowSwitch = true;
}
function OnMouseExit ()
{
renderer.material.color = Color.white;
}
6 读取txt文本
using UnityEngine;
using System.Collections;
using System.IO;
using System.Text;
public class ReadTxt : MonoBehaviour {
string path = "D:\\txtName.txt";
StreamReader smRead = new StreamReader(path,
Encoding.Default); //设置路径
string line;
void Update () {
if ((line = smRead.ReadLine()) != null) {
string[] arrStr = line.Split('|'); //分割符 “|”
id1 = arrStr[0].ToString();
name = arrStr[1].ToString();
sfz = arrStr[2].ToString();
}
}
}
7 截屏
function OnMouseDown() {
Application.CaptureScreenshot("Screenshot.png");
}
8 下拉菜单
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
public class DropDownList : MonoBehaviour
{
private Rect DropDownRect;          // Size and Location for drop down
private Transform currentRoot;      // selected object transform
private Vector2 ListScrollPos;      // scroll list position
public string selectedItemCaption;  // name of selected item
private string lastCaption;         // last selected item
private int guiWidth;               // width of drop list
private int guiHight;               // hight of drop list
private bool textChanged;           // if text in text box has changed look for item
private bool clearDropList;         // clear text box
public bool DropdownVisible;        // show drop down list
public bool updateInfo;             // update info window
public Transform root;              // top of the Hierarchy
public GUISkin dropSkin;            // GUISkin for drop down list
public int itemtSelected;           // index of selected item
public bool targetChange;           // text in text box was changed, update list
public class GuiListItem        //The class that contains our list items
{
public string Name;         // name of the item
public int GuiStyle;        // current style to use
public int UnSelectedStyle; // unselected GUI style
public int SelectedStyle;   // selected GUI style
public int Depth;           // depth in the Hierarchy
public bool Selected;       // if the item is selected
public bool ToggleChildren; // show child objects in list
// constructors
public GuiListItem(bool mSelected, string mName, int iGuiStyle, bool childrenOn, int depth)
{
Selected = mSelected;
Name = mName;
GuiStyle = iGuiStyle;
ToggleChildren = childrenOn;
Depth = depth;
UnSelectedStyle = 0;
SelectedStyle = 0;
}
public GuiListItem(bool mSelected, string mName)
{
Selected = mSelected;
Name = mName;
GuiStyle = 0;
ToggleChildren = true;
Depth = 0;
UnSelectedStyle = 0;
SelectedStyle = 0;
}
public GuiListItem(string mName)
{
Selected = false;
Name = mName;
GuiStyle = 0;
ToggleChildren = true;
Depth = 0;
UnSelectedStyle = 0;
SelectedStyle = 0;
}
// Accessors
public void enable()// don't show in list
{
Selected = true;
}
public void disable()// show in list
{
Selected = false;
}
public void setStlye(int stlye)
{
GuiStyle = stlye;
}
public void setToggleChildren(bool childrenOn)
{
ToggleChildren = childrenOn;
}
public void setDepth(int depth)
{
Depth = depth;
}
public void SetStyles(int unSelected, int selected)
{
UnSelectedStyle = unSelected;
SelectedStyle = selected;
}
}

//Declare our list of stuff

public List<GuiListItem> MyListOfStuff;

// Initialization

void Start()

{

guiWidth = 400;

guiHight = 28;

// Manually position our list, because the dropdown will appear over other controls

DropDownRect = new Rect(10, 10, guiWidth, guiHight);

DropdownVisible = false;

itemtSelected = -1;

targetChange = false;

lastCaption = selectedItemCaption = "Select a Part...";

if (!root)

root = gameObject.transform;

MyListOfStuff = new List<GuiListItem>(); //Initialize our list of stuff

// fill the list

BuildList(root);

// set GUI for each item in list

SetupGUISetting();

// fill the list

FillList(root);

}

void OnGUI()

{

//Show the dropdown list if required (make sure any controls that should appear behind the list are before this block)

if (DropdownVisible)

{

GUI.SetNextControlName("ScrollView");

GUILayout.BeginArea(new Rect(DropDownRect.xMin, DropDownRect.yMin + DropDownRect.height, guiWidth, Screen.height * .25f), "", "box");

ListScrollPos = GUILayout.BeginScrollView(ListScrollPos, dropSkin.scrollView);

GUILayout.BeginVertical(GUILayout.Width(120));

for (int i = 0; i < MyListOfStuff.Count; i++)

{

if (MyListOfStuff[i].Selected && GUILayout.Button(MyListOfStuff[i].Name, dropSkin.customStyles[MyListOfStuff[i].GuiStyle]))

{

HandleSelectedButton(i);

}

}

GUILayout.EndVertical();

GUILayout.EndScrollView();

GUILayout.EndArea();

}

//Draw the dropdown control

GUILayout.BeginArea(DropDownRect, "", "box");

GUILayout.BeginHorizontal();

string ButtonText = (DropdownVisible) ? "<<" : ">>";

DropdownVisible = GUILayout.Toggle(DropdownVisible, ButtonText, "button", GUILayout.Width(32), GUILayout.Height(20));

GUI.SetNextControlName("PartSelect");

selectedItemCaption = GUILayout.TextField(selectedItemCaption);

clearDropList = GUILayout.Toggle(clearDropList, "Clear", "button", GUILayout.Width(40), GUILayout.Height(20));

GUILayout.EndHorizontal();

GUILayout.EndArea();

}

void Update()

{

//check if text box info changed

if (selectedItemCaption != lastCaption)

{

textChanged = true;

}

// if text box info changed look for part matching text

if (textChanged)

{

lastCaption = selectedItemCaption;

textChanged = false;

// go though list to find item

for (int i = 0; i < MyListOfStuff.Count; ++i)

{

if (MyListOfStuff[i].Name.StartsWith(selectedItemCaption, System.StringComparison.CurrentCultureIgnoreCase))

{

MyListOfStuff[i].enable();

MyListOfStuff[i].ToggleChildren = false;

MyListOfStuff[i].GuiStyle = MyListOfStuff[i].UnSelectedStyle;

}

else

{

MyListOfStuff[i].disable();

MyListOfStuff[i].ToggleChildren = false;

MyListOfStuff[i].GuiStyle = MyListOfStuff[i].UnSelectedStyle;

}

}

for (int i = 0; i < MyListOfStuff.Count; ++i)

{

// check list for item

int test = string.Compare(selectedItemCaption, MyListOfStuff[i].Name, true);

if (test == 0)

{

itemtSelected = i;

targetChange = true;

break; // stop looking when found

}

}

}

// reset message if list closed and text box is empty

if (selectedItemCaption == "" && !DropdownVisible)

{

lastCaption = selectedItemCaption = "Select a Part...";

ClearList(root);

FillList(root);

}

// if Clear button pushed

if (clearDropList)

{

clearDropList = false;

selectedItemCaption = "";

}

}

public void HandleSelectedButton(int selection)

{

// do the stuff, camera etc

itemtSelected = selection;//Set the index for our currently selected item

updateInfo = true;

selectedItemCaption = MyListOfStuff[selection].Name;

currentRoot = GameObject.Find(MyListOfStuff[itemtSelected].Name).transform;

// toggle item show child

MyListOfStuff[selection].ToggleChildren = !MyListOfStuff[selection].ToggleChildren;

lastCaption = selectedItemCaption;

// fill my drop down list with the children of the current selected object

if (!MyListOfStuff[selection].ToggleChildren)

{

if (currentRoot.childCount > 0)

{

MyListOfStuff[selection].GuiStyle = MyListOfStuff[selection].SelectedStyle;

}

FillList(currentRoot);

}

else

{

if (currentRoot.childCount > 0)

{

MyListOfStuff[selection].GuiStyle = MyListOfStuff[selection].UnSelectedStyle;

}

ClearList(currentRoot);

}

targetChange = true;

}

// show only items that are the root and its children

public void FillList(Transform root)

{

foreach (Transform child in root)

{

for (int i = 0; i < MyListOfStuff.Count; ++i)

{

if (MyListOfStuff[i].Name == child.name)

{

MyListOfStuff[i].enable();

MyListOfStuff[i].ToggleChildren = false;

MyListOfStuff[i].GuiStyle = MyListOfStuff[i].UnSelectedStyle;

}

}

}

}

// turn off children objects

public void ClearList(Transform root)

{

//Debug.Log(root.name);

Transform[] childs = root.GetComponentsInChildren<Transform>();

foreach (Transform child in childs)

{

for (int i = 0; i < MyListOfStuff.Count; ++i)

{

if (MyListOfStuff[i].Name == child.name && MyListOfStuff[i].Name != root.name)

{

MyListOfStuff[i].disable();

MyListOfStuff[i].ToggleChildren = false;

MyListOfStuff[i].GuiStyle = MyListOfStuff[i].UnSelectedStyle;

}

}

}

}

// recursively build the list so the hierarchy is in tact

void BuildList(Transform root)

{

// for every object in the thing we are viewing

foreach (Transform child in root)

{

// add the item

MyListOfStuff.Add(new GuiListItem(false, child.name));

// if it has children add the children

if (child.childCount > 0)

{

BuildList(child);

}

}

}

public void ResetDropDownList()

{

selectedItemCaption = "";

ClearList(root);

FillList(root);

}

public string RemoveNumbers(string key)

{

return Regex.Replace(key, @"\d", "");

}

// sets the drop list elements to use the correct GUI skin custom style

private void SetupGUISetting()

{

// set drop down list gui

int depth = 0;

// check all the parts for hierarchy depth

for (int i = 0; i < MyListOfStuff.Count; ++i)

{

GameObject currentObject = GameObject.Find(MyListOfStuff[i].Name);

Transform currentTransform = currentObject.transform;

depth = 0;

if (currentObject.transform.parent == root) // if under root

{

if (currentObject.transform.childCount > 0)

{

MyListOfStuff[i].GuiStyle = depth;

MyListOfStuff[i].UnSelectedStyle = depth;

MyListOfStuff[i].SelectedStyle = depth + 2;

}

else

{

MyListOfStuff[i].GuiStyle = depth + 1;

MyListOfStuff[i].UnSelectedStyle = depth + 1;

MyListOfStuff[i].SelectedStyle = depth + 1;

}

MyListOfStuff[i].Depth = depth;

}

else // if not under root find depth

{

while (currentTransform.parent != root)

{

++depth;

currentTransform = currentTransform.parent;

}

MyListOfStuff[i].Depth = depth;

// set gui basied on depth

if (currentObject.transform.childCount > 0)

{

MyListOfStuff[i].GuiStyle = depth * 3;

MyListOfStuff[i].UnSelectedStyle = depth * 3;

MyListOfStuff[i].SelectedStyle = (depth * 3) + 2;

}

else

{

MyListOfStuff[i].GuiStyle = depth * 3 + 1;

MyListOfStuff[i].UnSelectedStyle = depth * 3 + 1;

MyListOfStuff[i].SelectedStyle = depth * 3 + 1;

}

}

}

}

}

相关文章:

Python 搭建车道智能检测系统

作者 | 李秋键责编 | 寇雪芹出品 | AI科技大本营&#xff08;ID:rgznai100&#xff09;引言&#xff1a;本文将利用opencv实现对复杂场景下车道线的实时检测&#xff1b;所使用的图像处理方法主要是在读取图片的基础上&#xff0c;进行多种边缘检测&#xff0c;然后对不同的检测…

ASP.NET弹出窗口技术之增加网站流量方法

作为Microsoft的最新建立动态Web网站的工具,ASP.NET相对于ASP和JSP在改变原始的Web编程方式方面有了长足的长进。它的代码与页面分离技术(CodeBehind)以及完善的Web服务器控件为程序员提供了一个更加符合传统编程的Web服务器端开发方式。但Web编程还是有着与传统编程不相同的特…

检查是否支持 SO_REUSEPORT

为什么80%的码农都做不了架构师&#xff1f;>>> int reuse_port(int sockfd) {#ifndef SO_REUSEPORT#define SO_REUSEPORT (15)#endifconst int on 1;return setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)); } 转载于:https://my.oschina.n…

nginx的tmp文件过大导致磁盘空间不足一例

个人微博&#xff1a;http://weibo.com/h2fly欢迎技术交流现象&#xff1a;8月23之后&#xff0c;时不时收到服务器的/usrused > 90%的报警排查:1、du发现磁盘/usr使用不大&#xff0c;而报警使用的df》明显是有文件删除了空间没释放。注&#xff1a;du和df的实现机制不同&a…

10年Java老兵宝藏资料,吐血奉献!

2021都说工作不好找&#xff0c;也对开发人员的要求变高。前段时间自己有整理了一些Java后端开发面试常问的高频考点问题做成一份PDF文档&#xff08;1000道高频题&#xff09;&#xff0c;同时也整理一些图文解析及笔记&#xff0c;今天在这免费分享给大家&#xff0c;希望大家…

IOCP , kqueue , epoll ... 有多重要?

原文地址&#xff1a;http://blog.codingnow.com/2006/04/iocp_kqueue_epoll.html设计 mmo 服务器&#xff0c;我听过许多老生常谈&#xff0c;说起处理大量连接时&#xff0c; select 是多么低效。我们应该换用 iocp (windows), kqueue(freebsd), 或是 epoll(linux) 。的确&am…

[故障解决]图文:python启动报错:api-ms-win-crt-runtime-l1-1-0.dll丢失解决

python启动报错&#xff1a;api-ms-win-crt-runtime-l1-1-0.dll丢失解决 环境 Windows 7 SP1 x64python3.6.1报错 解决办法 1.下载VC redist&#xff08;安装时读条卡在&#xff1a;正在处理:Windows7_MSU_x64&#xff09;2.到C:\ProgramData\Package Cache\里面搜索&#xff0…

ASP.NET设计应用程序的七大绝招

随着微软.NET的流行&#xff0c;ASP.NET越来越为广大开发人员所接受。作为ASP.NET的开发人员&#xff0c;我们不仅需要掌握其基本的原理&#xff0c;更要多多实践&#xff0c;从实践中获取真正的开发本领。在我们的实际开发中&#xff0c;往往基本的原理满足不了开发需求&#…

Chromium之各国语言切换

在\src\build\Debug\locales\目录下存放着各国语言所需要的资源文件xx.pak,我这边共有53中语言支持。 命令行进入src\build\Debug目录,敲:chrome.exe --langzh-CN就能用中文简体,zh-CN可以根据需要换成各种语言版本。 Chrome的整个solution中&#xff0c;每种语言都会有个相应的…

程序员每天工作摸鱼俩小时,月薪35K?

职场上有很多奇奇怪怪的事。比如说有人爆肝996&#xff0c;工资却还养不活自己。有人每天工作摸鱼&#xff0c;但是却月薪数万。前端时间&#xff0c;小编在某职场社交平台上看到这么一则帖子#程序员摸鱼2小时月入35k#仔细看下&#xff0c;该员工每天的工作日常就是摸鱼的间隙工…

JAVA的get post 区别

1. get 是从服务器上获取数据&#xff0c;post 是向服务器传送数据。 get 请求返回 request - URI 所指出的任意信息。Post 请求用来发送电子邮件、新闻或发送能由交互用户填写的表格。这是唯一需要在请求中发送body的请求。使用Post请求时需要在报文首部 Content - Length 字段…

多些时间能少写些代码(转自酷壳 – CoolShell.cn)

我在我的微博上说过这样一段话&#xff0c;我想在这里把我的这个观点阐述地更完整一些。左耳朵耗子&#xff1a;聪明的程序员使用50%-70%的时间用来思考&#xff0c;尝试和权衡各种设计和实现&#xff0c;而用30% – 50%的时间是在忙碌着编码&#xff0c;调试和测试。聪明的老板…

HTTP协议之Chunked解析

在网上找了好一会&#xff0c;始终没发现有解析Chunked编码的文章&#xff0c;那就自己写一个吧&#xff0c;呵呵。网上使用Chunked编码的网站似乎并不是很多&#xff0c;除了那些使用GZip压缩的网站&#xff0c;例&#xff1a;google.com&#xff0c;还有就是大部分打开GZip压…

关于深度学习编译器,这些知识你需要知道

作者 | 小O妹出品 | AI科技大本营&#xff08;ID:rgznai100&#xff09;神经网络编译器概览近年来&#xff0c;以机器学习、深度学习为核心的AI技术得到迅猛发展&#xff0c;深度神经网络在各行各业得到广泛应用&#xff1a; 1. CV&#xff08;计算机视觉&#xff09;&#xf…

checkbox点击切换选中状态

2019独角兽企业重金招聘Python工程师标准>>> function cboxChecked(ele) {$(ele).click(function () {var isChecked $(ele).attr(checked);if (!isChecked) {$(ele).attr(checked, true)} else {$(ele).attr(checked, false)}})} 转载于:https://my.oschina.net/u…

提升Hadoop计算能力的并行框架

集算器是新型并行计算框架&#xff0c;它支持读写HDFS中的文件&#xff0c;可以通过并行框架将计算任务分担到多个节点中。它专注于加强Hadoop的计算能力&#xff0c;从而实现计算性能和开发效率更高的大数据应用。更强的计算能力。Hadoop所使用的计算语言为JAVA&#xff0c;JA…

在ASP.NET 2.0中建立站点导航层次

站点导航提供程序--ASP.NET 2.0中的站点导航提供程序暴露了应用程序中的页面的导航信息&#xff0c;它允许你单独地定义站点的结构&#xff0c;而不用考虑页面的实际物理布局。默认的站点导航提供程序是基于XML的&#xff0c;但是你也可以通过编写自定义的提供程序&#xff0c;…

加速数据中心变革,Xilinx推出软件定义、硬件加速型 Alveo SmartNIC

近日&#xff0c;为满足现代数据中心发展需求&#xff0c;赛灵思公司宣布推出一系列全新数据中心产品及解决方案&#xff0c;包括全新 Alveo SmartNIC 系列、smart world &#xff08;智能世界&#xff09; AI 视频分析应用、一款能够实现亚微秒级交易的加速算法交易参考设计&a…

跟阿里云技术专家阙寒一起深度了解视频直播CDN技术

网络直播平台现下已经十分火热&#xff0c;很多常见的直播平台都采用了阿里云直播CDN来搭建自身业务。今天&#xff0c;我们请来了阿里云CDN团队技术专家阙寒&#xff0c;来介绍下视频的一些基础知识和视频直播的架构。在进入正题之前&#xff0c;我们先来了解视频直播相关的名…

一个ASP.NET中使用的MessageBox类

/// <summary>/// 自定义信息对话框/// </summary>public class MessageBox{/// <summary>/// 定义一个web页面&#xff0c;用来显示用户自定错误提示信息/// </summary>System.Web.UI.Page p;/// <summary>/// 实例时&#xff0c;参数为:this 如…

Ubuntu 13.10 安装Terminalx 后更改默认终端设置

1、安装 terminalx&#xff0c; sudo apt-get install terminator 2、Ctrl Alt t 试一下打开什么终端&#xff0c;我的默认启动的是Terminator;如果想换换默认的终端&#xff0c;还需以下一步 3、接下来&#xff0c;安装dconf-tools&#xff0c;这个是设置默认终端的必须 打开…

360数科张家兴:如何突破三大瓶颈,破解金融科技发展难题?

3月6日&#xff0c;上海香港联会、普陀香港联会联合普陀新区联会&#xff0c;IFTA亚洲金融科技师学会共同举办了“沪港合作共创未来”——沪港两地金融科技线上论坛。本次活动通过沪港两地直播连线&#xff0c;探讨两地金融科技领域的发展机遇。麻省理工学院香港创坊执行董事冼…

通过改进算法来优化程序性能的真实案例(Ransac)

对于运行不了几次&#xff0c;一次运行不了多久的方法&#xff0c;我们不需要考虑性能优化&#xff0c;对于那些需要经常运行几百次几千次的方法&#xff0c;我们头脑里还是要有性能这根弦。C#太优雅方便了&#xff0c;以至于很多人写程序时根本就把性能抛到脑后了&#xff0c;…

ASP.NET中使用MD5和SHA1算法加密

你的主页或者你管理的网站有各种密码需要保护&#xff0c;把密码直接放在数据库或者文件中存在不少安全隐患&#xff0c;所以密码加密后存储是最常见的做法。在ASP.NET中实现加密非常容易。.NET SDK中提供了CookieAuthentication类&#xff0c;其中的HashPasswordForStoringInC…

不追逐标准化产品,360数科的一站式风控体系有何不同?

新冠肺炎疫情无疑加速了金融行业数字化转型&#xff0c;竞争者不断涌入&#xff0c;逐渐形成由BATJ、传统银行旗下金融科技子公司、以及专注于金融机构的数字化服务公司构成的竞争格局。然而&#xff0c;风控始终是金融行业的核心。作为定位于中国零售金融领域科技服务商的360数…

基于Bootstrap里面的Button dropdown打造自定义select

最近工作非常的忙&#xff0c;在对一个系统进行改版。项目后台是MVC1.0开发的&#xff0c;但是前端部分已经改过几个版本&#xff0c;而已之前的设计师很强大&#xff0c;又做设计又做前端开发。而已很时尚和前沿&#xff0c;使用了一直都很热门的Bootstrap工具包&#xff0c;有…

HybridDB · 源码分析 · MemoryContext 内存管理和内存异常分析

背景 最近排查和解决了几处 HybridDB for PostgreSQL 内存泄漏的BUG。觉得有一定通用性。 这期分享给大家一些实现细节和小技巧。 阿里云上的 HybridDB for PostgreSQL 是基于 PostgreSQL 开发&#xff0c;定位于 OLAP 场景的 MPP 架构数据库集群。它不少的内部机制沿用了 Post…

联合南京大学,爱奇艺智能论文入选顶会CVPR 2021

日前&#xff0c;全球计算机视觉顶级会议CVPR (IEEE Conference on Computer Vision and Pattern Recognition)公布了2021年论文接收结果。作为计算机视觉领域世界三大顶会(CVPR、ICCV、ECCV)之一&#xff0c;CVPR的论文投稿量近五年来持续大涨。据CVPR官网显示&#xff0c;今…

Forefront_TMG_2010-TMG发布Web服务器

1.环境拓扑图&#xff1a;2.准备DMZ区域的Web服务器&#xff1a;安装Web服务器&#xff1a;在DMZ区域的Web服务器进行测试&#xff1a;3.TMG发布Web服务器&#xff1a;打开TMG管理控制台&#xff0c;新建“网站发布规则”&#xff1a;新建名称&#xff1a;选择“允许”&#xf…

ASP.NET实现身份模拟

使用模拟时&#xff0c;ASP.NET 应用程序可以选择以这些应用程序当前正为之操作的客户的身份执行。通常这样做的原因是为了避免在 ASP.NET 应用程序代码中处理身份验证和授权问题。而您依赖于 Microsoft Internet 信息服务 (IIS) 来验证用户&#xff0c;然后将已通过验证的标记…