Assignment One – 15%
Algorithms and Data Structures – COMP3506/7505 – Semester 2, 2024
Due: 3pm on Friday August 23 (week 5)
Summary
The main objective of this assignment is to get your hands dirty with some simple data structures
and algorithms to solve basic computational problems. These data structures will also come in handy
for your second assignment, so you should take your time to think about your implementations and
try to make them as efficient as possible.
1 Getting Started
Before we get into the nitty gritty, we will discuss the skeleton codebase that will form
the basis of your implementations, and provide some rules that must be followed when
implementing your solutions.
1.1 Codebase
The codebase contains a number of data structures stubs that you should implement, as well
as some scripts that allow your code to be tested. Figure 1 shows a snapshot of the project
directory tree with the different files categorized.
test_structures.py
test_warmup.py
test_kmers.py
structures
dynamic_array.py
linked_list.py
bit_vector.py
warmup
warmup.py
malloclabs
kmer_structure.py
analysis.txt
generate_dna.py
Figure 1 The directory tree is organized by task. Blue represents directories, Teal represents files
that contain implementations (but are not executable), and Orange represents executable files.
1.2 Implementation Rules
The following list outlines some important information regarding the skeleton code, and your
implementation. If you have any doubts, please ask on Ed discussion.
? The code is written in Python and, in particular, should be executed with Python 3
or higher. The EAIT student server, moss, has Python 3.11.* installed by default. We
recommend using moss for the development and testing of your assignment, but you can
use your own system if you wish.
2 COMP3506/7505 – Semester 2, 2024
? You are not allowed to use built-in methods or data structures – this is an algorithms and
data structures course, after all. If you want to use a dict (aka {}), you will need to imple-
ment that yourself. Lists can be used as “dumb arrays” by manually allocating space like
myArray = [None] * 10 but you may not use built-ins like append, clear, count,
copy, extend, index, insert, pop, remove, reverse, sort, min, max, and so
on. List slicing is also prohibited, as are functions like sorted, len, reversed, zip.
Be sensible – if you need the functionality provided by these methods, you may implement
them yourself. Similarly, don’t use any other collections or structures such as set or
tuple (for example; mytup = ("abc", 123)).
? You are not allowed to use libraries such as numpy, pandas, scipy, collections, and so
on.
? Exceptions: The only additional libraries you can use are random and math. You are
allowed to use range and enumerate to handle looping. You can also use for item in
my_list looping over simple lists.
2 Task 1: Data Structures (5 marks)
We’ll start off by implementing some fundamental data structures. You should write your
own tests. We will try to break your code via (hidden) corner cases. You have been warned.
Task 1.1: Doubly Linked List (1.5 Marks)
Your first task is to implement a doubly linked list — your first “pointer-based” data structure.
To get started, look at the linked_list.py file. You will notice that this file contains two
classes: the Node type, which stores a data payload, as well as a reference to the next node;
and the DoublyLinkedList type which tracks the head and tail of the list, as well as the number
of nodes in the list.
A basic set of functions that you need to support are provided as function templates, and
you will need to implement them. You will also notice that there may be some changes or
modifications required to the data structures to support the necessary operations – feel free
to add member variables or functions, but please do not change the names of the provided
functions as these will be used for marking.
You will need to implement your own tests and run them using:
python3 test_structures.py --linkedlist.
Task 1.2: Dynamic Array (2 Marks)
Unlike the linked list discussed above, which can store nodes at any abitrary location in
memory, we often prefer to have data items stored contiguously (consecutively in memory),
allowing us to access an element x at some index i in constant time. One such way to achieve
this is through the use of a dynamic array.
The file dynamic_array.py contains another skeleton for you to implement. You should
store your data in self._data, and you can add any other member variables to your Dy-
namicArray object. Each function that needs to be supported is provided as a stub. Your
implementations should be efficient and correct, and we have provided annotations to describe
the expected complexity. In this assignment, we have given you a slightly trickier ADT
than the classic append-only array discussed in the lectures. In particular, you must support
prepend operations — that is, allowing an element x to be placed at the front of the array —
in O(1) amortized time, worst case.
Assignment 1 3
You will need to implement your own tests and run them using:
python3 test_structures.py --dynamicarray
Task 1.3: Bitvector (1.5 marks)
In some applications, it is useful to track the state of a collection of objects using simple
Boolean (True or False) flags. A na?ve way to do this is to simply use a (dynamic) array,
storing bool types as the underlying data. However, Boolean types are usually represented
by a machine word (32 or 64 bits), meaning that we waste a lot of space with this approach.1
An alternative approach is to use a bitvector , which stores an array of b-bit integers to
represent each item — unset bits (value 0) represent False, and set bits (value 1) represent
True. Clearly, this approach uses 64× less space than the na?ve approach, as a single b = 64
bit integer can track the state of 64 items.
The file bit_vector.py contains another skeleton for you to implement. Note that it
uses a composition based design where a DynamicArray object is used to store the underlying
data. Each function that needs to be supported is provided as a stub. Your implementations
should be efficient and correct, and we have provided annotations to describe the expected
complexity. We describe two of the more exotic operations that should be supported in more
detail below.
You will need to implement your own tests and run them using:
python3 test_structures.py --bitvector.
Bitvector Operations: Shift
The shift operator handles both left and right shifts, depending on the sign of the dist
parameter. If the dist parameter is positive, we do a left shift by dist. A left shift moves all
bits in the bitvector left by dist positions, replacing empty positions with 0 bits. For example,
the following demonstrates the before (top) and after (bottom) of a left shift by dist = 2:
1011000100011
1100010001100
Notice that the two most significant bits have fallen off (the leftmost 10 on the first bitvector).
The right shifts work the same way, but we move the bits dist positions to the right (and the
least significant bits will fall off).
Bitvector Operations: Rotate
The rotate operator works exactly the same way as the shift operator, except it ensures that
any bits that fall off the end are rotated back onto the start of the bitvector. Using the same
example as above with dist = 2:
1011000100011
1100010001110
1 For the interested student: Most statically typed languages would represent a Boolean value as a
machine word (that is, 32 or 64 bits) for convenience. Python is a dynamically typed language, and
each object actually carries a bunch of metadata around with it, and may be something like 24 bytes.
However, every True or False used is merely a reference to one of these two objects (there is only real
True and one real False object instantiated in the runtime). Nonetheless, here, we will pretend that
each Bool usually costs a machine word. In C, for example, a bool would use 8 bits (one byte), the
minimal addressable size.
COMP3506/7505
4 COMP3506/7505 – Semester 2, 2024
3 Task 2: Algorithmic Thinking Warm-Up (5 Marks)
Next, we are going to work on some simple warm up problems. These are designed to build
your problem solving skills. Some of them may appear tricky at first; you are encouraged
to sit down and think about them (a pen and a piece of paper will help). Do not be afraid
to get creative, as there may be multiple ways to solve each problem. Each problem will
be assessed on three tiers of tests — see the warmup.py file for more details, and test with
test_warmup.py (you need to implement your own tests).
3.1 The Main Character
You are given a string S. You need to simply return the first position of a repeated character
(indexed from zero), or ?1 if there are no repeats.
? S = hello → 3.
? S = world → ?1.
? S = algorithmsarefun → 10.
? S = ooooohigetitnow → 1.
Here’s the catch: S can be built from an alphabet containing 232 possible characters,
represented as integers in the range [0, 232 ? 1]. Hint: You should use one of your data
structures from part one to help you solve this problem efficiently!
3.2 Sum-Thing Odd
You are given an unsorted list L containing n unique integers. Let min(L) and max(L)
represent the smallest and largest integers in L. Your task is to find the sum of the missing
odd integers in the range [min(L),max(L)].
? Consider L = ?6, 4, 9?: min(L) = 4 and max(L) = 9. Your range of interest is thus [4, 9].
The sum of the missing odd integers will be 5 + 7 = 12.
? Consider L = ?10, 1, 7, 17?: min(L) = 1 and max(L) = 17. Your range of interest is [1, 17].
The sum of missing odds in this range will be 3 + 5 + 9 + 11 + 13 + 15 = 56.
3.3 It’s cool, k?
A natural number is k-cool if it can be represented as the sum of unique non-negative powers
of k. For example:
? 17 is 4-cool because 40 + 42 = 17;
? 128 is 2-cool because 27 = 128;
? 11 is 10-cool because 100 + 101 = 11.
Given n and k, you must return the n th largest k-cool natural number. Two alternative
ways to say this:
? Return the n th smallest number that can be created by summing non-negative integer
powers of k; or
? If you created all combinations of sums of powers of k and sorted them into ascending
order, we want you to return the n th one.
Clearly, the first k-cool number is always 1 (k0 = 1) and the second k-cool number is always
k1 = k. Since we will test some very large numbers (up to 101,000,000), you should return the
number modulo 1016 + 61.
Assignment 1 5
3.4 Your Number is Up
Alice and Bob are playing a numbers game. The game starts with an unsorted list of integers,
L, with n = |L| guaranteed to be even. On each turn, they both remove one number from L.
If Alice removes an even number, it is added to her score. If she removes an odd number,
her score remains unchanged. The opposite is true for Bob (removing an odd number adds
to his score; removing an even number keeps his score unchanged). After n turns, the array
is exhausted, and the winner is determined by the player with the largest score — A draw is
also possible. Given L, you must return the winner, and their score, assuming both Alice
and Bob play optimally. You can assume that Alice always gets the first turn.
3.5 Getting Lit
A straight road of length k is illuminated by n light poles. Each light pole is represented
by a natural number i, where i represents the total distance from the start of the road to
the given pole. Each light is capable of illuminating a radius r. Given an unsorted list L of
poles, you need to return the minimal radius r such that the entire length of the road, k, is
illuminated. You may assume that the width of the road is infinitely small.2
k =12
L = 4, 7, 8, 1 .
0 3 6 9 12
r is too small!
0 3 6 9 12
r
r is too big!
0 3 6 9 12
r
r is just right.
0 3 6 9 12
r
Figure 2 A sketch of getting lit with n = 4 light poles.
2 Yes, we know it’s not a very useful road, but it makes your assignment easier. See also: https:
//w.wiki/Ajs5
COMP3506/7505
6 COMP3506/7505 – Semester 2, 2024
4 Task 3: Problem Solving with Data Structures (5 marks)
You are an algorithms specialist working at SIGSEGVTM, a world leader in high perform-
ance algorithmic solutions. You have been contracted by a bioinformatics company called
MallocLabs who require a bespoke system to help them deal with a growing amount of
genomic data they need to index. Their lead Bioinformatician, Barry Malloc, has provided
you with the following overview of the data and the system requirements. Your job is to
design and implement an appropriate data structure — and related algorithms — to match
Barry’s requirements. Barry has kindly placed the required time bounds in the function
stubs — you should carefully consider these when designing your data structure.
4.1 Data Representation
DNA data is represented as a string S of length |S| over an alphabet Σ = {A, C, G, T}.
Each character represents a different base (Adenine, Cytosine, Guanine, and Thymine). For
example, a sequence S with |S| = 32 might look like
S = GTCGTGAAGTCGGTTCCTTCAATGGTTAAACC.
Since sequences can be very long, we can break them up into k-mers, all possible substrings
of length k. For example, there are 10 individual 23-mers of S:
GTCGTGAAGTCGGTTCCTTCAAT
TCGTGAAGTCGGTTCCTTCAATG
CGTGAAGTCGGTTCCTTCAATGG
GTGAAGTCGGTTCCTTCAATGGT
TGAAGTCGGTTCCTTCAATGGTT
GAAGTCGGTTCCTTCAATGGTTA
AAGTCGGTTCCTTCAATGGTTAA
AGTCGGTTCCTTCAATGGTTAAA
GTCGGTTCCTTCAATGGTTAAAC
TCGGTTCCTTCAATGGTTAAACC
In general, a sequence of length |S| will contain |S|?k+1 k-mers, and there are a total of |Σ|k
unique possible k-mers (in our case, |Σ| = 4). You are provided with a tool generate_dna.py
that can generate n sequences of length |S| for you to experiment with; it is probably easiest
to simply write them out to a file, and use the file as input to your testing program.
4.2 Required Functionality
At run-time, your program will be given two arguments that specify a path to a file containing
DNA sequences, as well as the value of k we are interested in working with. For example,
you might be given a file containing 50, 000 sequences of length 200, and k = 31. We will
always use str types to represent k-mers. The data structure used to solve the following
requirements is up to you, and should be designed based on the functionality requested. You
may need to use one or more of the structures implemented in part one for example, but the
final choice is yours. Implement in kmer_structure.py and test with test_kmers.py (you
need to implement your own tests).
Assignment 1 7
Storage and Modification: 2 marks
The first set of functions you need to support allow for reading and modifying data. They
are specified as follows:
? read: Given a file containing DNA sequences, break them into individual k-mers, and
store them in your data structure;
? batch_insert(L): Given a list of k-mers L, insert them into your data structure;
? batch_delete(L): Given a list of k-mers L, delete all occurences of them from your data
structure.
Note that there may be some duplicate k-mers in your data structure. You must keep track
of duplicates and their frequency, as these will be required for answering some query types in
the next section.
Queries: 3 marks
Your data structure also needs to support the following query types.
? freqgeq(n): Return a list of unique k-mers that occur at least n times;
? count(q): Return the number of times a k-mer q occurs;
? countgeq(q): Return the total number of k-mers that are ≥ q; that is, you need to sum
the frequencies of all k-mers lexicographically greater than or equal to q;
? compatible(q): Return the total number of k-mers that are compatible with q.
We provide some further information on the compatibility query as follows. A given k-mer q
is called compatible with k-mer b if the last two characters in q are the complement of the
first two characters in b. In genomics, the pair A and T is complementary, as is the pair C
and G. So, for example, CCTGATG is compatible with ACTTGCG:
q = CCTGATG
| |
ACTTGCG
Note that we always assume we are matching the end of the input query k-mer q with the
start of all other k-mers.
Analysis: 2 marks (COMP7505 Students Only)
If you are a COMP7505 student, you must also answer the questions posed in the plain text
file called analysis.txt (inside the malloclabs directory).COMP3506 students are encouraged
to do this too, but they will not be assessed on this component. Please keep your answers
succinct, but make sure to include all details that may be relevant. If in doubt, err on the
side of more detail.
COMP3506/7505
8 COMP3506/7505 – Semester 2, 2024
5 Assessment
This section briefly describes how your assignment will be assessed.
5.1 Mark Allocation
Marks will be provided based on an extensive (hidden) set of unit tests. These tests will do
their best to break your data structure in terms of time and/or correctness, so you need to
pay careful attention to the efficiency and the validity of your code. Each test passed will
carry some weight, and your autograder score will be computed based on the outcome of the
test suite. If you did not rigorously test your programs/code, you should go back and do so!
As the famous poet Ice Cube once said: check yourself before you wreck yourself.
The marks (percentages) provided in each task above are indicative of the total score
available for each part, but marks may be taken off for poor coding style including lack of
commenting, inefficient solutions, and incorrect solutions. Our code quality checks are not as
strict as PEP8, but we assume typical best practices are used such as informative variable
and function names, commenting, and breaking long lines. While the overall grade/score
will be calculated mathematically, an indicative rubric is provided as follows:
? Excellent: Passes at least 90% of test cases, failing only sophisticated or tricky tests;
well structured and commented code; appropriate design choices; appropriate application
of data structures/algorithms for solving Tasks 2/3.
? Good: Passes at least 80% of test cases, failing one or two simple tests; well structured
and commented code; good design choices with some minor improvements possible;
good application of data structures/algorithms for solving Task 2/3 with some minor
improvements possible.
? Satisfactory: Passes at least 70% of test cases; code is reasonably well structured with
some comments; most design choices are reasonable but significant room for improvement;
reasonable application of data structures/algorithms for solving Task 2/3, but significant
improvements possible.
? Poor: Passes less than 70% of test cases; code is difficult to read, not well structured, or
lacks comments; design choices do not demonstrate a sound understanding of the desired
functionality; little or no suitable application of data structures or algorithms towards
solving Task 2/3.
5.2 Plagiarism and Generative AI
If you want to actually learn something in this course, our recommendation is that you avoid
using Generative AI tools: You need to think about what you are doing, and why, in order
to put the theory (what we talk about in the lectures and tutorials) into practical knowledge
that you can use, and this is often what makes things “click” when learning. Mindlessly
lifting code from an AI engine won’t teach you how to solve algorithms problems, and if
you’re not caught here, you’ll be caught soon enough by prospective employers.
If you are still tempted, note that we will be running your assignments through sophistic-
ated software similarity checking systems against a number of samples including including
your classmates and our own solutions (including a number that have been developed with
AI assistance). If we believe you may have used AI extensively in your solution, you may
be called in for an interview to walk through your code. Note also that the final exam
may contain questions or scenarios derived from those presented in the assignment work, so
cheating could weaken your chances of successfully passing the exam.
Assignment 1 9
As part of your submission, you must create a file called statement.txt. In that file,
you must provide attribution to any sources or tools used to help you with your assignment,
including any prompts provided to AI tooling. If you did not use any such tooling, you can
make a statement outlining that fact. Failing to submit this file will yield you zero marks.
6 Submission
You need to submit your solution to Gradescope under the Assignment 1: Autograder link in
your dashboard. Please use the appropriate link as there is a separate submission for 3506
and 7505 students. Once you submit your solution, a series of tests will be conducted and
the results of the public tests will be provided to you. However, the assessment will also
include a number of additional hidden tests, so you should make sure you test your solutions
extensively. You may resubmit as often as you like before the deadline, but we are imposing
a limit of ten submissions per 24 hour period. Please write your own tests!
Structure
The easiest way to submit your solution is to submit a .zip file. The autograder expects a
specific directory structure for your solution, and the tests will fail if you do not use this
structure. In particular, you should use the same structure as the skeleton codebase that
was provided. You should also have the statement.txt and analysis.txt (for COMP7505
students). Submissions without the statement.txt will be given zero marks, and the
autograder will notify you of this.
7 Resources
We provide a number of useful git and/or unix resources to help you get started. Please go
onto the Blackboard LMS and see the Learning Resources > Resources directory for more
information.
8 Changelog
? V1.0: Initial release.
? V2.0: Release with code; changed directory structure to match code. Clarified k-cool
further. Fixed an unfortunate typo.
? V3.0: Add clarifications section to the end of the spec to track any additonal changes or
clarifications from Ed or other discussions.
? V3.1: Remove some of the clarifying discussion about linked list nodes, since the API
was changed in the v3.0 code skeleton and the discussion is no longer relevant.
? V4.0: Further clarifications in the section below. No further changes.
COMP3506/7505
10 COMP3506/7505 – Semester 2, 2024
9 Clarifications
This section is introduced in V3.0 of the spec. It will be used to track any additional
clarifications on the spec or functionality.
Corner Cases
Here we clarify some corner cases and expected behaviour.
DoublyLinkedList
? What happens if I call set_head (or set_tail) on an empty list? In this case, do nothing.
These functions simply change the data of the head or tail if they do already exist. The
v3 skeleton code docstrings now capture this functionality.
BitVector
? If the dist provided to shift is greater than the bitvector length, what happens? The
bitvector would simply become filled with 0’s as everything will be shifted off.
? What about the case where we call rotate with a dist value larger than the length?
You will just keep rotating until done; rotating a bitvector of length l by l or 2l or 3l will
end up with the same bitvector as before the rotation. Modulus is your friend...
Node API
In our test suite, we will not be checking individual linked list Node types in isolation. What we
will be checking is that the linked list API works as expected; we will be traversing/modifying
your linked list (via the public DoublyLinkedList methods) and comparing the behaviour with
what a correct implementation does.
So, to be clear, we will never take a single Node type and check what is in prev or next
for example. This means you may even modify the Node API as it is only accessed internally
from the DoublyLinkedList; just ensure it is still compatible with the DoublyLinkedList
API.
Banned Code
Our philosophy for banning specific python functionality is to avoid the situation where some
complex operations are being hidden by syntactic sugar. For example, consider:
my_list = [1, 6, 105, 4, 9]
x = 4
if x in my_list:
print ("Yay!")
This innocent looking code is actually hiding an O(n) execution, where n is the length of
my_list. That’s because Python allows us to search for an item using nice syntax like if x
in my_list. That’s why we would prefer you to write something like:
...
for item in my_list:
if x == item:
print ("Yay!")
Even though this is longer, it clearly demonstrates that the list is being iterated over.
Some examples of things that are OK or not:
Assignment 1 11
? Generators: These are OK, because they hide annoying/ugly complexity, but do not mask
the fact that they are used for iteration.
? Dictionaries: Clearly not OK, because you need to be able to implement a map data
structure to get this behaviour. Same for Sets. (More in Week 5/6/7).
? Dunder methods: These are OK, as you will need to implement them anyway (and indeed,
you will implement __str__ for example).
In general: If you want to use something, you need to implement it yourself, not use an “out
of the box” implementation.
Why Moss?
You do not need to use Moss. We recommend you do because it provides a shared platform
for us to help if anything goes wrong. However, you are more than welcome to develop/test
your work elsewhere.
More about Bitvectors
A key principle in this assignment is that the data structure being implemented should
behave the way a user expects. This is different to the question of how the data is stored (in
what sort of container, in what order, ...) as a user doesn’t care about that. We do care, as
the designer of the data structure, so we endeavour to make things as efficient as possible
while maintaining correctness.
In terms of bitvectors, we cannot answer questions like should I append a bit to the most
significant bit, or the least significant bit? or should I store my bits little or big endian? –
What really matters is that a user appending the sequence 1 0 1 0 will get back a 1 if they
ask for the value of the bit at index 0, and a 0 back if they ask for the value of the bit at
index 3. If they then flip all of the bits, and prepend a 0, they should get a 0 back if they ask
for the value at index 0, and a 0 if they ask for the element at index 1 (this was previously
the first 1 we appended, but it has now been flipped). When these operations happen, it
is up to you to design how it works under the hood. The API should behave like a user
interacting with the DynamicArray using only 0 and 1’s, except that it should be much more
space efficient.
I’m Overwhelmed
This is a tough assignment, and it will take time. If you are overwhelmed, our advice is to
simplify the API you support for each structure. For example, instead of supporting both
append and prepend, just focus on supporting append efficiently. Similarly, ignore reverse for
now. This will at least allow you to build an efficient “append-only” list that you can use in
the assignment. You will of course lose some marks, but you will be able to move on and
capitalise in the other sections. For the warmup problems, just focus on solving them – even
if it is inefficient at first – as you will get marks just for giving correct (albeit slow) solutions
on small inputs.
Finally, please seek support; we have Ed, office hours, assignment help sessions. But we
cannot help you if you do not seek help.
COMP3506/7505
相关推荐
WebPack 4 +TypeScript 3 +Vue 2.5+SCSS 简单环境搭建
开发环境 VSCODE NPM包管理工具 环境 名称:node 版本:10.7.0 名称:npm 版本:6.1.0 名称:webpack 版本:4.16.5 名称:typescript 版本:3.0.1 名称:sass 版本:3.5.7 试验软件/包 名称:vue 版本:3.0.0-rc.11 名称:typescript 版本:3.0.1 安装步骤 项目...
【Webpack】处理Sass和Scss资源详解
Sass(Syntactically Awesome Stylesheets)是一种扩展的 CSS 预处理器,允许开发者使用更加简洁的语法和变量、嵌套等特性编写 CSS 代码。Sass 语法:缩进式语法,使用缩进表示嵌套。Scss 语法:与 CSS 兼容的语法,使用大括号和分号。在现代开发中,Scss 语法更常用,因为它与标准的 CSS 语法更加兼容。无论你选择哪种语法,Sass 和 Scss 都能够极大地提高样式代码的可读性和可维护性。
手机刷双系统
刷机教程(https://www.geekeyes.cn/forum.php/forum.php?mod=viewthread&tid=492) 解锁教程(http://www.gioov.com/index.php/1386) 解锁教程 cmd下 进入adb目录( 如果环境变量配置了adb 可以直接在cmd 下输入命令) 手机连接电脑,确保usb 调试打开,然后手机连接电脑,...
webpack配置全局scss
【代码】webpack配置全局scss。
centos7安装db2 version11.1
centos7安装db2 version11.1
AMD锐龙笔记本隐藏玩法:分核降压+ PBO2超频全攻略(以5900HX/6900HX为例)
本文详细解析了AMD锐龙笔记本(以5900HX/6900HX为例)的分核降压与PBO2超频技术,帮助用户释放处理器隐藏性能。通过BIOS设置、Curve Optimizer参数调整及稳定性测试,实现性能提升与温度控制的完美平衡,适合硬件爱好者进阶调校。
Webpack 配置完全指南(最全万字详解)
Webpack核心概念与配置指南:Webpack作为现代JavaScript应用的静态模块打包工具,其核心概念包括入口(Entry)、输出(Output)、加载器(Loaders)、插件(Plugins)和模式(Mode)。文章详细解析了开发与生产环境的完整配置方案,涵盖代码分割、缓存优化、性能调优等高级特性,并针对React/Vue项目提供了实战配置示例。重点介绍了常用Loader(Babel、CSS、PostCSS)和插件(HTML、CSS提取、压缩)的配置方法,以及开发服务器设置、模块联邦等高级功能。
.NET适配HarmonyOS进展 1. 前言
目前国产化系统浪潮下,适配鸿蒙是中国软件大势所趋,.NET作为最适合开发客户端语言之一,适配鸿蒙系统(HarmonyOS Next)是目前.NET开发者最关心的事情。我目前业余时间正在移植Avalonia到HarmonyOS,去年在.NET Conf CN上分享过,目前又取得一点进展,所以本文把所有问题进行整合与大家进行分享。
vue+webpack+scss+jade(pug)的环境搭建
标签:vue,webpack,jade,scss 声明:转载须经本人同意 这篇博客就聊一聊如何用webpack搭建vue2.0的环境,以及拓展了下如何在搭建好的环境中使用scss以及pug(jade),废话不多说,直接进入主题。 第一步 准备工作 1.1首先要保证自己的环境中安装了node.js,我们可以通过命令行node -v查看 如果出现版本号,说明已经安装成功了。我这里的node版本是7....
YOLOv10精度上不去?QAT量化感知训练全流程,INT8推理mAP只掉0.8%
普通PTQ量化虽简单,但无法应对YOLOv10的小目标特征和激活分布波动,导致精度暴跌。QAT通过“模拟量化误差+联合优化权重与量化参数”,让INT8模型精度接近FP16,同时速度提升1.8倍,完美适配实时检测场景(如安防监控、自动驾驶)。该流程已在工业级项目中验证,针对YOLOv10的优化策略(敏感层保护、小目标加权、分阶段训练)可直接迁移至其他YOLO系列(v8/v9),量化后精度损失均可控制在1%以内。
光学传播仿真软件:SPEOS_(14).建筑物内光环境仿真
在建筑物内光环境仿真中,材料属性的定义直接影响光的传播和反射效果。SPEOS提供了丰富的材料库,但也可以自定义材料属性以满足特定需求。创建新材料选择Materials->。输入材料名称和类型。配置材料属性选择材料对象,打开属性编辑器。设置反射率、透射率、表面粗糙度和颜色。# 导入SPEOS模块# 创建新材料# 配置材料属性custom_material.set_reflectivity(0.8) # 设置反射率为0.8。
vue + webpack + node + yarn + less + scss 项目环境搭建
一、安装node环境和安装yarn环境 1、下载地址为:https://nodejs.org/en/ 2、检查是否安装成功:如果输出版本号,说明我们安装node环境成功 node -v npm -v (npm ,yarn包管理工具) 3、为了提高我们的效率,可以使用淘宝的镜像:http://npm.taobao.org/ 输入:n...
PD详解 扩展消息——Source_Capabilities_Extended Message
PD的协议层分为控制消息,数据消息还有扩展消息,今天大师匈讲一下扩展消息中的source_cap_extended。这个消息在扩展消息中算是比较关键的东西。 扩展消息中的source_cap_extended 大师匈先上图,然后逐一解释; 上面的图表说了source_cap_ext中包含了哪些内容。 我们注意到在source_cap扩展消息中是以字节为单位的,并不是像source_cap中以一个object为单位,当然有注意到PD标准spec中说明的扩展消息的话,那里有说明,在header之后的字节
【SCSS入门】2、安装和配置SCSS环境
Sass(Syntactically Awesome Stylesheets)是一种强大的CSS预处理器,它通过引入变量、嵌套、混合(mixins)、继承和函数等高级特性,显著增强了CSS的功能和灵活性。Sass允许你使用更简洁和模块化的语法来编写样式表,从而提高代码的可读性和可维护性。变量使得颜色、字体和其他值可以重复使用,嵌套规则让样式结构更加清晰,混合可以创建可重用的代码块,继承和函数则提供了更高级的样式控制。最终,Sass代码会被编译成标准的CSS,使其兼容所有浏览器。这种预处理器特别适用于大型项目
论文必备 - YOLOv8训练前一键扩充数据集,支持9种扩充方法,支持图像和标签同步扩充
在网络模型训练前,大量的数据集是必备的。而对于一些特殊场景中的特殊目标,大量的数据集往往难以获取,无法满足模型训练的基本需求。本文提供了,脚本可一键运行,。
老版QQ原生表情gif动态
这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。
webpack入门
1. 创建环境 创建一个webpack-demo的目录,该目录下有五个文件: index.html app.js module-1.js module-2.js index.scss cd ~/Desktop mkdir webpack-demo cd webpack-demo touch index.html app.js module-1.js index.scss npm init // ...
VC中sqlite的使用
在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示
vue2+webpack4+scss
作者:心叶时间:2019年01月30日 10:37 前要 由于webpack的配置具有实时性,之前搭建的vue2项目是基于webpack2,因此,特地在此维护一篇关于webpack4搭建vue2项目的说明,会及时更新(github地址:https://github.com/yelloxing/...)。 基础配置 npm install ...
jre9下载 jdk9
(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】
C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片
基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正
sass环境搭建之node-sass,ruby
该内容全部为搬运,感谢作者的分享~,附有原文链接。 使用ruby环境 SASS学习系列之(一)--------- SASS,SCSS环境搭建(Ruby) 使用node-sass SASS学习系列之(二)--------- SASS,SCSS环境搭建(node-sass) 通过命令编译: npm run sass input.scss output.css sass-lo...
如何为gh_mirrors/ca/card贡献代码:完整开发环境搭建与PR提交流程指南
gh_mirrors/ca/card是一个专注于优化信用卡表单体验的开源项目,仅需一行代码即可显著提升表单交互效果。本文将详细介绍如何搭建开发环境并通过PR流程贡献代码,帮助新手轻松参与到这个实用项目的开发中。 ## 开发前准备工作 在开始贡献代码前,需要确保你的开发环境满足以下基本要求: - Git版本控制系统 - Node.js环境(推荐使用LTS版本) - npm或yarn包管理工具
使用webpack4从零构建React + React-router + Redux + Scss/Css开发环境
前言 最近这几年,前端变化非常大,各种新框架应接不暇,从最开始几个html,css,js文件就搞定了前端,到现在前端的模块化,工程化,旨在构建出易于维护的前端系统。目前为止,前端三大框架Vue/React/Angular(Vue官网:https://cn.vuejs.org/index.html, React官网:https://reactjs.org/,Angular官网:h...
webpack
初始化WebPack 一、为什么会有webpack? 因为开发者编写的代码是模块化开发,.less .scss .vue .js等文件 开发者编写的代码是工程化 因为浏览器不能解析vue、react 、less 、scss 等工程化,模块化的代码,所以需要webpack 工具,将编写的模块化代码,进行编译/打包,然后在浏览器中运行的编译后或者打包后的代码。 二、webpack是什么? webpack是自动化构建工具 三、怎么搭建使用webpack的环境 依赖node.js npm 下载
webpack最新版本_Webpack+React+TypeScript+SCSS配置一站搞定
前言任何不讲版本的webpack相关的配置都是耍流氓!很多模块的不同版本之间,仿佛两个东西一样,这导致海量的教程只有少数能用的,占用我们大量的时间去搜索,而我这里要做的就是把它们系统的整理出来,形成一个切实可用的文档。好了,我们开始吧!PS:我用的基本都是最新版本,所以趟了不少坑!这里整个环境都是自己搭建的,没有使用create-react-app脚手架,大家可以参考我之前的教程:https://...
从零开始搭建一个简单的基于webpack的vue开发环境
都8102年了,现在还来谈webpack的配置,额,是有点晚了。而且,基于vue-cli或者create-react-app生成的项目,也已经一键为我们配置好了webpack,看起来似乎并不需要我们深入了解。 不过,为了学习和理解webpack解决了前端的哪些痛点,还是有必要从零开始自己搭建一个简单的开发环境。本文的webpack配置参考了vue-cli提供webpack-simple 模板,这...
webpack的简单搭建
文章目录webpackwebpack 是什么?webpack 的特点?webpack的核心?webpack 手动搭建步骤 webpack sass gulp转换成css文件 一个页面很多个js文件,维护只能加 轻易不能删 页面的优化,js/html/css文件的压缩,图片压缩 webpack 是什么? 打包工具 (静态资源打包工具) 前端必备 webpack 的特点? 1. js依赖进行整合处理 (打包整合) 2. 一些预处理的sass,less可以在环境中进行编译 (转换) 3. 可以对js、
3743



被折叠的 条评论
为什么被折叠?



