text:
Q: How can I make axis x vertical so the long names of countries become understandable in the plot The name of the countries are long and are on top of each other in the x labels, how can I make it readable?

ggplot(results, aes(x = Nationality, horiz=TRUE)) +
  theme_solarized() +
  geom_bar() +
  labs(y = "Number of Medals",
       title = "Number of Medals by Country")

A: Welcome to stackoverflow. Here are some suggestions on how you can deal with the many values. In both methods, I am using the forcats library within the tidyverse. You can read more about it here: https://r4ds.had.co.nz/factors.html
First, some fake data & replicating your problem
library(tidyverse)

df <-
  mpg %>%
  arrange(manufacturer) %>%
  mutate(
    n = row_number(),
    vehicle = paste(year, manufacturer, model)
  ) %>%
  uncount(n)

# this replicates your problem
ggplot(df, aes(vehicle)) +
  geom_bar() +
  coord_flip()

Option 1: consolidate
df %>%
  mutate(
    vehicle = # making heavy use of forcats here
      fct_lump(vehicle, 35) %>% # keep only the 35 most frequent values, others in "Other" category
      fct_infreq() %>% # order them by frequency
      fct_rev() #reverse the order
  ) %>%
  ggplot(aes(vehicle)) +
  geom_bar() +
  coord_flip()

Option 2: facet
Someone may have a more elegant way of getting these groups but I use this method quite a bit
df %>%
  mutate(
    vehicle = # similar methods to earlier
      fct_infreq(vehicle) %>%
      fct_rev(),
    num_fct = as.integer(vehicle), # generates a number for each factor
    facet = (max(num_fct)-num_fct) %/% 20 # will make groups of 20, but they need to be in descending order within each facet
  ) %>%
  ggplot(aes(vehicle)) +
  geom_bar() +
  coord_flip() +
  facet_wrap(~facet, scales = "free_y", nrow = 1) +
  theme(
    strip.background = element_blank(),
    strip.text = element_blank()
  )

Hope this helps.


text:
Q: basis free volume form for a symplectic vector space It's easy to show, using a symplectic basis, that if $\omega$ is a symplectic form on a $2n$-dimensional vector space $V$, then $\omega^n \neq 0$ (see for example Jason DeVito's excellent answer to this question). I'd like to be able to prove it without choosing a basis (the symplectic analogue to a question I asked recently about inner products), and I think it should be possible, but so far I've been unable.
Let $\omega\in \Lambda^2 V^*$, where $V$ is an inner product space of dim $2n$.
I want to show that $\omega^n=0 \Leftrightarrow\omega$ is degenerate.
$\Leftarrow:$ $\omega$ is degenerate, so there is some element $u\in V$ with $\omega(u,v)=0, \forall v\in V.$ Then let $\{e^i\}$ be a basis containing $u$. Therefore $\omega^n(e_1\wedge\dotsb\wedge e_{2n})=0,$ and any other $2n$-vector is collinear with $e_1\wedge\dotsb\wedge e_{2n},$ so $\omega^n=0.$
$\Rightarrow:$ Given the canonical isomorphism $V\cong V^*$, we have an associated element $\omega^\sharp=\sum_i q^i\wedge p^i.$ Let $W$ be the span of the $q^i,p^i.$ If there are fewer than $2n$ distinct elements in $\{q^i,p^i\}_i$, then $\dim W<2n$ so there is a vector $u\in W^\perp$ which is in the kernel of $\omega.$ If there are $2n$ distinct $q^i,p^i$, hence exactly $n$ terms in the sum then $\omega^n=q^1\wedge p^1\wedge\dotsb \wedge p^n\wedge q^n$, but since $\omega^n=0$, there is some linear dependence among the $q^i,p^i$, so the dimension of their span is again less than $2n$, so we have an element in the kernel.
If there are more than $n$ terms, then $\omega^n$ will be a sum of volume elements, which we stipulate vanishes. Can I find an element of the kernel here? (One way maybe is to say $\omega^n=\operatorname{Pf}(\omega)\text{vol}$ which vanishes iff $\det\omega$ does, but this seems like cheating)
(Previous apparently nonsensical argument below:because $\omega$ is nondegenerate, we have an isomorphism $\tilde{\omega}\colon V\to V^*$ given by $v \mapsto (u\mapsto \omega(v,u))$. This induces an isomorphism $\det(\tilde{\omega})\colon \Lambda^{2n} V\to \Lambda^{2n} V^*$. Then let $u = u_1\wedge \dotsb \wedge u_{2n}$ and $v = v_1\wedge \dotsb \wedge v_{2n}$ be rank $2n$ multivectors in $\Lambda^{2n} V$ ... next step?? This doesn't seem to work right.)

redpajama_set_name: RedPajamaStackExchange


text:
Q: php: Use different arrays in foreach loop I have 3 input that can be added dynamically. So the name of input is array, like:
<input type="text" name="qty1[]">
<input type="text" name="qty2[]">
<input type="text" name="qty3[]">

(Each of these input texts can be generated by javascript)
In my php file, I get them and want to insert to database (my controller in codeigniter):
$address = $this->input->post("qty1");
$LocX =    $this->input->post("qty2");
$LocY =    $this->input->post("qty3");

In my db part, where I want to use foreach and add to database:
Edit
foreach ($address as $key) {
  // I want to add $LocX and $LocY to the table
  // LocX and LocY are column names.
  $query = $this->db->query("INSERT INTO address (Comp_ID, Value, LocX, LocY)
                             VALUES(?, ?)", array($Comp_ID, $key ,? ,?));
}

I want to add all of them into foreach as parameter. As I searched it's not possible. What shoud I do? Thanks.
Edit2
The result of arrays, for example for $LocX :
Array
(
  [0] => test1
  [1] => test2
  [2] => test3
)

A: You can use the index in the foreach to get to the other elements. But you need to carefully check if the index value exists in the other arrays (isset check)
For example:
foreach ($address as $key => $value) {
  if(isset($LocX[$key], $LocY[$key]) {
      $a_LocX = $LocX[$key]; // This will be the locx of the address
      $a_LocY = $LocY[$key]; // This will be the locy of the address

      // Change your query to fit the table and fill in the locx and y.
      $query = $this->db->query("INSERT INTO address (Comp_ID, Value)
                             VALUES(?, ?)", array($Comp_ID, $key));
}

A: You can also use a for loop for this.
$address = $this->input->post("qty1");
$LocX =    $this->input->post("qty2");
$LocY =    $this->input->post("qty3");

$n=count($address);
for($i=0;$i<$n;$i++){
       $a=$address[$i];
       $x=$locX[$i];
       $y=$locY[$i];
       //insert here
}

A: I will suggest you to use Codeigniter syntax, and this will make your insert work,
foreach($address as $k => $v)
{
    $insert = array(
                'Comp_ID' => $Comp_ID,
                'Value' => $v,
            ); // insert array

    if(in_array($LocX[$k], $LocX)) // existance check
        $insert = array_merge($insert, array('LocX' => $LocX[$k]));

    if(in_array($LocY[$k], $LocY)) // existance check
        $insert = array_merge($insert, array('LocY' => $LocY[$k]));

    $this->db->insert('address', $insert); // No need to write full query
}


text:
Q: Can't post in friends wall anymore with my Rails app and Koala I was using this in my app to post to users friends' wall:
Koala::Facebook::GraphAPI.new(facebook_token).put_wall_post("My message", {:link => "http://www.mywebsite.com.br/invitation/#{uniq_link}"}, uid)

And it was all working fine, i ask for publish_stream and manage_friendlists permissions, but now, if someone send an invitation to me, i receive the notification but can't see the message or the link, is something wrong with my app? With koala? Facebook changed something? The fact that i already posted in a lot of walls is a problem?

A: Unfortunately I had a similar problem, but with fb_graph gem. Seems like my access_token was changed without me knowing. I guess the first place you should go is to do just that at the Facebook Developer App site.
Another thing I did was to just use the Facebook Social plugin instead via their Javascript API. I found that to be slightly more reliable and I don't have to rely on a gem to do it.
Hope this helps you out.


text:
Q: How to have tabmix plus not adapt bookmarklet names as tab title? Tabmix Plus has the very nice option to let tabs display the bookmark title instead of the actual document.title. Unfortunately, this also includes bookmarklets, i.e. if I use a bookmarklet (a bookmark starting with javascript:) Tabmix Plus changes the tab title to the bookmarklet title. How can this be fixed without disabling this otherwise very useful option?

A: I have the same issue using Tab Mix Plus v0.5.0.4 on Firefox 54.0.1 32-bit and 64-bit. The current tab title changes as soon as I execute some bookmarklets. What is curious is that the Firefox windows title is not impacted.
I have contacted the Tab Mix Plus developer in order to ask for support.
I will update this answer as soon as I have some news.
Edit: on 19/11/2017, the dev contacted me and I communicated all the technical info to him. He says he will see what he can do.
Edit: as Tab Mix Plus is not compatible with FF57+, I think the developer doesn't want to put further effort in it. I don't use Tab Mix Plus anymore, I have found alternatives.


text:
Q: Iron-Router flickering issue According to the Iron-Router Documentation, this is how you can handle routing when trying to route to a page that has no data associated with it.
if Meteor.isClient
    Router.onBeforeAction('dataNotFound')

Router.map ->

    @route 'chat',
        path: '/chat/:room_name'
        notFoundTemplate: 'home'
        data: ->
            Rooms.findOne({room_name: @params.room_name})

My code specifically is designed to redirect to the home page when a specific chat room is not defined. It works as expected with one very annoying issue. There is a lot of page flickering going on. The hooks seems to be rendering the home page first than following through with the logic to land you on the right page.
So when visiting a chat room that does exists, it quickly renders the home page for a split second, than loads the room. When visiting a chat room that doesn't exist, it is rendering the home page, than quickly re-rendering it. In both cases there is a flicker happening that makes these pages very annoying to use.
Am I just doing this in the wrong way? Or is there a better way to avoid the flickering?
EDIT: This only happens on a hard page reload
Here is my updated code based on the first answer, but I am having an issue where every room_name is being rendered and the ones that dont exist aren't being redirected to home
Routes: Which exists in the root level outside of client/server folders
if Meteor.isClient
    Router.onBeforeAction('dataNotFound')

Router.map ->

    roomExists = undefined
    @route 'chat',
        path: '/chat/:room_name'
        notFoundTemplate: 'home'
        onBeforeAction: ->
            @subscribe('rooms').wait()
        data: ->
            Rooms.findOne({room_name: @params.room_name})

Server Code
Meteor.publish 'rooms', () ->
    Room.find({})

A: You could also subscribe in the helper using the following pattern:
Template.someTemplate.helper = function() {
    var ready = Meteor.subscribe('somePublish').ready();
    var data = collection.find({_id: this.id});

    return {
        ready: ready,
        data: data
    };
};

In the template html you would then do this:
{{#with helper}}
    {{#if ready}}
        {{Dostuff with your data}}
    {{else}}
        {{>spinner}} Loading...
    {{/if}}
{{/with}}

Using the subscribes in the router stops the whole page from loading, while in most cases only a few sections of that page actually depend on that subscription being ready.

A: Possible reason for that behavior is the subscription not being ready when the page is rendered the first time. The fix is to move your subscriptions to the router and wait on them:
Router.map ->

  @route 'chat',
    path: '/chat/:room_name'
    notFoundTemplate: 'home'
    onBeforeAction: ->
      @subscribe('chatRooms').wait()
    data: ->
      Rooms.findOne({room_name: @params.room_name})


text:
Q: Can pressure in bars be equated to flow in litres per second? I have a 160 mm water pipe at 5 bar pressure.What is the flow in litres per sec? I want to fit a hydro turbine to the outlet.

A: Yes. Pressure difference and flow rates are related. You can see this analogous to voltage and current in electrical systems. They are related via hydraulic conductance or resistance or via friction factors.


text:
Q: $n$ such that decimal digits of $2^n$ begins with $n$ Are there infinitely many $n$ such that the decimal expansion $2^n$ begins with $n$?
For example, $2^6=64$ and $2^{10} =1024$.
It can easily be shown that this problem is equivalent to the following.
Are there infinitely many $n$ such that
$\{n\log_{10}2-\log_{10}n\}<\log_{10}{(1+\frac{1}{n})}$?
Here, $\{x\}=x-[x]$, where [x] denotes the largest integral number that is smaller than $x$.
More generally, for $\alpha,\beta,\gamma > 0$,   are there infinitely many $n$ such that
$\{\alpha n - \beta \log n\}<\frac{\gamma}{n}$?
I think it would help if I know something about the distribution of $\{\log n\}$.

A: Some general information on the problem, which is probably open.
As pointed out by Ivan Neretin at math.stackexchange, this is OEIS A100129. There you can find the first 16 numbers with this property.
According to this paper,

*

*Jan van de Lune, "A note on a problem of Erdős" (1978)

the problem goes back to Erdős:

"Recently my attention was drawn to the following observation made by
  P. Erdős: $2^6=64$ and $2^{10}=1024$. Here we have two examples of the
  phenomenon that the number $2^n$ starts with the same ordered sequence
  of digits as the natural number $n$ itself."

The characterization used in van de Lune's calculations is
$$0\leq \{n\log 2\}-\{\log n\}<\log(n+1)-\log n$$


text:
Q: Not able to run neo4jshell : Connection refused I am trying to follow the steps listed here https://neo4j.com/developer/kb/fulltext-search-in-neo4j/
I am using version 3.4.4
to try out full text search. I am not able to run the neo4jshell. I always get the following error :
$ ./neo4j-shell
ERROR (-v for expanded information):
    Connection refused

 -host      Domain name or IP of host to connect to (default: localhost)
 -port      Port of host to connect to (default: 1337)
 -name      RMI name, i.e. rmi://<host>:<port>/<name> (default: shell)
 -pid       Process ID to connect to
 -c         Command line to execute. After executing it the shell exits
 -file      File containing commands to execute, or '-' to read from stdin. After executing it the shell exits
 -readonly  Connect in readonly mode (only for connecting with -path)
 -path      Points to a neo4j db path so that a local server can be started there
 -config    Points to a config file when starting a local server

Example arguments for remote:
    -port 1337
    -host 192.168.1.234 -port 1337 -name shell
    -host localhost -readonly
    ...or no arguments for default values
Example arguments for local:
    -path /path/to/db
    -path /path/to/db -config /path/to/neo4j.config
    -path /path/to/db -readonly

java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
    java.net.ConnectException: Connection refused (Connection refused)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:338)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:112)
    at java.rmi.Naming.lookup(Naming.java:101)
    at org.neo4j.shell.impl.RmiLocation.getBoundObject(RmiLocation.java:191)
    at org.neo4j.shell.impl.RemoteClient.findRemoteServer(RemoteClient.java:72)
    at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:65)
    at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:46)
    at org.neo4j.shell.ShellLobby.newClient(ShellLobby.java:203)
    at org.neo4j.shell.StartClient.startRemote(StartClient.java:353)
    at org.neo4j.shell.StartClient.start(StartClient.java:229)
    at org.neo4j.shell.StartClient.main(StartClient.java:147)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at java.net.Socket.<init>(Socket.java:434)
    at java.net.Socket.<init>(Socket.java:211)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
    ... 13 more

I have tried the localhost, port etc options as well. No luck. Do I have to do any configuration changes?
Please help!

A: Neo4j-shell is deprecated, try using cypher-shell instead.


text:
Q: Stack Exchange android application crashes too often This app crashes too often. I open the app, scroll down to see the feeds and it crashes. Next time I open it, it goes smoothly. Then I click on a question, scroll down and the app crashes. I do the same, it goes smoothly. I now in the same run, open my profile, click on a answer I posted and the app crashed! I have knowledge of app development but still can't figure out what the problem is. I think when the answer consists of code or blockquote, the app crashes. I'm using android 4.1.1 having 512 MB RAM, MDPI resolution, stock ROM, Stack Exchange app v1.0.43
Also when the app crashes, it does not show- Unfortunately, Stack Exchange has crashed. It just closes so I can't even report it! When I long press the home button, it doesn't show the previous screen that was open. It shows transparent black screen.
Update: Saved it using catlog( I have a rooted device):- log.text on Dropbox Tell me if this of any use. Started recording with log filter set to "com.stackexchange" and log level "verbose(default)" and started using the application until it crashed. Did not restart the application then. Stopped the log recording. (If you read the log, try it from the bottom to up, as I used the application while trying to get to crash.)
Today once more this application crashed and I have logged it. Please look into this.

A: Thank you so much for the detailed report! From the looks of the logcat files it seems as if the app is being killed since the WebView rendering we're using for questions and answers is too intensive on your device. I don't quite know where to start on trying to fix that since dealing with WebViews is kind of a mess (Pre android 4.4 they are powered by WebKit, post android 4.4 they're powered by Chromium), but I'm going to investigate this with my lower end device (Android 4.0.4 on a device with 512 MB RAM) and see what I can do. I'll update this post as work on this progresses.


text:
Q: How to extract several observations of another dataframe and include it in the main dataframe under conditions? I am working with two different dataframes that both include different observations of a categorical variable and its frequency in a specific year, but for two different groups of different size (group 2 is bigger than group 1).
Now, I would like to include the frequency of those observations of group 2 in group 1 that have the same "value" for the categorical variable (a) and that are of the same year. So far, I was not able to find the correct function or for loop.
What I have tried so far:
library(tidyverse)
    library(dplyr)

    year_1 <- c(1914, 1915, 1916, 1917)
    a_1 <- c("blue", "green", "green", "blue")
    df_1 <- data.frame(a_1, year_1)
    df_1 <- group_by(a_1, year_1) %>% count(name = "counts") %>%
            ungroup(a_1, year_1) %>%
    df_1 <- mutate(freq_1=counts/sum(counts))

    year_2 <- c(1912, 1913, 1914, 1915, 1916, 1917, 1918)
    a_2    <- c("black", "pink", "blue", "green", "green", "pink", "blue")
    df_2 <- data.frame(a_2, year_2)
    df_2 <- group_by(a_2, year_2) %>% count(name = "counts") %>%
            ungroup(a_2, year_2) %>%
    df_2 <- mutate(freq_2=counts/sum(counts))

    for(i in df_1) {
      if(df_2$a_2==df_1$a_1[i] & df_2$year_2==df_1$year_1[i]) {
       df_1 %>%
       mutate(df_1, freq_2 = df_2$freq_2) %>%
        return(df_1)}

      }

A: I would do this with aggregate and merge or with ave:
#Your original Data
df1 <- data.frame(a=c("blue", "green", "green", "blue"), year=c(1914, 1915, 1916, 1917))
df2 <- data.frame(a=c("black", "pink", "blue", "green", "green", "pink", "blue"), year=c(1912, 1913, 1914, 1915, 1916, 1917, 1918))

#Count per a and year
df1 <- with(df1, aggregate(list(count=year), list(a=a, year=year), FUN=length))
df2 <- with(df2, aggregate(list(count=year), list(a=a, year=year), FUN=length))

#Include counts of df2 in df1 using aggregate and merge
merge(df1[c("a","year")], aggregate(count ~ a + year, data=rbind(df1, df2), FUN=sum))
      a year count
1  blue 1914     2
2  blue 1917     1
3 green 1915     2
4 green 1916     2

#Include counts of df2 in df1 using ave
df1$count <- with(rbind(df1, df2), ave(count, a, year, FUN=sum))[1:NROW(df1)]
df1
      a year count
1  blue 1914     2
2 green 1915     2
3 green 1916     2
4  blue 1917     1

A: I don't know if that's what you want:

library(dplyr)

#just recreating your data with minor corrections
year_1 <- c(1914, 1915, 1916, 1917)
a_1 <- c("blue", "green", "green", "blue")
df_1 <- data.frame(a_1, year_1, stringsAsFactors = FALSE)
df_1 <- df_1 %>% group_by(a_1, year_1) %>% tally() %>%
        ungroup(a_1, year_1) %>%
        mutate(freq_1=n/sum(n))

year_2 <- c(1912, 1913, 1914, 1915, 1916, 1917, 1918)
a_2    <- c("black", "pink", "blue", "green", "green", "pink", "blue")
df_2 <- data.frame(a_2, year_2, stringsAsFactors = FALSE)
df_2 <- df_2 %>% group_by(a_2, year_2) %>% tally() %>%
        ungroup(a_2, year_2) %>%
        mutate(freq_2=n/sum(n))

df_1 %>% left_join(df_2, by = c("year_1" = "year_2", "a_1" = "a_2")) %>%
  mutate(count = ifelse(!is.na(n.y), n.x + n.y, n.x),
         freq = count/sum(count)) %>% select(-n.y, -n.x, - freq_1, -freq_2 )

# A tibble: 4 x 4
  a_1   year_1 count  freq
  <chr>  <dbl> <int> <dbl>
1 blue    1914     2 0.286
2 blue    1917     1 0.143
3 green   1915     2 0.286
4 green   1916     2 0.286

This adds all categories from df_2 to df_1 which exist in the same year in both data frames, adds up their respective frequencies from both data frames and calculates a new percentage analogous to your freq_1and freq_2-columns.


text:
Q: Rewriting a proxy script URL I've been struggling for days now trying to figure this out, or if it is even possible, but basically I have a PHP proxy script running on an Apache server and I wish to rewrite the URL's such that you can't see that a proxy script is in use. For example:
http://www.domain-one.com/miniProxy.php/http://www.domain-two.com/about-us
Would look like:
http://www.domain-one.com/about-us
The proxy script is only being used to access a single domain, so domain-two.com can be hard-coded into the rewrite rule if need be. Is this even possible within the bounds of mod_rewrite rules? If so, can anyone help with what the regex might look like for something like this? Thanks.

A: use a href tag.
http://www.domain-one.com/about-us


text:
Q: VBA: Refreshing Pivot Tables as Sheet Opens I have two Pivot Tables on a sheet that I'd like to have automatically refreshed when the sheet is selected.  The Pivot Tables have been named "Order Detail-No Common Names" and "Master Table".  The code for the first table works but errors on the second table.  "Run time error 1004: Application-defined or object-defined error".  Does anyone have any idea as to why this may be?
Private Sub Worksheet_Activate()

Worksheets("TRANSLATION-Eligible Product").PivotTables("Order Detail-No
Common Names").PivotCache.Refresh

Worksheets("TRANSLATION-Eligible Product").PivotTables("Master
Table").PivotCache.Refresh

End Sub


text:
Q: How to handle xhr.js error gracefully using axios  export const startLogin = (email, password) => {
    return async (dispatch) => {
        try {
            const response = await axios.post('/admins/login', {email, password})
            if( response.status === 201 ) {
                dispatch(Login(response.data.token))
                return response
            }
        } catch(error) {
            if(error.response && error.response.status === 400) {
                console.log(error.response.data)
                return Promise.reject(error.response.data.error)
            } else if(error.request) {
                console.log('Request error: ', error.request)
            } else {
                console.log(error.response)
            }
        }
    }
}

I am trying to handle 400 bad request error upon user login. I get the desired response error message from my nodejs server. but the problem is I am also getting a weird console error message that says:
POST http://localhost:3000/admins/login 400 (Bad Request) xhr.js:178

and i tried everything i could do, catching all the errors like above but it didnt work. what could be the problem here?
How can i  handle this console error gracefully? Any help would be appreciated. Thanks


text:
Q: Perl - remove first word in a string with regexps I'm new to both Perl and reg-ex's, and I'm trying to remove the first word in a string (or the first word in a line in a text file) , along with any whitespace that follows it.
For example, if my string is 'one two abd123words', I want to remove 'one '.
The code I was trying is: $line =~/(\S)$/i;
but this only gives me the last word.
If it makes any difference, the word i'm trying to remove is an input, and stored as $arg.

A: You mean, like this? :
my $line = 'one two abd123words';
$line =~ s/^\s*\S+\s*//;
# now $line is 'two abd123words'

(That removes any initial whitespace, followed by a one or more non-whitespace characters, followed by any newly-initial whitespace.)

A: In one-liner form:
$ perl -pi.bak -e 's{^\s*\S+\s*}//' file.txt

A: To remove the first word of each line use:
$line =~ s/^\S+\s*//;

EDIT for a explanation:
s/.../.../            # Substitute command.
^                     # (Zero-width) Begin of line.
\S+                   # Non-space characters.
\s*                   # Blank-space characters.
//                    # Substitute with nothing, so remove them.


text:
Q: Upgrading cordova 1.9.0 (iOS) to cordova 2.1.0 and updating existing projects to use 2.1.0 I have uninstalled cordova 1.9.0 by doing:
To uninstall:

*

*Remove the PHONEGAPLIB value in Xcode Preferences -> Source Trees

*Delete the ~/Documents/PhoneGapLib folder

*Delete the ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/PhoneGap folder

*Delete the "~/Library/Application Support/Developer/Shared/Xcode/Templates/Project Templates/Application/PhoneGap-based Application.xctemplate" or the "~/Library/Developer/Xcode/Templates/Project\ Templates/Application/PhoneGap-based\ Application.xctemplate" folder

*Delete the /Users/Shared/PhoneGap/Frameworks/PhoneGap.framework folder
Delete the ~/Library/Frameworks/PhoneGap.framework symlink
I then followed the upgrade guides:
http://github.com/apache/incubator-cordova ios/blob/master/guides/Cordova%20Plugin%20Upgrade%20Guide.md
and http://docs.phonegap.com/en/2.1.0/guide_upgrading_ios_index.md.html
The project builds with no errors, but when I try to run:
On an iPhone with  iOS 5.1.1 I get this error:
ERROR: Start Page at 'www/index.html' was not found.

and on an iPhone with iOS 6.0 I get this error:
Failed to load webpage with error: The requested URL was not found on this server.

Whether I remove the only external link or all javascript sources, whether I manually add the www folder, or anything at all that can be found on the internet, these errors are persistent.

A: Apparently this problem was first noticed in cordova 1.4 and I followed this solution http://www.tricedesigns.com/2012/02/16/linked-source-files-across-phonegap-projects-on-osx/
The problem was that Xcode could not see the www folder.


text:
Q: How to escape the < and ≤ symbols in xml? I want to create a string <res> in android as below:
<string name="bmi0">0: BMI≤18.5</string>
<string name="bmi1">1: 18.5<BMI≤24</string>
<string name="bmi2">2: 24<BMI≤27</string>

But i shown the error of "Tag start is not closed".
I tried to put a \ symbol in front, but it doesn't work, it has shown the same error.
<string name="bmi0">0: BMI\≤18.5</string>
<string name="bmi1">1: 18.5<BMI\≤24</string>
<string name="bmi2">2: 24<BMI\≤27</string>

How to escape the special XML symbols ?

A: You have to escape those symbols for XML.
What characters do I need to escape in XML documents?

A: As said, for the < and >, you can use this:
<   <
>   >

You need to do this because the < and > aren't allowed in XML, so you need to escape them. You do that by typing: & + specific code for your character + ;, when you show this string, this will be recognized as being the special character (< or >).
You also wanted the smaller or equal sign (≤), which is afaik allowed in XML, so just use ≤.
These are the characters you have to escape:
"   =   "
'   =   '
<   =   <
>   =   >
&   =   &

A: Use this:
<   <
>   >

A: You will have to escape those symbols as following:

*

*< will be <

*> will be >
The ≤ sign doesn't need escaping.

A: Use Unicode sequences for special characters.
You can find some of them here: http://jrgraphix.net/r/Unicode/2200-22FF
Use it like this:
\u2264

will be converted to ≤

A: use
https://stackoverflow.com/a/4301267/2740014
to escape the strings and then put them into your xml.
StringEscapeUtils.escapeXml(stringHere);

Is the needed thing i think.

A: Use Unicode
For    <  use  \u003c
For    > \u003e and
For    ≤ \u2264
For getting unicode of any String use the following method
public static String getUnicode(String input){
    String output = "";
    for(char c:input.toCharArray()){
        output +="\\u" + Integer.toHexString(c|0x10000).substring(1) ;
    }
    return output;
}

A: Just my 2 cents: guava 15 introduced Escapers, especially for this situations:
 Escaper escaper = XmlEscapers.xmlAttributeEscaper();
 String result = escaper.escape("<>");
 System.out.println(result); // <>


text:
Q: Java Scanner input into int and string arrays If someone would be kind enough to give me a hand with this program it would be appreciated, it accepts multiple students names and grades using a Scanner and then puts them into 2 arrays, Students and Scores.  Then it will print out like the following...
Max. Grade = 98 (Lauren)
Min. Grade = 50 (Joe)
Avg. Grade = 83.9
/* Chris Brocato
 *  10-27-15
 * This program will read the students names and scores using a Scanner and use two arrays to
 * show the grade and name of the highest and lowest scoring student as well as the average grade.*/

import java.util.*;

public class StudentCenter {

    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        System.out.print("Please enter the number of students: ");
        int students = console.nextInt();
        String[] name = new String[students];
        int[] scores = new int[students];

        int min = 0; int max = 0; int sum = 0;
        for (int i = 0; i < name.length; i++) {
            System.out.print("Please enter student's name: ");
            name[i] = console.next();
            System.out.print("Now enter their score: ");
            scores[i] = console.nextInt();
            if (i == 0) {
                min = students;
                max = students;
            }else {
                if (students < min) min = students;
                if (students > max) max = students;
            }sum += students;
        }
        System.out.println("Min. Grade = " + min + name );
        System.out.println("Max. Grade = " + max + name);
        System.out.println("Average Grade = " + sum);
        double avg = (double) sum / (double) students;
        System.out.println("Avg = " + avg);
        console.close();
        }

    }

A: You're setting min,max, and sum to the value of students, which is the number of students—not their scores. You should probably be setting them to scores[i].
if (i == 0) {
    min = scores[i];
    max = scores[i];
}else {
    if (students < min) min = scores[i];
    if (students > max) max = scores[i];
}
sum += scores[i];

I would also store the indices for minimum and maximum scores, so that you can reference their names later.
 min = scores[i];
 minIndex = i;
 ...
 System.out.println("Min. Grade = " + min + name[minIndex] );

A: I would use the Min and Max values for constants.
int max = Integer.MIN_VALUE;
int min = Integer.MAX_VALUE;
int maxValue = 0;
int minValue = 0;
String minName;
String maxName;

//then use them for comparison in the loop

if(scores[i] < min)
{
 minValue = scores[i];
 minName = name[i];
}

if(scores[i] > max)
{
 maxValue = scores[i];
 maxName = name[i];
}

That will store your max/min values with the associated name.

A: You are comparing min and max with incorrect values. students is the number of students you have not the grades. Also when printing tha names you are printing the whole array and not just a specific value. So my advice is that you create two variables like this:
int minInd = 0;
int maxInd = 0;
then change your if like this:
if (i == 0) {
                min = scores[i];
                max = scores[i];
            } else {
                if (scores[i] < min) {
                    min = scores[i];
                    minInd = i;
                }
                if (scores[i] > max) {
                    max = scores[i];
                    maxInd = i;
                }
            }
  sum += scores[i];

And print the result like this:
System.out.println("Min. Grade = " + min + " ("+ name[minInd]+")");
  System.out.println("Max. Grade = " + max + " ("+name[maxInd]+")");


text:
Q: Hex colors in Android are sometimes eight digits. How? What is the difference between #FFFFFF and #FFFFFF00? I sometimes have seen in examples where the coloring in Android is done as #FF191919. I mean an eight-digit hex number. But it should only be a six-digit number. How are they related?
If I want to convert a six-digit number to a eight-digit number, how can I do it? I mean convert #424242 to a eight-digit number coloring? What are the the details?

A: The eight-digit color is defined with an alpha level.
Let's extract all. We define the hexadecimal color as six value pairs of RGB two digits per pair.

*

*The first two digits for red.

*The second two digits for green.

*The third two digits for blue.

Now if you want to set the alpha level of that then it is defined with the eight digits as ARGB.
So now the first two digit values define the alpha and the rest are for the RGB.

A: The first two characters represent the alpha (transparency) value, where FF is fully visible. This is known as ARGB.

A: The eight-digit hexadecimal value is an ARGB color. It is the same as the usual RGB, but it provides an extra alpha channel.
#RRGGBB in RGB is the same as #00RRGGBB in ARGB. Also take a look at Color.argb.

A: The extra two digits are used to define the colors' transparency, or alpha channel.
Android uses the ARGB format (or AARRGGBB as you use in your example).
For more (Android-specific) information, take a look at the Color documentation.

A: An eight-digit Android hexadecimal value is called an ARGB. ARGB values are typically expressed using eight hexadecimal digits, with each pair of the hexadecimal digits representing the values of the alpha, red, green and blue channel, respectively. For example, 80FFFF00 represents 50.2% opaque (non-premultiplied) yellow.
The 80 hexadecimal value, which is 128 in decimal, represents a 50.2% alpha value because 128 is approximately 50.2% of the maximum value of 255 (FF hexadecimal); to continue to decipher the 80FFFF00 value, the first FF represents the maximum value red can have; the second FF is like the previous, but for green; the final 00 represents the minimum value blue can have (effectively – no blue).
Consequently red + green yields yellow. In cases where the alpha is not used, this can be shortened to six digits, RRGGBB, and this is why it was chosen to put the alpha in the top bits. Depending on the context, a 0x or a number sign, #, is put before the hexadecimal digits.

A: Eight-digit hex notation works the same as the six-digit notation, in that you provide a six-digit hexadecimal value, prefixed with a hash (#) symbol.
The difference is, eight-digit notation, as the name suggests, adds two more digits. These two digits represent the alpha channel of the color.
The alpha channel is represented by the last two digits.
This last pair of digits are interpreted as a hexadecimal number (just like the other digits). A value of 00 represents a fully transparent color, and a value of FF represents a fully opaque color.
So for a fully opaque color do this : Color(0xFF<your-6digit-code>)
For example, if you have a 6 digit code: E64526
Now convert it to an 8 digit code with: Color(0xFFE64526)


text:
Q: How to get the average without using the sum function Heres my code below
def average(a_list):  # returns average value of a list of numbers.
    total = 0
    a_list = []
    for n in (a_list):
        total += n
    return total/ len(a_list)

But I keep getting an error that my "len(a_list)" doesn't work because it is dividing by zero

A: Yes, it's zero: you very specifically destroyed your input argument just before you entered the loop.  Don't do that!
Remove that statement:
def average(a_list):  # returns average value of a list of numbers.
    total = 0
    for n in a_list:
        total += n
    return total / len(a_list)


text:
Q: how to create a contiguous 2d array in c++? I want to create a function that returns a contiguous 2D array in C++.
It is not a problem to create the array using the command:
 int (*v)[cols] = new (int[rows][cols]);

However, I am not sure how to return this array as a general type for a function. The function is:
  NOT_SURE_WHAT_TYPE create_array(int rows, int cols)
  {
        int (*v)[cols] = new (int[rows][cols]);
        return v;
  }

I tried double*[] and double** and both don't work. I wouldn't want to use double*, since I want to access this array from outside as a 2D array.
Related question: How do I declare a 2d array in C++ using new?

A: Unless the size of the two dimensions is known at compile time, your don't have much choice: allocate a single rows*cols array of ints, and roll your own 2D indexing with integer multiplication and addition. Wrapping this in a class can produce a nice-looking syntax for accessing array elements with square bracket operator. Since your array is 2D, you will need to use proxy (AKA "surrogate") objects for the first level of data access.
Here is a small sample code that uses std::vector<T> for maintaining a contiguous memory region in dynamic memory:
template<class T>
class Array2D {
    vector<T> data;
    size_t cols;
public:
    // This is the surrogate object for the second-level indexing
    template <class U>
    class Array2DIndexer {
        size_t offset;
        vector<U> &data;
    public:
        Array2DIndexer(size_t o, vector<U> &dt) : offset(o), data(dt) {}
        // Second-level indexing is done in this function
        T& operator[](size_t index) {
            return data[offset+index];
        }
    };
    Array2D(size_t r, size_t c) : data (r*c), cols(c) {}
    // First-level indexing is done in this function.
    Array2DIndexer<T> operator[](size_t index) {
        return Array2DIndexer<T>(index*cols, data);
    }
};

You can now use Array2D<int> as if it were a built-in C++ array:
Array2D<int> a2d(10, 20);
for (int r = 0 ; r != 10 ; r++) {
    for (int c = 0 ; c != 20 ; c++) {
        a2d[r][c] = r+2*c+1;
    }
}

Running demo on ideone.

A: Since you're using C++ and not C, I would recommend to use one vector instead of messing around with new/delete.
You can define one contiguous block of memory like this:
std::vector<int> my_matrix(rows*cols);

And now you access this vector in a 2d-array-like way with the formula i*n + j, with i being the row index, j the column index and n the length of a row:
my_matrix[i*n + j];

That's the same as accessing a 2d array with array[i][j]. But now you have the advantage of one contiguous block of memory, you don't need to bother about new/delete and you can easily share and return this vector object with functions.

A: handling raw memory ressources is often icky. Best shot is a simple wrapper as :
struct array2D : private std::vector<int>
{
  typedef  std::vector<int> base_type;

  array2D() : base_type(), height_(0), width_(0) {}
  array2D(std::size_t h, std::size_t w) : base_type(h*w), height_(h), width_(w);

  int operator()(std::size_t i, std::size_t j) const
  {
     return base_type::operator[](i+j*height_);
  }

  int& operator()(std::size_t i, std::size_t j)
  {
     return base_type::operator[](i+j*height_);
  }

  std::size_t rows() const { return height_; }
  std::size_t cols() const { return width_; }

  private:
  std::size_t height_, width_;
}

private inheritance let you grab all the goodies from vector, just add your 2D constructor. Ressources management is free as vector ctor/dtor will do their magic. Obviously, the i+h*j can be changed to whateever storage order you want.
vector< vector< int > > is 2D but won't be contiguous in memory.
Your function then become :
array2D create_array(int rows, int cols)
{
  return array2D(cols,rows);
}

EDIT:
You can also retrieve other vector interface parts like begin/end or size with the usign clause to make the private inherited member functions public again.

A: None of the ways of defining a 2D dynamic array in standard C++ are entirely satisfactory in my opinion.
You end up having to roll your own solutions. Luckily there is already a solution in Boost. boost::multi_array:
#include "boost/multi_array.hpp"

template<typename T>
boost::multi_array<T, 2> create_array(int rows, int cols) {
  auto dims = boost::extents[rows][cols];
  return boost::multi_array<T, 2>(dims);
}

int main() {
  auto array = create_array<int>(4, 3);
  array[3][2] = 0;
}

Live demo.

A: If you want to create an array where the data is contiguous and you don't want a 1-dimensional array (i.e. you want to use the [][] syntax), then the following should work.  It creates an array of pointers, and each pointer points to a position into a pool of memory.
#include <iostream>
#include <exception>

template <typename T>
T** create2DArray(unsigned nrows, unsigned ncols, const T& val = T())
{
   if (nrows == 0)
        throw std::invalid_argument("number of rows is 0");
   if (ncols == 0)
        throw std::invalid_argument("number of columns is 0");
   T** ptr = nullptr;
   T* pool = nullptr;
   try
   {
       ptr = new T*[nrows];  // allocate pointers (can throw here)
       pool = new T[nrows*ncols]{val};  // allocate pool (can throw here)

       // now point the row pointers to the appropriate positions in
       // the memory pool
       for (unsigned i = 0; i < nrows; ++i, pool += ncols )
           ptr[i] = pool;

       // Done.
       return ptr;
   }
   catch (std::bad_alloc& ex)
   {
       delete [] ptr; // either this is nullptr or it was allocated
       throw ex;  // memory allocation error
   }
}

template <typename T>
void delete2DArray(T** arr)
{
   delete [] arr[0];  // remove the pool
   delete [] arr;     // remove the pointers
}

int main()
{
   try
   {
      double **dPtr = create2DArray<double>(10,10);
      dPtr[0][0] = 10;  // for example
      delete2DArray(dPtr);  // free the memory
   }
   catch(std::bad_alloc& ex)
   {
      std::cout << "Could not allocate array";
   }
}

Note that only 2 allocations are done.  Not only is this more efficient due to the lesser amounts of allocations done, we now have a better chance of doing a rollback of the allocated memory if a memory allocation fails, unlike the "traditional" way of allocating a 2D array in non-contiguous memory:
// The "traditional" non-contiguous allocation of a 2D array (assume N x M)
T** ptr;
ptr = new T*[N];
for (int i = 0; i < N; ++i)
   ptr[i] = new T [M]; // <<-- What happens if new[] throws at some iteration?

If new[] throws an exception somewhere during the operation of the for loop, you have to roll back all of the successful calls to new[] that happened previously -- that requires more code and adds complexity.
Note how you deallocate the memory in the contiguous version -- just two calls to delete[] when allocated contiguously instead of a loop calling delete[] for each row.

Also, since the data is in contiguous memory, algorithms, functions, etc. that assume that the data is in contiguous memory, just like a one-dimensional array, can now be used by specifying the start and end range for the M*N matrix:
[&array[0][0], &array[M-1][N])
For example:
std::sort(&myArray[0][0], &myArray[M-1][N]);
will sort the entire matrix in ascending order, starting from index [0][0] up until the last index [M-1][N-1].
You can improve on the design by making this a true class instead of having allocation / deallocation as 2 separate functions.

Edit:  The class is not RAII-like, just as the comment says.  I leave that as an exercise for the reader.  One thing missing from the code above is the check that nRows and nCols are > 0 when creating such an array.
Edit 2: Added a try-catch to ensure a proper roll back of the memory allocation is done if a std::bad_alloc exception is thrown attempting to allocate memory.

Edit: For a 3 dimensional array example of code similar to the above see this answer.  Included is code to roll back allocations if the allocation fails.

Edit: Rudimentary RAII class added:
template <typename T>
class Array2D
{
    T** data_ptr;
    unsigned m_rows;
    unsigned m_cols;

    T** create2DArray(unsigned nrows, unsigned ncols, const T& val = T())
    {
        T** ptr = nullptr;
        T* pool = nullptr;
        try
        {
            ptr = new T*[nrows];  // allocate pointers (can throw here)
            pool = new T[nrows*ncols]{ val };  // allocate pool (can throw here)

            // now point the row pointers to the appropriate positions in
            // the memory pool
            for (unsigned i = 0; i < nrows; ++i, pool += ncols)
                ptr[i] = pool;

            // Done.
            return ptr;
        }
        catch (std::bad_alloc& ex)
        {
            delete[] ptr; // either this is nullptr or it was allocated
            throw ex;  // memory allocation error
        }
    }

public:
    typedef T value_type;
    T** data() {
        return data_ptr;
    }

    unsigned get_rows() const {
        return m_rows;
    }

    unsigned get_cols() const {
        return m_cols;
    }

    Array2D() : data_ptr(nullptr), m_rows(0), m_cols(0) {}
    Array2D(unsigned rows, unsigned cols, const T& val = T())
    {
        if (rows == 0)
            throw std::invalid_argument("number of rows is 0");
        if (cols == 0)
            throw std::invalid_argument("number of columns is 0");
        data_ptr = create2DArray(rows, cols, val);
        m_rows = rows;
        m_cols = cols;
    }

    ~Array2D()
    {
        if (data_ptr)
        {
            delete[] data_ptr[0];  // remove the pool
            delete[] data_ptr;     // remove the pointers
        }
    }

    Array2D(const Array2D& rhs) : m_rows(rhs.m_rows), m_cols(rhs.m_cols)
    {
        data_ptr = create2DArray(m_rows, m_cols);
        std::copy(&rhs.data_ptr[0][0], &rhs.data_ptr[m_rows-1][m_cols], &data_ptr[0][0]);
    }

    Array2D(Array2D&& rhs) noexcept
    {
        data_ptr = rhs.data_ptr;
        m_rows = rhs.m_rows;
        m_cols = rhs.m_cols;
        rhs.data_ptr = nullptr;
    }

    Array2D& operator=(Array2D&& rhs) noexcept
    {
        if (&rhs != this)
        {
            swap(rhs, *this);
            rhs.data_ptr = nullptr;
        }
        return *this;
    }

    void swap(Array2D& left, Array2D& right)
    {
        std::swap(left.data_ptr, right.data_ptr);
        std::swap(left.m_cols, right.m_cols);
        std::swap(left.m_rows, right.m_rows);
    }

    Array2D& operator = (const Array2D& rhs)
    {
        if (&rhs != this)
        {
            Array2D temp(rhs);
            swap(*this, temp);
        }
        return *this;
    }

    T* operator[](unsigned row)
    {
        return data_ptr[row];
    }

    const T* operator[](unsigned row) const
    {
        return data_ptr[row];
    }

    void create(unsigned rows, unsigned cols, const T& val = T())
    {
        *this = Array2D(rows, cols, val);
    }
};

int main()
{
    try
    {
        Array2D<double> dPtr(10, 10);
        std::cout << dPtr[0][0] << " " << dPtr[1][1] << "\n";
    }
    catch (std::exception& ex)
    {
        std::cout << ex.what();
    }
}

A: The "Rudimentary RAll" class provided by PaulMcKenzie is an excellent solution. In my use of it I did find a memory leak which is fixed in the version shown below.
The memory leak was due to an issue with
Array2D& operator=(Array2D&& rhs) noexcept.
The statement rhs.m_dataPtr = nullPtr needed to be removed in order to allow the rhs destructor to delete the original data (pool and pointers) swapped from lhs.
Here is the corrected code for the "Rudimentary RAll" class provided by PaulMcKenzie
template <typename T>
class Array2D
{
    T** data_ptr;
    unsigned m_rows;
    unsigned m_cols;

    T** create2DArray(unsigned nrows, unsigned ncols, const T& val = T())
    {
        T** ptr = nullptr;
        T* pool = nullptr;
        try
        {
            ptr = new T*[nrows];  // allocate pointers (can throw here)
            pool = new T[nrows*ncols]{ val };  // allocate pool (can throw here)

            // now point the row pointers to the appropriate positions in
            // the memory pool
            for (unsigned i = 0; i < nrows; ++i, pool += ncols)
                ptr[i] = pool;

            // Done.
            return ptr;
        }
        catch (std::bad_alloc& ex)
        {
            delete[] ptr; // either this is nullptr or it was allocated
            throw ex;  // memory allocation error
        }
    }

public:
    typedef T value_type;
    T** data() {
        return data_ptr;
    }

    unsigned get_rows() const {
        return m_rows;
    }

    unsigned get_cols() const {
        return m_cols;
    }

    Array2D() : data_ptr(nullptr), m_rows(0), m_cols(0) {}
    Array2D(unsigned rows, unsigned cols, const T& val = T())
    {
        if (rows == 0)
            throw std::invalid_argument("number of rows is 0");
        if (cols == 0)
            throw std::invalid_argument("number of columns is 0");
        data_ptr = create2DArray(rows, cols, val);
        m_rows = rows;
        m_cols = cols;
    }

    ~Array2D()
    {
        if (data_ptr)
        {
            delete[] data_ptr[0];  // remove the pool
            delete[] data_ptr;     // remove the pointers
        }
    }

    Array2D(const Array2D& rhs) : m_rows(rhs.m_rows), m_cols(rhs.m_cols)
    {
        data_ptr = create2DArray(m_rows, m_cols);
        std::copy(&rhs.data_ptr[0][0], &rhs.data_ptr[m_rows-1][m_cols], &data_ptr[0][0]);
    }

    Array2D(Array2D&& rhs) noexcept
    {
        data_ptr = rhs.data_ptr;
        m_rows = rhs.m_rows;
        m_cols = rhs.m_cols;
        rhs.data_ptr = nullptr;
    }

    Array2D& operator=(Array2D&& rhs) noexcept
    {
        if (&rhs != this)
        {
            swap(rhs, *this);
        }
        return *this;
    }

    void swap(Array2D& left, Array2D& right)
    {
        std::swap(left.data_ptr, right.data_ptr);
        std::swap(left.m_cols, right.m_cols);
        std::swap(left.m_rows, right.m_rows);
    }

    Array2D& operator = (const Array2D& rhs)
    {
        if (&rhs != this)
        {
            Array2D temp(rhs);
            swap(*this, temp);
        }
        return *this;
    }

    T* operator[](unsigned row)
    {
        return data_ptr[row];
    }

    const T* operator[](unsigned row) const
    {
        return data_ptr[row];
    }

    void create(unsigned rows, unsigned cols, const T& val = T())
    {
        *this = Array2D(rows, cols, val);
    }
};

int main()
{
    try
    {
        Array2D<double> dPtr(10, 10);
        std::cout << dPtr[0][0] << " " << a2[0][0] << "\n";
    }
    catch (std::exception& ex)
    {
        std::cout << ex.what();
    }
}

A: I think you should write a simple class to wrap a 1-dim array. Then you can implement a 2-dim array with operator() overloading for getting values and deconstruct func for release the memory. Code as below:
#include <assert.h>

template <typename T>
class Array_2D
{
private:
    T *data_inside;
public:
    int size[2];
    Array_2D(int row, int column);
    ~Array_2D();

    //
    T operator()(int index1, int index2){
        return data_inside[get_index(index1, index2)];
    }

    int get_index(int index1, int index2){
        if(index1>=0 and index1<size[0] and index2>=0 and index2<=size[1]){
            return index1*size[0] + index2;
        }else{
            assert("wrong index for array!" == "True");
        }
    }

};

template <typename T>
Array_2D<T>::Array_2D(int row, int column)
{
    size[0] = row;
    size[1] = column;
    data_inside = new T[row*column];
}

template <typename T>
Array_2D<T>::~Array_2D()
{
    // 使用析构函数,自动释放资源
    delete[] data_inside;
}


text:
Q: Serializing with Jackson (JSON) - getting "No serializer found"? I get the an exception when trying to serialize a very simple object using Jackson. The error:

org.codehaus.jackson.map.JsonMappingException: No serializer found for
  class MyPackage.TestA and no properties
  discovered to create BeanSerializer (to avoid exception, disable
  SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) )

Below is the simple class and code to serialize.
Can anyone tell my why I get this error?
public class TestA {
    String SomeString = "asd";
}

TestA testA = new TestA();
ObjectMapper om = new ObjectMapper();
try {
    String testAString = om.writeValueAsString(testA); // error here!

    TestA newTestA = om.readValue(testAString, TestA.class);
} catch (JsonGenerationException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (JsonMappingException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

A: For Jackson to serialize that class, the SomeString field needs to either be public (right now it's package level isolation) or you need to define getter and setter methods for it.

A: Jackson uses getters and setters serialization./deserialization.
So add getter and setter in your model class.

A: If you can edit the class containing that object, I usually just add the annotation
import com.fasterxml.jackson.annotation.JsonIgnore;

@JsonIgnore
NonSerializeableClass obj;

A: I had the same problem for a child class where I had control, object mapper was in a common module and was inaccessible. I solved it by adding this annotation for my child class whose object was to be serialized.
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)

A: This error is also thrown if you forget to add the .build() method onto your return status.
return Response.status(Status.OK);         // fails
return Response.status(Status.OK).build(); // works

I got the following error without build() method:
org.codehaus.jackson.map.JsonMappingException: No serializer found for class com.sun.jersey.core.spi.factory.ResponseBuilderImpl

A: SpringBoot2.0 ,I resolve it by follow code:
@Bean public ObjectMapper objectMapper() {
 return new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);}

A: As already described, the default configuration of an ObjectMapper instance is to only access properties that are public fields or have public getters/setters.  An alternative to changing the class definition to make a field public or to provide a public getter/setter is to specify (to the underlying VisibilityChecker) a different property visibility rule.  Jackson 1.9 provides the ObjectMapper.setVisibility() convenience method for doing so.  For the example in the original question, I'd likely configure this as
myObjectMapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);

For Jackson >2.0:
myObjectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);

For more information and details on related configuration options, I recommend reviewing the JavaDocs on ObjectMapper.setVisibility().

A: I had a similar problem with lazy loading via the hibernate proxy object. Got around it by annotating the class having lazy loaded private properties with:
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})

A: The problem in my case was Jackson was trying to serialize an empty object with no attributes nor methods.
As suggested in the exception I added the following line to avoid failure on empty beans:
For Jackson 1.9
myObjectMapper.configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);

For Jackson 2.X
myObjectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);

You can find a simple example on jackson disable fail_on_empty_beans

A: For Oracle Java applications, add this after the ObjectMapper instantiation:
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);

A: I found at least three ways of doing this:

*

*Add public getters on your entity that you try to serialize;

*Add an annotation at the top of the entity, if you don't want public getters. This will change the default for Jackson from Visbility=DEFAULT to @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) where any access modifiers are accepted;

*Change your ObjectMapper globally by setting objectMapperInstance.setVisibility(JsonMethod.FIELD, Visibility.ANY);. This should be avoided if you don't need this functionality globally.

Choose based on your needs.

A: Here are the three options:

*

*Data/class that's been accessed needs to be public

*If not public, add getters & setters

*Or add @JsonIgnore("context")

A: The problem may be because you have declared variable as private.
If you change it to public, it works.
Better option is to use getter and setter methods for it.
This will solve the issue!

A: Please use this at class level for the bean:
@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})

A: I just had only getters , after adding setters too , problems resolved.

A: Add a

getter

and a

setter

and the problem is solved.

A: adding setter and getter will also solve the issue as it fixed for me.
 For Ex:
public class TestA {
    String SomeString = "asd";

    public String getSomeString () {        return SomeString ;     }

    public void setSomeString (String SS ) {        SomeString = SS ;   }
}

A: in spring boot 2.2.5
after adding getter and setter
i added @JsonIgnore on top of the field.

A: Though I added getters and setters I was getting the same error. Later I found a bug, that is by Sonar's advice I cgahnged the getters and setters as protected which was causing the issue. Once I fixed that it worked as exppected.

A: If you use Lomdok libraray (https://projectlombok.org/) then add @Data (https://projectlombok.org/features/Data) annotation to your data object class.

A: For me, the problem was the annotation @RestResource(exported = false) from the import org.springframework.data.rest.core.annotation.RestResource. Which I forgot to remove.
Also, I got the same error when I forgot to add the class annotation @XmlRootElement from the import javax.xml.bind.annotation.XmlRootElement.

A: I solved with @Getter from lombok

A: Adding a getter/setter solved this problem for me.
either manually add getter/setter or use Lombok annotations @Getter/@Setter/@Data for the same.


text:
Q: Input-store-store-output I can't get the function to do some storing of values on another page and outputting it on the next page.
For example, I have dog.html and cat.html that has a submit button respectively. I want to get the inputs of dog.html and cat.html and output the values on pay.html(after clicking the submit button in cat.html
I have this code in pay4.html where I can get the value from the previous page.
function getParams(){
    var idx = document.URL.indexOf('?');
    var params = new Array();
    if (idx != -1) {
        var pairs = document.URL.substring(idx+1,
                document.URL.length).split('&');
        for (var i=0; i<pairs.length; i++){
            nameVal = pairs[i].split('=');
            params[nameVal[0]] = nameVal[1];
        }
    }
    return params;
}
params = getParams();
Name = unescape(params["Name"]);
Address = unescape(params["Address"]);
ContactNo = unescape(params["ContactNo"]);
Email = unescape(params["Email"]);
document.write("Name: " + Name + "
");
document.write("Address: " + Address + "
");
document.write("Contact number: " + ContactNo + "
");
document.write("E-mail: " + Email + "
");

I need to do this to input again in some pages before outputting all the values I entered.
<form name="info" action="pay1.html" type=GET>
<form name="info" action="pay2.html" type=GET>
<form name="info" action="pay3.html" type=GET>
<form name="info" action="pay4.html" type=GET>

A: Try using cookies to carry your data across several pages (assuming they're on same domain).
If it was running on a server, you can use sessions.
Read more at https://developer.mozilla.org/en-US/docs/DOM/document.cookie


text:
Q: String performacne: PHP vs MySQL Are there any performance concerns of note when using MySQL's CONCAT() function in a select query? Is it faster/slower/negligible to do a simple select, and format strings for a view using PHP after the result set from the database is returned? Or is a more complicated SQL query with multiple calls to CONCAT() that returns a string already formatted for the view a better approach?
ie is this:
select CONCAT(lastname, ', ', firstname) from people;

Faster/Slower/No difference from this:
<?php
    $query = 'Select lastname, firstname from people';
    ...

    $name = $data['lastname'] . ', ' . $data['firstname']; //OR
    $name = sprintf("%s, %s", $data['lastname'], $data['firstname']);
?>

A: You're better off in almost all cases by doing filtering and data massaging with the SQL engine versus on the web server.

A: Unless you are planning to do hundreds of thousands such operations at once, it will not matter where you do the string concatenation from a performance point of view. The possible time savings will be so minuscule, they will probably not even be measurable.


text:
Q: Attach file in SharePoint List without using permission Edit I've got a list where a particular user group should be able to add items only to this list, but not edit them.
However, these users cannot ATTACH a document to the item they are adding because « edit permission » is disabled.
If I add the "edit items" permission to this group, they are able to attach a document, but then they are able to edit information they shouldn't have access to edit. I search solution who users can add items and attach files without using « edit permission ».
Can you help me to solve this problem?

A: You can create a new editform.aspx in which you disable each field that can't be modified using css and js scripts.
If some other users can modify the items, then you can make a script depending on the sharePoint group.
This blog post may help you : http://spjsblog.com/2012/05/07/showing-or-hiding-form-fields-based-on-membership-in-a-sharepoint-group/


text:
Q: Qemu monitor : How to display a model specific register content? Qemu monitor command info registers displays CPU general purpose registers along with a handful of control registers. However, which command gives us the content of a model specific register?
I found this thread by googling where they exchange idea about a patch which will supply a command but it is not said if they end up implementing the feature.


text: Q: MetroFramework Modern UI Version 1.4.0 - TextBox & ComboBox Issue I am working on a VB.NET project with MetroFramework Modern UI Version 1.4.0 and I have this issue... If I add a MetroTextBox or a MetroComboBox control and run it, my application goes in Break Mode and gives me this message Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code). Any idea why is this happening?


text:
Q: How to initialize a member array with a lenght given as object parameter I don't manage to determine the size of a member array from a parameter passed to the object.
For now I have something like this, which works even if not very convenient: the size of the member array is defined directly in the class header.
main.cpp:
int main()
{
    Test foo;
}

class_test.cpp:
Test::Test()
{

}

class_test.h:
class Test
{
    public:
        Test();

    private:
        std::array<int,10> myarray; // I define the size here.
};

Now I would like to pass the array size as a parameter when I create the object.
Something like this:
main.cpp:
int main()
{
    Test foo(10); // I pass the array size
}

class_test.cpp:
Test::Test(int size): arraysize(size) // I affect the size to a class attribute
{

}

class_test.h:
class Test
{
    public:
        Test(int size);

    private:
        int arraysize;
        std::array<int,arraysize> myarray; // I use the attribute to determine the member array size
};

I tried a lot of solutions but in the end I always have compile errors.
I saw the other threads on this subject but they didn't allowed me to find how to deal with this configuration.
I could use a vector but in my situation the array's extra performance is very beneficial.

A: An array's size must be known at compile time (in other words, it's constant).
Either you use std::vector, or you bake that size in the type:
template<int N> // make it a template parameter
class Test
{
    public:
        Test() {}

    private:
        std::array<int, N> myarray;
};

Test<10> test; // array of 10 elements.

Personally, I'd recommend vectors, since I doubt the performance difference is that big.


text:
Q: Integrate Cakephp username and password for a php script I am currently working on a PHP Project where i need to integrate user information from a CakePHP driven website.
CakePHP using the following method for password encryption:
Security::hash($user['User']['password'],null,true);

I know, CakePHP By default use the SHA1 encryption method.
i have tried to encrypt a password using SHA1 by using PHP but i come to know that is not matching with cakePHP encryption.
    <?php
    $str = 'apple';

    if (sha1($str) === 'd0be2dc421be4fcd0172e5afceea3970e2f3d940') {
        echo "login info found?";
    }
else{

echo "No info found";

}
    ?>

if any one has a solution. please help me.

A: Because your 3rd argument is true, CakePHP will salt the hash with the value stored in your configuration:
$string = Configure::read('Security.salt') . $string;
See http://api.cakephp.org/view_source/security#line-91


text:
Q: How does NHibernate implement optional log4net logging I remember the days (not too long ago, really) when log4net came along with NH and was compulsory for the OR-Mapper. Nowadays it isn't compulsory anymore, but optional.
I really wonder how this is achieved by NHibernate. If anyone could explain in a few words, that would be highly appreciated!

A: NHibernate has an ILoggerFactory to create the logger defined as below:
public interface ILoggerFactory
    {
        IInternalLogger LoggerFor(string keyName);
        IInternalLogger LoggerFor(System.Type type);
    }

The IInternalLogger interface, that depites the name is not internal at all, is the actual logger interface, that non surprisingly map exactly the ILog interface of log4net. NH internally ask logger factory when it needs to log. If no other logger is configured, and log4net assembly is present, the factory return a wrapper around log4net. If you want provide your own you just need to provide a logger factory and configure it as:
 <appSettings>
        <add key="nhibernate-logger"
                  value="MyLoggingLoggerFactory, MyLoggingAssembly"/>
    </appSettings>

As you guess, the class MyLoggingLoggerFactory must implement ILoggerFactory. The returned loggers of course must implement IInternalLogger, that as said before is public even if the unhappy name can be misleading.
This is the startegy they use to be log4net independent. As an addition, if you don't want log at all, just remove the log4net assembly from your deploy directory: NH will degrade gracefully and use internally a null logger.

A: NHibernate no longer references log4net.dll. It does have its own logger abstraction layer, however, they do have a built-in implementation of their own logger abstraction that is designed for log4net.
They accomplish this by forcing the CLR to load the log4net assembly using reflection, when you configure NHibernate to use log4net, of course. See NHibernate.Log4NetLogger and NHibernate.Log4NetLoggerFactory using your favorite reflector, if you're interested in more.


text:
Q: the workflow runs only once! This is part of my workflow which works fine:
wait for status to equal B

If current Item:status equals B
and Variable:IsItemApproved equals No

set status to A

My problem is that it only works one time. i.e. the first time the user changes the status field in the document set to B, if it is not approved yet the field will change to A. However if the user again set the status to B nothing happen any more!
PS: I have already checked these boxes for the workflow:

*

*Start this workflow when a new item is created.

*Start this workflow when an item is changed.

A: Check in your Sharepoint Designer to see if your group has enabled "Loop" in workflow manager. The "Loop" function will show up in SharePoint designer in the ribbon in the workflow and insert section.
What you need is some sort of loop, either a for-style loop that will run for n-iterations or a while-style loop that runs while a condition is met.
Outside of that your workflow is only set to "run once". I.e., it will trigger and wait until the condition is met. Once the condition is met it will automatically stop. You can set up some logging to prove this to yourself.
You will need to create another step or use some logic that forces the workflow to either start again, place itself back in a waiting mode or go down the rabbit hole and writing a multitude of manual loop actions.

A: End of the workflow action, add one more action is "Stop workflow and log -------". then check may it will be works.
One more suggestion is just avoid the wait action, the wait action unnecessarily  fired and stop the workflow.


text:
Q: Can we make md-matrix?
*

*make md matrix with python.

*What is principle of reshape function?

The in and result should be look like result
 in = (0, 1, 2, 3, 4, 5, 6, 7, 8)
tensor = (2, 3, 2)
result:
(((0, 1), (2, 3), (4, 5)), ((6, 7), (8, 0), (0, 0)))

A: Try:
def multiply (arr):
    result = 1
    for x in arr:
        result *= x
    return result

def reshape(shape, arr):
    result = arr
    newSize = multiply(shape)
    if (len(arr) < newSize):
        while (len(arr) < newSize):
            result.append(0)
    else:
        result= result[:newSize]

    for s in shape[::-1]:
        result = [ result[i:i+s] for i in range(0,len(result),s)]
    return result

data = [0, 1, 2, 3, 4, 5, 6, 7, 8]
shape = [2, 3, 2]

print(reshape(shape, data))

data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
shape = [6, 2]

print(reshape(shape, data))


text:
Q: SVG draw one letter at a time I am trying to recreate the following behavior, specifically I want the letters to come in one letter at a time, from left to right as if someone was actually writing it on the screen.
http://codepen.io/itsnorbat/pen/vNEEYZ
I know that this part of svg code is the word hello:
<path id="fontshape" d="m 250 252 c 0 0 25.833 -21.854 33 -6.59 c 2.244 4.778 -43.583 107.903 -43.583 107.903 s 20.416 -48.943 27.583 -51.667 c 5.042 -1.916 42.333 2.175 53 -3.079 s 31.667 -58.746 31.667 -58.746 s -49.991 106.985 -38.334 113.492 c 14.228 7.941 77.913 -39.622 64.667 -50.334 c -8.667 -7.009 -17.608 4.216 -21 8.334 c -1.747 2.121 -21.333 44.027 2.667 42.014 s 91.817 -93.427 96.306 -103.723 c 4.669 -10.712 1.947 -11.996 -0.639 -12.291 c -11.721 -1.335 -37.539 40.442 -53 103.333 c -3.426 13.935 6.667 17.333 15.333 9.333 s 76.855 -91.35 79 -100.226 c 2.393 -9.902 -7.731 -15.378 -17 0.226 c -11.271 18.976 -36.465 82.571 -36 92.667 c 0.263 5.689 2.403 18.828 15.333 6.667 c 19.894 -18.71 42.666 -47.667 42.666 -47.667 s -21.522 22.389 -22 45 c -0.245 11.592 16.631 5.965 23.274 0.667 c 5.081 -4.052 17.727 -21.334 15.06 -36.667 s -13.334 -10.001 -16.667 1.333 s 5 10 17 8 s 17 -13.666 17 -14.333" fill="none" stroke="none" />

and this is the animation:
.animatedfont {
fill:none;
stroke:#fff;
stroke-width:3;
stroke-linecap:round;
stroke-linejoin:round;
stroke-miterlimit:100;
stroke-dasharray: 2000;
stroke-dashoffset: 0;
-webkit-animation: dash 4.9s linear forwards;
-o-animation: dash 4.9s linear forwards;
-moz-animation: dash 4.9s linear forwards;
animation: dash 4.9s linear forwards;
-webkit-animation-play-state: running;
}
@-webkit-keyframes dash {
from {
        stroke-dashoffset: 2000;
}
to {
        stroke-dashoffset: 0;
}

Here is my effort:
https://jsbin.com/qelonotoxu/1/edit?html,js,output
and my animate code:
<style type="text/css">
.st0{

    fill:none;
    stroke:#000000;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    -webkit-animation: dash 10s linear forwards;
    -o-animation: dash 10s linear forwards;
    -moz-animation: dash 10s linear forwards;
    animation: dash 10s linear forwards;

}

@-webkit-keyframes dash {
    to {
stroke-dashoffset: 2000;
    }
}

@keyframes dash {
  to {
    stroke-dashoffset: 0;
  }
}

 </style>

As you can see all of the letters are animated at the same time and if I change my stroke-dashoffset = 0, it does not animate at all.  Any suggestions are much appreciated. Thanks.

A: I'll show you how you can animate each of these letters (well, actually I stopped after three letters) separately using as few changes as possible to the svg path and only using css-based animation keyframes. However, let me say from the start, this is painful and not the way to animate letters in the way you want. Perhaps the end lesson will be: "Try something else."
To see the animation in action, click "Run code snippet" below.
I had to do several things. Animating from start-to-end (or end-to-start) along a path that has multiple 'moveto' commands within it (i.e. multiple "M"s) using the stroke-dashoffset attribute is undoable. This is because the stroke dasharray re-starts after every 'moveto' and, I believe, you have no control over that. Thus, the path had to have all the 'moveto' commands eliminated. This meant, though, that with a solid stroke there would be ugly connections from where one letter "ends" to where the next letter "begins". These needed to be gotten rid of by inserting a dasharray gap at each jump to the next letter where the original 'moveto' commands were. I did that (painfully) by trial and error. Then multiple animation keyframes were required to animate one letter after the next. To start, one dash was gradually lengthened to complete the first letter, followed by an essentially infinite gap to hide the remaining letters. Then a correct gap was inserted to the second letter, and the process was repeated.
Part of the problem here is that the letters in your path are separated by 'moveto' commands. In the codepen that you linked to in your question showing the behaviour you were looking for, you'll see that the path is actually continuous, with no gaps between letters...a much easier thing to css-animate by changing stroke-dashoffset. If that's what you want, great, but you're going to have to fundamentally change (i.e. go back to Illustrator, etc.) the image you're using, which you may or may not be willing or able to do.
You still could animate each letter in this image separately. However, if you did, I think the best strategy would be to separate the single monolithic path element into individual paths for each "letter". You would then have to animate the first letter (possibly using stroke-dashoffset, but possibly another way) and, when that is finished, start the next letter, etc. I suppose you could try to do this using strictly css-based animations. However, in the end, I think it would probably be better (more efficient, more broadly applicable, etc.) to use some sort of JavaScript-based animation where you could control things more programmatically.

.st0 {
  fill: none;
  stroke: #000000;
  stroke-dashoffset: 0;
  -webkit-animation: dash 5s linear forwards;
  -o-animation: dash 5s linear forwards;
  -moz-animation: dash 5s linear forwards;
  animation: dash 5s linear forwards;
}
@keyframes dash {
  0% {
    stroke-dasharray: 0 10000000;
  }
  40% {
    stroke-dasharray: 580 10000000;
  }
  40% {
    stroke-dasharray: 580 50 0 10000000;
  }
  70% {
    stroke-dasharray: 580 50 295 10000000;
  }
  70% {
    stroke-dasharray: 580 50 295 53 0 10000000;
  }
  90% {
    stroke-dasharray: 580 50 295 53 113 10000000;
  }
  90% {
    stroke-dasharray: 580 50 295 53 113 42 0 10000000;
  }
  100% {
    stroke-dasharray: 580 50 295 53 113 42 60 10000000;
  }
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 268.382 72.239" style="enable-background:new 0 0 268.382 72.239;" xml:space="preserve">
  <g>
    <path id="path" class="st0" stroke-width="5" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M37.627,7.954c-2.16,1.632-4.032,3.54-5.616,5.724c-1.584,2.185-3.013,4.525-4.284,7.02
  c-1.272,2.497-2.425,5.088-3.456,7.776c-1.033,2.688-2.052,5.389-3.06,8.1c-1.008,2.712-2.077,5.353-3.204,7.92
  c-1.128,2.568-2.437,4.98-3.924,7.236l0.144,0.144c1.487-1.392,3.107-2.952,4.86-4.68c1.751-1.728,3.552-3.528,5.4-5.4
  c1.847-1.872,3.683-3.768,5.508-5.688c1.824-1.919,3.564-3.792,5.22-5.616c1.656-1.823,3.179-3.564,4.572-5.22
  c1.392-1.656,2.544-3.132,3.456-4.428c0.288-0.432,0.731-1.08,1.332-1.944c0.6-0.864,1.26-1.812,1.98-2.844
  c0.72-1.031,1.512-2.099,2.376-3.204c0.864-1.104,1.728-2.1,2.592-2.988c0.864-0.888,1.703-1.62,2.52-2.196
  c0.815-0.576,1.559-0.864,2.232-0.864c0.24,0,0.456,0.084,0.648,0.252c0.191,0.169,0.288,0.421,0.288,0.756
  c0,0.288-0.121,0.612-0.36,0.972c-0.241,0.36-0.517,0.72-0.828,1.08c-0.313,0.36-0.661,0.709-1.044,1.044
  c-0.385,0.336-0.72,0.625-1.008,0.864c-2.016,1.776-3.697,3.732-5.04,5.868c-1.344,2.137-2.532,4.405-3.564,6.804
  c-1.033,2.401-1.956,4.86-2.772,7.38c-0.816,2.52-1.692,5.04-2.628,7.56s-1.992,4.993-3.168,7.416
  c-1.177,2.424-2.653,4.716-4.428,6.876l0.144,0.144c2.208-1.487,4.632-3.12,7.272-4.896c2.64-1.775,5.292-3.683,7.956-5.724
  c2.664-2.04,5.256-4.212,7.776-6.516c2.52-2.304,4.788-4.716,6.804-7.236c2.016-2.52,3.696-5.148,5.04-7.884
  c1.343-2.736,2.16-5.568,2.448-8.496c-0.529-0.288-0.925-0.708-1.188-1.26c-0.265-0.551-0.396-1.14-0.396-1.764
  c0-0.767,0.275-1.404,0.828-1.908c0.551-0.504,1.235-0.756,2.052-0.756c0.576,0,1.067,0.133,1.476,0.396
  c0.407,0.264,0.744,0.601,1.008,1.008c0.263,0.409,0.443,0.864,0.54,1.368c0.096,0.504,0.144,0.997,0.144,1.476
  c0,2.113-0.588,4.345-1.764,6.696c-1.177,2.353-2.7,4.705-4.572,7.056c-1.872,2.353-3.996,4.692-6.372,7.02
  c-2.376,2.329-4.777,4.5-7.2,6.516c-2.424,2.016-4.764,3.864-7.02,5.544c-2.256,1.681-4.201,3.072-5.832,4.176
  c-1.152,0.769-2.4,1.597-3.744,2.484c-1.345,0.889-2.653,1.777-3.924,2.664c-1.272,0.889-2.46,1.753-3.564,2.592
  c-1.104,0.84-1.992,1.596-2.664,2.268l-0.432-0.576c1.728-2.399,3.215-5.004,4.464-7.812c1.248-2.808,2.399-5.711,3.456-8.712
  c1.055-3,2.124-6.012,3.204-9.036c1.08-3.024,2.292-5.904,3.636-8.64l-0.144-0.072c-1.584,1.969-3.48,4.201-5.688,6.696
  c-2.208,2.497-4.584,5.076-7.128,7.74c-2.545,2.664-5.148,5.304-7.812,7.92c-2.664,2.617-5.245,5.052-7.74,7.308
  c-0.72,0.673-1.357,1.321-1.908,1.944c-0.552,0.625-1.044,1.177-1.476,1.656c-0.432,0.48-0.853,0.864-1.26,1.152
  c-0.409,0.288-0.876,0.432-1.404,0.432c-0.673,0-1.008-0.241-1.008-0.72c0-0.288,0.167-0.576,0.504-0.864
  c0.335-0.288,0.72-0.6,1.152-0.936c0.432-0.335,0.852-0.659,1.26-0.972c0.407-0.312,0.708-0.636,0.9-0.972
  c1.392-2.399,2.58-4.919,3.564-7.56c0.983-2.639,1.908-5.292,2.772-7.956c0.864-2.664,1.775-5.328,2.736-7.992
  c0.959-2.664,2.099-5.244,3.42-7.74c1.319-2.495,2.927-4.883,4.824-7.164c1.896-2.279,4.236-4.356,7.02-6.228l-0.144-0.144
  c-1.584,0.72-3.432,1.393-5.544,2.016c-2.113,0.624-4.284,1.308-6.516,2.052c-2.232,0.745-4.428,1.548-6.588,2.412
  c-2.16,0.864-4.093,1.861-5.796,2.988c-1.705,1.128-3.072,2.424-4.104,3.888c-1.033,1.465-1.548,3.157-1.548,5.076
  c0,1.776,0.479,3.145,1.44,4.104c0.959,0.961,2.207,1.44,3.744,1.44c1.104,0,2.111-0.216,3.024-0.648
  c0.911-0.432,1.692-1.008,2.34-1.728c0.648-0.72,1.14-1.536,1.476-2.448c0.335-0.911,0.504-1.824,0.504-2.736
  c0-0.288-0.012-0.576-0.036-0.864c-0.024-0.288-0.061-0.576-0.108-0.864h0.864c0.047,0.288,0.083,0.576,0.108,0.864
  c0.023,0.288,0.036,0.576,0.036,0.864c0,1.2-0.216,2.316-0.648,3.348c-0.432,1.033-1.02,1.933-1.764,2.7
  c-0.745,0.769-1.632,1.357-2.664,1.764c-1.033,0.408-2.149,0.612-3.348,0.612c-2.016,0-3.684-0.576-5.004-1.728
  c-1.321-1.152-1.98-2.808-1.98-4.968c0-2.16,0.587-4.02,1.764-5.58c1.175-1.56,2.772-2.94,4.788-4.14
  c2.016-1.199,4.392-2.279,7.128-3.24c2.736-0.96,5.639-1.872,8.712-2.736c2.543-0.72,4.596-1.319,6.156-1.8
  c1.56-0.479,2.796-0.888,3.708-1.224c0.911-0.335,1.572-0.612,1.98-0.828c0.407-0.216,0.684-0.419,0.828-0.612L37.627,7.954

L89.682,8.241L64.194,46.113l0.144,0.144c0.959-1.199,2.088-2.58,3.384-4.14
  c1.296-1.559,2.7-3.035,4.212-4.428c1.512-1.392,3.107-2.567,4.788-3.528c1.68-0.96,3.359-1.44,5.04-1.44
  c2.927,0,4.392,1.465,4.392,4.392c0,0.769-0.277,1.681-0.828,2.736c-0.552,1.056-1.249,2.172-2.088,3.348
  c-0.84,1.177-1.741,2.365-2.7,3.564c-0.961,1.201-1.861,2.365-2.7,3.492c-0.841,1.128-1.537,2.185-2.088,3.168
  c-0.552,0.984-0.828,1.812-0.828,2.484c0,0.529,0.155,0.972,0.468,1.332c0.312,0.36,0.731,0.54,1.26,0.54
  c1.104,0,2.315-0.348,3.636-1.044c1.32-0.695,2.688-1.607,4.104-2.736c1.415-1.127,2.819-2.387,4.212-3.78
  c1.392-1.392,2.675-2.772,3.852-4.14c1.176-1.368,2.232-2.664,3.168-3.888s1.62-2.22,2.052-2.988l0.432,0.144
  c-0.529,0.913-1.272,2.016-2.232,3.312c-0.96,1.296-2.052,2.664-3.276,4.104c-1.224,1.44-2.545,2.869-3.96,4.284
  c-1.417,1.417-2.833,2.689-4.248,3.816c-1.417,1.128-2.82,2.041-4.212,2.736c-1.393,0.695-2.689,1.044-3.888,1.044
  c-1.249,0-2.268-0.385-3.06-1.152c-0.792-0.767-1.188-1.823-1.188-3.168c0-0.959,0.276-2.016,0.828-3.168
  c0.551-1.152,1.248-2.315,2.088-3.492c0.839-1.176,1.739-2.352,2.7-3.528c0.959-1.175,1.859-2.292,2.7-3.348
  c0.839-1.056,1.536-2.027,2.088-2.916c0.551-0.888,0.828-1.644,0.828-2.268c0-0.768-0.216-1.296-0.648-1.584
  c-0.432-0.288-0.96-0.432-1.584-0.432c-1.2,0-2.532,0.444-3.996,1.332c-1.464,0.889-2.977,2.052-4.536,3.492
  c-1.561,1.44-3.108,3.06-4.644,4.86c-1.537,1.8-2.988,3.612-4.356,5.436c-1.368,1.825-2.568,3.553-3.6,5.184
  c-1.033,1.632-1.836,3.024-2.412,4.176h-4.68c2.64-4.127,5.352-8.327,8.136-12.6c2.783-4.271,5.555-8.52,8.316-12.744
  c2.76-4.223,5.46-8.388,8.1-12.492c2.639-4.104,5.136-8.028,7.488-11.772L89.682,8.241

L129.928,39.85c-1.152,1.296-2.448,2.329-3.888,3.096c-1.44,0.769-2.856,1.152-4.248,1.152
  c-1.344,0-2.497-0.299-3.456-0.9c-0.961-0.6-1.705-1.307-2.232-2.124h-0.144c-0.48,1.825-1.368,3.769-2.664,5.832
  c-1.296,2.064-2.844,3.96-4.644,5.688c-1.8,1.728-3.78,3.168-5.94,4.32c-2.16,1.152-4.368,1.728-6.624,1.728
  c-2.064,0-3.625-0.6-4.68-1.8c-1.057-1.199-1.584-2.808-1.584-4.824c0-1.055,0.264-2.279,0.792-3.672
  c0.528-1.392,1.26-2.795,2.196-4.212c0.936-1.415,2.04-2.808,3.312-4.176c1.271-1.368,2.651-2.592,4.14-3.672
  c1.487-1.08,3.06-1.944,4.716-2.592c1.656-0.648,3.323-0.972,5.004-0.972c1.968,0,3.492,0.576,4.572,1.728
  c1.08,1.152,1.667,2.641,1.764,4.464c0.096,1.104,0.612,2.124,1.548,3.06s2.219,1.404,3.852,1.404c1.44,0,2.796-0.36,4.068-1.08
  c1.271-0.72,2.459-1.656,3.564-2.808L129.928,39.85

L93.713,53.746c0,1.249,0.24,2.232,0.72,2.952
  c0.479,0.72,1.199,1.08,2.16,1.08c1.296,0,2.58-0.348,3.852-1.044c1.271-0.695,2.496-1.607,3.672-2.736
  c1.176-1.127,2.268-2.412,3.276-3.852c1.008-1.44,1.883-2.927,2.628-4.464c0.744-1.536,1.332-3.036,1.764-4.5
  c0.432-1.464,0.648-2.796,0.648-3.996c0-1.008-0.252-1.86-0.756-2.556c-0.504-0.695-1.285-1.044-2.34-1.044
  c-1.008,0-2.088,0.324-3.24,0.972c-1.152,0.648-2.316,1.5-3.492,2.556c-1.177,1.057-2.293,2.281-3.348,3.672
  c-1.056,1.393-2.005,2.833-2.844,4.32c-0.84,1.488-1.501,2.977-1.98,4.464C93.952,51.058,93.713,52.449,93.713,53.746

L153.688,7.954c-4.273,6.48-7.992,12.084-11.16,16.812c-3.168,4.728-5.881,8.772-8.137,12.132
  c-2.256,3.36-4.104,6.132-5.543,8.316c-1.44,2.185-2.568,3.973-3.384,5.364c-0.817,1.393-1.38,2.496-1.692,3.312
  c-0.313,0.816-0.468,1.512-0.468,2.088c0,1.2,0.528,1.8,1.584,1.8c1.199,0,2.604-0.492,4.212-1.476
  c1.608-0.983,3.336-2.328,5.184-4.032c1.848-1.703,3.732-3.696,5.652-5.976c1.92-2.279,3.791-4.716,5.615-7.308l0.793,0.288
  c-1.729,2.448-3.553,4.812-5.473,7.092c-1.92,2.281-3.77,4.261-5.543,5.94c-2.353,2.208-4.382,3.816-6.085,4.824
  c-1.704,1.008-3.252,1.512-4.644,1.512c-1.488,0-2.556-0.336-3.204-1.008c-0.648-0.671-0.972-1.559-0.972-2.664
  c0-1.008,0.18-2.052,0.54-3.132c0.36-1.08,0.972-2.376,1.836-3.888c0.864-1.512,2.003-3.348,3.42-5.508
  c1.415-2.16,3.168-4.812,5.256-7.956c2.088-3.143,4.548-6.887,7.38-11.232c2.832-4.344,6.096-9.443,9.791-15.3H153.688

L170.174,39.418c-0.72,1.2-1.62,2.52-2.699,3.96c-1.08,1.44-2.305,2.869-3.673,4.284
  c-1.367,1.416-2.832,2.784-4.392,4.104c-1.561,1.32-3.181,2.496-4.86,3.528c-1.681,1.033-3.372,1.848-5.075,2.448
  c-1.705,0.6-3.373,0.9-5.005,0.9c-2.016,0-3.576-0.517-4.68-1.548c-1.104-1.031-1.656-2.507-1.656-4.428
  c0-2.112,0.636-4.332,1.908-6.66c1.271-2.328,2.892-4.475,4.86-6.444c1.968-1.968,4.127-3.6,6.479-4.896
  c2.352-1.296,4.608-1.944,6.769-1.944c1.199,0,2.135,0.252,2.808,0.756c0.672,0.504,1.008,1.236,1.008,2.196
  c0,1.152-0.624,2.268-1.872,3.348s-2.771,2.064-4.571,2.952c-1.801,0.889-3.733,1.681-5.796,2.376
  c-2.064,0.696-3.889,1.212-5.473,1.548c-0.528,0.961-0.961,2.041-1.296,3.24c-0.336,1.201-0.504,2.401-0.504,3.6
  c0,0.576,0.06,1.141,0.18,1.692c0.119,0.553,0.312,1.057,0.576,1.512c0.264,0.457,0.623,0.828,1.08,1.116
  c0.456,0.288,1.02,0.432,1.692,0.432c1.584,0,3.443-0.515,5.58-1.548c2.135-1.032,4.308-2.412,6.516-4.14
  c2.207-1.728,4.32-3.695,6.336-5.904c2.016-2.208,3.744-4.488,5.185-6.84L170.174,39.418

L158.51,35.602
  c0-0.672-0.18-1.176-0.54-1.512c-0.359-0.335-0.804-0.504-1.332-0.504c-1.008,0-2.1,0.396-3.275,1.188
  c-1.177,0.792-2.34,1.776-3.492,2.952c-1.152,1.177-2.196,2.437-3.132,3.78c-0.937,1.344-1.645,2.545-2.124,3.6
  c1.055-0.191,2.376-0.563,3.96-1.116c1.584-0.551,3.107-1.235,4.572-2.052c1.463-0.816,2.724-1.764,3.779-2.844
  C157.982,38.014,158.51,36.85,158.51,35.602

L193.934,39.489c-1.439,2.304-3.108,4.597-5.004,6.876c-1.896,2.281-3.973,4.333-6.228,6.156
  c-2.257,1.825-4.717,3.301-7.381,4.428c-2.663,1.127-5.507,1.692-8.531,1.692c-1.152,0-2.232-0.144-3.24-0.432
  s-1.885-0.72-2.628-1.296c-0.744-0.576-1.344-1.308-1.8-2.196c-0.456-0.888-0.685-1.932-0.685-3.132
  c0-1.248,0.408-2.376,1.225-3.384c0.816-1.008,1.919-1.512,3.312-1.512c0.72,0,1.308,0.18,1.764,0.54s0.685,0.9,0.685,1.62
  c0,0.672-0.169,1.249-0.504,1.728c-0.337,0.48-0.841,0.72-1.513,0.72c-0.528,0-0.948-0.144-1.26-0.432
  c-0.312-0.288-0.517-0.648-0.611-1.08c-0.529,0.288-0.888,0.708-1.08,1.26c-0.191,0.552-0.288,1.116-0.288,1.692
  c0,1.681,0.637,2.941,1.908,3.78c1.271,0.84,2.699,1.26,4.283,1.26c1.009,0,1.884-0.204,2.628-0.612
  c0.744-0.407,1.368-0.936,1.872-1.584s0.876-1.404,1.116-2.268c0.239-0.864,0.36-1.728,0.36-2.592c0-0.911-0.156-1.859-0.468-2.844
  c-0.313-0.983-0.661-1.955-1.045-2.916c-0.385-0.959-0.744-1.908-1.079-2.844c-0.337-0.936-0.505-1.811-0.505-2.628
  c0-1.055,0.217-2.003,0.648-2.844c0.432-0.839,1.02-1.548,1.764-2.124s1.596-1.02,2.556-1.332c0.959-0.312,1.968-0.468,3.023-0.468
  c1.92,0,3.479,0.421,4.681,1.26c1.199,0.84,1.8,1.957,1.8,3.348c0,1.249-0.468,2.16-1.404,2.736
  c-0.936,0.576-1.979,0.864-3.132,0.864c0.288-0.527,0.54-1.163,0.756-1.908c0.216-0.744,0.324-1.428,0.324-2.052
  c0-0.959-0.301-1.764-0.9-2.412c-0.601-0.648-1.452-0.972-2.556-0.972c-1.393,0-2.425,0.421-3.096,1.26
  c-0.672,0.841-1.008,1.861-1.008,3.06c0,1.057,0.181,2.064,0.54,3.024c0.36,0.961,0.78,1.92,1.26,2.88
  c0.432,0.96,0.827,1.944,1.188,2.952c0.36,1.008,0.54,2.137,0.54,3.384c0,0.912-0.205,1.789-0.612,2.628
  c-0.408,0.84-0.948,1.609-1.62,2.304c-0.671,0.696-1.428,1.285-2.267,1.764c-0.84,0.48-1.692,0.792-2.556,0.936l0.144,0.144
  c2.592-0.288,5.063-1.044,7.416-2.268c2.352-1.224,4.548-2.711,6.588-4.464c2.04-1.751,3.924-3.672,5.652-5.76
  c1.728-2.088,3.24-4.14,4.536-6.156L193.934,39.489

L212.726,33.297h4.68c-1.776,2.497-3.48,4.921-5.112,7.272c-1.632,2.353-3.084,4.525-4.355,6.516
  c-1.272,1.992-2.293,3.744-3.061,5.256c-0.768,1.512-1.151,2.7-1.151,3.564c0,1.249,0.647,1.872,1.943,1.872
  c1.009,0,2.292-0.492,3.853-1.476c1.56-0.983,3.251-2.34,5.076-4.068c1.823-1.728,3.695-3.744,5.615-6.048
  c1.92-2.304,3.744-4.752,5.473-7.344l0.432,0.144c-1.296,1.969-2.82,4.093-4.572,6.372c-1.752,2.28-3.588,4.404-5.508,6.372
  c-1.92,1.969-3.841,3.612-5.76,4.932c-1.92,1.321-3.721,1.98-5.4,1.98c-1.393,0-2.412-0.349-3.06-1.044
  c-0.648-0.695-0.972-1.523-0.972-2.484c0-0.671,0.107-1.332,0.323-1.98c0.217-0.648,0.443-1.307,0.685-1.98l-0.145-0.072
  c-0.624,0.673-1.403,1.452-2.34,2.34c-0.936,0.889-1.943,1.717-3.023,2.484c-1.08,0.769-2.196,1.417-3.349,1.944
  c-1.151,0.527-2.257,0.792-3.312,0.792c-1.776,0-3.024-0.553-3.744-1.656s-1.08-2.351-1.08-3.744c0-1.967,0.623-4.14,1.872-6.516
  c1.247-2.376,2.832-4.608,4.752-6.696c1.919-2.088,4.007-3.827,6.264-5.22c2.256-1.392,4.393-2.088,6.408-2.088
  c0.96,0,1.8,0.133,2.521,0.396c0.72,0.265,1.319,0.625,1.8,1.08c0.479,0.457,0.852,0.972,1.116,1.548
  c0.263,0.576,0.468,1.177,0.611,1.8h0.145L212.726,33.297

L189.182,53.458c0,1.104,0.227,1.956,0.684,2.556
  c0.456,0.601,1.092,0.9,1.908,0.9c0.815,0,1.775-0.299,2.88-0.9c1.104-0.6,2.256-1.404,3.456-2.412
  c1.199-1.008,2.387-2.171,3.563-3.492c1.176-1.319,2.22-2.724,3.133-4.212c0.911-1.487,1.655-3,2.231-4.536
  c0.576-1.536,0.864-2.999,0.864-4.392c0-1.104-0.312-1.944-0.937-2.52c-0.624-0.576-1.393-0.864-2.304-0.864
  c-1.439,0-3.049,0.625-4.824,1.872c-1.776,1.249-3.456,2.844-5.04,4.788c-1.584,1.944-2.916,4.093-3.995,6.444
  C189.722,49.042,189.182,51.297,189.182,53.458

L249.588,7.954c-4.272,6.48-7.992,12.084-11.16,16.812c-3.168,4.728-5.88,8.772-8.136,12.132
  c-2.257,3.36-4.104,6.132-5.544,8.316c-1.439,2.185-2.568,3.973-3.384,5.364c-0.816,1.393-1.381,2.496-1.692,3.312
  c-0.312,0.816-0.468,1.512-0.468,2.088c0,1.2,0.527,1.8,1.584,1.8c1.199,0,2.604-0.492,4.212-1.476
  c1.607-0.983,3.336-2.328,5.185-4.032c1.847-1.703,3.731-3.696,5.651-5.976c1.92-2.279,3.791-4.716,5.616-7.308l0.792,0.288
  c-1.728,2.448-3.553,4.812-5.472,7.092c-1.921,2.281-3.77,4.261-5.544,5.94c-2.353,2.208-4.381,3.816-6.084,4.824
  c-1.705,1.008-3.253,1.512-4.645,1.512c-1.488,0-2.556-0.336-3.204-1.008c-0.647-0.671-0.972-1.559-0.972-2.664
  c0-1.008,0.18-2.052,0.54-3.132s0.972-2.376,1.836-3.888c0.864-1.512,2.004-3.348,3.42-5.508c1.415-2.16,3.168-4.812,5.256-7.956
  c2.088-3.143,4.548-6.887,7.38-11.232c2.832-4.344,6.096-9.443,9.792-15.3H249.588

L266.074,39.418c-0.72,1.2-1.62,2.52-2.699,3.96c-1.08,1.44-2.305,2.869-3.673,4.284
  c-1.367,1.416-2.832,2.784-4.392,4.104c-1.561,1.32-3.181,2.496-4.86,3.528c-1.681,1.033-3.372,1.848-5.075,2.448
  c-1.705,0.6-3.373,0.9-5.005,0.9c-2.016,0-3.576-0.517-4.68-1.548c-1.104-1.031-1.656-2.507-1.656-4.428
  c0-2.112,0.636-4.332,1.908-6.66c1.271-2.328,2.892-4.475,4.86-6.444c1.968-1.968,4.127-3.6,6.479-4.896
  c2.352-1.296,4.608-1.944,6.769-1.944c1.199,0,2.135,0.252,2.808,0.756c0.672,0.504,1.008,1.236,1.008,2.196
  c0,1.152-0.624,2.268-1.872,3.348s-2.771,2.064-4.571,2.952c-1.801,0.889-3.733,1.681-5.796,2.376
  c-2.064,0.696-3.889,1.212-5.473,1.548c-0.528,0.961-0.961,2.041-1.296,3.24c-0.336,1.201-0.504,2.401-0.504,3.6
  c0,0.576,0.06,1.141,0.18,1.692c0.119,0.553,0.312,1.057,0.576,1.512c0.264,0.457,0.623,0.828,1.08,1.116
  c0.456,0.288,1.02,0.432,1.692,0.432c1.584,0,3.443-0.515,5.58-1.548c2.135-1.032,4.308-2.412,6.516-4.14
  c2.207-1.728,4.32-3.695,6.336-5.904c2.016-2.208,3.744-4.488,5.185-6.84L266.074,39.418

L254.41,35.602
  c0-0.672-0.18-1.176-0.54-1.512c-0.359-0.335-0.804-0.504-1.332-0.504c-1.008,0-2.1,0.396-3.275,1.188
  c-1.177,0.792-2.34,1.776-3.492,2.952c-1.152,1.177-2.196,2.437-3.132,3.78c-0.937,1.344-1.645,2.545-2.124,3.6
  c1.055-0.191,2.376-0.563,3.96-1.116c1.584-0.551,3.107-1.235,4.572-2.052c1.463-0.816,2.724-1.764,3.779-2.844
  C253.882,38.014,254.41,36.85,254.41,35.602z" />
  </g>
</svg>


text:
Q: How to find the test ID for parametrized tests during execution of the test? I have a test that is parametrized with @pytest.mark.parametrize so that the same test function can be executed with different parameters. @pytest.mark.parametrize uses the ids argument defined as a function so that a custom test ID is generated for each parameter.
My test function writes a file to disk that tabulates the differences between actual and expected results for the given parameter. I would like to report the test ID in the file.
Is there an API I can call which will tell me what test ID applies to a particular execution of the test?

A: You can use request.node.callspec.id from the Request Fixture.

But take note that the value depends on whether the ids function "generates a string representation to make part of the test ID". From pytest's docs on Different options for test IDs, the stringified version of the param is normally added to the test ID.
For example, if the ids function generates an ID that does not include the stringified param or does not depend on anything else:
import random
def generate_random_id(param) -> str:
    return f'{random.randint(1,100)}'

testdata = ['argA', 'argB']

@pytest.mark.parametrize('param', testdata, ids=generate_random_id)
def test_foo(param, request):
    print(request.node.callspec.id)

Then you would get the generated ID as-is:
tests/test_a.py::test_foo[78] PASSED
tests/test_a.py::test_foo[10] PASSED

============================ PASSES =============================
_________________________ test_foo[78] __________________________
--------------------- Captured stdout call ----------------------
78
_________________________ test_foo[10] __________________________
--------------------- Captured stdout call ----------------------
10

If the ids function includes the string representation of the param, then you would need some sort of delimiter to manually split the param and the test ID:
import random
def generate_random_id(param):
    test_id = random.randint(1, 100)
    return f'{param}-{test_id}'

testdata = ['argA', 'argB']

@pytest.mark.parametrize('param', testdata, ids=generate_random_id)
def test_foo(param, request):
    param, test_id = request.node.callspec.id.split('-')
    print(param)
    print(test_id)

tests/test_a.py::test_foo[argA-43] PASSED
tests/test_a.py::test_foo[argB-37] PASSED

============================ PASSES =============================
_______________________ test_foo[argA-43] _______________________
--------------------- Captured stdout call ----------------------
argA
43
_______________________ test_foo[argB-37] _______________________
--------------------- Captured stdout call ----------------------
argB
37

If there are multiple params, then it becomes more complicated, since all the param + ids combinations are concatenated together to create the full Test ID. You will need a separate delimiter different from -:
import random
def generate_random_id(param):
    test_id = random.randint(1, 100)
    return f'{param}+{test_id}'  # Use '+' to separate param+ID

testdata = [
    ('argA', 'argB'),
    ('argC', 'argD'),
]

@pytest.mark.parametrize('param1, param2', testdata, ids=generate_random_id)
def test_foo(param1, param2, request):
    print(request.node.callspec.id)
    params = request.node.callspec.id.split('-')
    for a_param in params:
        param, test_id = a_param.split('+')
        print(param)
        print(test_id)

tests/test_a.py::test_foo[argA+70-argB+25] PASSED
tests/test_a.py::test_foo[argC+97-argD+30] PASSED

===================================== PASSES =====================================
___________________________ test_foo[argA+70-argB+25] ____________________________
------------------------------ Captured stdout call ------------------------------
argA+70-argB+25
argA
70
argB
25
___________________________ test_foo[argC+97-argD+30] ____________________________
------------------------------ Captured stdout call ------------------------------
argC+97-argD+30
argC
97
argD
30

A: You can use:
os.environ.get('PYTEST_CURRENT_TEST')

To get the current parametrize execution.
A similar question was already asked and has a lot of other options: py.test: how to get the current test's name from the setup method?
If you are looking for a more dynamic way of doing it, take a look in: https://hackebrot.github.io/pytest-tricks/param_id_func/, is a plugin for pytest that may easy the pain.