Is there a way to automatically format spaces in Atom to make neat columns? - formatting

Basically, I'd like to go from this
#inproceedings{208512,
author = {Phillip Rogaway},
title = {The Moral Character of Cryptographic Work},
year = {2016},
address = {Austin, TX},
publisher = {{USENIX} Association},
booktitle = {Proceedings of the 25th {USENIX} Security Symposium ({USENIX} Security 16)},
month = {August}
}
to this
#inproceedings{208512,
author = {Phillip Rogaway},
title = {The Moral Character of Cryptographic Work},
year = {2016},
address = {Austin, TX},
publisher = {{USENIX} Association},
booktitle = {Proceedings of the 25th {USENIX} Security Symposium ({USENIX} Security 16)},
month = {August}
}
I've tried various things in the regex Find/Replace function of Atom, but I don't know if there's a way to do what I'm looking for. I was thinking I could specify a row location (like x characters in), and fill the space between [a-z]* and = with spaces... but I haven't seen anything online to suggest I could do that.
Any help (even to tell me it's impossible in Atom, or suggest another tool) would be appreciated.

Related

replace text with stars

Good day,
I just do basic, very basic HTML, CSS coding and couldn't get through my newest task - hope to get the answer here.
I want to have an input field where when I paste an e-mail address like somethingnice#gmail.com that will convert it to so*****#gmail.com and put it in an paragraph. Basically it should keep the first two letters, then put 5 stars (like in a password) and than keep what follows after #. If it's too difficult to do 5 stars no matter of the lengh of the e-mail address, I would be more then happy if it would just replace the characters beetwen the first two letters and # with stars.
Regards,
Sonny
var email = "alice#example.com";
var firstTwo = email.substring(0,2);
var domain = email.substring(email.indexOf("#"));
var sanitizedEmail = firstTwo + "*****" + domain;
console.log(sanitizedEmail);
Checkout the following links:
https://www.w3schools.com/jsref/jsref_indexof.asp
https://www.w3schools.com/jsref/jsref_substring.asp

How to get professions on world of warcraft vanilla's addon?

I'm creating an AddOn for a private server of World of Warcraft 1.12.1/Classic/Vanilla and I need to check the user's professions.
The information I got was the APIs GetProfessions() and GetProfessionInfo() but I can't find out how to use them.
I wanna have a variable for each profession.
It's something like this:
prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions()
Profession1 = GetProfessionInfo(prof1)
Profession2 = GetProfessionInfo(prof2)
Profession3 = GetProfessionInfo(archaeology)
Profession4 = GetProfessionInfo(fishing)
Profession5 = GetProfessionInfo(cooking)
Profession6 = GetProfessionInfo(firstAid)
Quick glance shows there are no special tradeskill functions in API in 1.12.1. AFAIR professions were just regular entries in the spellbook back then. As such you can iterate over spellbook with GetSpellName and check that either first return matches name of known profession or second return matches name of a known profession rank.
Additional info on each profession can be retrieved with GetTradeSkillLine, but only when this profession is opened in tradeskill window (i.e. window where you see list of items to craft).
If I'm understanding this correctly, GetProfessions() returns a table. You could always try a different way around the problem, like so:
professions = GetProfessions()
Profession1 = GetProfessionInfo(professions[1])
Profession2 = GetProfessionInfo(professions[2])
Profession3 = GetProfessionInfo(professions[3])
Profession4 = GetProfessionInfo(professions[4])
Profession5 = GetProfessionInfo(professions[5])
Profession6 = GetProfessionInfo(professions[6])
I'm not sure if this will solve your problem, but I figured I could weigh in my opinion. I have never done anything with World of Warcraft.

Need to extract information from free text, information like location, course etc

I need to write a text parser for the education domain which can extract out the information like institute, location, course etc from the free text.
Currently i am doing it through lucene, steps are as follows:
Index all the data related to institute, courses and location.
Making shingles of the free text and searching each shingle in location, course and institute index dir and then trying to find out which part of text represents location, course etc.
In this approach I am missing lot of cases like B.tech can be written as btech, b-tech or b.tech.
I want to know is there any thing available which can do all these kind of things, I have heard about Ling-pipe and Gate but don't know how efficient they are.
You definitely need GATE. GATE has 2 main most frequently used features (among thousands others): rules and dictionaries. Dictionaries (gazetteers in GATE's terms) allow you to put all possible cases like "B.tech", "btech" and so on in a single text file and let GATE find and mark them all. Rules (more precisely, JAPE-rules) allow you to define patterns in text. For example, here's pattern to catch MIT's postal address ("77 Massachusetts Ave., Building XX, Cambridge MA 02139"):
{Token.kind == number}(SP){Token.orth == uppercase}(SP){Lookup.majorType == avenue}(COMMA)(SP)
{Token.string == "Building"}(SP){Token.kind == number}(COMMA)(SP)
{Lookup.majorType == city}(SP){Lookup.majorType == USState}(SP){Token.kind == number}
where (SP) and (COMMA) - macros (just to make text shorter), {Somthing} - is annotation, , {Token.kind == number} - annotation "Token" with feature "kind" equal to "number" (i.e. just number in the text), {Lookup} - annotation that captures values from dictionary (BTW, GATE already has dictionaries for such things as US cities). This is quite simple example, but you should see how easily you can cover even very complicated cases.
I didn't use Lucene but in your case I would leave different forms of the same keyword as they are and just hold a link table or such. In this table I'd keep the relation of these different forms.
You may need to write a regular expression to cover each possible form of your vocabulary.
Be careful about your choice of analyzer / tokenizer, because words like B.tech can be easily split into 2 different words (i.e. B and tech).
You may want to check UIMA. As Lingpipe and Gate, this framework features text annotation, which is what you are trying to do. Here is a tutorial which will help you write an annotator for UIMA:
http://uima.apache.org/d/uimaj-2.3.1/tutorials_and_users_guides.html#ugr.tug.aae.developing_annotator_code
UIMA has addons, in particular one for Lucene integration.
You can try http://code.google.com/p/graph-expression/
example of Adress parsing rules
GraphRegExp.Matcher Token = match("Token");
GraphRegExp.Matcher Country = GraphUtils.regexp("^USA$", Token);
GraphRegExp.Matcher Number = GraphUtils.regexp("^\\d+$", Token);
GraphRegExp.Matcher StateLike = GraphUtils.regexp("^([A-Z]{2})$", Token);
GraphRegExp.Matcher Postoffice = seq(match("BoxPrefix"), Number);
GraphRegExp.Matcher Postcode =
mark("Postcode", seq(GraphUtils.regexp("^\\d{5}$", Token), opt(GraphUtils.regexp("^\\d{4}$", Token))))
;
//mark(String, Matcher) -- means creating chunk over sub matcher
GraphRegExp.Matcher streetAddress = mark("StreetAddress", seq(Number, times(Token, 2, 5).reluctant()));
//without new lines
streetAddress = regexpNot("\n", streetAddress);
GraphRegExp.Matcher City = mark("City", GraphUtils.regexp("^[A-Z]\\w+$", Token));
Chunker chunker = Chunkers.pipeline(
Chunkers.regexp("Token", "\\w+"),
Chunkers.regexp("BoxPrefix", "\\b(POB|PO BOX)\\b"),
new GraphExpChunker("Address",
seq(
opt(streetAddress),
opt(Postoffice),
City,
StateLike,
Postcode,
Country
)
).setDebugString(true)
);
B.tech can be written as btech, b-tech or b.tech
Lucene will let you do fuzzy searches based on the Levenshtein Distance. A query for roam~ (note the ~) will find terms like foam and roams.
That might allow you to match the different cases.

Equivalent BAPI for a MB01 transaction?

I'm trying to replace some un-reliable sap scripting we have in place to do an MB01 from a custom goods receipt application. I have come across the .NET connector and it looks like it could do a job for me.
Research has churned up the BAPI called BAPI_GOODSMVT_CREATE but can anyone tell me what parameters might be required to perform this transaction?
I have access to a SAP test environment.
BAPI_GOODSMVT_CREATE accepts a table of values called GOODSMVT_ITEM which contains 121 fields. I'm sure that not all of these fields are required.
Ultimately I guess my question is, what how can I work out which ones are required?
Do you have access to a SAP system? I have recently used this BAPI, and it has quite detailed documentation. To view the documentation, use transaction SE37, and enter the BAPI name. Unfortunately I don't currently have access to a system.
You will have to ask one of your MM/Logistics people to tell you what the movement type (BWART) is, and depending on the config you will need details like material number (MATNR), plant (WERKS), storage location etc.
MB01 is a Post GR for PO transaction, it is an equivalent of GM_Code 01 in MIGO or BAPI_GOODSMVT_CREATE. MIGO transaction is a modern successor for obsolete MB01.
So, as per the BAPI_GOODSMVT_CREATE documentation for GM_Code 01 the following fields are mandatory:
Purchase order
Purchase order item
Movement type
Movement indicator
Quantity in unit of entry
ISO code unit of measurement for unit of entry or
quantity proposal
Here is the sample:
gmhead-pstng_date = sy-datum.
gmhead-doc_date = sy-datum.
gmhead-pr_uname = sy-uname.
gmcode-gm_code = '01'.
loop at pcitab.
itab-move_type = pcitab-mvt_type.
itab-mvt_ind = 'B'.
itab-plant = pcitab-plant.
itab-material = pcitab-material.
itab-entry_qnt = pcitab-qty.
itab-move_stloc = pcitab-recv_loc.
itab-stge_loc = pcitab-issue_loc.
itab-po_number = pcitab-pur_doc.
itab-po_item = pcitab-po_item.
concatenate pcitab-del_no pcitab-del_item into itab-item_text.
itab-move_reas = pcitab-scrap_reason.
append itab.
endloop.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gmhead
goodsmvt_code = gmcode
IMPORTING
goodsmvt_headret = mthead
tables
goodsmvt_item = itab
return = errmsg

RegEx help - finding / returning a code

I must admit it's been a few years since my RegEx class and since then, I have done little with them. So I turn to the brain power of SO. . .
I have an Excel spreadsheet (2007) with some data. I want to search one of the columns for a pattern (here's the RegEx part). When I find a match I want to copy a portion of the found match to another column in the same row.
A sample of the source data is included below. Each line represents a cell in the source.
I'm looking for a regex that matches "abms feature = XXX" where XXX is a varibale length word - no spaces in it and I think all alpha characters. Once I find a match, I want to toss out the "abms feature = " portion of the match and place the code (the XXX part) into another column.
I can handle the excel coding part. I just need help with the regex.
If you can provide a solution to do this entirely within Excel - no coding required, just using native excel formula and commands - I would like to hear that, too.
Thanks!
###################################
Structure
abms feature = rl
abms feature = sta
abms feature = pc, pcc, pi, poc, pot, psc, pst, pt, radp
font = 5 abms feature = equl, equr
abms feature = bl
abms feature = tl
abms feature = prl
font = 5
###################################
I am still learning about regex myself, but I have found this place useful for getting ideas or comparing what I came up with, might help in the future?
http://regexlib.com/
Try this regular expression:
abms feature = (\w+)
Here is an example of how to extract the value from the capture group:
using System;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{
Regex regex = new Regex(#"abms feature = (\w+)",
RegexOptions.Compiled |
RegexOptions.CultureInvariant |
RegexOptions.IgnoreCase);
Match match = regex.Match("abms feature = XXX");
if (match.Success)
{
Console.WriteLine(match.Groups[1].Value);
}
}
}
(?<=^abms feature = )[a-zA-Z]*
assuming you're not doing anything with the words after the commas