ECE3790工程算法课程概览:Python与Java的实践应用

需积分: 5 0 下载量 45 浏览量 更新于2024-12-17 收藏 1.07MB ZIP 举报
资源摘要信息:"曼尼托巴大学的ECE3790课程是一门专注于工程算法的计算机工程课程。该课程主要以Python语言进行授课,同时也涉及到Java和MATLAB的编程。课程的教学工具包括集成开发环境PyCharm,这是开发者编写Python代码的常用工具,提供了代码高亮、智能代码补全、代码分析等多种功能,有助于提高开发效率和代码质量。 本课程于2021年冬季开设,以工程实践和理论相结合的方式教授算法知识。课程内容的组织和教学进度都遵循着明确的时间线,例如在课程的早期阶段,学生会接触到算法的基础知识和操作计数(也称为算法复杂度分析),这是评估算法性能的重要工具。例如,在第一周的课程中,教师通过矩阵-矩阵乘法和插入排序等实例来介绍算法的基本概念和应用场景。 除了课堂教学,该课程还包括实验环节,允许学生在实际应用中测试和巩固所学的理论知识。学生需要使用Python和Java进行编程实践,这不仅有助于他们理解和掌握课程内容,而且还能保持他们对最新编程语言和技术的了解。 由于课程信息中只提供了部分周次的内容,我们可以推测课程在后续周次中将会涉及更高级的算法话题,如图算法、动态规划、分支限界法等复杂的工程算法。由于文件名称为ECE3790-main,我们可以假设这是一门综合性的课程,覆盖了多个相关的主题,并且贯穿了整个学期。 标签信息中提到的'uofm'代表曼尼托巴大学(University of Manitoba),而'ece3790'则是课程编号,这有助于快速识别课程所属的学校和学科领域。RichTextFormat是一个文件格式,这表明课程的材料可能包含丰富的文本格式,如不同的字体、颜色、图像和格式设置等,使得学习材料更加生动和易于理解。 整体来看,这门课程旨在为工程专业的学生提供坚实的基础,使他们能够运用算法知识解决现实世界的问题,并且具备使用多种编程语言进行软件开发的能力。"

请逐句解释一下下面的代码import java.util.Arrays; import org.apache.http.client.fluent.Request; import ece448.iot_sim.SimConfig; import ece448.iot_sim.Main; public class GradeP2 { public static void main(String[] args) throws Exception { SimConfig config = new SimConfig( 8080, Arrays.asList("xxxx", "yyyy", "zzzz.789"), null, null, null); try (Main m = new Main(config)) { Grading.run(new GradeP2(), 10); } } private String get(String pathParams) throws Exception { return Request.Get("http://127.0.0.1:8080"+pathParams) .userAgent("Mozilla/5.0") .connectTimeout(1000) .socketTimeout(1000) .execute().returnContent().asString(); } public boolean testCase00() throws Exception { String ret = get("/xxxx"); return (ret.indexOf("xxxx is off") != -1) && (ret.indexOf("xxxx is on") == -1) && (ret.indexOf("Power reading is 0.000") != -1); } public boolean testCase01() throws Exception { String ret = get("/xxxx?action=on"); return (ret.indexOf("xxxx is on") != -1) && (ret.indexOf("xxxx is off") == -1); } public boolean testCase02() throws Exception { String ret = get("/xxxx?action=off"); return (ret.indexOf("xxxx is off") != -1) && (ret.indexOf("xxxx is on") == -1); } public boolean testCase03() throws Exception { String ret = get("/xxxx?action=on"); return (ret.indexOf("xxxx is on") != -1) && (ret.indexOf("xxxx is off") == -1); } public boolean testCase04() throws Exception { String ret = get("/xxxx?action=toggle"); return (ret.indexOf("xxxx is off") != -1) && (ret.indexOf("xxxx is on") == -1); } public boolean testCase05() throws Exception { String ret = get("/xxxx?action=toggle"); return (ret.indexOf("xxxx is on") != -1) && (ret.indexOf("xxxx is off") == -1); } public boolean testCase06() throws Exception { String ret = get("/yyyy"); return (ret.indexOf("yyyy is off") != -1) && (ret.indexOf("yyyy is on") == -1); } public boolean testCase07() throws Exception { String ret = get("/xxxx"); return (ret.indexOf("xxxx is on") != -1) && (ret.indexOf("xxxx is off") == -1); } public boolean testCase08() throws Exception { String ret = get("/zzzz.789"); return (ret.indexOf("Power reading is 0.000") != -1); } public boolean testCase09() throws Exception { get("/zzzz.789?action=on"); Thread.sleep(1500); String ret = get("/zzzz.789"); return (ret.indexOf("Power reading is 789.000") != -1); } } private static final Logger logger = LoggerFactory.getLogger(HTTPCommands.class); }

2023-06-12 上传

import java.util.Arrays; import org.apache.http.client.fluent.Request; import ece448.iot_sim.SimConfig; import ece448.iot_sim.Main; public class GradeP2 { public static void main(String[] args) throws Exception { SimConfig config = new SimConfig( 8080, Arrays.asList("xxxx", "yyyy", "zzzz.789"), null, null, null); try (Main m = new Main(config)) { Grading.run(new GradeP2(), 10); } } private String get(String pathParams) throws Exception { return Request.Get("http://127.0.0.1:8080"+pathParams) .userAgent("Mozilla/5.0") .connectTimeout(1000) .socketTimeout(1000) .execute().returnContent().asString(); } public boolean testCase00() throws Exception { String ret = get("/xxxx"); return (ret.indexOf("xxxx is off") != -1) && (ret.indexOf("xxxx is on") == -1) && (ret.indexOf("Power reading is 0.000") != -1); } public boolean testCase01() throws Exception { String ret = get("/xxxx?action=on"); return (ret.indexOf("xxxx is on") != -1) && (ret.indexOf("xxxx is off") == -1); } public boolean testCase02() throws Exception { String ret = get("/xxxx?action=off"); return (ret.indexOf("xxxx is off") != -1) && (ret.indexOf("xxxx is on") == -1); } public boolean testCase03() throws Exception { String ret = get("/xxxx?action=on"); return (ret.indexOf("xxxx is on") != -1) && (ret.indexOf("xxxx is off") == -1); } public boolean testCase04() throws Exception { String ret = get("/xxxx?action=toggle"); return (ret.indexOf("xxxx is off") != -1) && (ret.indexOf("xxxx is on") == -1); } public boolean testCase05() throws Exception { String ret = get("/xxxx?action=toggle"); return (ret.indexOf("xxxx is on") != -1) && (ret.indexOf("xxxx is off") == -1); } public boolean testCase06() throws Exception { String ret = get("/yyyy"); return (ret.indexOf("yyyy is off") != -1) && (ret.indexOf("yyyy is on") == -1); } public boolean testCase07() throws Exception { String ret = get("/xxxx"); return (ret.indexOf("xxxx is on") != -1) && (ret.indexOf("xxxx is off") == -1); } public boolean testCase08() throws Exception { String ret = get("/zzzz.789"); return (ret.indexOf("Power reading is 0.000") != -1); } public boolean testCase09() throws Exception { get("/zzzz.789?action=on"); Thread.sleep(1500); String ret = get("/zzzz.789"); return (ret.indexOf("Power reading is 789.000") != -1); } } private static final Logger logger = LoggerFactory.getLogger(HTTPCommands.class); }请逐句解释一下上述代码

2023-06-12 上传
132 浏览量

public int convert2Ofd(int imagefileid, String filename,String docdcsurl) { writeLog("ConvertToPdfForDcsE9--convertUot2Ofd-------------------start"); //String docdcsurl = Util.null2String(getPropValue("yzDcsUrl", "docdcsurl")); writeLog("ConvertToPdfForDcsE9--convertUot2Ofd-------------------imagefileid=" + imagefileid + ";filename=" + filename + ";docdcsurl=" + docdcsurl); int newimagefileid = -1; try { if (imagefileid > 0 && !"".equals(filename) && !"".equals(docdcsurl)) { String fileext = ""; if (filename.indexOf(".") != -1) { fileext = filename.substring(filename.lastIndexOf(".")); } writeLog("ConvertToPdfForDcsE9--convertUot2Ofd-------------------fileext=" + fileext); String sourcefilepath = getImageFile(imagefileid + ""); writeLog("ConvertToPdfForDcsE9--convertUot2Ofd-------------------sourcefilepath=" + sourcefilepath); if (!"".equals(sourcefilepath)) { String dcsurl = convert(docdcsurl, sourcefilepath, "29"); writeLog("ConvertToPdfForDcsE9--convertUot2Ofd-------------------dcsurl=" + dcsurl); if (!"".equals(dcsurl)) { InputStream input = getInputStreamFromDcs(dcsurl); writeLog("ConvertToPdfForDcsE9--convertUot2Ofd-------------------input=" + input); String newfilename = filename.substring(0, filename.lastIndexOf(".")) + ".ofd"; if (input != null) { newimagefileid = savePdfImageFile(input, newfilename); } if (new File(sourcefilepath).exists() && new File(sourcefilepath).isFile()) { new File(sourcefilepath).delete(); } } } } } catch (Exception e) { writeLog("ConvertToPdfForDcsE9--convertUot2Ofd-------------------Exception=" + e); } writeLog("ConvertToPdfForDcsE9--convertUot2Ofd-------------------newimagefileid=" + newimagefileid); writeLog("ConvertToPdfForDcsE9--convertUot2Ofd-------------------end"); return newimagefileid; } 这段代码里2023-06-07 10:00:41,501 INFO A2 - [null] pool-20-thread-1-827[weaver.odoc.ofd.util.ConvertToPdfForDcs:395] - ConvertToPdfForDcsE9--convertUot2Ofd-------------------Exception=java.net.MalformedURLException: no protocol: {"data":{"fileHash":"f68995999879716524d33048cf89713eb6909b540af36f0c1326666747933f7f1","code":0,"destFileName":"5cf6fc7a-b466-4d2f-bd8a-90021ece7f03.ofd","srcFileName":"5cf6fc7a-b466-4d2f-bd8a-90021ece7f03.docx","srcFileSize":"1470724","destFileSize":"272921","convertType":29,"srcStoragePath":"f68995999879716524d33048cf89713eb/5cf6fc7a-b466-4d2f-bd8a-90021ece7f03.docx","destStoragePath":"2023/06/07/d897526c6b1848d38158e2d397dc1564/5cf6fc7a-b466-4d2f-bd8a-90021ece7f03.ofd","convertTime":"4224","viewUrl":"http://10.2.120.2:19090/fcscloud/view/preview/__u_3ZnLmSOahAqKi6icTcKJrPrgXJLd2m6bLJJ9Vy1AE7bOu07HXJe5EdV3ICfU4--G5-1b-C_BMkuxJ6YiThUP9cZrRTnS8WH7LNaAySY1b4J6VNRm5bUix26SO24700BVblzn6_Sgh3k8GCEv2iW5ceUlHmsE-UIfGUPobbnm9fShs4Gg-L5wSnmdcobmWgVCHNZvPMzNAj5FNM1RAAY0iGeLBNp1ezhgLFc-LsEC5fArMOLpbVonVHX-liJuUKBubUznMLCwaouob5HRqFnSwB6l-qEWFMyKeKK7yOknI8K-59iCZpKpUAzxt4hPezq1Pgh1nR1tTtwEypycLkvEnWyugeKTxu9mwyN_fFfIUyv6oV7P79BMIZt2o-B6kDJgXVaMxne2wjydgWr2nir306Hg_R0R0zS-Z4yG74g=/"},"message":"操作成功","errorcode":0}这个异常应该怎么修改

156 浏览量