Categories
Linux Mastering Development

Editing a file based on a pattern appearance

I have a file that contains text and numbers like this: state(1, s(1,a), [s(1,b)]). state(1, s(1,b), [s(1,a)]). state(1, s(2,a), [s(2,b)]). state(1, s(2,b), [s(2,a)]). state(1, s(3,a), [s(3,b)]). state(1, s(3,b), [s(3,a)]). state(1, s(4,a), [t(1), t(2)]). state(1, s(5,a), [t(1), t(3)]). state(1, s(6,a), [s(6,b)]). state(1, s(6,b), [s(6,a)]). …so on I want the numbering with in s(x,y) to change as […]

Categories
Ask Geographic Information System (GIS)

Raster file not found (R)

I am using raster() inside an if statement and I get the following error: Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", : Cannot create a RasterLayer object from this file. (file does not exist) I am cheching all the paths and are correct. Perhaps the function file.path() is not correct to get the […]

Categories
Mastering Development

How to limit number of permutations

I have like 20 short strings that I want to permutate, but I just want the permutations that have len=8. I could do something like that, but it calculates aaalll possible permutations and then print. import itertools p = itertools.permutations([s1, s2, s3, s4, s5, s6,…]) for i in p: s = ”.join(j for j in […]

Categories
Linux Mastering Development Ubuntu

how to convert MIPS to C

i want to convert these two pieces of code from MIPS to C . aub $s0, $s0, $s1 aub $s0, $s0, $s3 add $s0, $s0, $s1 and addi $t0, $s6, 4 add $t0, $s6, $0 sw $t1, 0($t0) lw $t0, 0($t0) add $s0, $t1, $t0 how??

Categories
Mastering Development

How do I use numpy genfromtxt to read a fixed width, mixed format file?

A sample of my data file is below. Note that I have not included all of the header. Note also that often a specific data value is left blank (in this case CALL for rows 1 and 5 but it can be other columns too). USAF WBAN STATION NAME CTRY ST CALL LAT LON ELEV(M) […]

Categories
Mastering Development

Grabbing result from a picker view for use in other view controller

Hello fellow programmers, I am having some trouble figuring out passing data between view controllers. my initial view controller(SelectCarViewController) consists of two pickers(year and make/model) I have a Label that displays the year once selected and a label that displays the make/model once selected. Once the two are filled in an invisible button(search parts) will […]

Categories
Android User Help

Debunk: tripping KNOX removes your battery life?

I’ve heard various people in XDA reporting that rooting a Samsung S8 (or similar–S8+, S7, S7 Edge, S6, S5, S9, etc.) will remove 30% of your battery life, permanently. Is there any truth to this? I think the myth is built on reports that KNOX uses 30% of the battery life in some phones and […]

Categories
Mastering Development

Using ggplot to plot more than 6 groups

I’m aware this question has been asked before and have attempted to use the solutions in said posts but to no avail, and to avoid necro’ing old posts I thought I’d make a new one. In my free time, which I have a lot of these days given the current pandemic, I’ve been watching episodes […]

Categories
Mastering Development

How can I adjust bars on X-axis accord to numerical order?

The ideal order of bars on X-axis is (S1,S2,S3,S4,S5,S6,S7,S8,S9,S10).But it just can not be adjust successfully 🙁 ggplot(data=T1, aes(x=Scenarios, y=Yields, fill=Scenarios)) + geom_bar(stat=”identity”) + scale_fill_manual(values=cbPalette)

Categories
Ask Mathematics

PDA that accepts L $\{a^i b^j c^k \mid i,j,k≥0 \text{ and } i=j \text{ or } i=k\}$

I have to construct a PDA which accepts the L $\{a^i b^j c^k\mid i,j,k ≥ 0 \text{ and } i=j \text{ or } i=k\}$ I have been at it for hours but whenever I try to design one, it fails the test. The string from the L is something like this $\{c,b,ab,ac,abcc,abbc,aabb,aabbccc,aabcc,\ldots\}$ because the amount […]