Change starting line number of SublimeText - sublimetext3

I have access to a small portion of a code file, when I get an exception, the line number in the exception will refer to the entire code file, rather than just the section I have access too.
This means I'll get a error message for line 300, which is actually line 5 in my code file. The starting number varies depending on the file I'm working on.
To get around this at the moment, I just insert the relevant number of blank lines so that my line 1 lines up with where it will in the parent file.
I'd like to know if there is a way to get the line numbers in Sublime to start at something other than 1.
That way I'd be able to set the first line number in my file to the actual line number it will be when its inserted into the parent file.

The line numbers in Sublime are based on the number of lines that are actually in the current view. There is no method in the API to alter their appearance, unfortunately.

Related

Nodejs Edit single row in CSV

I am trying to understand how I would use TypeScript and Nodejs to grab a Csv file by row number and edit that row. I assume the steps would be to 'get line 2, read the single line, save that to an object, I change the data, delete line 2, write a new line 2 with my new object data".
I'm able to read the file and iterate row by row. So I can easily grab the row id. I'm running into a wall trying to figure out the actual editing of a single row, and seems the only way to 'edit' is to delete the row and add it back. I need to add the line back to the exact line number, since I'm iterating row by row and if I just added the new line to the end of the file my script would never stop.
I'm using the csv-writer package to write a full Csv file, the csv-parse package in conjunction with the fs.createReadStream() to iterate row by row of a Csv.

When I public batch (upload csv files) in Amazon Mechanical Turk, it always pumped errors for the row after my last data observation?

I am trying to publish a batch on Amazon Mechanical Turk.
All the design part and csv file organizing part have been done by my professor and I. I am pretty sure these parts are correct.
However, my data only has 27921 rows (the last line number in csv is 27921). But after I click publish tab, the MTturk always pumped up an error message regarding the line 27922, which is completely empty in my file!
I have tried to download the template and paste my original data into that template. It didn't work.
The Error is:
Line 27722: Row has 1 column while the header has 2
I just had the exact same problem.
For some reason mturk doesn't identify a new blank line as an end of the file.
I opened the csv file in a text editor (in my case notepad++ but I guess a regular text editor will work aswell) and just deleted the last line.

excel breaks content in row to another row

i have an excel sheet that i have exported from a website, i have noticed that in some particular rows the content jumps to a new line. i have searched online, but no credible answer to my problem
what is the cause of this and how can it be solved.
i have even tried to copy them one by one to make them be on the same line, but i cant keep on doin that
here is a link to my file.
download
so that you can have a view of what i am talking about
The address field in your file contains newlines in certain records. I suggest you open the file in Notepad and join these lines together before importing the file (make sure you turn word wrap off to see the lines correctly).

save datawindow as text in powerbuilder with some additional text

***Process Date From:
01/05/2012 0:00
Group;Member
Status:****
Rcp Cd Health Num Rcp Name Rcp Dob
1042231 1 MARIA TOVAR DIAS 14-Feb-05
1042256 2 KHALID KHAN 04-Mar-70
1042257 3 SAMREEN ISMAT 25-Mar-80
1042257 5 SAMREEN ISMAT 25-Mar-80
1042257 4 SAMREEN ISMAT 25-Mar-80
I want my Powerbuilder datawindow Save As text look like this Bold text are the additional text want to add and rest is the current save as text result.
Text files cannot contain formatting. There's no way to get bold text in a plain text file. I suggest adding the text to your datawindow header band (bolded, with an expression to make sure it only displays on the first page), then saving the results as HTML.
Well, you didn't mention which version of PB you are using, so I'll assume a recent one in which case you have some better options such as SaveAsAscii and/or SaveAsFormattedText which offer more flexibility in displaying column headers, computed fields, etc.
If you want to add the top section, I would add one or more additional dummy columns (or computed fields) to your dataobject for the additional data. Then either populate the dummy columns manually after retrieve, or via expression in computed field. You could put all of it in one computed field that wraps, or use four different ones (e.g. process_date_label, process_datetime, group_status, status).
The two newer versions of SaveAs will work better for you as they display column header values instead of the column header name. SaveAsAscii came out pretty early somewhere around version 7 of PowerBuilder. SaveAsFormattedText is relatively new and came out somewhere around PB version 11 and it is a lot like SaveAsAscii but it lets you choose file encoding.
If you need more explicit detail let me know but I am sure you can get something to work using SaveAsAscii and extra columns.
Pseudo code
Do the SaveAs to temp file
Open the temp file for read in line mode
Open output file for write (replace) in line mode
Write your additional text lines to the output file (note: you can include CRLF to
write multiple lines at once)
Loop:
Read line from temp file
If EOF exit loop. Note: 0 is not EOF, -100 is EOF
Write line to output file
Close temp file, output file
Delete temp file

Find/Replace text in a file using a batch file

i need to replace a portion of a line of text with another line of text ex:
07/24/2012 06:30:00 <--what i start with
07/24/2012 06:30:00 Name=weather <---is what i need it to look like
every day the date changes and i have about 20 of these lines to change every day, whats the easiest way to do this using a bat file, i want to be able to run it and it would open the file, change what needed to be changed then spit out the changed text file in another location. there are hundreds of lines in this text file that need to stay in the new one and not change only about 20 or so need to be changed. i dont need it to loop at all since every time i need to edit the file the text needed to change will be exactly the same and it will need to change the same number of lines each time. thanks in advance
One way using sed:
sed -e "s/\(.*\)/\1 Name=weather/" file.txt > /your/new/location/newfile.txt
Perhaps you should update your question, to include example input and expected output. But the above line should get you started.

Resources