I'm importing a CSV that has 3 columns, one of these columns could have duplicate records.

I have 2 things to check:

1. The field 'NAME' is not null and is a string
2. The field 'ID' is unique

So far, I'm parsing the CSV file, once and checking that 1. (NAME is valid), which if it fails, it simply breaks out of the while loop and stops.

I guess the question is, how I'd check that ID is unique?

I have fields like the following:

Bob,   1,
Tom,   2,
James, 1,
Terry, 3,
Joe,   4,

This would output something like `Duplicate ID on line 3'


P.S this CSV file has more columns and can have around 100,000 records. I have simplified it for a specific reason to solve the duplicate column/field




我正在导入一个包含3列的CSV,其中一列可能有重复的记录。</ p>

我需要检查两件事:</ p>

  1。 字段'NAME'不为null,是一个字符串
2。 字段'ID'是唯一的
</ code> </ pre>

到目前为止,我正在解析CSV文件,并检查 1。 (NAME有效)</ code>,如果失败,它只会突破while循环并停止。</ p>

我想问题是,我怎么检查< 代码> ID </ code>是唯一的吗?</ p>

我有以下字段:</ p>

BOB,1 ,
</ code> </ pre>

这会输出类似“第3行的重复ID” </ p>

谢谢</ p>

PS这个CSV文件有更多列,可以有大约100,000条记录。 我已将其简化为特定原因以解决重复的列/字段</ p>

谢谢</ p>
</ div>

doudu22272099831 如果您在编码站点检查这一点,那可能会出现性能问题。我认为,更好的方法是检查数据输入级别并构建CSV状态。如果不关心性能问题,您可以在程序端的数据库或存储位置检查您的ID是否已存在。
6 年多之前 回复
doutuo3935 如何在数组中推送每个值并在每行检查ID值不在此数组中?如果是的话,只需回显“xxx线上的错误”;
6 年多之前 回复
dtbonklcs575884485 你插入数据库?
6 年多之前 回复


I went assuming a certain type of design, as stripped out the CSV part, but the idea will remain the same :

  /* Let's make an array of 100,000 rows (Be careful, you might run into memory issues with this, issues you won't have with a CSV read line by line)*/
  $arr = [];
  for ($i = 0; $i < 100000; $i++)
    $arr[] = [rand(0, 1000000), 'Hey'];

  /* Now let's have fun */
  $ids = [];
  foreach ($arr as $line => $couple) {
    if ($ids[$couple[0]])
      echo "Id " . $couple[0] . " on line " . $line . " already used<br />";
      $ids[$couple[0]] = true;

100, 000 rows aren't that much, this will be enough. (It ran in 3 seconds at my place.)

EDIT: As pointed out, in_array is less efficient than key lookup. I've updated my code consequently.



我假设某种类型的设计被剥离了CSV部分,但这个想法将保持不变:</ p>

/ 让我们创建一个包含100,000行的数组(小心,你可能会遇到内存问题,这是CSV读取行所没有的问题) line) /
$ arr = [];
for($ i = 0; $ i&lt; 100000; $ i ++)
$ arr [] = [rand(0,1000000),'嘿'];

/ 现在让我们玩得开心 /
$ ids = [];
foreach($ arr as $ line =&gt; $ couple){
if($ ids [$ couple [0]])

echo“Id”。 $ couple [0]。 “在线”。 $ line。 “已使用&lt; br /&gt;”;
$ ids [$ couple [0]] = true;
</ code> </ pre>

< p> 100,000行不是那么多,这就足够了。 (它在我的地方运行了3秒。)</ p>

编辑:正如所指出的, in_array </ code>的效率低于键查找效率。 我因此更新了我的代码。</ p>
</ div>

$cnt = 0;
if (($handle = fopen("1.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
         for ($c=0; $c < $num; $c++) {
                if (array_key_exists($data[$c], $arr)) 
                    $arrdup[] = "duplicate value at ".($cnt-1); 
                    $arr[$data[$c]] = $data[$c-1];



$ cnt = 0;
$ arr = array();
if(($ handle = fopen(“1.csv”,“r”))!== FALSE){
while(($ data = fgetcsv($ handle,1000,“,”))!== FALSE){
$ num = count($ data);
$ cnt ++;
for($ c = 0; $ c&lt; $ num; $ c ++){
if(is_numeric($ data [$ c])){
if(array_key_exists($ data [$ c],$ arr))
$ arrdup [] =“重复值为”。($ cnt-1);

$ arr [$ data [$ c]] = $ data [$ c-1];
fclose($ handle);
nprint_r($ arrdup );
</ code> </ pre>
</ div>

Give it a try:

    $row = 1;
    $totalIDs = array();
    if (($handle = fopen('/tmp/test1.csv', "r")) !== FALSE) 
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) 
            $name = '';

            if (isset($data[0]) && $data[0] != '')
                $name = $data[0];
                if (is_numeric($data[0]) || !is_string($data[0]))
                    echo "Name is not a string for row $row
                echo "Name not set for row $row

            $id = '';
            if (isset($data[1]))
                $id = $data[1];                 
                echo "ID not set for row $row

            if (isset($totalIDs[$id]))
                echo "Duplicate ID on line $row
                $totalIDs[$id] = 1;                         




试一试:</ p>

  $ row = 1; 
$ totalIDs = array();
if(($ handle = fopen('/ tmp / test1.csv',“r”))!== FALSE)
while(($ data = fgetcsv($ handle, 1000,“,”))!== FALSE)
$ name ='';

if if(isset($ data [0])&amp;&amp; $ data [0]!='' )
$ name = $ data [0];
if(is_numeric($ data [0])||!is_string($ data [0]))
echo“Name不是行的字符串 $ row
echo”名称未设置为行$ row


$ id ='';
if(isset($ data [1]))
$ id = $ data [1];


\ {

呼号“未为行$ row


if(isset($ totalIDs [$ id]))

$ totalIDs [$ id] = 1;

$ row ++;
fclose($ handle);
</ code> </ pre>
</ div>

Are the IDs sorted with possible duplicates in between or are they randomly distributed?

If they are sorted and there are no holes in the list (1,2,3,4 is OK; 1,3,4,7 is NOT OK) then just store the last ID you read and compare it with the current ID. If current is equal or less than last then it's a duplicate.

If the IDs are in random order then you'll have to store them in an array. You have multiple options here. If you have plenty of memory just store the ID as a key in a plain PHP array and check it:

$ids = array();
// ... read and parse CSV
if (isset($ids[$newId])) {
    // you have a duplicate
} else {
    $ids[$newId] = true; // new value, not a duplicate

PHP arrays are hash tables and have a very fast key lookup. Storing IDs as values and searching with in_array() will hurt performance a lot as the array grows.

If you have to save memory and you know the number of lines you going to read from the CSV you could use SplFixedArray instead of a plain PHP array. The duplicate check would be the same as above.



ID是否按可能重复的方式排序,或者是否随机分布?</ p>

如果是 排序并且列表中没有空洞(1,2,3,4可以; 1,3,4,7不行)然后只存储您读取的最后一个ID并将其与当前ID进行比较。 如果current等于或小于last,则它是重复的。</ p>

如果ID是随机顺序,那么你必须将它们存储在一个数组中。 你有多种选择。 如果你有足够的内存,只需将ID作为密钥存储在一个普通的PHP数组中并检查它:</ p>

  $ ids = array(); 
// ... 读取和解析CSV
if(isset($ ids [$ newId])){
$ ids [$ newId] = true; //新值,而不是重复
</ code> </ pre>

PHP数组是哈希表,具有非常快速的键查找。 将ID存储为值并使用 in_array()</ code>进行搜索会在阵列增长时损害性能。</ p>

如果必须节省内存并且知道数量 您将从CSV中读取的行,您可以使用 SplFixedArray </ code>而不是普通的PHP数组。 重复检查将与上述相同。</ p>
</ div>

donglei7152 它们是随机分布的。
6 年多之前 回复
Csdn user default icon

需要在第二列中查询某个值的整行数据: > a = (df['XXoXX'] == b) >print (df[a]) **但是语句写成这样了之后出现了两个问题** + a的值不知道怎么判断了 + 当a的值不存在于XXoXX的时候还是会输出Empty DataFrame 还有个问题就是csv数据比较大,有2G,这样查询会不会比较费时间,所以请教一下,能否有比较快速在XXoXX列进行数据查询的方法,然后可以判断a的值,若a的值 不存在的话可以输出自定义的语句

golang csv如果匹配列值则删除重复项

<div class="post-text" itemprop="text"> <p>New to Golang and struggling to figure out how to remove duplicates in CSVs if a particular column value matches another rows.</p> <p>My table has 3 columns name | band | year </p> <p>If a persons name appears twices or more I just want them to output them the once.</p> <p>I have only been able to output all the details in a for loop so I am guessing I need to push to a new array and compare from that?</p> </div>


我现在有爬好数据的csv文件,需要导入neo4j形成节点。 但是这csv中有些数据是一样的(即形成的节点一模一样) </br> 现在需要不导入重复的,或者导入后在neo4j中删除重复节点,如何做?




比如:文件一 序号 代号 姓名 书价1 书价2 1 001 张三 23 18 2 005 李斯 3 50 文件二 序号 代号 姓名 书价2 书价3 1 008 张强 66 33 2 001 张三 18

PHP - CSV导出 - 在列数据中添加逗号

<div class="post-text" itemprop="text"> <p>I am exporting data to CSV and facing one problem.</p> <pre><code>$data['name'] = "Test"; $data['category'] = "category1, category2, caegory3"; </code></pre> <p>When I export code to CSV, it exports records but make separate column for category1, separate column for category 2 and separate column for category3.</p> <pre><code>Current Output ------------------------------------------- | Name | Category | | | -------------------------------------------- | TEst | category1 | category2 | category3 | -------------------------------------------- Expected Output ------------------------------------------------------------ | Name | Category | | | -------------------------------------------- --------------- | TEst | category1,category2,category3 | | | ------------------------------------------------------------ </code></pre> <p>What should I do so comma-separated String fall in same column?</p> </div>

php:使用google csv,删除列中填充的重复值

<div class="post-text" itemprop="text"> <p>I am a newbie to php and have been searching tirelessly for a solution to this problem (i'll bet its a super simple solve too *sigh).</p> <p>I am importing a .csv feed from a google doc. It is pulling in 2 columns, one for "name" and the other "location". I would like to remove duplicate "locations". since i am using fgetcsv, my understanding is that it is already sorting the data into an array. Ideally, it would omit the "location" duplicates so that the "names" look as though they are listed under the "location" they correspond to.</p> <p><strong>Here is what i have:</strong></p> <pre><code> $url = "https://docs.google.com/spreadsheet/pub?key=0AsMT_AMlRR9TdE44QmlGd1FwTmhRRkFHMzFTeTZhS3c&amp;output=csv"; $handle = fopen($url, "r"); while (($data = fgetcsv($handle, 5000, ",")) !== FALSE) { echo "&lt;li&gt; "; echo $data[1]; echo "&lt;br/&gt; "; echo $data[2]; echo "&lt;/li&gt; "; } fclose($handle); </code></pre> <p><strong>ideally i would be able to use something like this:</strong></p> <pre><code> $url = "https://docs.google.com/spreadsheet/pub?key=0AsMT_AMlRR9TdE44QmlGd1FwTmhRRkFHMzFTeTZhS3c&amp;output=csv"; $handle = fopen($url, "r"); while (($data = fgetcsv($handle, 5000, ",")) !== FALSE) { echo "&lt;li&gt; "; echo array_unique($data[1]); echo "&lt;br/&gt; "; echo $data[2]; echo "&lt;/li&gt; "; } fclose($handle); </code></pre> <p>Many thanks in advance for any help! :o)</p> </div>


<div class="post-text" itemprop="text"> <p>I have a code that will allow users to import/insert data into database from the CSV file. the problem is that if there is an empty columns or cells from the CSV file, it will display an error telling me that the <strong>column count doesn't match value count at row 1</strong>. I tried to assign a value in the empty cells/columns of the CSV file and it successfully uploaded. How can I allow the users to upload a CSV file even if there's an empty columns/cells? Below is my code.</p> <pre><code> if ($handle) { $counter = 0; $sql ="INSERT IGNORE INTO bill_of_materials(allotment_code, category_name, activity, quantity, unit, description, end_unit_quantity, unit_cost, regular_labor_cost, end_unit_labor_cost, type, batch) VALUES"; while (($line = fgets($handle)) !== false) { $sql .= "('".implode("', '", explode("|", addslashes(str_replace('"', '', $line))))."'),"; $counter++; } $sql = substr($sql, 0, strlen($sql) - 1); if (mysqli_query($new_conn, $sql) === TRUE) { $message = 1; } else { echo mysqli_error($new_conn); } fclose($handle); </code></pre> <p>here is my table: <a href="https://i.stack.imgur.com/zyKhd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zyKhd.png" alt="my table"></a></p> <p>and here's the csv file: <a href="https://i.stack.imgur.com/ieSj6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ieSj6.png" alt="csv file"></a></p> </div>

pandas 对csv增加一行一列并随机赋值的问题

在最后一列添加新的列,列名为wine; 添加的数据为随机正态分布,1/5的数据为1,剩余数据为-1; df['wine']=-1 ran1=random.sample(range(0,len(df)//5),len(df)//5)#随机产生行号 for i in ran1: df['wine'][ran1[i]]=1 #这里难道不是对wine列 ran1[i]行赋值为1吗, #我的结果为什么是前面全是1, 后面是-1啊 在最后一行之后添加一行,随机添加1/4的数据为1,剩余为-1; df.loc[len(df)] = -1 ran2=random.sample(range(0,df.shape[1]//4),df.shape[1]//4)#随机产生列号 for i in ran2: df[ran2[i]][df.shape[0]]=1#这里难道不是对最后一行,ran2[i]列赋值为1吗



python csv写入,为啥头信息会重复

第一次写的头信息只写入一次,正常 复制粘贴改了一些东西后,就每次都会写入一次头了 ------------------------------------------------------------- 正常的第一次 ``` tag_list = [] for tags in text['items']: #print(type(tags)) tag = tags['tag'] tag = tag_list.append(tag) #print(tag_list) #把标签和原文件内容一起写进新文件 tag_list = str(tag_list).replace('[','').replace(']','').replace('\'','') tou = ['title','content','baidu_tag'] with open('ahahaha22333.csv','a+',encoding='utf-8',newline='') as f: fwriter = csv.writer(f) csvrow1 = [] csvrow2 = [] csvrow3 = [] csvrow1.append(d['title']) csvrow2.append(d['content']) csvrow3.append(tag_list) fwriter.writerow(tou) fwriter.writerows(zip(csvrow1,csvrow2,csvrow3)) n = n + 1 print(str(n)) #------------------------------------------------ copy改动版后头信息会重复写入的 try: summary = text['summary'] except Exception as eee: print('---eee') print(eee) summary = '_' #print(summary) tou = ['title','content','summary'] with open('ahahaha22333.csv','a+',encoding='utf-8',newline='') as f: fwriter = csv.writer(f) csvrow1 = [] csvrow2 = [] csvrow3 = [] csvrow1.append(d['title']) csvrow2.append(d['content']) csvrow3.append(summary) #fwriter.writerow(tou) fwriter.writerows(zip(csvrow1,csvrow2,csvrow3)) n = n + 1 print(str(n)) ``` -----------------------------------------------------------


<div class="post-text" itemprop="text"> <p>I have a simple PHP script that reads a CSV file and generates an array from this:</p> <pre><code>&lt;?php $file = fopen('food.csv', 'r'); $allfile = []; $idsColumnsWanted = array(0,1,16); while (($line = fgetcsv($file)) !== FALSE) { $i = 0; foreach ($line as $i =&gt; $cell) { if (!in_array($i, $idsColumnsWanted)) { continue; } $allfile[] = $line; $i++; } } fclose($file); ?&gt; </code></pre> <p>I'd like to display just the data in columns 0, 1 &amp; 16.</p> <p>I have made an attempt above, but it still outputs the entire CSV.</p> </div>


<div class="post-text" itemprop="text"> <p>I have a CSV file which has many rows in, like the following:</p> <p>Client Product Quantity Unit Amount Total 1 Prod1 1 10 10 1 Prod2 2 15 30 2 Prod1 2 12 24 2 Prod2 1 5 5</p> <p>etc...</p> <p>i want to be able to import the CSV file using PHP and group each client together and display the total cost for each client.</p> <p>I have my import function etc...</p> <pre><code>if(is_uploaded_file($_FILES['file']['tmp_name'])) { echo "&lt;h3&gt;" . "File ". $_FILES['file']['name'] ." uploaded successfully." . "&lt;/h3&gt;&lt;br&gt;&lt;br&gt;"; } $handle = fopen($_FILES['file']['tmp_name'], "r"); fgetcsv($handle); //then loop through each row while(($data = fgetcsv($handle, 1000, ",")) !== FALSE) { } </code></pre> <p>but im not sure what to do inside the while loop</p> <p>if possible, i want to do this without using a database</p> </div>




1.一个csv文件有三列,将内容以,分割 比如:a,b,c一行这样的数据。String data = x.split(","),data[0]=a, data[1]=b, data[2]=c 2.判断最后一列为空时:data[2]==null 如果将c去掉,这样判断就会报数组下标越界,如果当最后一列为空时,导入时如何判断为空

python 如何将CSV表格中相同的两行内容合并在一起,并为其加上数字统计?

![图片说明](https://img-ask.csdn.net/upload/201910/20/1571568457_472613.jpg) 我尝试过的代码 ``` import pandas as pd data_cvs = pd.read_csv("tt.csv", engine='python',header=None,skiprows=1) data_list = [] for item in zip(data_cvs[0], data_cvs[1]): data_list.append((item [0],item [1],1)) # 增加一列 全为 1 ,用于表示已读取过的行 listtt = data_list ListTT = [] for tt in range (len(listtt)): vv = 1 for tt1 in range (len(listtt)): if listtt[tt][0] == listtt[tt1][0] and listtt[tt][1] == listtt[tt1][1] and tt != tt1 and listtt[tt][2] !=0: #条件判断 判断前两列对于相同的行,跳过已经读取过的行 vv += 1 listtt[tt1][2] = 0 #将已经读取过的行 标识码归零 ListTT.append((listtt[tt][0],listtt[tt][1],vv)) CsvFile = pd.DataFrame(ListTT) CsvFile.to_csv('ListTT.csv', index=False) ``` 但是一直报错 ,没找到原因 ![图片说明](https://img-ask.csdn.net/upload/201910/20/1571568847_884123.png)


例如:有 a.csv文件内容如下 Name,Age,Tel, cz,27,13333333333, cc,29,13344444444, 修改后csv内容为: ID,School,Address,Name,Age,Tel, ,,, cz,27,13333333333, ,,, cc,29,13344444444,


<div class="post-text" itemprop="text"> <p>I have a set of files I am trying to import into MySQL.</p> <p>Each CSV file looks like this:</p> <pre class="lang-none prettyprint-override"><code>Header1;Header2;Header3;Header4;Header5 Data1;Data2;Data3;Data4;Data5; Data1;Data2;Data3;Data4;Data5; Data1;Data2;Data3;Data4;Data5; Data1;Data2;Data3;Data4;Data5; </code></pre> <p>Data may contain spaces, periods or a full colon. They absolutely will not contain a semi-colon so that is a valid delimiter. They also will not contain or any other newline characters.</p> <h3>Example Data</h3> <pre class="lang-none prettyprint-override"><code>2010.08.30 18:34:59 0.7508 String of characters with spaces in them </code></pre> <p>Each file has a unique name to it. The names all conform to the following pattern:<br>     Token1_Token2_Token3.csv</p> <p>I am interested in combining a lot of these CSV files (on the order of several hundred) into one CSV file. Files can range from 10KB to 400MB. Ultimately, I want to send it over to MySQL. Don't worry about getting rid of the individual header rows; I can do that in MySQL easily.</p> <p>I would like the final CSV file to look like this:</p> <pre class="lang-none prettyprint-override"><code>Header1,Header2,Header3,Header4,Header5,FileName Data1,Data2,Data3,Data4,Data5,Token1 Data1,Data2,Data3,Data4,Data5,Token1 Data1,Data2,Data3,Data4,Data5,Token1 Data1,Data2,Data3,Data4,Data5,Token1 Data1,Data2,Data3,Data4,Data5,Token1 </code></pre> <p>I don't care about any of the other tokens. I can also live if the solution just dumps each csv filename into the Token1 field because, again, I can parse that in MySQL easily.</p> <p>Please help me! I've spent over 10 hours on what should be a relatively easy problem.</p> <p>Technologies available:</p> <p>    awk<br>     windows batch<br>     linux bash<br>     powershell<br>     perl<br>     python<br>     php<br>     mysql-import<br></p> <p>This is a server box so I won't be able to compile anything but if you give me a Java solution I will definitely try to run it on the box.</p> </div>


<div class="post-text" itemprop="text"> <p>I am reading a comma deliminated CSV file line by line and then separate each column value using PHP <strong>explode</strong> function. The problem is that there are some columns which itself have <strong>comma (,)</strong> values in it so they are also exploded.</p> <p>A row of data:</p> <pre><code>03,1392,06,1000,1,"1000,36,21,68",4,AF,TJ,AF,44071000 </code></pre> <p>Here <strong>"1000,36,21,68"</strong> must be considered as a single value but PHP explode also breaks it. I know this is how explode works but is there any alternate function which can be used in this case. Also i would need to remove the <strong>double quotes (")</strong> from both sides from this value. </p> </div>


今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...





String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...


文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

将一个接口响应时间从2s优化到 200ms以内的一个案例

一、背景 在开发联调阶段发现一个接口的响应时间特别长,经常超时,囧… 本文讲讲是如何定位到性能瓶颈以及修改的思路,将该接口从 2 s 左右优化到 200ms 以内 。 二、步骤 2.1 定位 定位性能瓶颈有两个思路,一个是通过工具去监控,一个是通过经验去猜想。 2.1.1 工具监控 就工具而言,推荐使用 arthas ,用到的是 trace 命令 具体安装步骤很简单,大家自行研究。 我的使用步骤是...


微信上收到一位读者小涛的留言,大致的意思是自己只有高中学历,经过培训后找到了一份工作,但很难胜任,考虑要不要辞职找一份他能力可以胜任的实习工作。下面是他留言的一部分内容: 二哥,我是 2016 年高中毕业的,考上了大学但没去成,主要是因为当时家里经济条件不太允许。 打工了三年后想学一门技术,就去培训了。培训的学校比较垃圾,现在非常后悔没去正规一点的机构培训。 去年 11 月份来北京找到了一份工...


JVM内存结构和Java内存模型都是面试的热点问题,名字看感觉都差不多,网上有些博客也都把这两个概念混着用,实际上他们之间差别还是挺大的。 通俗点说,JVM内存结构是与JVM的内部存储结构相关,而Java内存模型是与多线程编程相关,本文针对这两个总是被混用的概念展开讲解。 JVM内存结构 JVM构成 说到JVM内存结构,就不会只是说内存结构的5个分区,而是会延展到整个JVM相关的问题,所以先了解下

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Google 与微软的浏览器之争

浏览器再现“神仙打架”。整理 | 屠敏头图 | CSDN 下载自东方 IC出品 | CSDN(ID:CSDNnews)从 IE 到 Chrome,再从 Chrome 到 Edge,微软与...


loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...








蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?



提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...






私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...






本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...




当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...


HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...