string id = System.Guid.NewGuid().ToString("N") + DateTime.Now.ToString("yyyyMMddHHmmss");的用法

由于不会再sqlite上设置主键,string id = System.Guid.NewGuid().ToString("N") + DateTime.Now.ToString("yyyyMMddHHmmss");可以用来每个数据表里用来区分每行吗,应该怎么用

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
string id = System.Guid.NewGuid().ToString("N") + DateTime.Now.ToString("yyyyMMddHHmmss");的用法

由于不会再sqlite上设置主键,string id = System.Guid.NewGuid().ToString("N") + DateTime.Now.ToString("yyyyMMddHHmmss");可以用来每个数据表里用来区分每行吗,应该怎么用

C#winform中显示无法将类型为“System.Int64”的对象强制转换为类型“System.String”

![图片说明](https://img-ask.csdn.net/upload/201911/01/1572602195_548859.png) ![图片说明](https://img-ask.csdn.net/upload/201911/01/1572602210_226294.png) ``` string yinsu = ""; if (radioButton2.Checked == true) { yinsu = "紫外线"; } else if (radioButton1.Checked == true) { yinsu = "温度、振动"; } string id = System.Guid.NewGuid().ToString("N") + DateTime.Now.ToString("yyyyMMddHHmmss"); string str = "'" + txtName.Text + "'," + "'" + txtyunxinglicheng.Text + "'," + "'" + txtyingdu.Text + "'," + "'" + txtlashenqiangdu + "'," + "'" + txtladuanshenchanglv + "'," + "'" + yinsu + "'," + "'" + id + "'"; string sq = @"Data Source=" + dbPath; m = new SQLiteConnection(sq); m.Open(); string sql = "insert into " + tableName + " (传感器型号,运行里程,硬度,拉伸强度,拉断伸长率,因素,材料特性ID) values (" + str + ")"; SQLiteCommand command = new SQLiteCommand(sql, m); command.ExecuteNonQuery(); m.Close(); ``` 问题1:原本打算自动生成一个id(string),在系统管理界面添加一组数,结果在dataGridView上材料特性ID显示为0,而数据库里显示为很长的一串字符 问题二:按修改按钮后 ,在Addcailiaoquxian.form1.TabText = (string)Eachcailiao.Rows[i].Cells[7].Value;// 处显示无法将类型为“System.Int64”的对象强制转换为类型“System.String”。如何处理

无法将类型为“System.Int32”的对象强制转换为类型“System.Array”

修改Edit.cshtml上部分字段,点击保存跳转到Index.cshtml。 但现在点击保存,就跳出以下错误。 ![图片说明](https://img-ask.csdn.net/upload/201508/23/1440271095_308679.jpg) **这是Model ** ``` using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Web; namespace MvcSilverTalent.Models { public class RetireeModel { [Key] [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public int RetireNum { get; set; } [Required] [DisplayName("单位编号")] [MaxLength(3)] public string UnitID { get; set; } [Required] [DisplayName("员工编号")] [MaxLength(6)] public string EmployeeID { get; set; } [Required] [DisplayName("离退休类型")] public int RetireType { get; set; } [Required] [DisplayName("删除标记")] public int DeleteFlag { get; set; } // // 基本信息 [Required] [DisplayName("姓名")] [MaxLength(20)] public string Name { get; set; } [Required] [DisplayName("性别")] public Boolean Gender { get; set; } [Required] [DisplayName("身份证号码")] public string IDCardNo { get; set; } [Required] [DisplayName("出生年月")] public DateTime Brityday { get; set; } [Required] [DisplayName("民族")] [MaxLength(30)] public string Nationality { get; set; } [Required] [DisplayName("籍贯")] [MaxLength(30)] public string NativePlace { get; set; } [DisplayName("党派")] [MaxLength(30)] public string Party { get; set; } [DisplayName("所在党支部")] [MaxLength(100)] public string PartyBranch { get; set; } [DisplayName("最高学历")] [MaxLength(20)] public string EducationDegree { get; set; } [Required] [DisplayName("用户组")] public string GroupName { get; set; } [Required] [DisplayName("是否参加爱心基金")] public Boolean HasLoveFund { get; set; } [DisplayName("享受爱心基金慰问情况")] public string LoveFundCase { get; set; } [DisplayName("慰问走访情况")] public string VisitCase { get; set; } // // 工作信息 [Required] [DisplayName("参加工作时期")] public int WorkPeriod { get; set; } [Required] [DisplayName("参加工作时间")] public DateTime WorkTime { get; set; } [Required] [DisplayName("退休时间")] public DateTime RetireTime { get; set; } [Required] [DisplayName("工龄")] public int WorkAge { get; set; } [Required] [DisplayName("退休单位")] [MaxLength(100)] public string UnitName { get; set; } [DisplayName("职称代码")] [MaxLength(3)] public int TitleID { get; set; } [DisplayName("职称")] [MaxLength(30)] public string Title { get; set; } [DisplayName("职务")] [MaxLength(30)] public string Position { get; set; } [DisplayName("编制")] [MaxLength(30)] public string Formation { get; set; } // // 可修改信息 [Required] [MaxLength(255)] [DisplayName("近照")] public string PhotoUrl { get; set; } [MaxLength(255)] [DisplayName("特长")] public string Specialty { get; set; } [Required] [MaxLength(255)] [DisplayName("现住地址")] public string Address { get; set; } [MaxLength(30)] [DisplayName("家庭电话")] public string HomeTel { get; set; } [MaxLength(30)] [DisplayName("手机号码")] public string MobileNum { get; set; } [MaxLength(10)] [DisplayName("邮政编码")] public string ZipCode { get; set; } [MaxLength(40)] [DisplayName("邮箱")] public string Email { get; set; } public virtual ICollection<EventSignModel> EventSignModels { get; set; } public virtual ICollection<HealthSignMain> HealthSignMains { get; set; } } } ``` **这是controller ** ``` // GET: /UserInfo/Edit.cshtml public ActionResult Edit(int RetireNum) { RetireeModel RetireeModel = db.RetireeModels.Find(RetireNum); if (RetireeModel == null) { return HttpNotFound(); } return View(RetireeModel); } // // POST: /UserInfo/Edit.cshtml [HttpPost] [ValidateAntiForgeryToken] public ActionResult Edit(RetireeModel RetireeModel) { Response.Write("<script>alert('ddddd')</script>"); if (ModelState.IsValid) { db.Entry(RetireeModel).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } Response.Write("<script>alert('xxxx')</script>"); return View("Index"); } ```

小白问题:String s =(String) list.get(s)的含义

![图片说明](https://img-ask.csdn.net/upload/201901/17/1547690818_230381.png) 问下老哥,=们, 这个是遍历输出List的集合,然后那句 String s =(String) list.get(s) 里面的(String)的含义是强制转型吗?还是别的意思

为什么我添加完数据后,数据库里的没问题,在软件的datagridview上显示的不对

![图片说明](https://img-ask.csdn.net/upload/201911/04/1572877158_602032.png) ![图片说明](https://img-ask.csdn.net/upload/201911/04/1572877170_380417.png) ![图片说明](https://img-ask.csdn.net/upload/201911/04/1572877184_874028.png) 先按添加按钮,出现第一个图来添加参数,确认后在第三幅图的datagridview上显示出来。(删除时要用材料特性ID做条件) 问题:第二图没问题(string tabText = System.Guid.NewGuid().ToString("N") + DateTime.Now.ToString("yyyyMMddHHmmss");随机生成的ID) 第三图中材料特性ID只显示了前面的数字 部分程序如下 ``` private void btntianjia_Click(object sender, EventArgs e) { string btnName = btntianjia.Text; main1.form1.toolOperation.Text = "正在加载窗体,请稍等..."; main1.form1.toolOperation.Font = new Font(main1.form1.toolOperation.Font, FontStyle.Bold); main1.form1.toolOperation.ForeColor = Color.FromArgb(254, 67, 101); Application.DoEvents(); Addcailiaoquxian form = new Addcailiaoquxian(); Addcailiaoquxian.form1.BtnName = btnName; form.Show(); main1.form1.toolOperation.Text = ""; } ``` Addcailiaoquxian窗口的 ``` private void btnAdd_Click(object sender, EventArgs e) { string dbPath = @"D:\历年高考分数.db"; if (btnName == "添加") { string sq = @"Data Source=" + dbPath; m = new SQLiteConnection(sq); m.Open(); string sql = "select * from sqlite_master where type='table' and name ='特性'"; SQLiteCommand command = new SQLiteCommand(sql, m);// m.Close(); AddcailiaoPara1(dbPath, "特性"); Guanlicailiaoquxian.form1.LoadcailiaoPara(); DialogResult result = MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } public void AddcailiaoPara1(string dbPath, string tableName) { string yinsu = ""; if (radioButton2.Checked == true) { yinsu = "紫外线"; } else if (radioButton1.Checked == true) { yinsu = "温度、振动"; } string tabText = System.Guid.NewGuid().ToString("N") + DateTime.Now.ToString("yyyyMMddHHmmss"); string str = "'" + txtName.Text + "'," + "'" + txtyunxinglicheng.Text + "'," + "'" + txtyingdu.Text + "'," + "'" + txtladuanshenchanglv.Text + "'," + "'" + txtlashenqiangdu.Text + "'," + "'" + yinsu + "'," + "'" + tabText + "'"; string sq = @"Data Source=" + dbPath; m = new SQLiteConnection(sq); m.Open(); string sql = "insert into " + tableName + " (传感器型号,运行里程,硬度,拉伸强度,拉断伸长率,因素,材料特性ID) values (" + str + ")"; SQLiteCommand command = new SQLiteCommand(sql, m); command.ExecuteNonQuery(); m.Close(); } ``` 删除使用的 ``` for (int i = 0; i < Eachcailiao.Rows.Count; i++) { DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)Eachcailiao.Rows[i].Cells[0]; Boolean flag = Convert.ToBoolean(checkCell.Value); if (flag == true) { string dbPath = @"D:\历年高考分数.db"; string sq = @"Data Source=" + dbPath; SQLiteConnection m = new SQLiteConnection(sq); m.Open(); string sql = "delete from 特性 where 材料特性ID='" + Eachcailiao.Rows[i].Cells[7].Value + "'"; SQLiteCommand command = new SQLiteCommand(sql, m); command.ExecuteNonQuery(); m.Close(); } } ```

使用EF查询数据是报下面的错,请高手指点

“System.InvalidOperationException”类型的异常在 EntityFramework.dll 中发生,但未在用户代码中进行处理 其他信息: The specified cast from a materialized 'System.Guid' type to the 'System.String' type is not valid.![图片说明](https://img-ask.csdn.net/upload/201605/19/1463642574_113627.png)

MVC Ajax.Begin()异步上传不了,求解救

View代码: ``` @using (Ajax.BeginForm("ProcessImagUpload", "Async", new AjaxOptions() { HttpMethod = "post", OnSuccess = "afterUpload" }, new { enctype = "multipart/form-data" })) { <input type="file" name="imgFile" /> <input type="submit" value="异步上传图片" /> } ``` Control代码 public ActionResult ProcessImagUpload() { var file = Request.Files["imgFile"]; string path ="/Upload/"+Guid.NewGuid().ToString()+ file.FileName; file.SaveAs(Request.MapPath(path)); return Content(path); } 查看请求报文 请求 URL:http://localhost:14092/Async/ProcessImagUpload?Length=5 请求方式:POST 状态代码:500 Internal Server Error 请求 HTTP 报头查看源代码 Accept:*/* Accept-Encoding:gzip,deflate Accept-Language:zh-CN Connection:keep-alive Content-Length:31 Content-Type:application/x-www-form-urlencoded; charset=UTF-8 大半夜的求大神拯救

在 JavaScript 中创建 GUID / UUID?

<div class="post-text" itemprop="text"> <p>I'm trying to create globally-unique identifiers in JavaScript. I'm not sure what routines are available on all browsers, how "random" and seeded the built-in random number generator is, etc..</p> <p>The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around.</p> </div> <p>转载于:https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript</p>

在MVC4中级联文本框?

<div class="post-text" itemprop="text"> <p>Hi I have two fields in my view <strong>CustomerName</strong> and <strong>ContactPerson</strong>. Before i kept these two field as dropdown field. Now I change the customer name field as autoComplete textbox and contact person field as dropdown field.</p> <p>Before i kept these two field as <strong>Cascading dropdown</strong> fields.That is if i select the <strong>CusomerName</strong> the CustomerName related <strong>ContactPerson</strong> will automatically in ContactPerson dropdown.</p> <p>Now I change that customer name field to textbox and contact person field as dropdown. Now what i want is if i type and select the CustomerName in customername textox, the CustomerName related ContactPerson have to load automatically in contactperson dropdown. </p> <p><strong>My Model(VisitorsViewModel)</strong></p> <pre><code>public Nullable&lt;System.Guid&gt; CustomerID { get; set; } public string CustomerName { get; set; } public Nullable&lt;System.Guid&gt; CustomerContactID { get; set; } public string ContactPerson { get; set; } </code></pre> <p><strong>My View</strong></p> <pre><code>@Html.LabelFor(model =&gt; Model.CustomerName, new { @class = "control-label" }) @Html.TextBoxFor(model =&gt; Model.CustomerName, new { @class = "form-control" }) @Html.HiddenFor(model =&gt; Model.CustomerID) @Html.Label("Contact Person", new { @class = "control-label" }) @Html.DropDownListFor(model =&gt; model.CustomerContactID, new SelectList(string.Empty, "Value", "Text"), "Please select a ContactPerson", new { @class = "form-control", type = "text", id = "CustomerContactID" }) </code></pre> <p><strong>My Jquery Code</strong></p> <pre><code>&lt;link href="~/Areas/Sales/Content/themes/base/jquery-ui.css" rel="stylesheet" /&gt; &lt;script src="~/Areas/Sales/Scripts/jquery-2.2.3.min.js"&gt;&lt;/script&gt; &lt;script src="~/Areas/Sales/Scripts/jquery-ui.1.10.4min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { debugger; $("#CustomerName").autocomplete({ source: function (request, response) { $.ajax({ url: '@Url.Action("GetVisitCustomer", "VisitorsForm")', datatype: "json", data: { Areas: 'Sales', term: request.term }, success: function (data) { response($.map(data, function (val, item) { debugger; return { label: val.Name, value: val.Name, customerId: val.ID } })) } }) }, select: function (event, ui) { $("#CustomerID").val(ui.item.customerId); debugger; } }); }); var Customerid = $("CustomerID").val(); $('#CustomerName').blur(function () { debugger; $('#CustomerContactID').empty(); $.ajax( '@Url.Action("GetContactPersobByCustomerId", "VisitorsForm", new { Area = "Sales" })', { type: "POST", datatype: "Json", data: { CustomerID: $('#CustomerID').val() }, success: function (data) { $('#CustomerContactID').append($('&lt;option&gt;&lt;/option&gt;').val('').text('Please select')); $.each(data, function (index, value) { $('#CustomerContactID').append('&lt;option value="' + value.CustomerContactID + '"&gt;' + value.ContactReference + '&lt;/option&gt;'); }); } }); }); </code></pre> <p><strong>My Controller Code</strong></p> <pre><code> public JsonResult GetVisitCustomer(string Areas, string term = "") { var objCustomerlist = db.Customers.Where(c =&gt; c.IsDeleted == false) .Where(c =&gt; c.DisplayName.ToUpper() .Contains(term.ToUpper())) .Select(c =&gt; new { Name = c.DisplayName, ID = c.CustomerID }) .Distinct().ToList(); return Json(objCustomerlist, JsonRequestBehavior.AllowGet); } public JsonResult GetContactPersobByCustomerId(string customerId) { Guid Id = Guid.Parse(customerId); var customercontacts = (from a in db.CustomerContacts where a.CustomerID == Id select a); return Json(customercontacts, JsonRequestBehavior.AllowGet); } </code></pre> <p>My above code is working if i type and select the <strong>customer name</strong> the customername related <strong>contact person</strong> is loading in contact person dropdown but what my doubt is i gave blur function in contact person dropdown</p> <pre><code> $('#CustomerName').blur(function () { </code></pre> <p>I donno my code is correct or not however it is working. now what i want is please any one tell me the alternate or correct code for this blur function. I tried to explain my issue as per my level best any one help me to resolve this issue..</p> <p>Advance Thanks.</p> </div>

java 解析WSDL 对应参数type解析不出来,为什么?可能是什么原因?

对应jar包![图片说明](https://img-ask.csdn.net/upload/201712/08/1512698071_837847.png) 效果图: ![图片说明](https://img-ask.csdn.net/upload/201712/08/1512698157_247518.png) 主要代码: package wsclient.test; import java.util.Iterator; import java.util.List; import wsclient.domain.OperationInfo; import wsclient.domain.ParameterInfo; import wsclient.domain.ServiceInfo; import wsclient.util.ComponentBuilder; public class WSClient { public static void testWSDL4J() { int i = 0, j = 0; try { ComponentBuilder builder = new ComponentBuilder(); ServiceInfo serviceInfo = new ServiceInfo(); String wsdllocation = "https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl"; serviceInfo.setWsdllocation(wsdllocation); serviceInfo = builder.buildserviceinformation(serviceInfo); Iterator<?> iter = serviceInfo.getOperations(); System.out.println("现在可以查看远端Web服务对象的有关情况了(对应本地Web服务类,ServiceInfo)"); System.out.println(serviceInfo.getName() + "提供的操作有:"); while (iter.hasNext()) { i++; OperationInfo oper = (OperationInfo) iter.next(); System.out.println(""); System.out.println("操作:" + i + " " + oper.getTargetMethodName()); List<?> inps = oper.getInparameters(); List<?> outps = oper.getOutparameters(); if (inps.size() == 0) { System.out.println("此操作所需的输入参数为:"); System.out.println("执行此操作不需要输入任何参数!"); } else { System.out.println("此操作所需的输入参数为:"); for (Iterator<?> iterator1 = inps.iterator(); iterator1.hasNext();) { ParameterInfo element = (ParameterInfo) iterator1.next(); System.out.println("参数名为:" + element.getName()); System.out.println("参数类型为:" + element.getKind()); } } if (outps.size() == 0) { System.out.println("执行此操作不返回任何参数!"); } else { System.out.println("此操作的输出参数为:"); for (Iterator<?> iterator2 = outps.iterator(); iterator2.hasNext();) { ParameterInfo element = (ParameterInfo) iterator2.next(); System.out.println("参数名:" + element.getName()); System.out.println("类型为:" + element.getKind()); } } System.out.println(""); } } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } } public static void main(String[] args) { WSClient.testWSDL4J(); } } public ServiceInfo buildserviceinformation(ServiceInfo serviceinfo) throws Exception { WSDLReader reader = wsdlFactory.newWSDLReader(); reader.setFeature("javax.wsdl.verbose", true); reader.setFeature("javax.wsdl.importDocuments", true); // reader.setExtensionRegistry(new MyExtensionRegistry()); Definition def = reader.readWSDL(serviceinfo.getWsdllocation()); System.out.println("***恭喜您!def已经成功构建***"); wsdlTypes = createSchemaFromTypes(def); // System.out.println("==========================="+def.toString()); System.out.println("WSDL的Schema已经成功构建完,总共有多少个Schema定义:" + wsdlTypes.size()); Map services = def.getServices(); if (services != null) { // System.out.println("======================"+services); Iterator svcIter = services.values().iterator(); populateComponent(serviceinfo, (Service) svcIter.next()); System.out.println("***恭喜您!系统的Web服务对象:ServiceInfo已经成功构建***"); System.out.println(""); } return serviceinfo; }

ASPxPageControl 动态添加 TabPage

代码如下:问题是tabpage添加成功了,当是tabpage下的iframe没有 ``` foreach (DataRow row in table2.Rows) { var ifra = new HtmlGenericControl("iframe") { ID = row["CellID"].ToString() }; ifra.Attributes["src"] = row["CellURL"].ToString(); var cc = new ContentControl { ID = Guid.NewGuid().ToString().Replace("-", "") }; cc.Controls.Add(ifra); var tp = new TabPage(row["CellName"].ToString(), row["CellName"].ToString()); tp.ContentCollection.Add(cc); pageControl.TabPages.Add(tp); } ``` ![这是运行结果,标签下的iframe没有](https://img-ask.csdn.net/upload/201501/14/1421228921_415210.jpg)

关于用代买生成K2 kprx 文件

我想在想要用代码来生成K2 KPRX 文件 , 现在的问题是文件已经生成成功,也能够通过代码发布,但是一旦发起流程 ,K2 就会报错 , 错误信息是:Key could not be found in the collection 。 代码如下 : 想请教下高手怎么解决这个问题, 我现在是不知道哪里写错了 。 enter code here #region 设置节点审核界面 ClientEvent approvalClientEvent = WorkflowFactory.CreateEvent<ClientEvent>(node.ApprovalNode_Name, WizardNames.DefaultClientEvent); approvalClientEvent.EventItem.InternetPlatform = "ASP"; approvalClientEvent.EventItem.SendToInternet = true; ////需要绑定smartobject作为审核界面来源 SmartObjectFieldPart smfp = new SmartObjectFieldPart(); //#region 创建locals Local localSmart = new Local("Name", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart(Config.SmartObjectName))); smfp.Properties.Locals.Add("Name", localSmart); EnvironmentFieldModel environment = new EnvironmentFieldModel("SmartObject Server", ""); ArtifactLibraryFieldPart fieldPart = new ArtifactLibraryFieldPart(environment); Local localServer = new Local("Server", K2FieldFactory.CreateK2Field(typeof(string), fieldPart)); smfp.Properties.Locals.Add("Server", localServer); Local localMothed = new Local("MethodDisplayName", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart(Config.FormUrl))); smfp.Properties.Locals.Add("MethodDisplayName", localMothed); Local localMothedType = new Local("MethodType", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart("read"))); smfp.Properties.Locals.Add("MethodType", localMothedType); Local localDisplayName = new Local("DisplayName", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart(Config.SmartObjectName))); smfp.Properties.Locals.Add("DisplayName", localDisplayName); //Local localIsList = new Local("IsList", K2FieldFactory.CreateK2Field(typeof(bool), new ValueTypePart("False"))); //smfp.Properties.Locals.Add("IsList", localIsList); Local localGuid = new Local("Guid", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart(Guid.NewGuid().ToString()))); smfp.Properties.Locals.Add("Guid", localGuid); Local localMethodName = new Local("MethodName", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart(Config.FormUrl))); smfp.Properties.Locals.Add("MethodName", localMethodName); Local localType = new Local("Type", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart("SourceCode.SmartFunctions.Syntax.Expressions.SmartObjectExp"))); smfp.Properties.Locals.Add("Type", localType); #endregion #region 创建inputs Input inputProId = new Input("procId", "procId", "Text", true, K2FieldFactory.CreateK2Field(typeof(string), new DataFieldPart("Process", "RequestID", DataTypes.String, FieldListOption.None))); smfp.Properties.Inputs.Add("procId", inputProId); Input inputActivityName = new Input("activityName", "activityName", "Text", true, K2FieldFactory.CreateK2Field(typeof(string), new WorkflowContextFieldPart(WorkflowContextProperty.ActivityInstanceName))); smfp.Properties.Inputs.Add("activityName", inputActivityName); #endregion #region 创建returns Return returnResult = new Return("result"); returnResult.DisplayName = "result"; returnResult.IsSelected = true; returnResult.Type = "Text"; smfp.Properties.Returns.Add("result", returnResult); #endregion #region 创建properties Property pResult = new Property(); pResult.Name = "result"; pResult.DisplayName = "result"; pResult.Type = "Text"; smfp.Properties.Properties.Add("result", pResult); #endregion #region SourceCode.Workflow.Authoring.K2Field interPart = new K2Field(); interPart.Parts.Add(smfp); interPart.Parts.Add(new ValueTypePart("&")); interPart.Parts.Add(new SerialNoFieldPart()); approvalClientEvent.EventItem.InternetUrl = interPart; approvalClientEvent.EventItem.InternetUrl = K2FieldFactory.CreateK2Field( typeof(string), new ValueTypePart("http://webserver/page.aspx?"), new SerialNoFieldPart()); activity.Events.Add(approvalClientEvent); #endregion #region 设置节点审核人 //如何通过smartobject设置审核人 SimpleDestinationRule destinationRule = new SimpleDestinationRule(); DestinationSet defaultDestinationSet = new DestinationSet(); Destination destination = new Destination(); destination.Type = DestinationTypes.User; SmartObjectFieldPart smfpDestination = new SmartObjectFieldPart(); //smfpDestination.SmartObjectGuid = smartobject.Guid; #region 创建locals Local localSmartDestination = new Local("Name", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart(Config.SmartObjectName))); smfpDestination.Properties.Locals.Add("Name", localSmartDestination); EnvironmentFieldModel environmentDestination = new EnvironmentFieldModel("SmartObject Server", ""); ArtifactLibraryFieldPart fieldPartDestination = new ArtifactLibraryFieldPart(environmentDestination); Local localServerDestination = new Local("Server", K2FieldFactory.CreateK2Field(typeof(string), fieldPartDestination)); smfpDestination.Properties.Locals.Add("Server", localServerDestination); Local localMothedDestination = new Local("MethodDisplayName", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart(Config.GetApproveUserNames))); smfpDestination.Properties.Locals.Add("MethodDisplayName", localMothedDestination); Local localMothedTypeDestination = new Local("MethodType", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart("list"))); smfpDestination.Properties.Locals.Add("MethodType", localMothedTypeDestination); Local localDisplayNameDestination = new Local("DisplayName", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart(Config.SmartObjectName))); smfpDestination.Properties.Locals.Add("DisplayName", localDisplayNameDestination); smfpDestination.Properties.Locals["IsList"].Value = K2FieldFactory.CreateK2Field(typeof(bool), new ValueTypePart("False")); Local localGuidDestination = new Local("Guid", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart(Guid.NewGuid().ToString()))); smfpDestination.Properties.Locals.Add("Guid", localGuidDestination); Local localMethodNameDestination = new Local("MethodName", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart(Config.GetApproveUserNames))); smfpDestination.Properties.Locals.Add("MethodName", localMethodNameDestination); Local localTypeDestination = new Local("Type", K2FieldFactory.CreateK2Field(typeof(string), new ValueTypePart("SourceCode.SmartFunctions.Syntax.Expressions.SmartObjectExp"))); smfpDestination.Properties.Locals.Add("Type", localTypeDestination); #endregion #region 创建inputs Input inputProIdDestination = new Input("procId", "procId", "Text", true, K2FieldFactory.CreateK2Field(typeof(string), new DataFieldPart("Process", "RequestID", DataTypes.String, FieldListOption.None))); smfpDestination.Properties.Inputs.Add("procId", inputProIdDestination); Input inputActivityNameDestination = new Input("activityName", "activityName", "Text", true, K2FieldFactory.CreateK2Field(typeof(string), new WorkflowContextFieldPart(WorkflowContextProperty.ActivityInstanceName))); smfpDestination.Properties.Inputs.Add("activityName", inputActivityNameDestination); #endregion #region 创建returns Return returnResultDestination = new Return("result"); returnResultDestination.DisplayName = "result"; returnResultDestination.IsSelected = true; returnResultDestination.Type = "Text"; smfpDestination.Properties.Returns.Add("result", returnResultDestination); #endregion #region 创建properties Property pResultDestination = new Property(); pResultDestination.Name = "result"; pResultDestination.DisplayName = "result"; pResultDestination.Type = "Text"; smfpDestination.Properties.Properties.Add("result", pResultDestination); #endregion SourceCode.Workflow.Authoring.K2Field destinationField = new K2Field(); destinationField.Parts.Add(smfpDestination); destination.Value = destinationField; defaultDestinationSet.Destinations.Add(destination); destinationRule.DestinationSets.Add(defaultDestinationSet); // Set the destination rule of the activity activity.DestinationRule = destinationRule; #endregion #region 设置节点上的动作 var lines = BllRulInfo.Fetch(new CriteriaRulInfo { EqStartActId = node.ID }); foreach (var line in lines) { if (!string.IsNullOrEmpty(line.RulAct)) { EventAction action = WorkflowFactory.CreateK2Object<EventAction>(line.RulAct); action.Description = line.Id; action.ActionItem = new DefaultOutcomeAction(); approvalClientEvent.Actions.Add(action); } } #endregion #region 设置节点上的规则导航 //相同动作不同规则如何设置 activity.SucceedingRule = new DefaultOutcomeSucceedingRule(); PropertyWizardDefinition propWizDefSimple = WorkflowHelpers.FindOfType<SimpleSucceedingRulePropertyWizardDefinition>(activity.WizardDefinition.PropertyWizardDefinitions); PropertyWizardDefinition propWizDefOutcome = WorkflowHelpers.FindOfType<OutcomeSucceedingRulePropertyWizardDefinition>(activity.WizardDefinition.PropertyWizardDefinitions); if (propWizDefSimple != null && propWizDefOutcome == null) { activity.WizardDefinition.PropertyWizardDefinitions.Remove(propWizDefSimple); activity.WizardDefinition.PropertyWizardDefinitions.Add( WorkflowFactory.CreatePropertyWizardDefinition(PropertyWizardNames.OutcomeSucceedingRule)); } #endregion #region 设置节点上的动作对应的outcome //如何生成一个动作对应多个outcome //SourceCode.Workflow.Design.Outcome.Common.GenerateDefaultOutcomesForActions(approvalClientEvent); ProcessFactory.GenerateDefaultOutcomesForActions(approvalClientEvent, lines); #endregion #region 设置节点上的outcome对应的line SourceCode.Workflow.Design.Outcome.Common.GenerateDefaultLinesForOutcomes(activity.SucceedingRule as DefaultOutcomeSucceedingRule); foreach (var line in lines) { if (!string.IsNullOrEmpty(line.RulAct)) { DefaultActivity finishActivity = FindActivity(process, nodeNameDic[line.EndActId]); Line pl = FindLine(process, node.ApprovalNode_Name, line.RulAct); if (pl != null) pl.FinishActivity = finishActivity; } } #endregion

异常:Cookie value must not be null

/** * 入口 * @param args */ public static void main(String[] args) { System.out.println("输出什么?"); Login login = new Login(); login.getPersonInfo(); } // 返会一个list对象 public List<String> getPersonInfo() {// 返回一个list对象 List<String> list = new ArrayList<String>(); try { // 得到session ,进行模拟登陆,(如果有验证码,我就不知道了)。--博客园老牛大讲堂 Connection.Response res = Jsoup.connect("http://www.51job.com") .data( "loginname", "15217727459" , "password", "15217727459." )// 进行模拟登陆 .method(Connection.Method.POST).timeout(10000).execute();// 设置请求时间和登陆用的用户名,密码。 // Document doc = res.parse(); // 根据session进行爬虫 // 注释:不是所有网站他们都需要cook,也不是所有的网站cook都是iPlanetDirectoryPro。 // 不同网站网址的cookie不一样。而且每次访问都不一样,所以不要想着把session保存起来。 String guid = res.cookie("guid"); String _ujz = res.cookie("_ujz"); System.out.println("guid === " + guid); System.out.println("_ujz === " + _ujz); Document objectDoc = Jsoup .connect("http://i.51job.com/resume/resume_preview.php?lang=c&resumeid=358968976&3658907287")// 里面的网址(就是你想要爬取的网页) .cookie("guid", guid) .cookie("_ujz", _ujz) // 异常提示行 .timeout(10000).post();// 设置请求的时间(这里设置的请求时间是10秒) System.out.println("objectDoc === " + objectDoc); Element htmlElement = objectDoc.getElementsByClass("name").get(0);// 得到class为name的第一个对象 Elements trElements = htmlElement.getElementsByTag("tr");// 得到tr标签的对象 System.out.println(trElements.size());// 输出多少个tr标签 for (int i = 1; i < trElements.size(); i++) { Elements divElments = trElements.get(i).getElementsByAttributeValue("align", "left");// 根据class进行得到对象。 for (int j = 0; j < trElements.size(); j++) { Element d = divElments.get(j);// 获取每一个对象 list.add(d.text());// 得到这个对象对应的值 } } } catch (IOException e) { e.printStackTrace(); } return list; }

字符串操作,删除一个逗号

<div class="post-text" itemprop="text"> <p><strong>UPDATE 1:</strong></p> <p>This is how I am attempting to build the string:</p> <pre><code>header('Content-type:application/json'); function getdata($the_query) { $connection = mysql_connect('server', 'user', 'pass') or die (mysql_error()); $db = mysql_select_db('db_name', $connection) or die (mysql_error()); $results = mysql_query($the_query) or die(mysql_error()); $the_data = "{ \"rss\": { \"channels\" : [ { \"title\" : \"".$title."\", \"link\": \"http://www.mycompany.com/external.php\", \"description\": \"company description goes here\","; while($row = mysql_fetch_array($results)) { extract($row); $the_data .= "\"items\" : [ { \"title\": \"".$title."\", \"link\": \"".$link."\", \"guid\": \"".$link."\", \"pubDate\": \"".$date."\", \"description\": \"".$description."\" } ],"; } $the_data .= "} ] } }"; mysql_close($connection); return $the_data; } </code></pre> <p><strong>ORIGINAL QUESTION:</strong></p> <p>I have a string similar to this:</p> <pre><code>$mystring = "{ \"rss\": { \"channels\" : [ { \"title" : \"title goes here\", \"link": \"link goes here\", \"description": \"description goes here\", \"items\" : [ { \"title\": \"title goes here\", \"link\": \"url goes here\", \"guid\": \"id goes here\", \"pubDate\": \"data goes her\", \"description\": \"description goes here\" } ], \"items\" : [ { \"title\": \"title goes here\", \"link\": \"url goes here\", \"guid\": \"id goes here\", \"pubDate\": \"data goes her\", \"description\": \"description goes here\" } ], \"items\" : [ { \"title\": \"title goes here\", \"link\": \"url goes here\", \"guid\": \"id goes here\", \"pubDate\": \"data goes her\", \"description\": \"description goes here\" } ], } ] } }"; </code></pre> <p>How do I remove the last comma?</p> </div>

有趣的问题:FLEX 多次请求中间出错!

错误信息: 1。Content Object flex.messaging.messages.ErrorMessage 2。Detected duplicate HTTP-based FlexSessions, generally due to the remote host disabling session cookies. Session cookies must be enabled to manage the client connection correctly. 3。String Server.Processing.DuplicateSessionDetected 描述:如下代码段在运行时,Foreach执行第一次是出错,第二次正确,如此循环至foreach终止。 问题出在什么方?高手请帮看一下,急等!!!! ``` foreach (CPNOLTPackageInfo cpn in requestMethod.cpnOltPackageInfo) { var slotcode = cpn.slotCode; // 封装一个Message AMFPostData cpnoltpostdata = new AMFPostData(AMFType.AMF3, 0, 1); cpnoltpostdata.AddTargetAndResponse("null", "null"); RemotingMessage cpnoltmessage = new RemotingMessage(); cpnoltmessage.operation = "listPortInfoByOltPkg"; cpnoltmessage.source = null; cpnoltmessage.timestamp = 0; cpnoltmessage.clientId = null; cpnoltmessage.timeToLive = 0; cpnoltmessage.messageId = Guid.NewGuid().ToString().ToUpper(); cpnoltmessage.destination = "cpnMgmtFacade"; List<object> cpnoltbody = new List<object>(); cpnoltbody.Add(int.Parse(shOltID)); cpnoltbody.Add(slotcode); cpnoltmessage.body = cpnoltbody; ; Dictionary<string, object> cpnobjoltHeaders = new Dictionary<string, object>(); cpnobjoltHeaders.Add("DSEndpoint", "my-amf"); cpnobjoltHeaders.Add("DSId", Guid.NewGuid().ToString().ToUpper()); cpnoltmessage.headers = objoltHeaders; AMFPostDataBody cpnoltpostdatabody = new AMFPostDataBody(DataType.Array, 1); cpnoltpostdatabody.AddData(DataType.AMFdata, cpnoltmessage); cpnoltpostdata.AddBody(cpnoltpostdatabody); byte[] cpnoltdata = cpnoltpostdata.Message.ToArray(); requestMethod.PostOltPortData(cpnoltdata, sh_Url, currentCookie);//请求查询 } ``` ```

怎么解决,求大神相助,急!

Uncaught ReferenceError: receivelist is not defined报这个错 function InsertOrUpdate() { var obj = {}; var t = $('#OrgId').combotree('tree'); // 获取树对象 var n = t.tree('getChecked'); // 获取选择的节点 var receivelist = ""; var ls = ""; for (var i = 0; i < n.length; i++) { receivelist += ls + n[i]["id"]; ls = ","; } var Method = $.getUrlParamer("guid") != "" ? "CGUpdaet" : "Add"; if ($.getUrlParamer("guid") != "") { $.InvokeAjax("PageService/JBXX", "CGGetListEntityCompany", { Guid: $.getUrlParamer("guid") }, true, function (data) { obj = $.StrToJson(data).Ret; FillObj(obj, Method); }); } else { FillObj(obj, Method); } } function FillObj(obj, Method) { obj.PGuid = $.GetValue("PGuid"); obj.UserId = $.GetValue("UserId"); obj.Name = $.GetValue("Name"); obj.Abbreviation = $.GetValue("Abbreviation"); obj.Remarks = $.GetValue("Remarks"); obj.Telephone = $.GetValue("Telephone"); obj.Mobile = $.GetValue("Mobile"); obj.Email = $.GetValue("Email"); obj.Nature = $.GetValue("Nature"); obj.Adresse = $.GetValue("Adresse"); obj.Valid = $.GetValue("Valid"); obj.Category = $.GetValue("Category"); obj.OrgID = receivelist; obj.CreaTime = $.JsonDateFy($.GetValue("CreaTime") == "自动" ? $.GetDateTime() : $.GetValue("CreaTime")); $.InvokeAjax("PageService/JBXX", Method, obj, true, function (data) { closeDialog(); }); };

关于条件查询中赋值

String TempStr = " SELECT INFO_GUID, INFO_ID, INFO_NAME, INFO_DESC FROM INFO_MESSAGE"; StringBuffer SQLWhere = new StringBuffer(); SQLWhere.append(" WHERE 1 = 1 AND"); if(INFO_ID ==null || INFO_ID.equals("")){ }else{ SQLWhere.append(" AND INFO_ID =? "); } if(INFO_NAME ==null || INFO_NAME.equals("")){ }else{ SQLWhere.append(" AND INFO_NAME =? "); } if(INFO_DESC ==null || INFO_DESC.equals("")){ }else{ SQLWhere.append(" AND INFO_DESC=? "); } String SQLStr = TempStr + SQLWhere; PreparedStatement pstmt = conn.prepareStatement(SQLStr); 到这边 我遇到一个 问题 我怎么知道 索引 给 对应的占位符 赋值 如果 三个条件都有值的话 pstmt.setString(1, "ID"); pstmt.setString(2, "NAME"); pstmt.setString(3, "Desc"); 但如果 只有 其中的两个 怎么办 各位有空 帮忙 看看 知道怎么解决的 告诉我一下 非常谢谢!

Android代码Value of type java.lang.String cannot be converted to JSONObject

在创建jsonObject对象时报错,result是发送poast请求返回的json内容 JSONObject jsonObject = new JSONObject(result); 试了网上说的什么UTF-8 BOM头的问题的方法还是不行, 哪位大神帮忙看一下 W/System.err: org.json.JSONException: Value {"mid":"004YVmzL0O67WR","m4a":"http:\/\/dl.stream.mmmusic.gg.com\/C400004YVmzL0O67WR.m4a?guid=2095717240&skey=CC1743DB70C0AFD81B6CD9A4826F619D0A60FBF859D5238D87EEA2DDEB50D1D6BF1732FDFB30E6C70648F4A57CBC2BAC740D22E1F7D2ED88&uin=0&fromtag=38","mp3_l":"http:\/\/dl.stream.mmmusic.gg.com\/M500004YVmzL0O67WR.mp3?guid=2095717240&skey=CC1743DB70C0AFD81B6CD9A4826F619D0A60FBF859D5238D87EEA2DDEB50D1D6BF1732FDFB30E6C70648F4A57CBC2BAC740D22E1F7D2ED88&uin=0&fromtag=53","mp3_h":"http:\/\/dl.stream.mmmusic.gg.com\/M800004YVmzL0O67WR.mp3?guid=2095717240&skey=CC1743DB70C0AFD81B6CD9A4826F619D0A60FBF859D5238D87EEA2DDEB50D1D6BF1732FDFB30E6C70648F4A57CBC2BAC740D22E1F7D2ED88&uin=0&fromtag=53","ape":"http:\/\/dl.stream.mmmusic.gg.com\/A000004YVmzL0O67WR.ape?guid=2095717240&skey=CC1743DB70C0AFD81B6CD9A4826F619D0A60FBF859D5238D87EEA2DDEB50D1D6BF1732FDFB30E6C70648F4A57CBC2BAC740D22E1F7D2ED88&uin=0&fromtag=53","flac":"http:\/\/dl.stream.mmmusic.gg.com\/F000004YVmzL0O67WR.flac?guid=2095717240&skey=CC1743DB70C0AFD81B6CD9A4826F619D0A60FBF859D5238D87EEA2DDEB50D1D6BF1732FDFB30E6C70648F4A57CBC2BAC740D22E1F7D2ED88&uin=0&fromtag=53","songname":"\u7ae5\u8bdd\u9547","albumname":"\u7ae5\u8bdd\u9547","singername":"\u8bb8\u5a1c","pic":"https:\/\/y.gtimg.cn\/music\/photo_new\/T002R300x300M000000fglnt1hPvpJ.jpg?max_age=2592000"} of type java.lang.String cannot be converted to JSONObject W/System.err: at org.json.JSON.typeMismatch(JSON.java:112) at org.json.JSONObject.<init>(JSONObject.java:163) at org.json.JSONObject.<init>(JSONObject.java:176)

axis调用webservice报参数为空的问题

axis调用无参数的接口可以,但是一但有参数就出错 错误信息大致是:参数为空,但是我传的值打印出来是有值的。下面附上代码,大佬帮忙看看!谢谢 PS:大致的错误我明白了,这个链接需要两个参数一个data 一个GUID 但是wsdl文件里只有一个data参数!!所以这个GUID只能拼接上去,axis可以拼接吗?在哪个地方拼接 public static String MethodsGeneral(String url,String methods, Map<String, Object> params,String str) { String GUID="7b33dd14-b183-4d1e-8c96-04baf421498f"; String result=""; try{ String namespace ="http://tempuri.org/"; String soapActionUI = "http://tempuri.org/"+methods; String endpoint = url; Service service = new Service(); Call call = (Call)service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setUseSOAPAction(true); call.setSOAPActionURI(soapActionUI); call.setOperationName(new QName(namespace,methods)); call.addParameter(new QName(namespace,"data"),org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN); call.addParameter(new QName(namespace,"GUID"),org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN); call.setReturnType(org.apache.axis.Constants.XSD_STRING); JSONObject jsonObject = new JSONObject(params); HashMap<String, String> allParam = new HashMap(); String beforeEnc = jsonObject.toString(); String cipherInfo = null; try { cipherInfo = AESUtil.encrypt(beforeEnc); } catch (Exception e) { e.printStackTrace(); } // 把加密后的字符串转化为16进制 String temp = StringUtil.str2HexStr(cipherInfo); //访问的方法名 System.out.println(temp); System.out.println(GUID); result = (String)call.invoke(new Object[]{temp,GUID}); }catch(Exception e){ e.printStackTrace(); System.out.println("调用webservice失败!"); } //將result字符串解析成要用的字符串 return result; } 以下是错误信息:AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server faultSubcode: faultString: System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---&gt; System.NullReferenceException: 未将对象引用设置到对象的实例。 在 Fuli.WebService.BaseWebService.AESEncrypt(String toEncrypt) 位置 D:\花汇购项目\Backend\Fuli.WebService\BaseWebService.cs:行号 426 在 Fuli.WebService.BaseWebService.GetExceptionReturnInfo(String exMessage) 位置 D:\花汇购项目\Backend\Fuli.WebService\BaseWebService.cs:行号 311 在 Fuli.WebService.UserWebService.GetAddresslistByUsername(String data) 位置 D:\花汇购项目\Backend\Fuli.WebService\UserWebService.asmx.cs:行号 689 --- 内部异常堆栈跟踪的结尾 --- faultActor: faultNode: faultDetail:

用C#简单模拟超市收银碰到的问题

class SuperMarket { WareHouse CangKu = new WareHouse(); //CangKu.GoodsIn("DreamCar", 100);这么写会报错 public SuperMarket() { CangKu.GoodsIn("DreamCar", 100); CangKu.GoodsIn("Apple", 800); CangKu.GoodsIn("Book", 997); CangKu.GoodsIn("Pencil", 68); } } ——————————————分割线————————————————— class WareHouse { List<List<Commodity>> storeroom = new List<List<Commodity>>(); public WareHouse() { storeroom.Add(new List<Commodity>()); storeroom.Add(new List<Commodity>()); storeroom.Add(new List<Commodity>()); storeroom.Add(new List<Commodity>()); } public void GoodsIn(string type, int count) { for (int i = 0; i < count; i++) { switch (type) { case "DreamCar": storeroom[0].Add(new DreamCar("DreamCar", 180000, Guid.NewGuid().ToString())); break; case "Apple": storeroom[1].Add(new Apple("嘎?果", 3, Guid.NewGuid().ToString())); break; case "Book": storeroom[2].Add(new Book("心灵鸭汤读本", 14, Guid.NewGuid().ToString())); break; case "Pencil": storeroom[3].Add(new Pencil("小嘴牌铅笔", 0.9, Guid.NewGuid().ToString())); break; } } } } ![图片说明](https://img-ask.csdn.net/upload/201508/30/1440866253_103476.png) 想简单模拟超市收银,写好WareHouse类,然后在SuperMarket中创建CangKu的时候,想添加商品进去,出现了图示情况。我初学,实在太菜,请大神指导,3Q。

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

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

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

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

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

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

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

你以为这样写Java代码很6,但我看不懂

为了提高 Java 编程的技艺,我最近在 GitHub 上学习一些高手编写的代码。下面这一行代码(出自大牛之手)据说可以征服你的朋友,让他们觉得你写的代码很 6,来欣赏一下吧。 IntStream.range(1, 5).boxed().map(i -&gt; { System.out.print("Happy Birthday "); if (i == 3) return "dear NAME"...

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

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

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

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

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

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

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

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

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

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

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

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

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

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

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

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

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

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

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

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

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

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

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

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

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

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

Python爬虫,高清美图我全都要(彼岸桌面壁纸)

爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

立即提问
相关内容推荐