请问ap =( int *) &a;这是什么意思?ap++;bp++;为什么要用这两个语句?为什么a,b两个值可以交换?

#include "pch.h"
#include
using namespace std;
int main()
{
double a = 123.456, b = 456.789;
int ap, *bp;
ap =( int *) &a;
bp =(int
)(&b);
cout << "a=" << a << "b=" << b << endl;
*ap = (*ap) ^ *(bp);
*bp = (*ap) ^ (*bp);
*ap = (*ap) ^ (*bp);
ap++;
bp++;
*ap = (*ap) ^ *(bp);
*bp = (*ap) ^ (*bp);
*ap = (*ap) ^ (*bp);
cout << "a=" << a << "b=" << b << endl; cout <<*ap << *bp;
return 0;
}

c++

1个回答

ap=(int*)&a; 这句话是把a的地址(double*)型转化成int*型,把int*的这个值赋值给ap这个int*型指针。

涉及到^异或的前三行(ap++前面)是交换a和b的值。(用异或运算交换值)
ap++;bp++; 这两句话是让ap和bp指向的地址往前进sizeof(int)个字节,访问可一个未知的地方。
接下来三行是把现在ap和bp所指向的值交换。(因为sizeof(double)>sizeof(int),所以会交换一部分a和b)

qq_43473753
Yes ,I can ! 你好,“把int*的这个值赋值给ap这个int*型指针”?不应该是把转化的int型值的地址赋给ap这个int*型指针吗?
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
请问ap =( int *) &a;这是什么意思?ap++;bp++;为什么要用这两个语句?为什么a,b两个值可以交换?
#include "pch.h" #include <iostream> using namespace std; int main() { double a = 123.456, b = 456.789; int *ap, *bp; ap =( int *) &a; bp =(int*)(&b); cout << "a=" << a << "b=" << b << endl; *ap = (*ap) ^ *(bp); *bp = (*ap) ^ (*bp); *ap = (*ap) ^ (*bp); ap++; bp++; *ap = (*ap) ^ *(bp); *bp = (*ap) ^ (*bp); *ap = (*ap) ^ (*bp); cout << "a=" << a << "b=" << b << endl; cout <<*ap << *bp; return 0; }
一个类中内嵌两个结构体
class AP_Vehicle { public: /* common parameters for fixed wing aircraft */ struct FixedWing { AP_Int8 throttle_min; AP_Int8 throttle_max; AP_Int8 throttle_slewrate; AP_Int8 throttle_cruise; AP_Int16 airspeed_min; AP_Int16 airspeed_max; AP_Int16 pitch_limit_max_cd; AP_Int16 pitch_limit_min_cd; AP_Int8 autotune_level; AP_Int16 land_pitch_cd; }; /* common parameters for multicopters */ struct MultiCopter { AP_Int16 angle_max; }; }; 一个类中内嵌两个结构体, static AP_Vehicle::MultiCopter aparm; //这个静态函数用来定义 这里的定义意思应该是aparm函数继承了MultiCopter的属性。 这样理解对吗?
c++ ofstream 把int=12写入文件后,打开文件只有2字节
问题: 用C++ ofstream把int=12写入文件后,打开文件只有2字节。 ``` std::ofstream outFile("hh.bin", std::ofstream::binary); int a = 12; int size = sizeof(a); char * ap = (char *)&a; outFile.write(ap, size); outFile.close(); ``` ![图片说明](https://img-ask.csdn.net/upload/202002/22/1582376785_299364.png) 用notepad++打开看,只有0c cc两个字节 如果把int a = 123456 (0001e240)写入文件,就是4个字节 ![图片说明](https://img-ask.csdn.net/upload/202002/22/1582376992_92581.png) 为什么12写入文件,只有2字节呢? **查阅过文件属性之后,发现占用空间是4字节。也许是notepad++的现实问题**
大神求解 有关c++指针的问题
double a = 123.456, b = 456.789; int *ap, *bp; ap = (int*)(&a); bp = (int*)(&b); cout << "a=" << a << "\tb=" << b << endl; *ap = (*ap) ^ (*bp); *bp = (*ap) ^ (*bp); *ap = (*ap) ^ (*bp); ap++; bp++; *ap = (*ap) ^ (*bp); *bp = (*ap) ^ (*bp); *ap = (*ap) ^ (*bp); cout << "a=" << a << "\tb=" << b << endl; 为什么这段码可以让两个值的数值互换呢
小白 求懂的帮忙讲讲
int myprintf(const char *format, ...) { va_list ap; int data; char str[32] = {0}; char *p; va_start(ap, format); while(*format != '\0') { if(*format == '%') { format++; switch(*format) { case 'x': break; case 'o': break; case '%': break; case 's': p = va_arg(ap, char *); myputs(p); break; case 'd': data = va_arg(ap, int); str[0] = '\0'; itoa(data, str); myputs(str); break; case 'c': data = va_arg(ap, int); putchar(data); break; } } else { putchar(*format); } format++; } va_end(ap); } int main(void) { myprintf("[%c]hello[%d][%s]world\n", 'A', 123, "Jason"); return 0; } 老师上课的给的一段代码 要把 x o % 下面补全 实在是没思路 谁能大概说下 这段代码编译了 大概理解什么意思 就是x o % 下面不知道怎么补
数据结构 有关多维数组的问题
int main(){ nArray<int> A(2, 3, 4); } /******************************/ template<typename aElem> class nArray{ private: aElem* base; int dim; int * bounds; int * constants; private: Status Locate(va_list, int&); public: nArray(int, ...); ~nArray(){ if (base) delete[] base; if (bounds) delete[]base; if (constants) delete[]constants; } Status Value(aElem&, ...); Status Assign(aElem, ...); }; template<typename aElem> nArray<aElem>::nArray(int d, ...) :dim(d), base(nullptr), bounds(nullptr), constants(nullptr){ va_list ap; va_start(ap, d); int elemtotal = 1; bounds = new int[dim]; constants = new int[dim];//运行到这行前,dim=2,貌似没问题,可是一到这行运行完,dim就变成了1323297024,并且有时程序崩溃出错,我实在找不到原因了,希望有前辈能指点下 for (int i = 0; i < dim; i++){ bounds[i] = va_arg(ap, int); if (bounds[i] < 0) exit(UNDERFLOW); elemtotal *= bounds[i]; } va_end(ap); base = new int[elemtotal]; if (!base) exit(OVERFLOW); constants[dim - 1] = 1; for (int i = dim - 2; i >= 0; --i) constants[i] = constants[i + 1] * bounds[i + 1]; } 大学生,刚开始学,问题可能极低级,请见谅 还有因为没什么人指点,如果哪写的不妥,也都请一并指出来,我好好改正,谢谢啦
knn猫狗识别算法中样本为0报错
错误如下: ValueError: With n_samples=0, test_size=0.25 and train_size=None, the resulting train set will be empty. Adjust any of the aforementioned parameters. 代码如下: # import the necessary packages from sklearn.neighbors import KNeighborsClassifier from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report from pyimagesearch.preprocessing import SimplePreprocessor from pyimagesearch.datasets import SimpleDatasetLoader from imutils import paths import argparse # construct the argument parse and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-d", "--datasets", type=str, default="‪H:\\111\\try1\\pyimagesearch\\datasets\\animals\\", help="path to input dataset") ap.add_argument("-k", "--neighbors", type=int, default=1, help="# of nearest neighbors for classification") ap.add_argument("-j", "--jobs", type=int, default=-1, help="# of jobs for k-NN distance (-1 uses all available cores)") args = vars(ap.parse_args()) # grab the list of images that we’ll be describing print("[INFO] loading images...") imagePaths = list(paths.list_images(args["datasets"])) # initialize the image preprocessor, load the dataset from disk, # and reshape the data matrix sp = SimplePreprocessor.SimplePreprocessor(32, 32) sdl = SimpleDatasetLoader.SimpleDatasetLoader(preprocessors=[sp]) (data, labels) = sdl.load(imagePaths, verbose=500) data = data.reshape((data.shape[0], 3072)) # show some information on memory consumption of the images print("[INFO] features matrix: {:.1f}MB".format( data.nbytes / (1024 * 1000.0))) # encode the labels as integers le = LabelEncoder() labels = le.fit_transform(labels) # partition the data into training and testing splits using 75% of # the data for training and the remaining 25% for testing (trainX, testX, trainY, testY) = train_test_split(data, labels, test_size=0.25, random_state=42) # train and evaluate a k-NN classifier on the raw pixel intensities print("[INFO] evaluating k-NN classifier...") model = KNeighborsClassifier(n_neighbors=args["neighbors"], n_jobs=args["jobs"]) model.fit(trainX, trainY) print(classification_report(testY, model.predict(testX), target_names=le.classes_)) ``` ```
全志A31s的AP6210驱动报错
报错信息如下,希望论坛的前辈指点一下 396825] dhd_bus_devreset: == WLAN ON == <4>[ 96.397188] dhd_conf_set_hw_oob_intr: Enable HW OOB for 43362 <4>[ 96.399852] F1 signature OK, socitype:0x1 chip:0xa962 rev:0x1 pkg:0x9 <4>[ 96.400676] DHD: dongle ram size is set to 245760(orig 245760) at 0x0 <4>[ 96.401370] dhd_conf_set_fw_name_by_chip: firmware_path=/system/vendor/modules/fw_bcm40181a2.bin <4>[ 96.401948] dhd_conf_download_config: dhd_master_mode = 0 <4>[ 96.401997] dhd_conf_download_config: pkt_filter_add[0][] = 120 0 0 12 0xFFFF000000000000000000FF00000000000000000000000000FF 0x0800000000000000000000110000000000000000000000000089 <4>[ 96.402020] dhd_conf_download_config: pkt_filter_add[1][] = 121 0 0 0 0xFFFF 0x3333 <4>[ 96.402081] Final fw_path=/system/vendor/modules/fw_bcm40181a2.bin <4>[ 96.402094] Final nv_path=/system/vendor/modules/nvram_ap6210.txt <4>[ 96.402107] Final conf_path=/system/vendor/modules/config.txt <4>[ 96.432921] NVRAM version: AP6210_NVRAM_V1.3_08182013 <4>[ 96.433597] dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded. <4>[ 96.434179] dhd_bus_init: delay 100ms for BCM43362 <4>[ 96.657226] dhd_bus_init: enable 0x06, ready 0x06 (waited 0us) <4>[ 96.657381] bcmsdh_set_drvdata: Enter <4>[ 96.657394] bcmsdh_set_irq: Flag = 1 <4>[ 96.657527] dhd_conf_set_band: Set band 0 <4>[ 96.661434] Firmware up: op_mode=0x0005, Broadcom Dongle Host Driver mac=94:a1:a2:6a:3b:1d <4>[ 96.661452] dhd_conf_set_country: Set country CN, revision 0 <4>[ 98.657220] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 53, RTO !! <4>[ 98.657245] [mmc]: *** sw_mci_request_done(L645): In data read operation <4>[ 98.657262] [mmc]: found data error, need to send stop command !! <4>[ 98.657279] [mmc]: *** sw_mci_send_manual_stop(L563): sdc 1 send stop command failed <4>[ 98.657333] bcmsdh_sdmmc: Failed to Read word, Err: 0xffffff92 <4>[ 98.657357] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 53, RTO !! <4>[ 98.657374] [mmc]: *** sw_mci_request_done(L645): In data read operation <4>[ 98.657388] [mmc]: found data error, need to send stop command !! <4>[ 98.657405] [mmc]: *** sw_mci_send_manual_stop(L563): sdc 1 send stop command failed <4>[ 98.657438] bcmsdh_sdmmc: Failed to Read word, Err: 0xffffff92 <4>[ 98.657461] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 53, RTO !! <4>[ 98.657478] [mmc]: *** sw_mci_request_done(L645): In data read operation <4>[ 98.657492] [mmc]: found data error, need to send stop command !! <4>[ 98.657508] [mmc]: *** sw_mci_send_manual_stop(L563): sdc 1 send stop command failed <4>[ 98.657541] bcmsdh_sdmmc: Failed to Read word, Err: 0xffffff92 <4>[ 98.657557] dhd_bus_rxctl: FAILEDstatusREAD, LINE 2650 <4>[ 98.657570] dhd_bus_rxctl: resumed on timeout, INT status=0x00000000 <4>[ 98.657599] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 52, RTO !! <4>[ 98.657625] bcmsdh_sdmmc: Failed to Write byte F1:@0x1000a=80, Err: -110 <4>[ 98.658662] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 52, RTO !! <4>[ 98.658700] bcmsdh_sdmmc: Failed to Write byte F1:@0x1000a=80, Err: -110 <4>[ 98.659736] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 52, RTO !! <4>[ 98.659769] bcmsdh_sdmmc: Failed to Write byte F1:@0x1000a=80, Err: -110 <4>[ 98.659784] dhdsdio_membytes: window change failed <4>[ 98.659815] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 52, RTO !! <4>[ 98.659848] bcmsdh_sdmmc: Failed to Write byte F1:@0x1000a=00, Err: -110 <4>[ 98.660882] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 52, RTO !! <4>[ 98.660914] bcmsdh_sdmmc: Failed to Write byte F1:@0x1000a=00, Err: -110 <4>[ 98.661949] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 52, RTO !! <4>[ 98.661983] bcmsdh_sdmmc: Failed to Write byte F1:@0x1000a=00, Err: -110 <4>[ 98.662035] dhd_conf_set_country: country code setting failed -110 <4>[ 98.662054] dhd_conf_fix_country: get channels failed with -1 <4>[ 98.662067] dhd_conf_fix_country: bcmerror=-1, # of channels 64 <4>[ 98.662080] dhd_conf_set_country: Set country CN, revision 0 <4>[ 98.662096] dhd_conf_set_country: country code setting failed -1 <4>[ 98.662109] dhd_conf_set_country: Set country US, revision 0 <4>[ 98.662124] dhd_conf_set_country: country code setting failed -1 <4>[ 98.662140] dhd_conf_get_country: country code getting failed -1 <4>[ 98.662156] dhd_conf_set_roam: Set roam_off 1 <4>[ 98.662215] bcmsdh_set_irq: Flag = 0 <4>[ 98.662267] [mmc]: *** sw_mci_dump_errinfo(L592): smc 1 err, cmd 52, RTO !! <4>[ 98.662297] sdioh_disable_func_intr: error for read SDIO_CCCR_IENx : 0xffffff92 <4>[ 98.662324] dhd_customer_gpio_wlan_ctrl: call customer specific GPIO to insert WLAN RESET <4>[ 98.662350] [ap6xxx]: succeed to set gpio ap6xxx_wl_regon to 0 ! <4>[ 98.762834] [ap6xxx]: sdio wifi power state: off <4>[ 98.762850] =========== WLAN placed in RESET ======== <4>[ 98.762862] wl_android_wifi_on: Failed
这个c程序什么意思啊,特别是第二个函数什么意思?
#include <stdio.h> #include <stdlib.h> #include <stdarg.h> void show_array(const double ar[], int n); double * new_d_array(int n, ...); int main() { double * p1; double * p2; p1 = new_d_array(5, 1.2, 2.3, 3.4, 4.5, 5.6); p2 = new_d_array(4, 100.0, 20.00, 8.08, -1890.0); show_array(p1, 5); show_array(p2, 4); free(p1); free(p2); return 0; } void show_array(const double ar[], int n) { int i; for(i=0; i<n; i++) printf("%g\t", ar[i]); printf("\n"); } double * new_d_array(int n, ...) { double *p; int i; va_list ap; p = (double *) malloc(n*sizeof(double)); va_start(ap, n); for(i=0; i<n; i++) p[i] = va_arg(ap, double); va_end(ap); return p; } 第二个函数什么意思,我对可变参数也不是很理解,求详解。
c++ 头文件定义数组 实现文件初始化 问题
c++ 新手 在类里定义一个数组 class A { public: A(); private: int m_a[3]; }; 在实现文件里初始化 A::A() { // 这样为什么不对 m_a = {1, 2, 3}; // 这样就可以 m_ap[0] = 1; m_ap[1] = 2; m_ap[2] = 3; } 怎样才能在实现文件里初始化 我知道有一种是用static有没有其它的方法
SQL Server提示错误,求高手帮解决
select gl.ccus_id 客户编码, gl.cexch_name 币种, gl.cbegind_c 金额期初方向, (case when gl.cbegind_c = '借' then SUM(ISNULL(gl.mb, 0)) + SUM(ISNULL(ap.iAmount_f,0)) - SUM(ISNULL(dts.iQuantity * dts.iTaxUnitPrice, 0)) else sum(isnull(-gl.mb, 0)) + SUM(ISNULL(ap.iAmount_f,0)) - SUM(ISNULL(dts.iQuantity * dts.iTaxUnitPrice, 0)) end ) 期初余额, gl.iyear 年, gl.iYPeriod 年月 from GL_accass gl --辅助总账 left join Ap_CloseBill ap on ap.cDwCode = gl.ccus_id and LEFT(ap.dVouchDate, 6) = gl.iYPeriod --收付款 left join DispatchList dt on dt.cCusCode = gl.ccus_id and LEFT(dt.dDate, 6) = gl.iYPeriod --发退货主表 left join DispatchLists dts on dts.DLID = dt.DLID --发退货子表 where ap.cDigest = '收货款' and gl.iyear = '2015' group by gl.ccus_id, gl.ccus_id, gl.cexch_name, gl.cbegind_c, gl.iyear , gl.iYPeriod 消息 245,级别 16,状态 1,第 1 行 在将 varchar 值 '11 21 ' 转换成数据类型 int 时失败。 求高手解决问题。谢谢。
父类非虚函数,子类继承变成虚函数,会发生什么
想法很奇葩,运行结果更是奇葩,大家看应该怎么解释一下,运行环境是vs2012 release Win32平台 代码: ``` c++ #include<iostream> using namespace std; class A { public: void foo() { printf("A类中:实foo()\n"); } virtual void fun() { printf("A类中:虚fun()\n"); } }; class B : public A { public: virtual void foo() { printf("B类中:虚foo()\n"); } void fun() { printf("B类中:实fun()\n"); } }; class C : public B { public: void foo() { printf("C类中:实foo()\n"); } void fun() { printf("C类中:实fun()\n"); } }; int main(void) { A a; B b; C oc; A *ap = &a; ap->foo(); //父实子虚 ap->fun(); //父虚子实 cout<<endl; ap = &b; ap->foo(); ap->fun(); cout<<endl; cout<<"???"<<endl; B *ptr = (B *)&a; ptr->foo(); //为什么是c ptr->fun(); //为什么是c cout<<endl; B *bp = &b; bp->foo(); bp->fun(); cout<<endl; bp = &oc; bp->foo(); bp->fun(); //为什么不是B中 cout<<endl; return 0; } ``` 运行结果: ![图片说明](https://img-ask.csdn.net/upload/201508/04/1438690862_960230.jpg)
socket编程write和read方式对应
1.NumberConverter.java public interface NumberConverter { public int toInt(byte[] b,int x,int y); } 2.MyServer.java import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; public class MyServer { private int lengthOffset; private int lengthSize; private int lengthAddtive; public int getLengthOffset() { return lengthOffset; } public void setLengthOffset(int lengthOffset) { this.lengthOffset = lengthOffset; } public int getLengthSize() { return lengthSize; } public void setLengthSize(int lengthSize) { this.lengthSize = lengthSize; } public int getLengthAddtive() { return lengthAddtive; } public void setLengthAddtive(int lengthAddtive) { this.lengthAddtive = lengthAddtive; } public void setNumberConverter(NumberConverter numberConverter){ this.numberConverter = numberConverter; } private NumberConverter numberConverter = new NumberConverter(){ public int toInt(byte[] b, int i, int i_0_) { String temp = ""; int i_1_ = 0; for(int i_2_=0;i_2_<i_0_;i_2_++){ temp = Byte.toString(b[i+i_2_]); if(!("32").equals(temp)){ i_1_ = i_1_*10 + ((b[i+i_2_] & 0xff) - 48); } } return i_1_; } }; public byte[] getBytesByLength(InputStream in0,int off,int len,NumberConverter converter,int addtive) throws IOException{ DataInputStream in1 = new DataInputStream(in0); byte[] lengthBytes = new byte[off+len]; in1.readFully(lengthBytes); int length = converter.toInt(lengthBytes, off, len); length+=addtive; System.out.println("接收客户端传输的字符长度为:"+length); return lengthBytes; } private byte[] resolve(InputStream in) throws IOException { lengthOffset = 0; lengthSize = 7; if(lengthSize>0){ return (getBytesByLength(in, lengthOffset, lengthSize, numberConverter, lengthAddtive)); }else{ throw new IllegalArgumentException("length size must > 0"); } } public static void main(String[] args) throws IOException { ServerSocket server = new ServerSocket(9999); System.out.println("我是服务器,等待客户端连接..."); Socket ssoc = null; String sendStr = "你好,我是服务器。"; while(true){ ssoc = server.accept(); //测试--重要步骤,关键 MyServer ms = new MyServer(); ms.resolve(ssoc.getInputStream()); //读取客户端的请求信息 InputStream in = ssoc.getInputStream(); DataInputStream din = new DataInputStream(in); String receiveStr = null; byte[] rBuf = new byte[7]; din.read(rBuf); receiveStr = new String(rBuf,0,7); System.out.println("我是服务器,客户端请求的信息:"+receiveStr); //响应客户端的请求 OutputStream out = ssoc.getOutputStream(); DataOutputStream dout = new DataOutputStream(out); byte[] buf = sendStr.getBytes(); out.write(buf); //关闭资源 out.close(); in.close(); ssoc.close(); } } } 3.MyClient.java import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; public class MyClient { public static void main(String[] args) throws IOException{ Socket soc = new Socket("127.0.0.1",9999); System.out.println("我是客户端,连接中..."); String sendStr = "<ap></ap>"; //向服务器发送消息 OutputStream out = soc.getOutputStream(); DataOutputStream dout = new DataOutputStream(out); byte[] buf = sendStr.getBytes(); out.write(buf); //读取服务器响应消息 InputStream in = soc.getInputStream(); DataInputStream din = new DataInputStream(in); String receiveStr = null; byte[] rBuf = new byte[1024]; din.read(rBuf); receiveStr = new String(rBuf); System.out.println("我是客户端,服务器响应的信息:"+receiveStr); //关闭资源 in.close(); out.close(); soc.close(); } } 疑问:System.out.println("接收客户端传输的字符长度为:"+length);接收客户端传输的字符长度为:17555239; 怎样通过修改MyClient.java,让此长度正确读取后转换为正确的字符串长度。 MyServer中resolve方法相关都不可以变更。因为这部分是框架中的内容,包括toInt方法都不可变。 请教一下,大神。万分感谢!
在训练Tensorflow模型(object_detection)时,训练在第一次评估后退出,怎么使训练继续下去?
当我进行ssd模型训练时,训练进行了10分钟,然后进入评估阶段,评估之后程序就自动退出了,没有看到误和警告,这是为什么,怎么让程序一直训练下去? 训练命令: ``` python object_detection/model_main.py --pipeline_config_path=D:/gitcode/models/research/object_detection/ssd_mobilenet_v1_coco_2018_01_28/pipeline.config --model_dir=D:/gitcode/models/research/object_detection/ssd_mobilenet_v1_coco_2018_01_28/saved_model --num_train_steps=50000 --alsologtostderr ``` 配置文件: ``` training exit after the first evaluation(only one evaluation) in Tensorflow model(object_detection) without error and waring System information What is the top-level directory of the model you are using:models/research/object_detection/ Have I written custom code (as opposed to using a stock example script provided in TensorFlow):NO OS Platform and Distribution (e.g., Linux Ubuntu 16.04):Windows-10(64bit) TensorFlow installed from (source or binary):conda install tensorflow-gpu TensorFlow version (use command below):1.13.1 Bazel version (if compiling from source):N/A CUDA/cuDNN version:cudnn-7.6.0 GPU model and memory:GeForce GTX 1060 6GB Exact command to reproduce:See below my command for training : python object_detection/model_main.py --pipeline_config_path=D:/gitcode/models/research/object_detection/ssd_mobilenet_v1_coco_2018_01_28/pipeline.config --model_dir=D:/gitcode/models/research/object_detection/ssd_mobilenet_v1_coco_2018_01_28/saved_model --num_train_steps=50000 --alsologtostderr This is my config : train_config { batch_size: 24 data_augmentation_options { random_horizontal_flip { } } data_augmentation_options { ssd_random_crop { } } optimizer { rms_prop_optimizer { learning_rate { exponential_decay_learning_rate { initial_learning_rate: 0.00400000018999 decay_steps: 800720 decay_factor: 0.949999988079 } } momentum_optimizer_value: 0.899999976158 decay: 0.899999976158 epsilon: 1.0 } } fine_tune_checkpoint: "D:/gitcode/models/research/object_detection/ssd_mobilenet_v1_coco_2018_01_28/model.ckpt" from_detection_checkpoint: true num_steps: 200000 train_input_reader { label_map_path: "D:/gitcode/models/research/object_detection/idol/tf_label_map.pbtxt" tf_record_input_reader { input_path: "D:/gitcode/models/research/object_detection/idol/train/Iframe_??????.tfrecord" } } eval_config { num_examples: 8000 max_evals: 10 use_moving_averages: false } eval_input_reader { label_map_path: "D:/gitcode/models/research/object_detection/idol/tf_label_map.pbtxt" shuffle: false num_readers: 1 tf_record_input_reader { input_path: "D:/gitcode/models/research/object_detection/idol/eval/Iframe_??????.tfrecord" } ``` 窗口输出: (default) D:\gitcode\models\research>python object_detection/model_main.py --pipeline_config_path=D:/gitcode/models/research/object_detection/ssd_mobilenet_v1_coco_2018_01_28/pipeline.config --model_dir=D:/gitcode/models/research/object_detection/ssd_mobilenet_v1_coco_2018_01_28/saved_model --num_train_steps=50000 --alsologtostderr WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0. For more information, please see: https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md https://github.com/tensorflow/addons If you depend on functionality not listed there, please file an issue. WARNING:tensorflow:Forced number of epochs for all eval validations to be 1. WARNING:tensorflow:Expected number of evaluation epochs is 1, but instead encountered eval_on_train_input_config.num_epochs = 0. Overwriting num_epochs to 1. WARNING:tensorflow:Estimator's model_fn (<function create_model_fn..model_fn at 0x0000027CBAB7BB70>) includes params argument, but params are not passed to Estimator. WARNING:tensorflow:From C:\Users\qian\Anaconda3\envs\default\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. WARNING:tensorflow:From C:\Users\qian\Anaconda3\envs\default\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\dataset_builder.py:86: parallel_interleave (from tensorflow.contrib.data.python.ops.interleave_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.data.experimental.parallel_interleave(...). WARNING:tensorflow:From C:\Users\qian\Anaconda3\envs\default\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\core\preprocessor.py:196: sample_distorted_bounding_box (from tensorflow.python.ops.image_ops_impl) is deprecated and will be removed in a future version. Instructions for updating: seed2 arg is deprecated.Use sample_distorted_bounding_box_v2 instead. WARNING:tensorflow:From C:\Users\qian\Anaconda3\envs\default\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\dataset_builder.py:158: batch_and_drop_remainder (from tensorflow.contrib.data.python.ops.batching) is deprecated and will be removed in a future version. Instructions for updating: Use tf.data.Dataset.batch(..., drop_remainder=True). WARNING:tensorflow:From C:\Users\qian\Anaconda3\envs\default\lib\site-packages\tensorflow\python\ops\losses\losses_impl.py:448: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead. WARNING:tensorflow:From C:\Users\qian\Anaconda3\envs\default\lib\site-packages\tensorflow\python\ops\array_grad.py:425: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead. 2019-08-14 16:29:31.607841: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties: name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.7845 pciBusID: 0000:04:00.0 totalMemory: 6.00GiB freeMemory: 4.97GiB 2019-08-14 16:29:31.621836: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0 2019-08-14 16:29:32.275712: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix: 2019-08-14 16:29:32.283072: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0 2019-08-14 16:29:32.288675: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0: N 2019-08-14 16:29:32.293514: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4714 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:04:00.0, compute capability: 6.1) WARNING:tensorflow:From C:\Users\qian\Anaconda3\envs\default\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\eval_util.py:796: to_int64 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead. WARNING:tensorflow:From C:\Users\qian\Anaconda3\envs\default\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\utils\visualization_utils.py:498: py_func (from tensorflow.python.ops.script_ops) is deprecated and will be removed in a future version. Instructions for updating: tf.py_func is deprecated in TF V2. Instead, use tf.py_function, which takes a python function which manipulates tf eager tensors instead of numpy arrays. It's easy to convert a tf eager tensor to an ndarray (just call tensor.numpy()) but having access to eager tensors means tf.py_functions can use accelerators such as GPUs as well as being differentiable using a gradient tape. 2019-08-14 16:41:44.736212: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0 2019-08-14 16:41:44.741242: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix: 2019-08-14 16:41:44.747522: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0 2019-08-14 16:41:44.751256: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0: N 2019-08-14 16:41:44.755548: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4714 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:04:00.0, compute capability: 6.1) WARNING:tensorflow:From C:\Users\qian\Anaconda3\envs\default\lib\site-packages\tensorflow\python\training\saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version. Instructions for updating: Use standard file APIs to check for files with this prefix. creating index... index created! creating index... index created! Running per image evaluation... Evaluate annotation type bbox DONE (t=2.43s). Accumulating evaluation results... DONE (t=0.14s). Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.287 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.529 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.278 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.031 Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.312 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.162 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.356 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.356 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.061 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.384 (default) D:\gitcode\models\research>
findfirst findnext遍历文件夹下的文件,老是缺少一个怎么回事
``` TSearchRec StrRecord; int iAttributes = 0; iAttributes |= faAnyFile; if(FindFirst(StrFolder + "\\" + StrFile, iAttributes, StrRecord) == 0) { do { m_Ap5FileNameList.push_back(StrRecord.Name); }while(FindNext(StrRecord) == 0); FindClose(StrRecord); } ``` 怎么回事
C++解决最大大于0子矩阵和
Description _AP神牛准备给自己盖一座很华丽的宫殿。于是,他看中了一块N*M的矩形空地。空地中每个格子都有自己的海拔高度。AP想让他的宫殿的平均海拔在海平面之上(假设海平面的高度是0,平均数都会算吧?)。而且,AP希望他的宫殿尽量大,能够容纳更多的人来膜拜他。请问AP的宫殿最后会有多大? Input Format 第一行为N和M。之后N行,每行M个数,描述的空地的海拔。 Output Format 输出一行,表示宫殿最大面积。 _ Sample Input 3 2 4 0 -10 8 -2 -2 Sample Output 4 Data Limit 对于30%的数据,N,M≤50; 对于100%的数据,N,M≤200; 数据很大,O(n^4)肯定过不了,希望大神能在不改变源程序的思路的基础上将此题改好,代码如下 ``` #include<iostream> using namespace std; int n,m,s[201][201],sum[201],f[201]; int main() { int i,j,ans=0,j1,j2,k,p,t; cin>>n>>m; for(i=1;i<=n;i++) for(j=1;j<=m;j++) { cin>>t; s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+t; } for(j1=1;j1<=n;j1++) for(j2=j1;j2<=n;j2++) { for(k=1;k<=n;k++) sum[k]=s[k][j2]-s[k][j1-1]; for(k=1;k<=n;k++) if(sum[k]>sum[k-1]) { f[k]=k; for(p=0;p<=f[k-1];p++) if(sum[k]-sum[p]>0) { f[k]=p; if((j2-j1+1)*(k-p)>ans) ans=(j2-j1+1)*(k-p); } else { f[k]=k; for(p=f[k-1];p<=k-1;p++) if(sum[k]-sum[p]>0) { f[k]=p; if((j2-j1+1)*(k-p)>ans) ans=(j2-j1+1)*(k-p); } } } } cout<<ans; return 0; } ```
获取已打开多个的EXCEL操作
【背景】南方CASS软件打开几千个EXCEL表格(都是新建的,还没保存),它们的特点是:一个excel在进程中表现为一个exccel进程,现在想以第一个工作表作为名称保存所有excel。 使用System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")只能获取第一个excel进程,于是我遍历进程,处理一个关闭一个,具体代码是: private void btnSave_Click(object sender, EventArgs e) { Process[] pl = Process.GetProcesses(); for (int i = 0; i < pl.Length; i++) { try { if (pl[i].ProcessName.ToLower()=="excel") { MessageBox.Show(pl[i].Id.ToString()); Microsoft.Office.Interop.Excel.Application ap = (Microsoft.Office.Interop.Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application"); MessageBox.Show(ap.Workbooks.Count.ToString());//问题表现 for (int j = 1; j <= ap.Workbooks.Count;j++ ) { Microsoft.Office.Interop.Excel.Workbook book = ap.Workbooks[j]; if (book != null) { //MessageBox.Show(book.Name); fileName = ((Microsoft.Office.Interop.Excel.Worksheet)book.ActiveSheet).Name; book.SaveAs(filePath + fileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); } } ap.Quit(); pl[i].Kill(); } } catch (System.Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace + "\n" + ex.Source + "\n" + ex.TargetSite); } } } 【问题】但这样的问题在于有时候能成功处理,有时候又不行,原因是有时excel进程Workbooks.Count=0,感觉是关闭进程的问题,求大神指出问题在哪里,或者给出其他解决方案。
printf 在内存里做了什么?
``` #define _GNU_SOURCE #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> void func(); void main(int argc,char **argv) { printf("i am main\n"); int clone_flag,arg,retval; char *stack; clone_flag=CLONE_VM|CLONE_SIGHAND; stack=(char*)malloc(4096); retval=clone((void*)func,&(stack[4095]),clone_flag,NULL); stack=(char*)malloc(4096); retval=clone((void*)func,&(stack[4095]),clone_flag,NULL); } void func() { int i; for(i=0;i<3;i++) { printf("i: %d\n ",i); } } ``` output: ``` i am main i: 0 i: 1 ``` strace -f ``` 5915 fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(4, 1), ...}) = 0 5915 ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0 5915 brk(NULL) = 0xaf2000 5915 brk(0xb14000) = 0xb14000 5915 write(1, "i am main\n", 10) = 10 5915 clone(child_stack=0xaf400f, flags=CLONE_VM|CLONE_SIGHAND) = 5916 5915 clone(child_stack=0xaf501f, flags=CLONE_VM|CLONE_SIGHAND) = 5917 5915 exit_group(5917) = ? 5915 +++ exited with 29 +++ 5917 write(1, "i", 1) = 1 5917 write(1, ": 0\n ", 5) = 5 5917 write(1, "i", 1) = 1 5917 write(1, ": 1\n ", 5) = 5 5916 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xaf194f} --- 5916 +++ killed by SIGSEGV (core dumped) +++ 5917 +++ killed by SIGSEGV +++ ``` gdb ./a.out core ``` Core was generated by `./a.out'. Program terminated with signal SIGSEGV, Segmentation fault. #0 buffered_vfprintf (s=0x7f737fd43620 <_IO_2_1_stdout_>, format=0x40074e "i: %d\n ", args=0x1f49f27) at vfprintf.c:2299 2299 vfprintf.c: No such file or directory. [Current thread is 1 (LWP 6280)] (gdb) where #0 buffered_vfprintf (s=0x7f737fd43620 <_IO_2_1_stdout_>, format=0x40074e "i: %d\n ", args=0x1f49f27) at vfprintf.c:2299 #1 0x00007f737f9cb32d in _IO_vfprintf_internal ( s=0x7f737fd43620 <_IO_2_1_stdout_>, format=0x40074e "i: %d\n ", ap=ap@entry=0x1f49f27) at vfprintf.c:1293 #2 0x00007f737f9d3899 in __printf (format=<optimized out>) at printf.c:33 #3 0x00000000004006a8 in func () at code.c:23 #4 0x00007f737fa8541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109 ``` **如果我把“printf("i am main\n")”删掉,一切运行正常** strace ``` 5937 brk(NULL) = 0x1f75000 5937 brk(0x1f97000) = 0x1f97000 5937 clone(child_stack=0x1f75fff, flags=CLONE_VM|CLONE_SIGHAND) = 5938 5937 clone(child_stack=0x1f7700f, flags=CLONE_VM|CLONE_SIGHAND) = 5939 5937 exit_group(5939) = ? 5937 +++ exited with 51 +++ 5939 fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(4, 1), ...}) = 0 5939 ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0 5939 write(1, "i: 0\n", 5) = 5 5939 write(1, " i: 1\n", 6) = 6 5939 write(1, " i: 2\n", 6) = 6 5938 write(1, " i: 2\ni: 0\n", 11) = 11 5939 exit_group(6) = ? 5939 +++ exited with 6 +++ 5938 write(1, " i: 1\n", 6) = 6 5938 write(1, " i: 2\n", 6) = 6 5938 exit_group(6) = ? 5938 +++ exited with 6 +++ ``` 为什么一个printf就能有这么大的影响呢?还有为什么SIGSEGV会把另外一个进程给杀死呢?
新手求助,C++的头文件引用问题
为什么#include "container.h"报错说打不开source file啊,我完全不知道怎么回事,啊啊啊啊啊,求帮助 #ifndef _CONTAINER #define _CONTAINER #include <iostream> using namespace std; class container { protected: int numOfHeal; int numOfMW; public: container(); void set(int heal_n, int mw_n); int nOfHeal(); int nOfMW(); void display(); bool useHeal(); bool useMW(); }; container::container() { set(0, 0); }; void container::set(int heal_n, int mw_n) { numOfHeal = heal_n; numOfMW = mw_n; }; int container::nOfHeal() { return numOfHeal; }; int container::nOfMW() { return numOfMW; }; void container::display() { cout << "Your bag contains: " << endl; cout << "Heal(HP+100): " << numOfHeal << endl; cout << "Magic Water (MP+80): " << numOfMW << endl; }; bool container::useHeal() { numOfHeal--; return 1; }; //use magic water bool container::useMW() { numOfMW--; return 1; }; #endif #ifndef _PLAYER #define _PLAYER #include <iomanip> #include <time.h> #include "container.h" #include <iostream> using namespace std; enum job { sw, ar, mg }; class player { friend void showinfo(player &p1, player &p2); friend class swordsman; protected: int HP, HPmax, MP, MPmax, AP, DP, speed, EXP, LV; string name; job role; container bag; public: virtual bool attack(player &p) = 0; virtual bool specialatt(player &p) = 0; virtual void isLevelUp() = 0; void reFill(); bool death(); void isDead(); bool useHeal(); bool useMW(); void transfer(player &p); void showRole(); private: bool playerdeath; }; void player::reFill() { HP = HPmax; MP = MPmax; } bool player::death() { return playerdeath; }; void player::isDead() { if (HP <= 0) cout << name << " is Dead." << endl; system("pause"); playerdeath = 1; } }; bool player::useHeal() { if (bag.nOfHeal()>0) { HP = HP + 100; if (HP>HPmax) HP = HPmax; cout << name << " used Heal, HP increased by 100." << endl; bag.useHeal(); system("pause"); return 1; } else { cout << "Sorry, you don't have heal to use." << endl; system("pause"); return 0; } }; bool player::useMW() { if (bag.nOfMW()>0) { MP = MP + 100; if (MP>MPmax) MP = MPmax; cout << name << " used Magic Water, MP increased by 100." << endl; bag.useMW(); system("pause"); return 1; } else { cout << "Sorry, you don't have magic water to use." << endl; system("pause"); return 0; } } // possess opponent's items after victory void player::transfer(player &p) { cout << name << " got" << p.bag.nOfHeal() << " Heal, and " << p.bag.nOfMW() << " Magic Water." << endl; system("pause"); p.bag.set(p.bag.nOfHeal(), p.bag.nOfMW()); }; void player::showRole() { switch (role) { case sw: cout << "Swordsman"; break; case ar: cout << "Archer"; break; case mg: cout << "Mage"; break; default: break; } }; // display character's job void showRole() { system("cls"); cout << "##############################################################" << endl; cout << "# Player" << setw(10) << p1.name << " LV. " << setw(3) << p1.LV << " # Opponent" << setw(10) << p2.name << " LV. " << setw(3) << p2.LV << " #" << endl; cout << "# HP " << setw(3) << (p1.HP <= 999 ? p1.HP : 999) << '/' << setw(3) << (p1.HPmax <= 999 ? p1.HPmax : 999) << " | MP " << setw(3) << (p1.MP <= 999 ? p1.MP : 999) << '/' << setw(3) << (p1.MPmax <= 999 ? p1.MPmax : 999) << " # HP " << setw(3) << (p2.HP <= 999 ? p2.HP : 999) << '/' << setw(3) << (p2.HPmax <= 999 ? p2.HPmax : 999) << " | MP " << setw(3) << (p2.MP <= 999 ? p2.MP : 999) << '/' << setw(3) << (p2.MPmax <= 999 ? p2.MPmax : 999) << " #" << endl; cout << "# AP " << setw(3) << (p1.AP <= 999 ? p1.AP : 999) << " | DP " << setw(3) << (p1.DP <= 999 ? p1.DP : 999) << " | speed " << setw(3) << (p1.speed <= 999 ? p1.speed : 999) << " # AP " << setw(3) << (p2.AP <= 999 ? p2.AP : 999) << " | DP " << setw(3) << (p2.DP <= 999 ? p2.DP : 999) << " | speed " << setw(3) << (p2.speed <= 999 ? p2.speed : 999) << " #" << endl; cout << "# EXP" << setw(7) << p1.EXP << " Job: " << setw(7); p1.showRole(); cout << " # EXP" << setw(7) << p2.EXP << " Job: " << setw(7); p2.showRole(); cout << " #" << endl; cout << "--------------------------------------------------------------" << endl; p1.bag.display(); cout << "##############################################################" << endl; }; #endif
程序报出NullPointerException
在第39行代码:`modelBatch.begin(cam);`报出 **NullPointerException** 异常。 请帮忙看看怎么回事,谢谢。 public class Loading implements Screen { private boolean AP; private Chemistry chemistry; public PerspectiveCamera cam; public ModelBatch modelBatch; public Model model; public ModelInstance instance; public Lights lights; public Loading(boolean AP, Chemistry chemistry) { this.AP = AP; this.chemistry = chemistry; } @Override public void render(float delta) { Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); modelBatch.begin(cam); modelBatch.render(instance, lights); modelBatch.end(); } @Override public void resize(int width, int height) { } @Override public void show() { modelBatch = new ModelBatch(); lights = new Lights(); lights.ambientLight.set(0.4f, 0.4f, 0.4f, 1f); lights.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f)); cam = new PerspectiveCamera(70, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(10f, 10f, 10f); cam.lookAt(0, 0, 0); cam.near = 0.1f; cam.far = 300f; cam.update(); ModelBuilder modelBuilder = new ModelBuilder(); model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position | Usage.Normal); instance = new ModelInstance(model); } ... }
在中国程序员是青春饭吗?
今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...
《MySQL 性能优化》之理解 MySQL 体系结构
本文介绍 MySQL 的体系结构,包括物理结构、逻辑结构以及插件式存储引擎。
程序员请照顾好自己,周末病魔差点一套带走我。
程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。
Python+OpenCV实时图像处理
目录 1、导入库文件 2、设计GUI 3、调用摄像头 4、实时图像处理 4.1、阈值二值化 4.2、边缘检测 4.3、轮廓检测 4.4、高斯滤波 4.5、色彩转换 4.6、调节对比度 5、退出系统 初学OpenCV图像处理的小伙伴肯定对什么高斯函数、滤波处理、阈值二值化等特性非常头疼,这里给各位分享一个小项目,可通过摄像头实时动态查看各类图像处理的特点,也可对各位调参、测试...
2020年一线城市程序员工资大调查
人才需求 一线城市共发布岗位38115个,招聘120827人。 其中 beijing 22805 guangzhou 25081 shanghai 39614 shenzhen 33327 工资分布 2020年中国一线城市程序员的平均工资为16285元,工资中位数为14583元,其中95%的人的工资位于5000到20000元之间。 和往年数据比较: yea...
为什么猝死的都是程序员,基本上不见产品经理猝死呢?
相信大家时不时听到程序员猝死的消息,但是基本上听不到产品经理猝死的消息,这是为什么呢? 我们先百度搜一下:程序员猝死,出现将近700多万条搜索结果: 搜索一下:产品经理猝死,只有400万条的搜索结果,从搜索结果数量上来看,程序员猝死的搜索结果就比产品经理猝死的搜索结果高了一倍,而且从下图可以看到,首页里面的五条搜索结果,其实只有两条才是符合条件。 所以程序员猝死的概率真的比产品经理大,并不是错...
害怕面试被问HashMap?这一篇就搞定了!
声明:本文以jdk1.8为主! 搞定HashMap 作为一个Java从业者,面试的时候肯定会被问到过HashMap,因为对于HashMap来说,可以说是Java集合中的精髓了,如果你觉得自己对它掌握的还不够好,我想今天这篇文章会非常适合你,至少,看了今天这篇文章,以后不怕面试被问HashMap了 其实在我学习HashMap的过程中,我个人觉得HashMap还是挺复杂的,如果真的想把它搞得明明白...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
python爬取百部电影数据,我分析出了一个残酷的真相
2019年就这么匆匆过去了,就在前几天国家电影局发布了2019年中国电影市场数据,数据显示去年总票房为642.66亿元,同比增长5.4%;国产电影总票房411.75亿元,同比增长8.65%,市场占比 64.07%;城市院线观影人次17.27亿,同比增长0.64%。 看上去似乎是一片大好对不对?不过作为一名严谨求实的数据分析师,我从官方数据中看出了一点端倪:国产票房增幅都已经高达8.65%了,为什...
推荐10个堪称神器的学习网站
每天都会收到很多读者的私信,问我:“二哥,有什么推荐的学习网站吗?最近很浮躁,手头的一些网站都看烦了,想看看二哥这里有什么新鲜货。” 今天一早做了个恶梦,梦到被老板辞退了。虽然说在我们公司,只有我辞退老板的份,没有老板辞退我这一说,但是还是被吓得 4 点多都起来了。(主要是因为我掌握着公司所有的核心源码,哈哈哈) 既然 4 点多起来,就得好好利用起来。于是我就挑选了 10 个堪称神器的学习网站,推...
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
阿里面试,面试官没想到一个ArrayList,我都能跟他扯半小时
我是真的没想到,面试官会这样问我ArrayList。
曾经优秀的人,怎么就突然不优秀了。
职场上有很多辛酸事,很多合伙人出局的故事,很多技术骨干被裁员的故事。说来模板都类似,曾经是名校毕业,曾经是优秀员工,曾经被领导表扬,曾经业绩突出,然而突然有一天,因为种种原因,被裁员了,...
C语言荣获2019年度最佳编程语言
关注、星标公众号,不错过精彩内容作者:黄工公众号:strongerHuang近日,TIOBE官方发布了2020年1月编程语言排行榜单。我在前面给过一篇文章《2019年11月C语言接近Ja...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
良心推荐,我珍藏的一些Chrome插件
上次搬家的时候,发了一个朋友圈,附带的照片中不小心暴露了自己的 Chrome 浏览器插件之多,于是就有小伙伴评论说分享一下我觉得还不错的浏览器插件。 我下面就把我日常工作和学习中经常用到的一些 Chrome 浏览器插件分享给大家,随便一个都能提高你的“生活品质”和工作效率。 Markdown Here Markdown Here 可以让你更愉快的写邮件,由于支持 Markdown 直接转电子邮...
看完这篇HTTP,跟面试官扯皮就没问题了
我是一名程序员,我的主要编程语言是 Java,我更是一名 Web 开发人员,所以我必须要了解 HTTP,所以本篇文章就来带你从 HTTP 入门到进阶,看完让你有一种恍然大悟、醍醐灌顶的感觉。 最初在有网络之前,我们的电脑都是单机的,单机系统是孤立的,我还记得 05 年前那会儿家里有个电脑,想打电脑游戏还得两个人在一个电脑上玩儿,及其不方便。我就想为什么家里人不让上网,我的同学 xxx 家里有网,每...
史上最全的IDEA快捷键总结
现在Idea成了主流开发工具,这篇博客对其使用的快捷键做了总结,希望对大家的开发工作有所帮助。
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
谁是华为扫地僧?
是的,华为也有扫地僧!2020年2月11-12日,“养在深闺人不知”的华为2012实验室扫地僧们,将在华为开发者大会2020(Cloud)上,和大家见面。到时,你可以和扫地僧们,吃一个洋...
AI 没让人类失业,搞 AI 的人先失业了
最近和几个 AI 领域的大佬闲聊 根据他们讲的消息和段子 改编出下面这个故事 如有雷同 都是巧合 1. 老王创业失败,被限制高消费 “这里写我跑路的消息实在太夸张了。” 王葱葱哼笑一下,把消息分享给群里。 阿杰也看了消息,笑了笑。在座几位也都笑了。 王葱葱是个有名的人物,21岁那年以全额奖学金进入 KMU 攻读人工智能博士,累计发表论文 40 余篇,个人技术博客更是成为深度学习领域内风向标。 ...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
一份王者荣耀的英雄数据报告
咪哥杂谈本篇阅读时间约为 6 分钟。1前言前一阵写了关于王者的一些系列文章,从数据的获取到数据清洗,数据落地,都是为了本篇的铺垫。今天来实现一下,看看不同维度得到的结论。2环境准备本次实...
作为一名大学生,如何在B站上快乐的学习?
B站是个宝,谁用谁知道???? 作为一名大学生,你必须掌握的一项能力就是自学能力,很多看起来很牛X的人,你可以了解下,人家私底下一定是花大量的时间自学的,你可能会说,我也想学习啊,可是嘞,该学习啥嘞,不怕告诉你,互联网时代,最不缺的就是学习资源,最宝贵的是啥? 你可能会说是时间,不,不是时间,而是你的注意力,懂了吧! 那么,你说学习资源多,我咋不知道,那今天我就告诉你一个你必须知道的学习的地方,人称...
那些年,我们信了课本里的那些鬼话
教材永远都是有错误的,从小学到大学,我们不断的学习了很多错误知识。 斑羚飞渡 在我们学习的很多小学课文里,有很多是错误文章,或者说是假课文。像《斑羚飞渡》: 随着镰刀头羊的那声吼叫,整个斑羚群迅速分成两拨,老年斑羚为一拨,年轻斑羚为一拨。 就在这时,我看见,从那拨老斑羚里走出一只公斑羚来。公斑羚朝那拨年轻斑羚示意性地咩了一声,一只半大的斑羚应声走了出来。一老一少走到伤心崖,后退了几步,突...
一个程序在计算机中是如何运行的?超级干货!!!
强烈声明:本文很干,请自备茶水!???? 开门见山,咱不说废话! 你有没有想过,你写的程序,是如何在计算机中运行的吗?比如我们搞Java的,肯定写过这段代码 public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } ...
【蘑菇街技术部年会】程序员与女神共舞,鼻血再次没止住。(文末内推)
蘑菇街技术部的年会,别开生面,一样全是美女。
那个在阿里养猪的工程师,5年了……
简介: 在阿里,走过1825天,没有趴下,依旧斗志满满,被称为“五年陈”。他们会被授予一枚戒指,过程就叫做“授戒仪式”。今天,咱们听听阿里的那些“五年陈”们的故事。 下一个五年,猪圈见! 我就是那个在养猪场里敲代码的工程师,一年多前我和20位工程师去了四川的猪场,出发前总架构师慷慨激昂的说:同学们,中国的养猪产业将因为我们而改变。但到了猪场,发现根本不是那么回事:要个WIFI,没有;...
为什么程序猿都不愿意去外包?
分享外包的组织架构,盈利模式,亲身经历,以及根据一些外包朋友的反馈,写了这篇文章 ,希望对正在找工作的老铁有所帮助
Java校招入职华为,半年后我跑路了
何来 我,一个双非本科弟弟,有幸在 19 届的秋招中得到前东家华为(以下简称 hw)的赏识,当时秋招签订就业协议,说是入了某 java bg,之后一系列组织架构调整原因等等让人无法理解的神操作,最终毕业前夕,被通知调往其他 bg 做嵌入式开发(纯 C 语言)。 由于已至于校招末尾,之前拿到的其他 offer 又无法再收回,一时感到无力回天,只得默默接受。 毕业后,直接入职开始了嵌入式苦旅,由于从未...
立即提问