Regex version number out of package names [closed] - python-3.x

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 months ago.
Improve this question
I have a folder with a bunch of packages, each with their version in their name. Im trying to use regex to create a list with those versions to be used later.
Some examples:
Input:
libpci-dev_3.5.2-1_amd64.deb
libpcre3-dev_8.39-12_amd64.deb
libaprutil1-ldap_1.6.1-4_amd64.deb
nftables_0.9.6-1~bpo10+1_amd64.deb
libkdb5-9_1.17-3+deb10u3_amd64.deb
libc-dev-bin_2.28-10+deb10u1_amd64.deb
libboost-locale1.67.0_1.67.0-13+deb10u1_amd64.deb
I want to delete the front of the package name as well all the amd64 and .deb as well as the _ or - surrounding the versions and then just leave the version of the package in the list
Expected output:
3.5.2-1
8.39-12
1.6.1-4
0.9.6-1~bpo10+1
9_1.17-3+deb10u3
2.28-10+deb10u1
1.67.0_1.67.0-13+deb10u1
I managed to select only the numbers, but im having issues with the last examples, where there is also letters involved

Versions are started after _, so 9_1.17-3+deb10u3 should be 1.17-3+deb10u3, and you can extract those using the following regex.
_(.*)_amd64\.deb
Python Example
import re
packages = """libpci-dev_3.5.2-1_amd64.deb
libpcre3-dev_8.39-12_amd64.deb
libaprutil1-ldap_1.6.1-4_amd64.deb
nftables_0.9.6-1~bpo10+1_amd64.deb
libkdb5-9_1.17-3+deb10u3_amd64.deb
libc-dev-bin_2.28-10+deb10u1_amd64.deb
libboost-locale1.67.0_1.67.0-13+deb10u1_amd64.deb"""
versions = re.findall(r"_(.*)_amd64\.deb", packages)
print(*versions, sep="\n")
OUTPUT
3.5.2-1
8.39-12
1.6.1-4
0.9.6-1~bpo10+1
1.17-3+deb10u3
2.28-10+deb10u1
1.67.0-13+deb10u1

Related

Error while converting a .mat file into csv file [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have used :
load('feature_table.mat');
csvwrite('ft.csv',feature_table);
But it shows following error. How can I solve this?
Check for missing argument or incorrect argument data type in call to
function 'real'.
Error in csvwrite (line 47)
throw(e)
More information about the file: The feature_table is a 3240x26 table
I'm not sure what the problem is, but Matlab recommends to use the "writematrix" function instead. See https://se.mathworks.com/help/matlab/ref/writematrix.html
You could also try saving the table as a .txt file, that is the output the Matlab website uses in their example of the csvwrite function (https://se.mathworks.com/help/matlab/ref/csvwrite.html).

How to run 100 csv File in script file from a folder (One file at once)? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I have to run the below script code for multiple files from a folder, one at once, I have change CSV file name at every iteration, file names are like D8.csv, D16.csv etc.
java -Xmx10G -jar dist/wikifier-3.0-jar-with-dependencies.jar -annotateData data/Splited_WikiQA_dev/**D8.csv** data/output_Splited_WikiQA_dev/ false configs/STAND_ALONE_NO_INFERENCE.xml
Use a for loop that processes all the files matching a wildcard.
for file in data/Splited_WikiQA_dev/*.csv
do
java -Xmx10G -jar dist/wikifier-3.0-jar-with-dependencies.jar -annotateData "$file" data/output_Splited_WikiQA_dev/ false configs/STAND_ALONE_NO_INFERENCE.xml
done

Best way of transferring Excel to ABAP and vice versa [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
What is the latest way to export and import data to/from Excel from SAP ABAP? I used some old OLE libraries but they have some limitations. One other thing I found was the SOFFICEINTEGRATION package, but that looks like was developed in the early 00's. Are there any new developments or should I just stick with OLE or SOFFICEINTEGRATION?
As far as I know, the official SAP solution is the two you described above. However there is abap2xlsx, as a freeware. This has to be implemented separately in your system (probably someone responsible in your company won't agree, implementing "random" stuff in productive business system). You can read more about it here:
https://wiki.scn.sap.com/wiki/display/ABAP/abap2xlsx
(I used it only once, creating an xlsx file and worked very well.)
Share some of my experience about Excel handling in ABAP.
1.Excel download from internal table.
data:
lo_table type ref to cl_salv_table,
lx_xml type xstring.
try.
cl_salv_table=>factory(
importing
r_salv_table = lo_table
changing
t_table = lt_data ). "lt_data is your internal table
catch cx_salv_msg.
endtry.
lx_xml = lo_table->to_xml( xml_type = '10' ). "XLSX
call function 'XML_EXPORT_DIALOG'
exporting
i_xml = lx_xml
i_default_extension = 'XLSX'
i_initial_directory = ''
i_default_file_name = 'export.XLSX'
i_mask = 'Excel (*.XLSX)|*.XLSX'
exceptions
application_not_executable = 1
others = 2.
2.Excel upload to internal table.
Function module ALSM_EXCEL_TO_INTERNAL_TABLE. See the example link here.

Accessing Multiple Trac projects with IIS using isapi_wsgi [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm a newbie in the bug tracking system world.
I managed to install Trac 0.12 in Windows Server 2003 and was able to serve the project using IIS through an isapi_wsgi extension using the procedure found here: http://trac.edgewall.org/wiki/TracOnWindowsIisIsapi
I installed the Trac project in c:\Trac\Project1, generated the cgi-bin and htdocs directories and placed them in c:\Trac\Project1\.
Now I want to create other projects at the same level than Project1 (c:\Trac\Project2, c:\Trac\Project3 and so on).
How can I change the trac_wsgi.py and use URLs as follows: "http://localhost/Project1", "http://localhost/Project2", and so on?
I have basic experience with IIS and no experience at all with Python.
Any help would be appreciated.
Thanks
You've chosen what seems like a good installation instruction. If I understand correctly, your answer is already in the example given there:
# Setup the virtual directories - this is a list of directories our
# extension uses - in this case only 1.
So you'll want to register multiple virtual directories by copying the example with a list of directories like so (untested):
vd1 = VirtualDirParameters(Name="Project1",
Description = "ISAPI-WSGI Trac",
ScriptMaps = sm,
ScriptMapUpdate = "replace"
)
vd2 = VirtualDirParameters(Name="Project2",
Description = "ISAPI-WSGI Trac",
ScriptMaps = sm,
ScriptMapUpdate = "replace"
)
...
params.VirtualDirs = [vd1, vd2, ...]
I don't know, if you really want to get rid of the ENV_PARENT_DIR in the path. Would it hurt to have 'http://localhost/trac/Project1' instead of 'http://localhost/Project1'? This is the common and expected layout of a multiple projects Trac installation. Just my 2ct.

adding phpdoc to new files [duplicate]

This question already has answers here:
A tool to add and complete PHP source code documentation [closed]
(9 answers)
Closed 9 years ago.
im looking for a way to add some docblocks to a new .php file, so i can have it add the description, package name, author , etc to a new file.
i have been searching for a couple days and I dont see any results on how to add just to 1 .php file, maybe a console command or another utility?
Some sort of generator
Try PHP_DocBlockGenerator from PEAR -- http://pear.php.net/package/PHP_DocBlockGenerator

Resources