An article to help you understand the analysis of parameter passing principles (java, go, python, c++)

Foreword In the past year or so, I have been exposed to some languages ​​that are unfamiliar to me, mainly Python and Go. During this period, in order to quickly realize the needs, I just followed the example. Lao’s code; I didn’t delve into some details and principles. Take parameter passing as an example. The implementation details of each language are different, but there are similarities; it is easy for many novices to be confused when they get started, leading to some low-level mistakes. Java Basic type transfer Let’s take Java, which I am most familiar with, as an example. I believe no one can write such code: @Test public void testBasic() { int a = 10; modifyBasic(a); System.out.println(String.format(“Final result main a==%s”, a)); } private void modifyBasic(int aa) { System.out.println(String.format(“aa==%s”, aa)); aa = 20; System.out.println(String.format(“After modification aa==%s”, aa)); } Output results: Before modification aa==10 After modification aa==20 Final result main a==10 However, judging from the purpose of this code, it should be to modify the value of a. Intuitively, it is understandable if the modification is successful. The fundamental reason why the results are not in line with expectations is the misunderstanding of parameter value passing and reference passing. Before…

Why do many companies turn to Golang? Are Java, Python, and C# declining?

Why do many companies turn to Golang? Are Java, Python, and C# declining?

Go language is the second open source programming language released by Google in 2009. The Go language is specially optimized for programming multi-processor system applications. Programs compiled using Go can be as fast as C or C++ code, are more secure, and support parallel processes. Why do many companies turn to Golang? Are Java, Python, and C# in decline? golang logo When choosing a development language for a project, focus on performance, improvement of the language technology stack, development efficiency, and language learning costs. Choose golang for many reasons How is the performance: Golang’s performance is relatively high, and qps, which does not require a framework to write an API, can be comparable to nginx. This kind of performance is unmatched by python. Language technology stack: Golang’s development technology stack is also very complete, and all required common components can be found on github. Development efficiency: Some coders who love C/C++ know that C/C++ development efficiency is not high, and go can solve the problem of development efficiency. A senior engineer said that he has been developing system software in C language for more than ten years. Now I will use go wherever Go can be used (except for the…

Development language performance comparison, C++, Java, Python, LUA, TCC

Development language performance comparison, C++, Java, Python, LUA, TCC

I have always wanted to compare the performance of development languages, so I happened to have time to do it for your reference, Compiled categories: C++ and Java perform well Script class: TCC script dynamically runs C language, and the performance is much faster than other scripts… Students who want to play TCC download the test package, modify script.c in the TCC directory, and run TccTest1.exe to see the modification effect, no need to compile!!! Link: http://pan.baidu.com/s/1kUVGGwJ Password: mgpx C++(VS2017) java8.2 Python2.7-3.5.2 aardio (LUA) TCC

How Java, PHP, Python, JS and other developers draw statistical charts

How Java, PHP, Python, JS and other developers draw statistical charts

Abstract: At present, many programmers basically use the back-end to generate data and pass it to the front-end, and then the front-end renders the data to the drawing library for display, so as to get the various results we finally saw. kind of graph, but sometimes we find that there is a lot of data that needs to be transferred. At this time, it is very slow to pass the data to the front end for analysis and display, so it is necessary to generate various statistical graphs on the back end, as follows Let’s talk about how various programmers make pictures? PHP programmers who have used PHP to create statistical charts should know that JqGraph is the golden partner of PHP. Using JqGraph we can complete the production of many charts, such as scatter charts, bar charts, line charts, stock charts, and pie charts. Wait, and the library currently supports PHP7, so we can use it with confidence. Currently, many programmers basically use the back-end to generate data and pass it to the front-end, and then the front-end renders the data to the drawing library for display, thereby obtaining the various pictures we finally see. But sometimes, we find…

storm installation (2) Installation of ZeroMQ, JZMQ, Python, Java environment

storm installation (2) Installation of ZeroMQ, JZMQ, Python, Java environment

2.ZeroMQ installation Copy the installation file zeromq-2.1.7.tar.gz to the home file path. Add permissions to files chmod +x /home/ zeromq-2.1.7.tar.gz unzip files tar -xzf /home/ zeromq-2.1.7.tar.gz Enter the file path to install cd /home/ zeromq-2.1.7 ./configure make sudo make install Installed ( An error uuid not found will be reported here. At this time, you need to install the util-linux-2.21.1.tar.gz file. Unzip it with the same installation steps, and then enter the decompressed folder ./configure –without-ncureses make sudo make install Then just install zeromq ) 3.JZMQ installation First enter the home path cd /home Download installation files git clone https://github.com/nathanmarz/jzmq.git Enter the jzmq file cd jzmq Install ./autogen.sh ./configure make sudo make install Installed ​ 4.Python installation Copy the file to the home folder Enter the home folder cd /home Add permissions chmod +x Python-2.7.6.tgz unzip files tar zxvf Python-2.7.6.tgz Install cd Python-2.6.6 ./configure make make install After the installation is complete, test whether the installation is successful python -V Python 2.7.6 Installed 5. I have already installed the Java environment when building Hadoop before, so I won’t go into details here.

listcode.cn-full platform addition, deletion, modification and checking  Code generator, java, python, php, nodejs can all generate

listcode.cn is a full-platform add, delete, modify, and check code generator that can be generated by java, python, php, and nodejs.

What is listcode listcode.cn is essentially a code-generated cloud service website.Mainly provided CRUD code generation services for common languages ​​and frameworks such as java, python, php, nodejs (i.e. common additions, deletions, modifications and checks), back-end code, front-end interface, js, etc., one-stop solution.Specific supported languages ​​and technical frameworks: java, springmvc jpa mybatis php: laravel, thinkPhp5 python: flask, tonardo nodejs: vue, react, angular Look at a demo generated using listcode.cn What are the characteristics Supports page turning: you can set the size of a single page. [Mark 1 in Figure 1, Mark 1 in Figure 3] Support complex queries: joint queries with multiple conditions, each condition can be set with a prefix, such as greater than a certain value, like a certain value. [Mark 1 in Figure 2, Mark 3 in Figure 3] Perfect display and editing of foreign key tables: for tables referenced by foreign keys, a string type field is intelligently selected as a representative; a query window pops up during entry, making entry more user-friendly. [Figures 1, 2, and 3 are marked with 2, Figures 4 and 5 are marked with 1] Specific types of specific displays: date type, switch type, enumeration type, which will be continuously improved in…

14150514_3YBp.png

phppython performance_Java, Python, Ruby, PHP, C and other language performance comparison

Code function:Loop to splice strings,and replace substrings Hardware environment:Intel Core2 Duo T7500@2.20Ghz CPU; 2 GB RAM; OS Debian GNU/Linux 2.6.32 i686 Code execution time Code performance comparison chart Slowest: Java gcj (native executable) Slower: Java (openJDK); Java (Sun); Lua Slightly slower: tcl; Javascript (spidermonkey) Faster: Python; Ruby; PHP; C++; Javascript V8; C; Perl5 The fastest is Perl,The slowest gcj,Can you accept it? Memory usage Memory comparison chart: Test source code: C (source); Result: C gcc (Debian 4.4.4-1) 4.4.4 #include #include #include #include int main(){ setbuf(stdout,NULL); //disable output buffering char *str&# 61;malloc(8); strcpy(str,”abcdefgh”); str=realloc(str,strlen(str)+8); strcat(str,”efghefgh”); //sprintf(str,”%s%s”,str,”efghefgh”); int imax=1024/strlen (str)*1024*4; printf(“%s”,”exec.tm.sec\tstr.length\n”); //fflush(stdout); time_t starttime=time(NULL); char *gstr=malloc(0); int i=0; char *pos; int lngth; char *pos_c=gstr; int str_len=strlen(str); while(i++ <imax+1000){ lngth=strlen(str)*i; gstr= realloc(gstr,lngth+str_len); strcat(gstr,str); //sprintf(gstr,”%s%s”,gstr,str); pos_c+=str_len; pos=gstr; while(pos=strstr(pos,”efgh”)){ memcpy(pos,”____”,4); } if(lngth % (1024*256)==0){ printf(“%dsec\t\t%dkb\n”,time(NULL)-starttime,lngth/1024); //fflush(stdout); } } //printf(“%s\n”,gstr); } C++ (source) Result: C++ g++ (Debian 4.4.3-7) 4.4.3 #include #include #include using namespace std; main () { string str &#61 ; “abcdefgh”; str += “efghefgh”; int imax = 1024 /str.length() * 1024 *4; time_t currentTime = time(NULL); cout <<"exec.tm.sec\tstr.length" <<endl; string find= “efgh”; string replace =”____”; string gstr; int i=0; int length; // int end=0; // size_t end=0; while(i+&# 43; <imax +1000){ gstr += str;…

What are the “th”, “python”, “python3”, “java”, etc… commands used to run the scripts in the front, called?

In Lua with Torch, you use “th” to run Lua scripts. In Python, you use “python” or “python3” to run python scripts. In Java, you use “java” to run java classes Script. What is this word in front of the command, and is it actually called? I tried searching for the name myself but I couldn’t find anything. 1> Henry Woody..: It’s just a shell command .not different from any cd or grep etc. For Python, the python command invokes the Python interpreter, starts an interactive session, or, if a file is specified, runs the file through the interpreter. But it just tells the shell what to do .

Comparison of four scripting languages: Perl, Python, Ruby, and Javascript

Perl In order to choose a suitable scripting language to learn, I checked a lot about Perl, Python, Ruby, and Javascript today, but I found that people from all major camps are touting their favorite languages, but the least controversial one should be Javascript is not suitable for independent development at this stage, and its world is still in web applications. ?I? Mainly want to do research on data mining algorithms, and I should be able to process a large amount of text. When it comes to text processing, I believe most people will say that Perl should be used. Indeed, Perl’s text processing is very powerful, but its syntax feels too confusing. I have learned the basic syntax of Perl before and used it to do some simple text processing work, but until now, it is difficult to use it. Still not that smooth. It seems that Perl is the best choice for system administration on Unix or Linux. ?Python is said to have absorbed some things from Perl. Its very special point should be that its syntax is very standardized. The programs written must be in a beautiful format. Since I have not studied it, I don’t know…

Wu Yuxiong’s artificial intelligence java, javascript, HTML5, python, oracle – implementation of a concise version of the WEB side review code of the intelligent medical system

Wu Yuxiong’s artificial intelligence java, javascript, HTML5, python, oracle – implementation of a concise version of the WEB side review code of the intelligent medical system

import sys import os import time importoperator import cx_Oracle import numpy as np import pandas as pd import tensorflow as tf conn=cx_Oracle.connect(‘doctor/admin@localhost:1521/tszr’) cursor = conn.cursor() def printHistory(userid): sql = “select username,sex,age,province,area,bumen,ke,result,chufang,jianyi,yiyuaan,yisheng,jianchaxiang,zhenduanriqi from zhenduanjilutable where userid= ‘%d'” % userid cursor.execute(sql) rows = cursor.fetchall() zhenduanjilu = [] for row in rows: temp = [] temp.append(row[0]) temp.append(row[1]) temp.append(row[2]) temp.append(row[3]) temp.append(row[4]) temp.append(row[5]) temp.append(row[6]) temp.append(row[7]) temp.append(row[8]) temp.append(row[9]) temp.append(row[10]) temp.append(row[11]) temp.append(row[12]) temp.append(row[13]) zhenduanjilu.append(temp) print(“====================Print diagnostic history=== ==================”) for i in range(len(zhenduanjilu)): print(“————–>>No.: ” +str(i+1)+”Diagnosis<<——————- “) print(” Name: “+zhenduanjilu[i][0]) print(” Gender: “+zhenduanjilu[i][1]) print(” Age: “+str(zhenduanjilu[i][2 ])) print(” Province: “+zhenduanjilu[i][3]) print(” Urban area: “+zhenduanjilu[i][4] ) print(” Outpatient department: “+zhenduanjilu[i][5] ) print(” Outpatient subjects: “+zhenduanjilu[i][6] ) print(” Diagnosis result: “+zhenduanjilu[i][7] ) print(” Medical prescription: “+zhenduanjilu[i][8] ) print(” Health advice: “+zhenduanjilu[i][9] ) print(” Recommended hospital: “+zhenduanjilu[i][10] ) print(” Recommended doctor: “+zhenduanjilu[i][11] ) print(” Suggested check items: “+zhenduanjilu[i][12 ]) print(” Diagnosis date: “+str(zhenduanjilu[i][13])) # printHistory(6) <%– Document: ALSelectHistory Created on : 2018-10-9, 21:28:13 Author: acer –%> <%@page import=”java.util.Iterator “%> <%@page import=”java.util.ArrayList “%> <%@page import=”java.util.List “%> <%@page import=”java.io.InputStreamReader “%> <%@page import=”java.io.Bpan >> <h2>Please enter the number of the follow-up record you need: <input type=”text” name=”hisid” value= “”/></h2> <input type=”hidden” name=”userid” value=””/> <input type=”hidden” name=”username” value=””/> <input type=”hidden” name=”province” value=””/> <input type=”hidden” name=”administr”…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索