Delphi的Application.ProcessMessages的作用?

在使用Delphi进行编程的时候,假如有一个长时间的循环,为了防止程序执行这个循环耗时太久而不能去响应其他消息,导致比如窗体不能拖动、按钮没法点击的情况,那么就需要在在循环中使用Application.ProcessMessages。

那么Application.ProcessMessages还有没有其他的作用?
Application.ProcessMessages的大概的原理是什么样的?

4个回答

Application.ProcessMessages的功能

通常情况下,程序在循环的时候不响应外界事件。直到循环结束为止才能接受和响应外界事件。
为了防止界面假死,就可以在循环的某时,执行Application.ProcessMessages,使程序在循环时能够响应外界事件。把控制权暂时交给系统,这样界面就不会假死。

Application.ProcessMessages可以有效的解决循环循环的独占问题,能够暂时中断应用程序的执行。

比如,你的一个循环10000次。你可以设置每循环100次的时候,执行一次Application.ProcessMessages,让程序响应其它操作,此时你就可以预先设置的cancel按钮取消循环。

把控制权暂时交给系统,放置界面假死,比如while循环中,要更新界面,如果不写这个,你看不到

xumenger
xumenger 你写错字了,不过谢谢你的回答
4 年多之前 回复

procedure TForm1.Button2Click(Sender: TObject);
var
   I, J, X, Y: Word;
begin
   I := 0;
   J := 0;
   while I
   begin
     Randomize;
     while J
     begin
       Y := Random(J);......
答案就在这里:delphi中application.processmessages的作用
----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

进行消息循环,让界面处理其他UI消息等,防止界面假死

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
部分外网用户无法通过delphi做的程序连接ftp服务器,宽带不行,换成手机热点却可以

1.服务器上安装的filezilla程序,采取被动模式,做了动态域名映射,端口也都放开了 2.用delphi做的程序通过idftp连接ftp服务器,用来上传和下载文件 3.公司内部使用没有问题 4.外网用户通过浏览器,文件夹都可以正常访问公司的ftp服务器获取文件 但是有部分用户使用delphi开发的程序时,却连不上,奇怪的是他们把电脑 连上手机热点的网络后却可以正常使用。还有的之前用家里的网使用的一切正常,后来t突就然就连不上了 ``` begin with TIdFTP.Create(nil) do try Port := gftp_port; Passive :=true; PassiveUseControlHost := true; Host := gFtpserver; Username := gftp_user; Password := gftp_pass; lst := TStringList.Create; try Connect; //在这里报错 cxm1.Lines.Clear; cxm1.Lines.Add('开始下载文件...'); tblo.First; while not tblo.EOF do begin bc := tblo.FieldByName('bcode').Value; sp := Format('\Original\%s\%s\', [formatdatetime('yyyymmdd',tblo.FieldByName('bdate').AsDateTime), bc]); fd := cxbtndt1.Text; if tblo.FieldByName('file1').IsNull then sf := '' else sf := tblo.FieldByName('file1').Value; if sf <> '' then begin try //修改了文件名称,文件名称为订单ID+文件名称 sf1 := tblo.FieldByName('wo_id').AsString + '_'+sf; if FileExists(fd+sf1) then DeleteFile(fd+sf1); Get(sp+sf, fd+sf1); //cxm1.Lines.Add(Format('%s 文件%s下载完成.', [bc, sf1])); except on e:Exception do begin if FileExists(fd+sf1) then DeleteFile(fd+sf1); cxm1.Lines.Add(Format('%s 文件%s不存在.', [bc, sf1])); end; end; end; tblo.Next; Application.ProcessMessages; end; cxm1.Lines.Add('文件下载结束.'); OpenDialog(s, '浏览文件', '所有文件(*.*)', '*.*', true, fd); except on e: Exception do begin cxm1.Lines.Add('连接文件服务器错误:'+e.Message); end; end; finally if Connected then Disconnect; Free; lst.Free; end; ``` ![图片说明](https://img-ask.csdn.net/upload/202004/03/1585922841_970025.png)

Delphi实现图片滚动切换的代码中move函数报错说variable required?为什么?

procedure TMainForm.startClick(Sender: TObject); var W, H, I, J, LineBytes: Integer; Line: PByteArray; //定义指针类型变量 Bmp: Tbitmap; R: TRect; begin if Image1.Picture.Bitmap.PixelFormat=pfDevice then //当没有打开图片时 begin MessageDlg ('没有打开图片!', mtInFormation, [mbOk], 0);//给出出错提示 exit; //退出 end else fCancel := False; start.Enabled := False; //改变两个按钮的属性 stop.Enabled := True; Bmp := Image1.Picture.Bitmap; //获取BMP 图像并定义图像尺寸 W := Bmp.Width; H := Bmp.Height; LineBytes := Abs (Integer (Bmp.ScanLine [1]) -Integer (Bmp.ScanLine [0])); Line := AllocMem (LineBytes); for I := 0 to H - 1 do begin if fCancel then //在每一次循环前均检查中断标志(即确定停止按钮是否按下) Break; //单击“停止”按钮则停止滚动图像 Move ((Bmp.ScanLine [0]), Line, LineBytes); //复制图像的第一行 for J := 1 to H - 1 do begin Move((Bmp.ScanLine [J]),(Bmp.ScanLine [J-1]),LineBytes); if (J mod nLines = 0) then begin R := Rect (0, Panel1.Height + J-nLines,W, Panel1.Height + J); InvalidateRect (Handle, @R, False); UpdateWindow (Handle); end; end; Move(Line,(Bmp.ScanLine [Bmp.Height - 1]), LineBytes); R := Rect (0, Panel1.Height + H - nLines,W, Panel1.Height + H); InvalidateRect (Handle, @R, False); UpdateWindow (Handle); Application.ProcessMessages; //允许立即停止循环使程序处于初始状态 end; start.Enabled := True; //激活“开始”按钮 stop.Enabled := False; // 停止“按钮”失效 end;![图片说明](https://img-ask.csdn.net/upload/201604/20/1461151425_560718.png)

delphi excel导入stringgrid后时间格式转换有越界

![CSDN移动问答][1]excel导入stringgrid过程: procedure TForm1.btn1Click(Sender: TObject); var ExcelApp,sheet:Variant; ExcelRowCount,ExcelcolCount,i,j,m,n,k:Integer; str,str1:string; wbk:OleVariant; EclApp, WorkBook : Variant; begin if dlgOpen1.Execute then begin try EclApp := CreateOleObject ('Excel.Application'); WorkBook := CreateOleObject ('Excel.Sheet'); except ShowMessage ('您的计算机上没有 Microsoft Excel!'); Exit; end; ExcelApp:=CreateOleObject ('Excel.Application'); //建立Excel对象 WBK := ExcelApp.WorkBooks.Open(dlgopen1.FileName); //打开指定文件 sheet := ExcelApp.WorkSheets[1]; ExcelApp.Visible := False; //不显示Excel ExcelRowCount := ExcelApp.WorkSheets[1].UsedRange.Rows.Count; //行数 ExcelColCount := ExcelApp.WorkSheets[1].UsedRange.Columns.Count; //列数 // showmessage(inttostr(ExcelColCount)); strngrd1.RowCount:= ExcelRowCount+1; strngrd1.ColCount:=ExcelcolCount+1; with strngrd1 do begin for n:=0 to ExcelcolCount -1 do begin if n<=ExcelcolCount then begin Cells[n,0]:=IntToStr(n+1); end; end; for k:=0 to ExcelRowCount do begin if k<=ExcelRowCount then begin Cells[0,k]:=IntToStr(k+1); end; end; end; pb1.Visible:=True; pb1.Max:=ExcelRowCount* ExcelcolCount; m:=0; for i := 1 to ExcelRowCount do begin for j := 1 to ExcelColCount do begin Application.ProcessMessages; str := sheet.cells[i,j]; if LeftStr(Trim(sheet.cells[i,j]),1)='.' then begin str1:='0'+str; strngrd1.Cells[j,i] :=FormatDateTime('hh:mm:ss',FloatToDateTime(StrToFloat(Trim(str1))));;//这里做了转换 ; ; end else begin strngrd1.Cells[j,i] := str; end; inc(m); end; pb1.Position:=m; end; WBK.Close(SaveChanges := True); ShowMessage('表格导入完成'); 导入excel表,时间栏结果: 23:45:23 9.8923611111111E-02 请各位大仙帮助解决为谢!

ACCESS数据选择性丢失,delphi开发

我用DELPHI+ACCESS做了一个小应用,发生了一件怪事: 订单数据明明插入到数据库了,可以正常进行下一步操作,并且可以正常导出,但软件关闭后,今天操作的订单数据会丢失,以前的数据不会丢失。后续的操作数据也会留下来。 下面贴出我导入EXCEL订单的代码。 ``` procedure TfrmFPimport.btnOpenClick(Sender: TObject); var ExcelApp: Variant; sl,subsl:TStringList; i,j:integer; filename,strSql,sql_mx:string; fapiao,yearmonth:string; cmd: TadoCommand; e: exception; kprq,bz,rq1,rq2,bizhi: string; code,number,capital_hz:string; hl,yfbf,dj,zj,dj_rmb,zj_rmb,rmb_hz,usd_hz,usd_hz_rmb,chayi,hangshu:double; road:string; begin dlgOpen1.FileName:=''; dlgOpen1.Execute; filename:=dlgOpen1.FileName; if filename <>'' then begin try sl:=TStringList.Create; subsl:=TStringList.Create; btnOpen.Enabled :=false; ADOConnection_Excel.Connected:=False; ADOConnection_Excel.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Password="";Data Source="'+ filename+'";Extended Properties="Excel 8.0;IMEX=1";Persist Security Info=False'; ADOConnection_Excel.Connected:=True; ADOConnection_Excel.GetTableNames(sl); if (sl.Count>0) and (sl.IndexOf('sheet1$')<>-1) then begin road:=ExtractFileDir(Application.Exename); ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source='+road+'\database\wxfp.mdb;Mode=Share Deny None;Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password=nbeport2010;Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;'; ADOConnection1.Connected:=True; ADOConnection1.BeginTrans; cmd := TadoCommand.Create(application); cmd.Connection := dmdCustom.cnnCustom; // cmd.ParamCheck := false; ADOQuery_Excel.Close; ADOQuery_Excel.Sql.Text:='SELECT * FROM [sheet1$]'; ADOQuery_Excel.Open; ADOQuery_Excel.First; for i:=1 to ADOQuery_Excel.RecordCount do begin //判断是否要发票已经开过了 qry_RunSql.Close; qry_RunSql.SQL.text:='select bgd_no from wxInvoice where bgd_no=:HGBH and zfflag='''+'0'+''''; qry_RunSql.Parameters.ParamByName('HGBH').Value:= ADOQuery_Excel.fieldbyname('内部发票号').AsString; qry_RunSql.Open; if not qry_RunSql.Eof then begin showmessage('内部发票号:'+ADOQuery_Excel.fieldbyname('内部发票号').AsString+'已经开具!请在excel文件中删除'); ADOConnection_Excel.Connected:=False; exit; end; end; ADOQuery_Excel.Close; ADOQuery_Excel.Sql.Text:='SELECT * FROM [sheet1$]'; ADOQuery_Excel.Open; if ADOQuery_Excel.RecordCount>0 then begin ADOQuery_Excel.First; fapiao:= ''; advprgrsbr1.Min:=1; advprgrsbr1.Max:= ADOQuery_Excel.RecordCount-1; for i:=1 to ADOQuery_Excel.RecordCount do begin advprgrsbr1.Position:=i; Application.ProcessMessages; if ADOQuery_Excel.fieldbyname('内部发票号').AsString = fapiao then begin // 多行的情况下,判断行数 qry_excel2.Close; qry_excel2.SQL.text:='SELECT * FROM [sheet1$] where 内部发票号=:fp'; qry_excel2.Parameters.ParamByName('fp').Value:= fapiao; qry_excel2.Open; hangshu:= qry_excel2.RecordCount; //处理明细行 //匹配国税编码及名称 qry.Close; qry.SQL.Text:='select * from tblCmcode where code=:code'; qry.Parameters.ParamByName('code').value:=ADOQuery_Excel.fieldbyname('HS编码').AsString; qry.Open; //只考虑FOB情况 zj:= ADOQuery_Excel.fieldbyname('报关金额').AsFloat; usd_hz:=usd_hz +strtofloat(format('%0.2f', [zj])); zj_rmb:= hl * zj; zj_rmb:= strtofloat(format('%0.2f', [zj_rmb])); dj_rmb:= zj_rmb / ADOQuery_Excel.fieldbyname('报关数量').AsFloat; rmb_hz:= rmb_hz + zj_rmb; usd_hz_rmb:=strtofloat(format('%0.2f', [usd_hz* hl])); //汇总美元金额 直接 乘以 汇率 if j = hangshu then begin chayi:= usd_hz_rmb - rmb_hz; chayi:= strtofloat(format('%0.2f', [chayi])); end; sql_mx:= 'insert into wxInvoiceDetail(invCode,invNumber,hscode,goodsName,model,unit,price,quantity,amount,'+ 'gscode,gsname,depname,rmb_dj,jsAmount,XH) values(''' + code + ''',''' + number + ''',''' + ADOQuery_Excel.fieldbyname('HS编码').AsString + ''',''' + ADOQuery_Excel.fieldbyname('报关品名').AsString + ''',''' + ADOQuery_Excel.fieldbyname('规格型号').AsString + ''',''' + '个' + ''',' + ADOQuery_Excel.fieldbyname('报关单价').AsString + ',' + ADOQuery_Excel.fieldbyname('报关数量').AsString + ',' + format('%0.2f', [zj]) + ',''' + qry.fieldbyname('GScode').AsString + ''',''' + qry.fieldbyname('name').AsString + ''',''' + qry.fieldbyname('depname').AsString + ''',' + format('%0.6f', [dj_rmb]) + ',' + format('%0.2f', [zj_rmb+chayi]) + ',''' + inttostr(j) + ''')' ; j:=j+1; // sql_mx := StringReplace(sql_mx, '''','''''', [rfReplaceAll]); cmd.CommandText := sql_mx; cmd.Execute(); //处理人民币合计 更新到表头里 capital_hz:= MoneyConvert(usd_hz_rmb); sql_mx:='update wxInvoice set rmb=:renminbi,capital=:capital,amt=:amt where bgd_no=:bgd_no'; cmd.CommandText:= sql_mx; cmd.Parameters.ParamByName('renminbi').Value:= formatfloat('0.00',usd_hz_rmb); cmd.Parameters.ParamByName('capital').Value:= capital_hz; cmd.Parameters.ParamByName('amt').Value:= usd_hz; cmd.Parameters.ParamByName('bgd_no').Value:= ADOQuery_Excel.FieldValues['内部发票号']; cmd.Execute(); fapiao:= ADOQuery_Excel.FieldValues['内部发票号']; end else begin if trim(ADOQuery_Excel.fieldbyname('内部发票号').AsString)='' then break; //初始化需要累加的值 j:=1; rmb_hz :=0; usd_hz:=0; qry.Close; //获取发票号码 代码 strSql := 'select startNumber,pcs,remain,invCode,id from wxFpkc' + ' where remain >0 ' + ' order by id'; qry.SQL.Text := strSql; qry.Open; if qry.Eof then begin qry.Close; showmessage('无可用的发票库存信息,请导入发票!'); exit; end; Number := formatfloat('00000000',strtoint(qry.Fields[0].AsString) +qry.Fields[1].AsInteger - qry.Fields[2].AsInteger); code:= qry.Fields[3].AsString; //判断汇率有没有设置过 kprq:= ADOQuery_Excel.fieldbyname('开票日期').AsString; kprq:= StringReplace (kprq, '.', '-', [rfReplaceAll]); yearmonth:=FormatdateTime('yyyymm',strtodatetime(kprq)); qry_RunSql.Close; qry_RunSql.SQL.text:='select * from tblBicode where code=:code and VALIDMONTH=:VALIDMONTH'; qry_RunSql.Parameters.ParamByName('VALIDMONTH').Value:= yearmonth; qry_RunSql.Parameters.ParamByName('code').Value:= ADOQuery_Excel.fieldbyname('币别').AsString; qry_RunSql.Open; if qry_RunSql.Eof then begin showmessage(yearmonth+'汇率没有设置,请设置!'); exit; end else hl:= qry_RunSql.fieldbyname('hl').asfloat/100; //处理明细行 //匹配国税编码及名称 qry.Close; qry.SQL.Text:='select * from tblCmcode where code=:code'; qry.Parameters.ParamByName('code').value:=ADOQuery_Excel.fieldbyname('HS编码').AsString; qry.Open; //只考虑FOB情况 zj:= ADOQuery_Excel.fieldbyname('报关金额').AsFloat; usd_hz:=usd_hz +strtofloat(format('%0.2f', [zj])); zj_rmb:= hl * zj; zj_rmb:= strtofloat(format('%0.2f', [zj_rmb])); dj_rmb:= zj_rmb / ADOQuery_Excel.fieldbyname('报关数量').AsFloat; rmb_hz:= rmb_hz + zj_rmb; //处理汇总差异 usd_hz_rmb:=strtofloat(format('%0.2f', [usd_hz* hl])); //汇总美元金额 直接 乘以 汇率 if j = hangshu then begin chayi:= usd_hz_rmb - rmb_hz; chayi:= strtofloat(format('%0.2f', [chayi])); end; //处理人民币合计 capital_hz:= MoneyConvert(usd_hz_rmb); sql_mx:= 'insert into wxInvoiceDetail(invCode,invNumber,hscode,goodsName,model,unit,price,quantity,amount,'+ 'gscode,gsname,depname,rmb_dj,jsAmount,XH) values(''' + code + ''',''' + number + ''',''' + ADOQuery_Excel.fieldbyname('HS编码').AsString + ''',''' + ADOQuery_Excel.fieldbyname('报关品名').AsString + ''',''' + ADOQuery_Excel.fieldbyname('规格型号').AsString + ''',''' + '个' + ''',' + ADOQuery_Excel.fieldbyname('报关单价').AsString + ',' + ADOQuery_Excel.fieldbyname('报关数量').AsString + ',' + format('%0.2f', [zj]) + ',''' + qry.fieldbyname('GScode').AsString + ''',''' + qry.fieldbyname('name').AsString + ''',''' + qry.fieldbyname('depname').AsString + ''',' + format('%0.6f', [dj_rmb]) + ',' + format('%0.2f', [zj_rmb+chayi]) + ',''' + inttostr(j) + ''')' ; j:=j+1; cmd.CommandText := sql_mx; cmd.Execute(); //处理表头信息 qry1.Close; qry1.SQL.Text:='select top 1 * from tblCompany'; qry1.Open; strSql:= 'insert into wxInvoice(taxNumber,invType,invCode,invNumber,kpDate,bgd_no,clientCode,CustName,amt,operator,payee,fhr,remark,'+ 'crny,exchange,rmb,contractNo,jckrq,capital) values(''' + '91330201610258252F.1' + ''',''' + '27310' + ''',''' + code + ''',''' + Number + ''',''' + kprq + ''',''' + ADOQuery_Excel.fieldbyname('内部发票号').AsString + ''',''' + ADOQuery_Excel.fieldbyname('客户名称').AsString + ''',''' + ADOQuery_Excel.fieldbyname('客户名称').AsString + ''',' + formatfloat('0.00',usd_hz) + ',''' + qry1.fieldbyname('kpr').AsString + ''',''' + qry1.fieldbyname('skr').AsString + ''',''' + qry1.fieldbyname('fhr').AsString + ''',''' + ADOQuery_Excel.fieldbyname('备注').AsString + ''',''' + ADOQuery_Excel.fieldbyname('币别').AsString + ''',' + floattostr(hl*100) + ',''' + formatfloat('0.00',usd_hz_rmb) + ''',''' + ADOQuery_Excel.fieldbyname('合同号').AsString + ''',''' + kprq + ''',''' + capital_hz + ''')' ; //strSql := StringReplace(strSql, '''','''''', [rfReplaceAll]); cmd.CommandText := strSql; cmd.Execute(); //更新库存,并以此为基准更新国税库存 strSql := 'update wxFpkc set remain=remain-1'; cmd.CommandText := strSql; cmd.Execute(); strSql := 'update wxFpkc ' + ' set crtNumber= right( ''00000000'' +cstr( cdbl(endNumber )-remain +1) ,8) '; cmd.CommandText := strSql; cmd.Execute(); strSql := 'delete from wxFpkc where remain=0'; cmd.CommandText := strSql; cmd.Execute(); fapiao:= ADOQuery_Excel.FieldValues['内部发票号']; end; ADOQuery_Excel.Next; // 更新发票库存 end; ADOConnection1.CommitTrans; //*******//提交到后台数据库 end; end; except ADOConnection1.RollbackTrans; showmessage(e.Message); ADOConnection1.Connected:=false; ADOConnection_Excel.Connected:=False; end; ADOConnection_Excel.Connected:=False; // ADOConnection1.endtrans; ADOConnection1.Connected:=false; showmessage('导入成功!'); btnOpen.Enabled :=true; end; end; ```

有没有更好的方法上传记录集与JSON或其他? [关闭]

<div class="post-text" itemprop="text"> <p>I have firebird database and need to upload one of database tables to remote mysql server on web. There are thousands records and I dont know how to upload these records. I can upload records one by one with JSON. I'm using POST method.</p> <p>How can I upload all records in one time or in parts?</p> <p><strong>Update 1:</strong> This codes is working for one by one data update. But it's like such a flood attack. I want to upload all data that I've selected in one time.</p> <p><strong>Delphi 7 Side</strong> <strong>HTTP Post Method</strong></p> <pre><code>function PostURLAsString(aURL: string; code:string): string; var lHTTP: TIdHTTP; lStream: TStringStream; parameters: TStringList; begin lHTTP := TIdHTTP.Create(nil); lHTTP.Request.ContentType := 'application/x-www-form-urlencoded'; lStream := TStringStream.Create(Result); try Parameters := TStringList.Create; parameters.Add('code=' + code); lHTTP.Post(aURL, parameters,lStream); lStream.Position := 0; Result := lStream.ReadString(lStream.Size); finally FreeAndNil(lHTTP); FreeAndNil(lStream); end; end; </code></pre> <p><strong>Upload Records One by One:</strong></p> <pre><code>procedure TForm1.Button1Click(Sender: TObject); var js:TlkJSONobject; jb: TlkJSONbase; s: String; code:string; begin IBQuery1.First; with IBQuery1 do while not Eof do begin code := VarToStr(FieldValues['code']); s := PostURLAsString('http://www.domain.com/uitems.php', code); js := TlkJSON.ParseText(s) as TlkJSONobject; jb := js.Field['items']; if VarToStr(jb.Child[0].Field['status'].Value) = '1' then ListBox1.Items.Add(code + ' is inserted') else ListBox1.Items.Add(code + ' is not inserted'); Application.ProcessMessages; js.Free; Next; end; end; </code></pre> <p><strong>PHP Side</strong> <strong>uitems.php</strong></p> <pre><code>&lt;?php include_once dirname(__FILE__) .'/DBConnect.php'; function update($code){ $db = new DbConnect(); // array for json response $response = array(); $response["items"] = array(); $sqlstr = "INSERT INTO items (`code`) VALUES ('$code')"; $result = mysql_query($sqlstr); $tmp = array(); if ($result) { // successfully updated $tmp["status"] = 1; //inserted } else { $tmp["status"] = 0; //not inserted } array_push($response["items"], $tmp); header("Content-Type: application/json; charset=utf-8", true); // echoing json result echo json_encode($response, JSON_UNESCAPED_UNICODE); } update($_POST["code"]); ?&gt; </code></pre> </div>

使用delphi开发的问题

为什么form2,form3没有出现 procedure TForm1.Button1Click(Sender: TObject); var num,user,pass:string; begin user:=edit1.Text; pass:=edit2.Text; if radiobutton1.checked=true then begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('select * from 登陆表 where 用户名='''+user+'''and 密码='''+pass+'''') ; ADOQuery1.Open; num:=ADOQuery1.fieldbyname('权限').AsString; if num='' then showmessage('error'); if num='1' then form2.show; if num='0' then form3.show; end else begin showmessage('ederror'); end end;

在订阅完成之前,AWS MQTT连接丢失

<div class="post-text" itemprop="text"> <p>I'm having an intermittent issue with go trying to connect to AWS MQTT. Sometimes it works fine, other times not so much. When I connect I get this error: Connection lost before Subscribe completed</p> <p>I'm really not sure why it does this, at first everything seemed to work fine but now it throws this error more often than not. Here's the code that I'm using to connect:</p> <pre><code>type ServerConnection struct { Cert tls.Certificate Host string Port int Path string Topic string Qos int Messages chan MQTT.Message Control chan os.Signal } func (server *ServerConnection) Start() error { cid := uuid.New().String() connOpts := &amp;MQTT.ClientOptions{ ClientID: cid, CleanSession: true, AutoReconnect: true, MaxReconnectInterval: 1 * time.Second, KeepAlive: 30000, TLSConfig: tls.Config{Certificates: []tls.Certificate{server.Cert}}, } connOpts.SetConnectTimeout(30 * time.Second) connOpts.SetDefaultPublishHandler(func(client MQTT.Client, msg MQTT.Message) { server.Messages &lt;- msg }) brokerURL := fmt.Sprintf("tcps://%s:%d%s", server.Host, server.Port, server.Path) connOpts.AddBroker(brokerURL) mqttClient := MQTT.NewClient(connOpts) if token := mqttClient.Connect(); token.Wait() &amp;&amp; token.Error() != nil { return token.Error() } // Subscribe go func() { log.Printf("subscribing") if token := mqttClient.Subscribe(server.Topic, byte(server.Qos), nil); token.Wait() &amp;&amp; token.Error() != nil { fmt.Println(token.Error()) os.Exit(1) } log.Printf("subscribed") }() server.ProcessMessages() log.Println("[MQTT] Connected") quit := make(chan struct{}) signal.Notify(server.Control, os.Interrupt) go func() { &lt;-server.Control mqttClient.Disconnect(250) fmt.Println("[MQTT] Disconnect") quit &lt;- struct{}{} }() &lt;-quit return nil } </code></pre> </div>

获取[Guzzle \ Http \ Exception \ RequestException]完成请求时出错

<div class="post-text" itemprop="text"> <p>I wrote a simple script to download some .JPG files and reupload them to Amazon S3. It works almost every time but every once in a while I'm getting the error:</p> <pre><code>[Guzzle\Http\Exception\RequestException] Error completing request </code></pre> <p>Since the error doesn't tell me much, where would I find more information as to what is causing the error. I don't even know if it is in the downloading of my files from the FTP server, the renaming, or the uploading to S3. Very confused on this error.</p> <p><b>EDIT</b></p> <p>Following the advice below, I added in the catch portion but I'm not sure what that's telling me exactly. This script is downloading jpg's and then uploading them to Amazon S3. Here's what the Catch is providing:</p> <pre><code>#0 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Http/Message/Request.php(378): Guzzle\Http\Message\Request-&gt;processResponse(Array) #1 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Http/Message/EntityEnclosingRequest.php(49): Guzzle\Http\Message\Request-&gt;setState('complete', Array) #2 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(286): Guzzle\Http\Message\EntityEnclosingRequest-&gt;setState('complete', Array) #3 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(244): Guzzle\Http\Curl\CurlMulti-&gt;processResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array) #4 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(227): Guzzle\Http\Curl\CurlMulti-&gt;processMessages() #5 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(211): Guzzle\Http\Curl\CurlMulti-&gt;executeHandles() #6 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(105): Guzzle\Http\Curl\CurlMulti-&gt;perform() #7 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMultiProxy.php(91): Guzzle\Http\Curl\CurlMulti-&gt;send() #8 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Http/Client.php(282): Guzzle\Http\Curl\CurlMultiProxy-&gt;send() #9 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/aws/aws-sdk-php/src/Aws/Common/Client/AbstractClient.php(284): Guzzle\Http\Client-&gt;send(Object(Guzzle\Http\Message\EntityEnclosingRequest)) #10 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php(136): Aws\Common\Client\AbstractClient-&gt;send(Object(Guzzle\Http\Message\EntityEnclosingRequest)) #11 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Service/Command/AbstractCommand.php(153): Guzzle\Service\Client-&gt;execute(Object(Aws\S3\Command\S3Command)) #12 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Service/Command/AbstractCommand.php(189): Guzzle\Service\Command\AbstractCommand-&gt;execute() #13 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php(76): Guzzle\Service\Command\AbstractCommand-&gt;getResult() #14 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/aws/aws-sdk-php/src/Aws/Common/Client/AbstractClient.php(105): Guzzle\Service\Client-&gt;__call('PutObject', Array) #15 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/app/commands/ProcessListings.php(156): Aws\Common\Client\AbstractClient-&gt;__call('putObject', Array) #16 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/app/commands/ProcessListings.php(156): Aws\S3\S3Client-&gt;putObject(Array) #17 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/app/commands/ProcessListings.php(137): ProcessListings-&gt;UploadImageToS3('naples', '213506540', '213506540-naple...', 'app/processing/...') #18 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/app/commands/ProcessListings.php(72): ProcessListings-&gt;DownloadImages('naples', '213506540', 'http://extimage...', '213506540-naple...', 12) #19 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(108): ProcessListings-&gt;fire() #20 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(244): Illuminate\Console\Command-&gt;execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #21 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(96): Symfony\Component\Console\Command\Command-&gt;run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #22 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/symfony/console/Symfony/Component/Console/Application.php(898): Illuminate\Console\Command-&gt;run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #23 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/symfony/console/Symfony/Component/Console/Application.php(191): Symfony\Component\Console\Application-&gt;doRunCommand(Object(ProcessListings), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #24 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/vendor/symfony/console/Symfony/Component/Console/Application.php(121): Symfony\Component\Console\Application-&gt;doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #25 /Volumes/Data/Users/chrisfarrugia/Sites/listingnaples.com/artisan(59): Symfony\Component\Console\Application-&gt;run() #26 {main} </code></pre> </div>

使用Amazon S3 PHP sdk时设置证书验证位置时出错

<div class="post-text" itemprop="text"> <p>Here is the code to implement Amazon S3 delete object</p> <pre><code> require_once(APPPATH . 'libraries/aws.phar'); $s3 = S3Client::factory(array( 'key' =&gt; S3_KEY, 'secret' =&gt; S3_SECRET )); $s3-&gt;deleteMatchingObjects(S3_BUCKET, "abc.mp4"); </code></pre> <p>The error message is:</p> <pre><code>Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 77: error setting certificate verify locations: CAfile: /tmp/guzzle-cacert.pem CApath: none [url] https://testdomain.s3.amazonaws.com?prefix=abc.mp4' in phar:///home/in001/public_html/yoga/application/libraries/aws.phar/Guzzle/Http/Curl/CurlMulti.php:359 Stack trace: #0 phar:///home/in001/public_html/yoga/application/libraries/aws.phar/Guzzle/Http/Curl/CurlMulti.php(292): Guzzle\Http\Curl\CurlMulti-&gt;isCurlException(Object(Guzzle\Http\Message\Request), Object(Guzzle\Http\Curl\CurlHandle), Array) #1 phar:///home/in001/public_html/yoga/application/libraries/aws.phar/Guzzle/Http/Curl/CurlMulti.php(257): Guzzle\Http\Curl\CurlMulti-&gt;processResponse(Object(Guzzle\Http\Message\Request), Object(Guzzle\Http\Curl\CurlHandle), Array) #2 phar:///home/in001/public_html/yoga/application/libraries/aws.phar/Guzzle/Http/Curl/CurlMulti.php(240): Guzzle\Http\Curl\CurlMulti-&gt;processMessages() #3 phar:///home/in001/public_html/yo in phar:///home/in001/public_html/yoga/application/libraries/aws.phar/Aws/Common/Client/AbstractClient.php on line 258 </code></pre> <p>I have followed the example here:</p> <p><a href="https://stackoverflow.com/questions/18346308/delete-object-or-bucket-in-amazon-s3">Delete object or bucket in Amazon S3?</a></p> <p>and logged all parameter is correct, any idea of how to fix it?</p> <p>Thanks for helping</p> </div>

亚马逊s3桶上传图片卷曲异常'数据倒带不可能'

<div class="post-text" itemprop="text"> <p>I am using codeigniter to upload images to a amazon storage bucket.Iam getting this error and i dont know what to do to overcome this problem</p> <blockquote> <p>Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 65: necessary data rewind wasn't possible [url] <a href="https://public-ww-lk.s3.amazonaws.com/images/gallery/the-kingsbury-colombo-sri-lanka-21401-293x154.jpg" rel="nofollow">https://public-ww-lk.s3.amazonaws.com/images/gallery/the-kingsbury-colombo-sri-lanka-21401-293x154.jpg</a>' in E:\projects\wwlk\application\third_party\Awsmy\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php:338 Stack trace: #0 E:\projects\wwlk\application\third_party\Awsmy\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php(279): Guzzle\Http\Curl\CurlMulti-&gt;isCurlException(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array) #1 E:\projects\wwlk\application\third_party\Awsmy\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php(244): Guzzle\Http\Curl\CurlMulti-&gt;processResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array) #2 E:\projects\wwlk\application\third_party\Awsmy\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php(227): Guzzle\Http\Curl\CurlMulti-&gt;processMessages() #3 E:\pro in E:\projects\wwlk\application\third_party\Awsmy\vendor\aws\aws-sdk-php\src\Aws\Common\Client\AbstractClient.php on line 285</p> </blockquote> </div>

把大图片分成四张小图片,定义了一个TBitmap指针数组,循环LoadFromFile,执行报错!

for(height=ImageHeight;height<=Image1->Height;height+=ImageHeight) for(width=ImageWidth;width<=Image1->Width;width+=ImageWidth) { Application->ProcessMessages(); if(IdChange == true) { for(i;i>=0;i--) delete pBitmap[i]; //lbTis->Caption = ""; return; } lbTis->Caption = "正在加载图片..."; String filename = DataModule5->adoqryPicture->FieldByName("name")->AsString; String pathheader = "F:\\"; String path = pathheader+ filename; pBitmap[i] = new Graphics::TBitmap(); pBitmap[i]->LoadFromFile(path); SrcRect = Rect(0,0,pBitmap[i]->Width,pBitmap[i]->Height); DstRect = Rect(width-ImageWidth,height-ImageHeight,width,height); Image1->Canvas->CopyRect(DstRect,pBitmap[i]->Canvas,SrcRect); DataModule5->adoqryPicture->RecNo++; i++; //delete pBitmap; } 进入第二次循环时会报错“存储空间不足,无法执行该命令”

定义一个TBitmap对象,循环加载图片,有时会出错,有时可以执行成功!

TRect SrcRect,DstRect; int width,height; ImageWidth = Image1->Width/ImageNum; ImageHeight = Image1->Height/ImageNum; Graphics::TBitmap* pBitmap=new Graphics::TBitmap(); for(height=ImageHeight;height<=Image1->Height;height+=ImageHeight) for(width=ImageWidth;width<=Image1->Width;width+=ImageWidth) { Application->ProcessMessages(); if(IdChange == true) break; bTis->Caption = "正在加载图片..."; String filename = DataModule5->adoqryPicture->FieldByName("name")->AsString; String pathheader = "F:\\"; String path = pathheader+ filename; pBitmap->LoadFromFile(path); SrcRect = Rect(0,0,pBitmap->Width,pBitmap->Height); DstRect = Rect(width-ImageWidth,height-ImageHeight,width,height); Image1->Canvas->CopyRect(DstRect,pBitmap->Canvas,SrcRect); DataModule5->adoqryPicture->RecNo++; } delete pBitmap; 进入循环执行第二次时,在SrcDest = Rect(0,0,pBitmap->Width,pBitmap->Height);处出现“存储空间不足,无法执行此命令”!

检索确切的连接-TCP套接字-通道-goroutine

<div class="post-text" itemprop="text"> <p>I am learning Golang by few days, so it's not clear to me, how to retrieve the right connection "conn" inside the function </p> <p>func processMessages</p> <p>for the relative message "msg"</p> <p>Thanks!</p> <pre><code>package main import ( "fmt" "log" "net" "os" "encoding/json" "time" "bufio" ) type Packet struct { Payload Payload `json:"payload"` } type Payload struct { Data string `json:"data"` } func main() { if len(os.Args) != 2 { fmt.Fprintf(os.Stderr, "Usage: %s hostname ", os.Args[0]) fmt.Println("Usage: ", os.Args[0], "port number") os.Exit(1) } msgchan := make(chan string) go processMessages(msgchan) addr := ":" + os.Args[1] ln, err := net.Listen("tcp", addr) if err != nil { fmt.Println(err) //log.Fatal(err) } fmt.Println("Server listening at ", addr) for { conn, err := ln.Accept() if err != nil { log.Println(err) continue } /* FIRST GOROUTINE */ go handleConnection(conn, msgchan) } } func processMessages(msgchan &lt;-chan string) { for msg := range msgchan { /* .. here the problem.. how I can know here the 'conn' the relative connection for this message??? */ if len(msg)&gt;0 { packet := &amp;Packet{} err := json.Unmarshal([]byte(msg), packet) if err != nil { log.Fatalln("Error xxx: ", err) } else { if len(packet.Payload.Data) &gt; 0 { fmt.Println( len(packet.Payload.Data) ) } } } } } func closeConnection(c net.Conn) { c.Close() } func handleConnection(c net.Conn, msgchan chan&lt;- string) { for { inputReader := bufio.NewReader(c) o, _ := inputReader.ReadString(' ') msgchan &lt;- o } } </code></pre> <p>inside the function func handleConnection I have the connection, but.. how to forward the connection to the channel "msgchan" together with the message "&lt;- o" ??? </p> <p>Valeriano Cossu</p> </div>

mailgun,guzzle卷曲错误

<div class="post-text" itemprop="text"> <p>I have this error when trying to attach a file with mailgun.</p> <pre><code>Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 26: couldn't open file "zzz.txt" [url] https://api.mailgun.net/v2/sandbox8df78f0cdbc646aeb2a46999a8c6def5.mailgun.org/messages' in C:\xampp\htdocs\tutlage ewsletter\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php:359 Stack trace: #0 C:\xampp\htdocs\tutlage ewsletter\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php(292): Guzzle\Http\Curl\CurlMulti-&gt;isCurlException(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array) #1 C:\xampp\htdocs\tutlage ewsletter\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php(257): Guzzle\Http\Curl\CurlMulti-&gt;processResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array) #2 C:\xampp\htdocs\tutlage ewsletter\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php(240): Guzzle\Http\Curl\CurlMulti-&gt;processMessages() #3 C:\xampp\htdocs\tutlage ewsletter\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\C in C:\xampp\htdocs\tutlage ewsletter\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php on line 359 </code></pre> <p>How to fix this ? Is it a guzzle certificate issue ?</p> <p>I attach the file like this (nothing wrong here) (file is accessible by php) : </p> <pre><code>$mg-&gt;sendMessage($domain, array('from' =&gt; '...', 'to' =&gt; '...', 'subject' =&gt; '...', 'text' =&gt; '...' ), array( 'attachment' =&gt; array('zzz.txt') ) ); </code></pre> </div>

Laravel Queue如何在作业句柄方法中获取数据

<div class="post-text" itemprop="text"> <p>I have created a sequence of messsages to be sent in text messages through twilio.</p> <p>I have created a controller to put the messages in a queue with the data received in the post request. Here is my controller to make queue:</p> <pre><code>public function make_queue(Request $request) { $data = array( 'phone' =&gt; $request-&gt;input('phone'), 'message'=&gt; $request-&gt;input('message'), 'token'=&gt; $request-&gt;input('token')', 'sid'=&gt; $request-&gt;input('sid') ); ProcessMessages::dispatch($data) -&gt;delay(now()-&gt;addSeconds(15)); return 'message will be sent'; } </code></pre> <p>And in handle the job , in the handle function </p> <pre><code>public function handle() { $token = should_come_from job; $sid = should_come_from job; $ids = should_come_from job; $msg = should_come_from job; try{ //send message } catch (exception $e) { handle exception } } </code></pre> <p>I am not able to figure out how do I get the values in the handle function to actually send the message....</p> </div>

如果抛出异常,则不会调用addEventListener

<div class="post-text" itemprop="text"> <p>I am trying to implement <a href="https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events" rel="nofollow">Server-sent-events</a> communication between my client and my server.</p> <p>I have implemented it and it works perfectly except when the server return exceptions.</p> <p>I am not sure why the exception message is not being returned to the client after the exception.</p> <p>Here is how my listener is written</p> <pre><code> var evtSource = new EventSource('poll.php'); evtSource.addEventListener("getMessagingQueue", function(e) { console.log(e); var data = JSON.parse(e.data); console.log(data); processServerData(data); }, false); </code></pre> <p>Below is my PHP code. (ie. <code>poll.php</code>) file</p> <pre><code>ini_set('display_errors', 0); set_time_limit(0); header("Content-Type: text/event-stream" . PHP_EOL); header("Cache-Control: no-cache" . PHP_EOL); try { $sleepTime = 1; $url = ''; $loggedIn = false; if( !isDefinedConstents('ICWS_USERNAME', 'ICWS_PASSWORD', 'ICWS_STATION_NAME', 'ICWS_SERVER', 'ICWS_PORT') ){ throw new exception('Missing Credentials'); } else { $scheme = 'http'; if(ICWS_SECURED){ $scheme = 'https'; } $url = sprintf('%s://%s:%s@%s:%s', $scheme, ICWS_USERNAME, ICWS_PASSWORD, ICWS_SERVER, ICWS_PORT); //configure the connection $conf = new ICWS\Config\Config($url, ICWS_STATION_NAME); //create a new instance of icws $icws = new ICWS\Connection($conf); $messaging = new ICWS\Messaging($icws); $loggedIn = $icws-&gt;isLogged(); } if(!$loggedIn){ throw new exception('Something Went Wrong when trying to login'); } while($loggedIn){ $messaging-&gt;processMessages(); $result = array_merge( (array) $messaging-&gt;getCallsQueue(), (array) $messaging-&gt;getCurrentUserStatusQueue()) ; displayResults($result); sleep(1); } } catch(Exception $e){ $result = array('userStatus' =&gt; array('statusId' =&gt; 'You are not logged in!', 'isLoggedIn' =&gt; false, 'icwsDescription' =&gt; $e ) ); displayResults($result); } function displayResults($result){ echo 'event: getMessagingQueue' . PHP_EOL; echo 'data: ' . json_encode( $result ) . PHP_EOL . PHP_EOL; ob_end_flush(); flush(); } function isDefinedConstents(){ $args = func_get_args(); foreach($args as $v){ $value = constant($v); if( !defined($v) || empty($value) ){ return false; } } return true; } </code></pre> <p>How do I get the listener to get the message even if the there is exceptions?</p> <p><strong>EDITED</strong> When I execute this code after the addEventListner line </p> <pre><code>evtSource.onerror = function(e) { console.log(e); }; </code></pre> <p>This is what I get</p> <pre><code>error { target: EventSource, isTrusted: true, currentTarget: EventSource, eventPhase: 2, bubbles: false, cancelable: false, defaultPrevented: false, timeStamp: 1435614201283000, originalTarget: EventSource, explicitOriginalTarget: EventSource, NONE: 0 } </code></pre> <p>It seems that the Exception thrown by PHP server cause the entire call to fail.</p> </div>

在windows用c++实现多线程??

用c++写了两个实现不同功能的代码,一个是将文件分块,另一个是对每个分块进行哈希处理,现在想用多线程并行处理每个分块,请问如何使用用多线程??本人之前从未用过多线程,不知该如何下手。求大神帮忙!!

无法使用Gaufrette和Symfony2检查Amazon s3存储桶是否存在

<div class="post-text" itemprop="text"> <p>Getting this error when trying to upload a file to my bucket using VichUploader, Gaufrette and the AWS SDK v2 on a Symfony2 web app. Sounds like a problem with the API calls. It's giving me a Denied Access (Error 500 Interal Server Error) Can anybody help me here ?</p> <p>Config :</p> <pre><code>knp_gaufrette: stream_wrapper: ~ adapters: local_adapter: local: directory: %kernel.root_dir%/../web/uploads/img aws_s3_adapter: aws_s3: service_id: 'et.aws_s3' bucket_name: mybucket options: create: false directory: 'uploads' filesystems: aws_s3_fs: adapter: aws_s3_adapter local_fs: adapter: local_adapter vich_uploader: db_driver: orm storage: gaufrette mappings: image: uri_prefix: https://s3.amazonaws.com/mybucket # you'll need this set to use the Vich URL generator upload_destination: aws_s3_fs namer: vich_uploader.namer_uniqid delete_on_remove: true delete_on_update: true inject_on_load: true </code></pre> <p>Services :</p> <pre><code>services: et.aws_s3: class: Aws\S3\S3Client #Gaufrette\Adapter\AwsS3 factory_class: Aws\S3\S3Client factory_method: factory arguments: - key: key secret: key region: us-west-2 </code></pre> <p>Stack trace: </p> <pre><code>[1] Aws\S3\Exception\AccessDeniedException: Access Denied at n/a in C:\xampp2\htdocs\WebProject\vendor\aws\aws-sdk-php\src\Aws\Common\Exception\NamespaceExceptionFactory.php line 91 at Aws\Common\Exception\NamespaceExceptionFactory-&gt;createException('Aws\S3\Exception\AccessDeniedException', object(EntityEnclosingRequest), object(Response), array('code' =&gt; 'AccessDenied', 'message' =&gt; 'Access Denied', 'type' =&gt; 'client', 'request_id' =&gt; 'B4966F7BBECF30F3', 'parsed' =&gt; object(SimpleXMLElement))) in C:\xampp2\htdocs\WebProject\vendor\aws\aws-sdk-php\src\Aws\Common\Exception\NamespaceExceptionFactory.php line 76 at Aws\Common\Exception\NamespaceExceptionFactory-&gt;fromResponse(object(EntityEnclosingRequest), object(Response)) in C:\xampp2\htdocs\WebProject\vendor\aws\aws-sdk-php\src\Aws\Common\Exception\ExceptionListener.php line 55 at Aws\Common\Exception\ExceptionListener-&gt;onRequestError(object(Event), 'request.error', object(EventDispatcher)) in line at call_user_func(array(object(ExceptionListener), 'onRequestError'), object(Event), 'request.error', object(EventDispatcher)) in C:\xampp2\htdocs\WebProject\app\cache\dev\classes.php line 1790 at Symfony\Component\EventDispatcher\EventDispatcher-&gt;doDispatch(array(array(object(ExceptionListener), 'onRequestError'), array('Guzzle\Http\Message\Request', 'onRequestError')), 'request.error', object(Event)) in C:\xampp2\htdocs\WebProject\app\cache\dev\classes.php line 1723 at Symfony\Component\EventDispatcher\EventDispatcher-&gt;dispatch('request.error', object(Event)) in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Http\Message\Request.php line 589 at Guzzle\Http\Message\Request-&gt;processResponse(array('handle' =&gt; object(CurlHandle))) in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Http\Message\Request.php line 378 at Guzzle\Http\Message\Request-&gt;setState('complete', array('handle' =&gt; object(CurlHandle))) in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Http\Message\EntityEnclosingRequest.php line 49 at Guzzle\Http\Message\EntityEnclosingRequest-&gt;setState('complete', array('handle' =&gt; object(CurlHandle))) in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php line 303 at Guzzle\Http\Curl\CurlMulti-&gt;processResponse(object(EntityEnclosingRequest), object(CurlHandle), array('msg' =&gt; '1', 'result' =&gt; '0', 'handle' =&gt; 'Resource id #2420')) in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php line 257 at Guzzle\Http\Curl\CurlMulti-&gt;processMessages() in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php line 240 at Guzzle\Http\Curl\CurlMulti-&gt;executeHandles() in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php line 224 at Guzzle\Http\Curl\CurlMulti-&gt;perform() in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php line 111 at Guzzle\Http\Curl\CurlMulti-&gt;send() in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMultiProxy.php line 94 at Guzzle\Http\Curl\CurlMultiProxy-&gt;send() in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Http\Client.php line 284 at Guzzle\Http\Client-&gt;send(object(EntityEnclosingRequest)) in C:\xampp2\htdocs\WebProject\vendor\aws\aws-sdk-php\src\Aws\Common\Client\AbstractClient.php line 256 at Aws\Common\Client\AbstractClient-&gt;send(object(EntityEnclosingRequest)) in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Service\Client.php line 136 at Guzzle\Service\Client-&gt;execute(object(S3Command)) in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Service\Command\AbstractCommand.php line 153 at Guzzle\Service\Command\AbstractCommand-&gt;execute() in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Service\Command\AbstractCommand.php line 189 at Guzzle\Service\Command\AbstractCommand-&gt;getResult() in C:\xampp2\htdocs\WebProject\vendor\guzzle\guzzle\src\Guzzle\Service\Client.php line 76 at Guzzle\Service\Client-&gt;__call('CreateBucket', array(array('Bucket' =&gt; 'eventori', 'LocationConstraint' =&gt; 'us-west-2'))) in C:\xampp2\htdocs\WebProject\vendor\aws\aws-sdk-php\src\Aws\Common\Client\AbstractClient.php line 104 at Aws\Common\Client\AbstractClient-&gt;__call('createBucket', array(array('Bucket' =&gt; 'eventori', 'LocationConstraint' =&gt; 'us-west-2'))) in C:\xampp2\htdocs\WebProject\vendor\knplabs\gaufrette\src\Gaufrette\Adapter\AwsS3.php line 254 at Aws\S3\S3Client-&gt;createBucket(array('Bucket' =&gt; 'eventori', 'LocationConstraint' =&gt; 'us-west-2')) in C:\xampp2\htdocs\WebProject\vendor\knplabs\gaufrette\src\Gaufrette\Adapter\AwsS3.php line 254 at Gaufrette\Adapter\AwsS3-&gt;ensureBucketExists() in C:\xampp2\htdocs\WebProject\vendor\knplabs\gaufrette\src\Gaufrette\Adapter\AwsS3.php line 125 at Gaufrette\Adapter\AwsS3-&gt;write('5535ad181397d.png', '') in C:\xampp2\htdocs\WebProject\vendor\knplabs\gaufrette\src\Gaufrette\Filesystem.php line 122 at Gaufrette\Filesystem-&gt;write('5535ad181397d.png', '', true) in C:\xampp2\htdocs\WebProject\vendor\vich\uploader-bundle\Storage\GaufretteStorage.php line 56 at Vich\UploaderBundle\Storage\GaufretteStorage-&gt;doUpload(object(PropertyMapping), object(UploadedFile), '', '5535ad181397d.png') in C:\xampp2\htdocs\WebProject\vendor\vich\uploader-bundle\Storage\AbstractStorage.php line 67 at Vich\UploaderBundle\Storage\AbstractStorage-&gt;upload(object(Image), object(PropertyMapping)) in C:\xampp2\htdocs\WebProject\vendor\vich\uploader-bundle\Handler\UploadHandler.php line 64 at Vich\UploaderBundle\Handler\UploadHandler-&gt;upload(object(Image), 'imageFile') in C:\xampp2\htdocs\WebProject\app\cache\dev\appDevDebugProjectContainer.php line 9126 at VichUploaderBundleHandlerUploadHandler_00000000534e394600000000143551d5-&gt;upload(object(Image), 'imageFile') in C:\xampp2\htdocs\WebProject\vendor\vich\uploader-bundle\EventListener\Doctrine\UploadListener.php line 41 at Vich\UploaderBundle\EventListener\Doctrine\UploadListener-&gt;prePersist(object(LifecycleEventArgs)) in C:\xampp2\htdocs\WebProject\vendor\symfony\symfony\src\Symfony\Bridge\Doctrine\ContainerAwareEventManager.php line 63 at Symfony\Bridge\Doctrine\ContainerAwareEventManager-&gt;dispatchEvent('prePersist', object(LifecycleEventArgs)) in C:\xampp2\htdocs\WebProject\vendor\doctrine\orm\lib\Doctrine\ORM\Event\ListenersInvoker.php line 117 at Doctrine\ORM\Event\ListenersInvoker-&gt;invoke(object(ClassMetadata), 'prePersist', object(Image), object(LifecycleEventArgs), '4') in C:\xampp2\htdocs\WebProject\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php line 896 at Doctrine\ORM\UnitOfWork-&gt;persistNew(object(ClassMetadata), object(Image)) in C:\xampp2\htdocs\WebProject\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php line 1683 at Doctrine\ORM\UnitOfWork-&gt;doPersist(object(Image), array('00000000534e3b0d00000000143551d5' =&gt; object(Event), '00000000534e272c00000000143551d5' =&gt; object(User), '00000000534e3df700000000143551d5' =&gt; object(Image))) in C:\xampp2\htdocs\WebProject\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php line 2229 at Doctrine\ORM\UnitOfWork-&gt;cascadePersist(object(Event), array('00000000534e3b0d00000000143551d5' =&gt; object(Event), '00000000534e272c00000000143551d5' =&gt; object(User), '00000000534e3df700000000143551d5' =&gt; object(Image))) in C:\xampp2\htdocs\WebProject\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php line 1702 at Doctrine\ORM\UnitOfWork-&gt;doPersist(object(Event), array('00000000534e3b0d00000000143551d5' =&gt; object(Event), '00000000534e272c00000000143551d5' =&gt; object(User), '00000000534e3df700000000143551d5' =&gt; object(Image))) in C:\xampp2\htdocs\WebProject\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php line 1639 at Doctrine\ORM\UnitOfWork-&gt;persist(object(Event)) in C:\xampp2\htdocs\WebProject\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php line 579 at Doctrine\ORM\EntityManager-&gt;persist(object(Event)) in C:\xampp2\htdocs\WebProject\src\ET\CoreBundle\Controller\EventController.php line 63 at ET\CoreBundle\Controller\EventController-&gt;createAction(object(Request)) in line at call_user_func_array(array(object(EventController), 'createAction'), array(object(Request))) in C:\xampp2\htdocs\WebProject\app\bootstrap.php.cache line 3029 at Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(object(Request), '1') in C:\xampp2\htdocs\WebProject\app\bootstrap.php.cache line 2991 at Symfony\Component\HttpKernel\HttpKernel-&gt;handle(object(Request), '1', true) in C:\xampp2\htdocs\WebProject\app\bootstrap.php.cache line 3140 at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel-&gt;handle(object(Request), '1', true) in C:\xampp2\htdocs\WebProject\app\bootstrap.php.cache line 2384 at Symfony\Component\HttpKernel\Kernel-&gt;handle(object(Request)) in C:\xampp2\htdocs\WebProject\web\app_dev.php line 28 </code></pre> </div>

急!求大神帮忙!!从客户端传一张70M左右的图片到服务器!!调了几天没调出来!!

客户端: Client->Active = true; //Application->ProcessMessages(); ShowMessage("send"); TMemoryStream *pMS = new TMemoryStream(); f = new TStringList(); pMS->LoadFromFile(Edit1->Text); int bmpsize = pMS->Size; int count = bmpsize/(BUFSIZE-8); int mod = bmpsize%(BUFSIZE-8); int ret; for(i=0;i<count;i++) { memset(buf,'\0',sizeof(buf)); //包头 buf[0] = 0xFD; buf[1] = 0xFD; buf[2] = 0xFD; buf[3] = 0xFD; buf[4] = 0x00; buf[5] = 0x0B; //图片内容 pMS->ReadBuffer(buf+6,BUFSIZE-8); //包尾 buf[BUFSIZE-2] = 0xFD; buf[BUFSIZE-1] = 0x0D; ret = Client->Socket->SendBuf(buf,BUFSIZE); while(ret <= 0) { errcount++; ret = Client->Socket->SendBuf(buf,BUFSIZE); } f->Add(ret); Sleep(10); } //最后的不完整包 if(mod != 0) { memset(buf,'\0',sizeof(buf)); buf[0] = 0xFD; buf[1] = 0xFD; buf[2] = 0xFD; buf[3] = 0xFD; buf[4] = 0x00; buf[5] = 0x0B; pMS->ReadBuffer(buf+6,mod); buf[6+mod] = 0xFD; buf[7+mod] = 0x0B; ret = Client->Socket->SendBuf(buf,mod+8); while(ret <= 0) { errcount++; ret = Client->Socket->SendBuf(buf,mod+8); } f->Add(mod); f->SaveToFile("f:\\send.txt"); } f->Add(ret); ShowMessage("发送完成"); delete pMS; delete f; Client->Active = false; 服务端: if(0 == flag) { fd = fopen("F:\\RAD2010\\server\\image\\1.bmp","ab+"); flag = 1; } int datalen = Socket->ReceiveLength(); if(datalen >= RECSIZE) size = RECSIZE; else size = datalen; memset(buf,'\0',sizeof(buf)); int ret = Socket->ReceiveBuf(buf,size); //判断是否含包头 if(buf[0] == 0xFD && buf[1] == 0xFD && buf[2] == 0xFD && buf[3] == 0xFD) { if(begin == 1) { memset(temp,'\0',sizeof(temp)); count = 0; position = 0; //ShowMessage("err"); } begin = 1; head = 6; } //判断是否含包尾 if((buf[ret-2] == 0xFD && buf[ret-1] == 0x0D) || (buf[ret-2] == 0xFD && buf[ret-1] == 0x0B)) { memcpy(temp+position,buf+head,size-head-2); count = count + size - head - 2; //把temp中的内容写到文件里面 if(fwrite(temp,count,1,fd) == 1) { f->Add(count); f->SaveToFile("f:\\rec.txt"); memset(temp,'\0',sizeof(temp)); } else { ShowMessage("error"); } position = 0; head = 0; begin = 0; //接收到最后一个包 if(buf[ret-2] == 0xFD && buf[ret-1] == 0x0B) { ShowMessage("接收成功"); fclose(fd); flag = 0; } } else { //把内容放到temp缓冲区Byte temp[110*1024]里面 memcpy(temp+position,buf+head,size-head); position = position + ret - head; count = count + size - head; head = 0; }

在中国程序员是青春饭吗?

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

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

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

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

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

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

Linux面试题(2020最新版)

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

和黑客斗争的 6 天!

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

Google 与微软的浏览器之争

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

讲一个程序员如何副业月赚三万的真实故事

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

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

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

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

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

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

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

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

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

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

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

程序员为什么千万不要瞎努力?

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

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

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

面试:第十六章:Java中级开发(16k)

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

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

立即提问
相关内容推荐