text:
Q: Custom CSS via controller returning via #show/n?format=css but not #show/n.css I am implementing a custom theming issue for a Rails 3.2 app, with a very small number of CSS overrides for each theme.
While I have so far implemented the theme variations by inlining some CSS (including occasional Erb parameters) within the layout file, I'd really like to tidy this up by delivering the customisation CSS via a GET request, e.g.: (assume current_theme is defined)
<%= stylesheet_link_tag theme_path(current_theme, format: :css) %>

In my themes_controller.rb:
class ThemesController < ApplicationController
  respond_to :css
  ...
  def show
    @theme = Theme.find(params[:id])
    respond_with @theme
  end
end

I have the requisite show.css.erb file in views/themes.
My main issue is that /themes/1?format=css loads and renders the CSS file correctly. However, /themes/1.css – the form of URL generated by the theme_path helper – is producing a 404.
I'm probably overlooking something very simple here – hopefully a fellow SO user can point out the bloomin' obvious to prevent my head and brick walls becoming better acquainted...
UPDATE: Doing a bot of Rails route recognition debugging:
r = Rails.application.routes
#=> #<ActionDispatch::Routing::RouteSet:0x007fc385016170>
r.recognize_path '/themes/1.css'
#=> {:action=>"show", :controller=>"themes", :id=>"1", :format=>"css"}
r.recognize_path '/themes/1?format=css'
#=> {:action=>"show", :controller=>"themes", :id=>"1"}

So the fact that ?format=css seems to be working is actually because, at least when CURLing from the command line, /themes/1 is returning the requisite CSS. As far as I'm concerned, that's a red herring...
Incidentally, adding this line to routes.rb works:
  get '/themestyle/:id' => 'themes#show', as: 'themestyle', format: 'css'

(using a slightly different route so as not to conflict with the resources :themes in routes.rb). themestyle_path(current_theme) generates a workable route of – /themestyle/1 – I can add the 'text/css' type header at render stage no problem. I'll have to hand-code a <link rel="stylesheet"> element though, as stylesheet_link_tag adds the css suffix.

A: I don't know if this is correct, but I see your error is that you're trying to use a controller action to do the job of a helper
Controller actions are only called on HTTP requests, and it's my experience that you cannot just call an action by linking to it from your view / layout -- you have to explicitly call the action, either through the backend, or through ajax or something

Change Your Action To A Helper
<%= stylesheet_link_tag theme(current_theme) %>

#app/controllers/application_controller.rb
def theme
    return theme_path(params[:id])
end
helper_method :theme

I don't know if this will generate the route correctly, but it's certainly the method I would use

A: I found the source of the problem: the rack-zippy gem, middleware designed to help deliver GZIPped production assets on heroku.
Disabling that middleware enables the routes to all work perfectly fine and be passed to the correct controller method with all formats, etc. retained.
Thanks to all who helped.


text:
Q: oninput input listener blocks Firefox whith some characters I'm trying this code:
<input type="text" oninput="javascript:alert('asd')" />

It works fine in Chrome and Opera as like other browsers, but when runned in Firefox the window blocks and the OK button of the alert does nothing as soon as you put a '`', '´' or '¨' character.
I'll be grateful for any insight or solution.
Thanks.

redpajama_set_name: RedPajamaStackExchange


text:
Q: tidyr::spread() with multiple keys and values I assume this has been asked multiple times but I couldn't find the proper words to find a workable solution.
How can I spread() a data frame based on multiple keys for multiple values?
A simplified (I have many more columns to spread, but on only two keys: Id and time point of a given measurement) data I'm working with looks like this:
df <- data.frame(id = rep(seq(1:10),3),
                 time = rep(1:3, each=10),
                 x = rnorm(n=30),
                 y = rnorm(n=30))

> head(df)
  id time           x           y
1  1    1 -2.62671241  0.01669755
2  2    1 -1.69862885  0.24992634
3  3    1  1.01820778 -1.04754037
4  4    1  0.97561596  0.35216040
5  5    1  0.60367158 -0.78066767
6  6    1 -0.03761868  1.08173157
> tail(df)
   id time           x          y
25  5    3  0.03621258 -1.1134368
26  6    3 -0.25900538  1.6009824
27  7    3  0.13996626  0.1359013
28  8    3 -0.60364935  1.5750232
29  9    3  0.89618748  0.0294315
30 10    3  0.14709567  0.5461084

What i'd like to have is a dataframe populated like this:

One row per Id columns for each value from the time and each measurement variable.

A: With the devel version of tidyr (tidyr_0.8.3.9000), we can use pivot_wider to reshape multiple value columns from long to wide format
library(dplyr)
library(tidyr)
library(stringr)
df %>%
   mutate(time = str_c("time", time)) %>%
   pivot_wider(names_from = time, values_from = c("x", "y"), names_sep="")
# A tibble: 10 x 7
#      id  xtime1 xtime2  xtime3  ytime1 ytime2 ytime3
#   <int>   <dbl>  <dbl>   <dbl>   <dbl>  <dbl>  <dbl>
# 1     1 -0.256   0.483 -0.254  -0.652   0.655  0.291
# 2     2  1.10   -0.596 -1.85    1.09   -0.401 -1.24
# 3     3  0.756  -2.19  -0.0779 -0.763  -0.335 -0.456
# 4     4 -0.238  -0.675  0.969  -0.829   1.37  -0.830
# 5     5  0.987  -2.12   0.185   0.834   2.14   0.340
# 6     6  0.741  -1.27  -1.38   -0.968   0.506  1.07
# 7     7  0.0893 -0.374 -1.44   -0.0288  0.786  1.22
# 8     8 -0.955  -0.688  0.362   0.233  -0.902  0.736
# 9     9 -0.195  -0.872 -1.76   -0.301   0.533 -0.481
#10    10  0.926  -0.102 -0.325  -0.678  -0.646  0.563

NOTE: The numbers are different as there was no set seed while creating the sample dataset

A: Reshaping with multiple value variables can best be done with dcast from data.table or reshape from base R.
library(data.table)
out <- dcast(setDT(df), id ~ paste0("time", time), value.var = c("x", "y"), sep = "")
out
#    id     xtime1     xtime2      xtime3      ytime1      ytime2      ytime3
# 1:  1  0.4334921 -0.5205570 -1.44364515  0.49288757 -1.26955148 -0.83344256
# 2:  2  0.4785870  0.9261711  0.68173681  1.24639813  0.91805332  0.34346260
# 3:  3 -1.2067665  1.7309593  0.04923993  1.28184341 -0.69435556  0.01609261
# 4:  4  0.5240518  0.7481787  0.07966677 -1.36408357  1.72636849 -0.45827205
# 5:  5  0.3733316 -0.3689391 -0.11879819 -0.03276689  0.91824437  2.18084692
# 6:  6  0.2363018 -0.2358572  0.73389984 -1.10946940 -1.05379502 -0.82691626
# 7:  7 -1.4979165  0.9026397  0.84666801  1.02138768 -0.01072588  0.08925716
# 8:  8  0.3428946 -0.2235349 -1.21684977  0.40549497  0.68937085 -0.15793111
# 9:  9 -1.1304688 -0.3901419 -0.10722222 -0.54206830  0.34134397  0.48504564
#10: 10 -0.5275251 -1.1328937 -0.68059800  1.38790593  0.93199593 -1.77498807

Using reshape we could do
# setDF(df) # in case df is a data.table now
reshape(df, idvar = "id", timevar = "time", direction = "wide")

A: Your entry data frame is not tidy. You should use gather to make it so.
gather(df, key, value, -id, -time) %>%
  mutate(key = paste0(key, "time", time)) %>%
  select(-time) %>%
  spread(key, value)


text:
Q: React Context API and component methods I've followed a few online examples, where they have a counter and an increment function in Context, and on a distant component, call the increment method and the results shows. All great, but ... I am trying to expand on this and create a login box, that sets an isAthenticated flag.
I have a very basic context:
import React from 'react';

const Context = React.createContext();

export class Provider extends React.Component {

    state = {
        isAuthenticated: false,
        user: {
            name: "Craig",
            email: "craig@here.com"
        },
        changeEmail: (newEmail) => {
            let user = this.state.user;
            user.email = newEmail;
            console.log(user);
            this.setState({ user: user})
        },
        changeAuthenticated: () => {
            this.setState ({ isAuthenticated: !this.state.isAuthenticated });
        }
    }

    render() {
        return (
            <Context.Provider value={this.state}>
                {this.props.children}
            </Context.Provider>
        )
    }
}

export const Consumer = Context.Consumer;

In it I allow the user to change email, and change isAuthenticated state.
My component (Remove style stuff) looks like this:
import React from 'react';
import { Input, Label, Button, Container } from 'reactstrap';
import { Consumer } from '../context';

class Login extends React.Component {

    render() {

        return (
            <Consumer>
                {value => {
                    return (
                        <Container style={containerStyle} >

Login

                                        Email:

                                            <Input type="email" name="email" id="email" placeholder="Your Email" value={value.user.email} onChange={e=>value.changeEmail(e.target.value)} />

                                            Password:

                                        <Input type="password" name="password" id="password" placeholder="Your Password" />

                                    <Button color="info" onClick={value.changeAuthenticated}>Login</Button>

                        </Container>
                    )}
                }
            </Consumer>
        )
    }
}

export default Login;

So when I change the email, the Context state is updated. And when I click the Login button, for now, it simply toggles IsAuthenticated.
I don't want the state to update as I type in the email box. I'd prefer to update the state when the Login button is clicked. So I feel I need a local component state, or something, which updates that state when I edit the data in the text boxes. And then updates the Context when I click Login.
But... How do I set up the state? 'values' (from context) is only available inside the Render. I need to set my component state outside of the render. So how would I go about achieving this?
My login button onClick should also fire a local method which has all the validation etc, and then update my route to redirect to a page on success. But then it needs access to the Context.UpdateMethod - from outside of the  tags. Not sure how to achieve this.

A: You should probably just create a sub-component and then use the props to initialize the state.
class Login extends React.Component {
  render() {
    return (
      <Consumer>
        {value => (
          <Container style={containerStyle}>
            <SubComponent
              changeAuthenticated={value.changeAuthenticated}
              // ...etc


text:
Q: xcode 7.3 crashes while archiving react native app I didn't catch since when, but now my xcode crashes if i try to archive my react native ios app.
already did:

*

*project clean & re-download

*tried previous success git versions of my app (same: crashes while archiving)

*uninstall and install fresh xcode 7.3

*disable/enable source control in preferences

so i'm out of ideas now and totally stuck, any help welcome


text:
Q: How would I go about using jsoup to parse a specific integer value from this HTML? I am a first year cs student working on a project for which I need to get the temperature date from a website. I am attempting to do this with Jsoup, but I am finding a lack of good tutorials on getting started. Here is the HTML I am trying to parse from.

        32

        °

        F

Specifically, I am trying to extract the number 32 from that. Any help would be greatly appreciated!

A: Based on your little piece of code you provided following would extract the temperature. You probably need to amend the code to work with the full HTML.
(for simplicity all checks or optimizations intentionally omitted)
Document doc = Jsoup.parse("\n"
        + "        \n"
        + "        32\n"
        + "        \n"
        + "        \n"
        + "        °\n"
        + "        \n"
        + "        \n"
        + "        F\n"
        + "   ");
Elements rows = doc.getElementsByAttributeValue("class", "ng-scope ng-binding");
String temperature;
for (Element span : rows) {
        temperature = span.text();
}
System.out.println("temperature = " + temperature);


text:
Q: How do I make my API action accept null complex types? So this works perfect
//localhost:1234/api/task/getData?id=1&name=test&phone=123456

public object GetData(long id, [FromUri] User complexType)
{
    //complexType is binding correctly
    return runSomeCode(id, complexType ?? User.Current);
}

But this doesn't. Not sure how to specify a null complex type.
//localhost:1234/api/task/getData?id=1

public object GetData(long id, [FromUri] User complexType)
{
    //complexType is not null, but all class properties are
    return runSomeCode(id, complexType ?? User.Current);
}

I even tried this but ran into new problems with "Multiple actions were found that match the request"
//localhost:1234/api/task/getData?id=1

public object GetData(long id)
{
    return runSomeCode(id, User.Current);
}

public object GetData(long id, [FromUri] User complexType)
{
    return runSomeCode(id, complexType);
}

Here is what my complex class looks like
public class User
{
    public string Name {get;set;}
    public string Phone {get;set;}

    public static User Current
    {
        get
        {
            //code to get the current user
        }
    }
}

UPDATE
I know that changing my method to a POST and using the body content works, but lets say that I'm stubborn and wish to accomplish this using GET.
How do I make a complex parameter nullable in an web api GET request? Excluding it doesn't work like in a POST request.

A: What I think you are looking for is how to define "Routing Rules"
WebApi 2.0 let's use an attribute called Route to define different "Resource URLs" with some rules(constraints) like length, format and default values
For example:
public class SomeController : ApiController{
     //where author is a letter(a-Z) with a minimum of 5 character and 10 max.
    [Route("html/{id}/{newAuthor:alpha:length(5,10)}/age:int?")]
    public Book Get(int id, string newAuthor , int age){
        return new Book() { Title = "SQL Server 2012 id= " + id, Author = "Adrian & " + newAuthor };
    }

Where the parameter age is of type integer and optional.
Or like this using a default value:
[Route("html/{id}/{newAuthor:alpha:length(5,10)}/age:int=33")]
public Book Get(int id, string newAuthor , int age){
  return new Book() { Title = "SQL Server 2012 id= " + id, Author = "Adrian & " + newAuthor };
}
    ...

Or being able to customize your routings based on your needs like :
[Route("url1/{id}")]
public Book Get(int id){
   return new Book() { Title = "SQL Server 2012 id= " + id, Author = "Adrian " };
}

[Route("url1/{id}/{author}")]
public Book Get(int id, string author){
   return new Book() { Title = "SQL Server 2012 id= " + id, Author = "Adrian & " + author };
}
...

In the first version of the WebApi this had to be done in the WebApiConfig class however the options are not the same, I think the only real option on that version was the use of regular expressions.
Going back to Web.Api 20 you also can define your own constraints to handle your own complex types by inheriting from IHttpRouteConstraint
There is additional information regarding the scenario you described on the WEB.Api documentation site, it is possible that you may need to implement a TypeConverter.
http://www.asp.net/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api


text:
Q: How to understand and fix conflicts in PLY I am working on a SystemVerilog parser and I am running into many ply conflicts (both shift/reduce and reduce/reduce).
I currently have like 170+ conflicts and the problem I have is that I don't really understand the parser.out file generated by PLY. Without properly understanding that there is little I can do, so my goal is to understand what ply is reporting. All the PLY documentation is brief and not very explainatory...
Here you have one of my states, the first where a conflict is found apparently:
state 24

(134) attribute_instance_optional_list -> attribute_instance_list .
(136) attribute_instance_list -> attribute_instance_list . attribute_instance
(138) attribute_instance -> . LPAREN ASTERISK attr_spec_list ASTERISK RPAREN

  ! shift/reduce conflict for LPAREN resolved as shift
    PLUS            reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    MINUS           reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    EXCLAMATION     reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    NEG             reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    AMPERSAND       reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    NEGAMPERSAND    reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    PIPE            reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    NEGPIPE         reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    CARET           reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    NEGCARET        reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    UNBASED_UNSIZED_LITERAL reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    STRING_LITERAL  reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    REAL_FLOATINGP_NUMBER reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    REAL_FIXEDP_NUMBER reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    INT_HEX_NUMBER  reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    INT_BINARY_NUMBER reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    INT_OCTAL_NUMBER reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    INT_DECIMAL_NUMBER reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    UNSIGNED_NUMBER reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    DOUBLEPLUS      reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    DOUBLEMINUS     reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    AT              reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    TAGGED          reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    INOUT           reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    INPUT           reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    OUTPUT          reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    REF             reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    ID              reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    ESCAPED_ID      reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    MODULE          reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    MACROMODULE     reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .)
    LPAREN          shift and go to state 21

  ! LPAREN          [ reduce using rule 134 (attribute_instance_optional_list -> attribute_instance_list .) ]

    attribute_instance             shift and go to state 49

As far as I understand ply, grammar rules are processed and states are built. Each of those states takes decisions based on the tokens that are coming in.
So in this state that I posted (state 24), for example, if a PLUS token was waiting to be shifted in the stack, ply would go ahead and "reduce using rule 134". One thing I don't understand is, what does ply do then? I mean does it stay in the same state (24)? Is it only when an "attribute_instance" is waiting to be shifted in, when ply actualy moves states and goes to state 49?
Another question, what do the parsing "snapshots" listed at the beggining of the state mean?
(134) attribute_instance_optional_list -> attribute_instance_list .
(136) attribute_instance_list -> attribute_instance_list . attribute_instance
(138) attribute_instance -> . LPAREN ASTERISK attr_spec_list ASTERISK RPAREN

Does PLY compute all the possible stack states under which state 24 could be reached? is that even possible?
In case it is of any use, here you can see my grammar's rules:
Grammar

Rule 0     S' -> source_text
Rule 1     source_text -> timeunits_declaration description_list
Rule 2     timeunits_declaration -> timeunit_and_precision
Rule 3     timeunits_declaration -> timeunit
Rule 4     timeunits_declaration -> timeprecision
Rule 5     timeunits_declaration -> timeunit timeprecision
Rule 6     timeunits_declaration -> timeprecision timeunit
Rule 7     timeunits_declaration -> empty
Rule 8     timeunit_and_precision -> TIMEUNIT time_literal SLASH time_literal SEMICOLON
Rule 9     timeunit -> TIMEUNIT time_literal SEMICOLON
Rule 10    timeprecision -> TIMEPRECISION time_literal SEMICOLON
Rule 11    time_literal -> UNSIGNED_NUMBER time_unit
Rule 12    time_literal -> REAL_FIXEDP_NUMBER time_unit
Rule 13    time_unit -> S
Rule 14    time_unit -> MS
Rule 15    time_unit -> US
Rule 16    time_unit -> NS
Rule 17    time_unit -> PS
Rule 18    time_unit -> FS
Rule 19    description_list -> description_list description
Rule 20    description_list -> description
Rule 21    description -> module_declaration
Rule 22    module_declaration -> module_nonansi_header timeunits_declaration module_item_list module_footer
Rule 23    module_declaration -> module_ansi_header timeunits_declaration non_port_module_item_list module_footer
Rule 24    module_declaration -> module_implicit_header timeunits_declaration module_item module_footer
Rule 25    module_declaration -> EXTERN module_nonansi_header
Rule 26    module_declaration -> EXTERN module_ansi_header
Rule 27    module_nonansi_header -> attribute_instance_optional_list module_keyword lifetime module_identifier package_import_declaration_list parameter_port_list list_of_ports SEMICOLON
Rule 28    module_ansi_header -> attribute_instance_optional_list module_keyword lifetime module_identifier package_import_declaration_list parameter_port_list list_of_port_declarations_list SEMICOLON
Rule 29    module_implicit_header -> attribute_instance_optional_list module_keyword lifetime module_identifier LPAREN DOT ASTERISK RPAREN SEMICOLON
Rule 30    module_keyword -> MODULE
Rule 31    module_keyword -> MACROMODULE
Rule 32    module_footer -> ENDMODULE COLON module_identifier
Rule 33    module_footer -> ENDMODULE
Rule 34    module_item -> port_declaration SEMICOLON
Rule 35    module_item -> non_port_module_item
Rule 36    port_declaration -> attribute_instance_optional_list inout_declaration
Rule 37    port_declaration -> attribute_instance_optional_list input_declaration
Rule 38    port_declaration -> attribute_instance_optional_list output_declaration
Rule 39    port_declaration -> attribute_instance_optional_list ref_declaration
Rule 40    port_declaration -> attribute_instance_optional_list interface_port_declaration
Rule 41    inout_declaration -> INOUT net_port_type list_of_port_identifiers
Rule 42    input_declaration -> INPUT net_port_type list_of_port_identifiers
Rule 43    input_declaration -> INPUT variable_port_type list_of_variable_identifiers
Rule 44    output_declaration -> OUTPUT net_port_type list_of_port_identifiers
Rule 45    interface_port_declaration -> interface_identifier list_of_interface_identifiers
Rule 46    interface_port_declaration -> interface_identifier DOT modport_identifier list_of_interface_identifiers
Rule 47    ref_declaration -> REF variable_port_type list_of_variable_identifiers
Rule 48    casting_type -> simple_type
Rule 49    casting_type -> constant_primary
Rule 50    casting_type -> signing
Rule 51    casting_type -> STRING
Rule 52    casting_type -> CONST
Rule 53    data_type -> integer_vector_type optional_signing optional_packed_dimension
Rule 54    data_type -> integer_atom_type optional_signing
Rule 55    data_type -> non_integer_type
Rule 56    data_type -> struct_union LBRACE struct_union_member_list RBRACE optional_packed_dimension_list
Rule 57    data_type -> ENUM LBRACE optional_enum_name_declaration_list RBRACE optional_packed_dimension_list
Rule 58    data_type -> ENUM enum_base_type LBRACE optional_enum_name_declaration_list RBRACE optional_packed_dimension_list
Rule 59    data_type -> STRING
Rule 60    data_type -> CHANDLE
Rule 61    data_type -> VIRTUAL interface_identifier optional_parameter_value_assignment optional_modport_identifier
Rule 62    data_type -> VIRTUAL INTERFACE interface_identifier optional_parameter_value_assignment optional_modport_identifier
Rule 63    data_type -> type_identifier optional_packed_dimension_list
Rule 64    data_type -> class_scope type_identifier optional_packed_dimension_list
Rule 65    data_type -> package_scope type_identifier optional_packed_dimension_list
Rule 66    data_type -> class_type
Rule 67    data_type -> EVENT
Rule 68    data_type -> ps_covergroup_identifier
Rule 69    data_type -> type_reference
Rule 70    data_type_or_implicit -> data_type
Rule 71    data_type_or_implicit -> implicit_data_type
Rule 72    implicit_data_type -> optional_signing optional_packed_dimension_list
Rule 73    enum_base_type -> integer_atom_type optional_signing
Rule 74    enum_base_type -> integer_vector_type optional_signing optional_packed_dimension
Rule 75    enum_base_type -> type_identifier optional_packed_dimension
Rule 76    enum_name_declaration -> enum_identifier optional_enum_identifier_pointer
Rule 77    enum_name_declaration -> enum_identifier optional_enum_identifier_pointer EQUALS constant_expression
Rule 78    optional_enum_identifier_pointer -> LBRACKET integral_number RBRACKET
Rule 79    optional_enum_identifier_pointer -> LBRACKET integral_number COLON integral_number RBRACKET
Rule 80    optional_enum_identifier_pointer -> empty
Rule 81    class_scope -> class_type DOUBLECOLON
Rule 82    class_type -> ps_class_identifier optional_parameter_value_assignment
Rule 83    class_type -> ps_class_identifier optional_parameter_value_assignment parametrized_class_list
Rule 84    parametrized_class_list -> parametrized_class_list DOUBLECOLON class_identifier optional_parameter_value_assignment
Rule 85    parametrized_class_list -> DOUBLECOLON class_identifier optional_parameter_value_assignment
Rule 86    integer_type -> integer_vector_type
Rule 87    integer_type -> integer_atom_type
Rule 88    integer_atom_type -> BYTE
Rule 89    integer_atom_type -> SHORTINT
Rule 90    integer_atom_type -> INT
Rule 91    integer_atom_type -> LONGINT
Rule 92    integer_atom_type -> INTEGER
Rule 93    integer_atom_type -> TIME
Rule 94    integer_vector_type -> BIT
Rule 95    integer_vector_type -> LOGIC
Rule 96    integer_vector_type -> REG
Rule 97    non_integer_type -> SHORTREAL
Rule 98    non_integer_type -> REAL
Rule 99    non_integer_type -> REALTIME
Rule 100   net_type -> SUPPLY0
Rule 101   net_type -> SUPPLY1
Rule 102   net_type -> TRI
Rule 103   net_type -> TRIAND
Rule 104   net_type -> TRIOR
Rule 105   net_type -> TRIREG
Rule 106   net_type -> TRI0
Rule 107   net_type -> TRI1
Rule 108   net_type -> UWIRE
Rule 109   net_type -> WIRE
Rule 110   net_type -> WAND
Rule 111   net_type -> WOR
Rule 112   net_port_type -> data_type_or_implicit
Rule 113   net_port_type -> net_type data_type_or_implicit
Rule 114   net_port_type -> net_type_identifier
Rule 115   net_port_type -> INTERCONNECT implicit_data_type
Rule 116   variable_port_type -> var_data_type
Rule 117   var_data_type -> data_type
Rule 118   var_data_type -> VAR data_type_or_implicit
Rule 119   signing -> SIGNED
Rule 120   signing -> UNSIGNED
Rule 121   simple_type -> integer_type
Rule 122   simple_type -> non_integer_type
Rule 123   simple_type -> ps_type_identifier
Rule 124   simple_type -> ps_parameter_identifier
Rule 125   struct_union_member -> attribute_instance_optional_list data_type_or_void list_of_variable_decl_assignments
Rule 126   struct_union_member -> attribute_instance_optional_list random_qualifier data_type_or_void list_of_variable_decl_assignments
Rule 127   data_type_or_void -> data_type
Rule 128   data_type_or_void -> VOID
Rule 129   struct_union -> STRUCT
Rule 130   struct_union -> UNION
Rule 131   struct_union -> UNION TAGGED
Rule 132   type_reference -> TYPE LPAREN expression RPAREN
Rule 133   type_reference -> TYPE LPAREN data_type RPAREN
Rule 134   attribute_instance_optional_list -> attribute_instance_list
Rule 135   attribute_instance_optional_list -> empty
Rule 136   attribute_instance_list -> attribute_instance_list attribute_instance
Rule 137   attribute_instance_list -> attribute_instance
Rule 138   attribute_instance -> LPAREN ASTERISK attr_spec_list ASTERISK RPAREN
Rule 139   attr_spec_list -> attr_spec_list COMMA attr_spec
Rule 140   attr_spec_list -> attr_spec
Rule 141   attr_spec -> attr_name
Rule 142   attr_spec -> attr_name EQUALS constant_expression
Rule 143   attr_name -> identifier
Rule 144   inc_or_dec_expression -> inc_or_dec_operator attribute_instance_optional_list variable_lvalue
Rule 145   inc_or_dec_expression -> variable_lvalue attribute_instance_optional_list inc_or_dec_operator
Rule 146   conditional_expression -> cond_predicate INTERROGATION attribute_instance_optional_list expression COLON expression
Rule 147   constant_expression -> constant_primary
Rule 148   constant_expression -> unary_operator attribute_instance_optional_list constant_primary
Rule 149   constant_expression -> constant_expression binary_operator attribute_instance_optional_list constant_expression
Rule 150   constant_expression -> constant_expression INTERROGATION attribute_instance_optional_list constant_expression COLON constant_expression
Rule 151   constant_mintypmax_expression -> constant_expression
Rule 152   constant_mintypmax_expression -> constant_expression COLON constant_expression COLON constant_expression
Rule 153   constant_param_expression -> constant_mintypmax_expression
Rule 154   constant_param_expression -> data_type
Rule 155   constant_param_expression -> DOLLAR
Rule 156   param_expression -> mintypmax_expression
Rule 157   param_expression -> data_type
Rule 158   param_expression -> DOLLAR
Rule 159   constant_range_expression -> constant_expression
Rule 160   constant_range_expression -> constant_part_select_range
Rule 161   constant_part_select_range -> constant_range
Rule 162   constant_part_select_range -> constant_indexed_range
Rule 163   constant_range -> constant_expression COLON constant_expression
Rule 164   constant_indexed_range -> constant_expression PLUSCOLON constant_expression
Rule 165   constant_indexed_range -> constant_expression MINUSCOLON constant_expression
Rule 166   expression -> primary
Rule 167   expression -> unary_operator attribute_instance_optional_list primary
Rule 168   expression -> inc_or_dec_expression
Rule 169   expression -> LPAREN operator_assignment RPAREN
Rule 170   expression -> expression binary_operator attribute_instance_optional_list expression
Rule 171   expression -> conditional_expression
Rule 172   expression -> inside_expression
Rule 173   expression -> tagged_union_expression
Rule 174   tagged_union_expression -> TAGGED member_identifier
Rule 175   tagged_union_expression -> TAGGED member_identifier expression
Rule 176   inside_expression -> expression INSIDE LBRACE open_range_list RBRACE
Rule 177   value_range -> expression
Rule 178   value_range -> LBRACKET expression COLON expression RBRACKET
Rule 179   mintypmax_expression -> expression
Rule 180   mintypmax_expression -> expression COLON expression COLON expression
Rule 181   module_path_conditional_expression -> module_path_expression INTERROGATION attribute_instance_optional_list module_path_expression COLON module_path_expression
Rule 182   module_path_expression -> module_path_primary
Rule 183   module_path_expression -> unary_module_path_operator attribute_instance_optional_list module_path_primary
Rule 184   module_path_expression -> module_path_expression binary_module_path_operator attribute_instance_optional_list module_path_expression
Rule 185   module_path_expression -> module_path_conditional_expression
Rule 186   module_path_mintypmax_expression -> module_path_expression
Rule 187   module_path_mintypmax_expression -> module_path_expression COLON module_path_expression COLON module_path_expression
Rule 188   part_select_range -> constant_range
Rule 189   part_select_range -> indexed_range
Rule 190   indexed_range -> expression PLUSCOLON constant_expression
Rule 191   indexed_range -> expression MINUSCOLON constant_expression
Rule 192   genvar_expression -> constant_expression
Rule 193   constant_primary -> primary_literal
Rule 194   primary_literal -> number
Rule 195   primary_literal -> time_literal
Rule 196   primary_literal -> UNBASED_UNSIZED_LITERAL
Rule 197   primary_literal -> STRING_LITERAL
Rule 198   number -> REAL_FLOATINGP_NUMBER
Rule 199   number -> REAL_FIXEDP_NUMBER
Rule 200   number -> INT_HEX_NUMBER
Rule 201   number -> INT_BINARY_NUMBER
Rule 202   number -> INT_OCTAL_NUMBER
Rule 203   number -> INT_DECIMAL_NUMBER
Rule 204   number -> UNSIGNED_NUMBER
Rule 205   unary_operator -> PLUS
Rule 206   unary_operator -> MINUS
Rule 207   unary_operator -> EXCLAMATION
Rule 208   unary_operator -> NEG
Rule 209   unary_operator -> AMPERSAND
Rule 210   unary_operator -> NEGAMPERSAND
Rule 211   unary_operator -> PIPE
Rule 212   unary_operator -> NEGPIPE
Rule 213   unary_operator -> CARET
Rule 214   unary_operator -> NEGCARET
Rule 215   binary_operator -> PLUS
Rule 216   binary_operator -> MINUS
Rule 217   binary_operator -> ASTERISK
Rule 218   binary_operator -> SLASH
Rule 219   binary_operator -> PERCENT
Rule 220   binary_operator -> ISEQUAL
Rule 221   binary_operator -> NISEQUAL
Rule 222   binary_operator -> CISEQUAL
Rule 223   binary_operator -> NCISEQUAL
Rule 224   binary_operator -> WISEQUAL
Rule 225   binary_operator -> NWISEQUAL
Rule 226   binary_operator -> DOUBLEAMPERSAND
Rule 227   binary_operator -> DOUBLEPIPE
Rule 228   binary_operator -> DOUBLEASTERISK
Rule 229   binary_operator -> LT
Rule 230   binary_operator -> LE
Rule 231   binary_operator -> GT
Rule 232   binary_operator -> GE
Rule 233   binary_operator -> AMPERSAND
Rule 234   binary_operator -> PIPE
Rule 235   binary_operator -> CARET
Rule 236   binary_operator -> NEGCARET
Rule 237   binary_operator -> RSHIFT
Rule 238   binary_operator -> LSHIFT
Rule 239   binary_operator -> ARSHIFT
Rule 240   binary_operator -> ALSHIFT
Rule 241   binary_operator -> IMPLICATION
Rule 242   binary_operator -> EQUIVALENCE
Rule 243   inc_or_dec_operator -> DOUBLEPLUS
Rule 244   inc_or_dec_operator -> DOUBLEMINUS
Rule 245   unary_module_path_operator -> EXCLAMATION
Rule 246   unary_module_path_operator -> NEG
Rule 247   unary_module_path_operator -> AMPERSAND
Rule 248   unary_module_path_operator -> NEGAMPERSAND
Rule 249   unary_module_path_operator -> PIPE
Rule 250   unary_module_path_operator -> NEGPIPE
Rule 251   unary_module_path_operator -> CARET
Rule 252   unary_module_path_operator -> NEGCARET
Rule 253   binary_module_path_operator -> ISEQUAL
Rule 254   binary_module_path_operator -> NISEQUAL
Rule 255   binary_module_path_operator -> DOUBLEAMPERSAND
Rule 256   binary_module_path_operator -> DOUBLEPIPE
Rule 257   binary_module_path_operator -> AMPERSAND
Rule 258   binary_module_path_operator -> PIPE
Rule 259   binary_module_path_operator -> CARET
Rule 260   binary_module_path_operator -> NEGCARET
Rule 261   array_identifier -> identifier
Rule 262   block_identifier -> identifier
Rule 263   bin_identifier -> identifier
Rule 264   c_identifier -> C_ID
Rule 265   cell_identifier -> identifier
Rule 266   checker_identifier -> identifier
Rule 267   class_identifier -> identifier
Rule 268   class_variable_identifier -> variable_identifier
Rule 269   clocking_identifier -> identifier
Rule 270   config_identifier -> identifier
Rule 271   const_identifier -> identifier
Rule 272   constraint_identifier -> identifier
Rule 273   covergroup_identifier -> identifier
Rule 274   covergroup_variable_identifier -> variable_identifier
Rule 275   cover_point_identifier -> identifier
Rule 276   cross_identifier -> identifier
Rule 277   dynamic_array_variable_identifier -> variable_identifier
Rule 278   enum_identifier -> identifier
Rule 279   escaped_identifier -> ESCAPED_ID
Rule 280   formal_identifier -> identifier
Rule 281   formal_port_identifier -> identifier
Rule 282   function_identifier -> identifier
Rule 283   generate_block_identifier -> identifier
Rule 284   genvar_identifier -> identifier
Rule 285   hierarchical_array_identifier -> hierarchical_identifier
Rule 286   hierarchical_block_identifier -> hierarchical_identifier
Rule 287   hierarchical_event_identifier -> hierarchical_identifier
Rule 288   hierarchical_identifier -> optional_identifier_constant_bit_select_list identifier
Rule 289   hierarchical_identifier -> DOLLAR ROOT DOT optional_identifier_constant_bit_select_list identifier
Rule 290   hierarchical_net_identifier -> hierarchical_identifier
Rule 291   hierarchical_parameter_identifier -> hierarchical_identifier
Rule 292   hierarchical_property_identifier -> hierarchical_identifier
Rule 293   hierarchical_sequence_identifier -> hierarchical_identifier
Rule 294   hierarchical_task_identifier -> hierarchical_identifier
Rule 295   hierarchical_tf_identifier -> hierarchical_identifier
Rule 296   hierarchical_variable_identifier -> hierarchical_identifier
Rule 297   identifier -> simple_identifier
Rule 298   identifier -> escaped_identifier
Rule 299   index_variable_identifier -> identifier
Rule 300   interface_identifier -> identifier
Rule 301   interface_instance_identifier -> identifier
Rule 302   inout_port_identifier -> identifier
Rule 303   input_port_identifier -> identifier
Rule 304   instance_identifier -> identifier
Rule 305   library_identifier -> identifier
Rule 306   member_identifier -> identifier
Rule 307   method_identifier -> identifier
Rule 308   modport_identifier -> identifier
Rule 309   module_identifier -> identifier
Rule 310   net_identifier -> identifier
Rule 311   net_type_identifier -> identifier
Rule 312   output_port_identifier -> identifier
Rule 313   package_identifier -> identifier
Rule 314   package_scope -> package_identifier DOUBLECOLON
Rule 315   package_scope -> DOLLAR UNIT DOUBLECOLON
Rule 316   optional_package_scope -> package_scope
Rule 317   optional_package_scope -> empty
Rule 318   parameter_identifier -> identifier
Rule 319   port_identifier -> identifier
Rule 320   production_identifier -> identifier
Rule 321   program_identifier -> identifier
Rule 322   property_identifier -> identifier
Rule 323   ps_class_identifier -> optional_package_scope class_identifier
Rule 324   ps_covergroup_identifier -> optional_package_scope covergroup_identifier
Rule 325   ps_checker_identifier -> optional_package_scope checker_identifier
Rule 326   ps_identifier -> optional_package_scope identifier
Rule 327   ps_or_hierarchical_array_identifier -> optional_package_scope hierarchical_array_identifier
Rule 328   ps_or_hierarchical_array_identifier -> implicit_class_handle DOT hierarchical_array_identifier
Rule 329   ps_or_hierarchical_array_identifier -> class_scope hierarchical_array_identifier
Rule 330   ps_or_hierarchical_net_identifier -> optional_package_scope net_identifier
Rule 331   ps_or_hierarchical_net_identifier -> hierarchical_net_identifier
Rule 332   ps_or_hierarchical_property_identifier -> optionnal_package_scope property_identifier
Rule 333   ps_or_hierarchical_property_identifier -> hierarchical_property_identifier
Rule 334   ps_or_hierarchical_sequence_identifier -> optional_package_scope sequence_identifier
Rule 335   ps_or_hierarchical_sequence_identifier -> hierarchical_sequence_identifier
Rule 336   ps_or_hierarchical_tf_identifier -> optional_package_scope tf_identifier
Rule 337   ps_or_hierarchical_tf_identifier -> hierarchical_tf_identifier
Rule 338   ps_parameter_identifier -> optional_package_scope parameter_identifier
Rule 339   ps_parameter_identifier -> class_scope parameter_identifier
Rule 340   ps_parameter_identifier -> ps_parameter_identifier_generate_list parameter_identifier
Rule 341   ps_parameter_identifier_generate_list -> ps_parameter_identifier_generate_list DOT ps_parameter_identifier_generate
Rule 342   ps_parameter_identifier_generate_list -> ps_parameter_identifier_generate
Rule 343   ps_parameter_identifier_generate -> generate_block_identifier LBRACKET constant_expression RBRACKET
Rule 344   ps_parameter_identifier_generate -> generate_block_identifier
Rule 345   ps_type_identifier -> type_identifier
Rule 346   ps_type_identifier -> LOCAL DOUBLECOLON type_identifier
Rule 347   ps_type_identifier -> package_scope type_identifier
Rule 348   sequence_identifier -> identifier
Rule 349   signal_identifier -> identifier
Rule 350   simple_identifier -> ID
Rule 351   specparam_identifier -> identifier
Rule 352   system_tf_identifier -> DOLLAR ID
Rule 353   task_identifier -> identifier
Rule 354   tf_identifier -> identifier
Rule 355   terminal_identifier -> identifier
Rule 356   topmodule_identifier -> identifier
Rule 357   type_identifier -> identifier
Rule 358   udp_identifier -> identifier
Rule 359   variable_identifier -> identifier
Rule 360   cond_predicate -> AT
Rule 361   implicit_class_handle -> AT
Rule 362   integral_number -> AT
Rule 363   lifetime -> AT
Rule 364   list_of_interface_identifiers -> AT
Rule 365   list_of_port_declarations_list -> AT
Rule 366   list_of_port_identifiers -> AT
Rule 367   list_of_ports -> AT
Rule 368   list_of_variable_decl_assignments -> AT
Rule 369   list_of_variable_identifiers -> AT
Rule 370   module_item_list -> AT
Rule 371   module_path_primary -> AT
Rule 372   non_port_module_item -> AT
Rule 373   non_port_module_item_list -> AT
Rule 374   open_range_list -> AT
Rule 375   operator_assignment -> AT
Rule 376   optional_enum_name_declaration_list -> AT
Rule 377   optional_identifier_constant_bit_select_list -> AT
Rule 378   optional_modport_identifier -> AT
Rule 379   optional_packed_dimension -> AT
Rule 380   optional_packed_dimension_list -> AT
Rule 381   optional_parameter_value_assignment -> AT
Rule 382   optional_signing -> AT
Rule 383   optionnal_package_scope -> AT
Rule 384   package_import_declaration_list -> AT
Rule 385   parameter_port_list -> AT
Rule 386   primary -> AT
Rule 387   random_qualifier -> AT
Rule 388   struct_union_member_list -> AT
Rule 389   variable_lvalue -> AT
Rule 390   empty -> <empty>

A: In LR parsing, we often talk about "items": an item is a production with a progress marker, usually written with a • but sometimes with a simple .. A state is just a collection of items; in effect, the state tells you the set of productions the parse might be inside.
There is one particularly special type of item: the item with a dot at the end:
(134) attribute_instance_optional_list -> attribute_instance_list .

This represents a production which could be finished, since the progress marker is at the end. If that is the correct production, the parser must then substitute the right-hand side for the left-hand side: this is the action referred to as "reducing" (since it is the opposite of "producing", which is what a "production" does).
However, the mere fact that you are in a state with a possible reduction does not mean that the reduction is possible. It is also necessary that the next token be consistent with the result of the reduction. If the next token could not follow the reduced non-terminal (in the context of the parser's state), then the reduction cannot be performed, so the parser will attempt a shift if one is possible.
Shifts are really simple. A shift is possible if one or more items in the state have the dot before the current lookahead symbol. Here, there is no question about additional lookahead because Ply (like many LALR parser generators) only creates LALR(1) parsers which only have a single lookahead in any state, so the only thing we have to go on is the symbol we are currently looking at, and it is reasonably obvious that we can only process it if some available item has that symbol in the next position.
If a given state with a given lookahead symbol can both shift and reduce, then you have a shift-reduce conflict; the parser doesn't know what to do. (If it has neither a shift nor a reduce available, that indicates that the input has a syntax error. That's how LR parsers identify syntax errors.)
The one important aspect of LR parsing is that a reduction must be performed immediately if it is going to be performed at all. That is, if we are in a state with a possible reduction, and the item's lookahead set indicates that the lookahead character is feasible, we must perform the reduction. We can't wait and see if it would be possible later, because there is no later for a reduction. In other words, anything to the left of the • in an item has already been reduced as much as it could be. (This is the R in LR parsing, which indicates that every reduction is "rightmost". If the use of "rightmost" doesn't make sense, don't worry about it; I only mentioned this fact in case you were wondering.)
Another thing which I might as well mention is that in LALR parsing ("Lookahead LR parsing"), a state is precisely defined by the set of items. Each item has an applicable lookahead set, but the lookahead sets don't form part of the state's identity. If the parser generator ends up producing two states with the same items but different lookahead sets, it must merge them into a single state, forming the union of each lookahead set. For full LR parsing, this limitation doesn't exist; you can (and do) have more than one state for a given set of items, and the result is that the parsing table is much larger and slightly more powerful.
Now, if a shift action is possible, you can mechanically figure out which state will be active after the shift. For example, from
(134) attribute_instance_optional_list -> attribute_instance_list .
(136) attribute_instance_list -> attribute_instance_list . attribute_instance
(138) attribute_instance -> . LPAREN ASTERISK attr_spec_list ASTERISK RPAREN

after shifting an LPAREN, the next state will have just one item:
(138) attribute_instance -> LPAREN . ASTERISK attr_spec_list ASTERISK RPAREN

(Note how the dot has moved.)
That was a simple case, since the next symbol is a terminal, ASTERISK. Most of the time, the next symbol after a shift will be a non-terminal, and in that case we need to add all of the productions for that non-terminal, with the dot at the beginning. (That's how states end up with more than one item.) So, for example, given the new state with one item and an input of ASTERISK (anything else will be an error, since this state has no reduction possibilities), then we will shift into a state which has the shifted item:
(138) attribute_instance -> LPAREN ASTERISK . attr_spec_list ASTERISK RPAREN

plus all the productions for attr_spec_list:
(139)   attr_spec_list -> . attr_spec_list COMMA attr_spec
(140)   attr_spec_list -> . attr_spec

plus all the productions for attr_spec (since we just added an item with the dot before attr_spec):
(141)   attr_spec -> . attr_name
(142)   attr_spec -> . attr_name EQUALS constant_expression

plus the production for attr_name:
(143)   attr_name -> . identifier

and so on until we stop seeing new non-terminals:
(297)   identifier -> . simple_identifier
(298)   identifier -> . escaped_identifier
(350)   simple_identifier -> . ID
(279)   escaped_identifier -> . ESCAPED_ID

OK, now the next token will have to be ID or ESCAPED_ID. Suppose it is ID. Now what? Well, we will shift into a state
(350)   simple_identifier -> ID .

with a possible reduction; assuming the lookahead symbol matches the lookahead set (I haven't and don't intend to explain how lookahead sets are computed for each state; there's an algorithm but its details aren't relevant here), then the ID will be reduced to simple_identifier. Then where does the parser go? Logically, it goes back to the state which generated the simple_identifier production, and shift the simple_identifier. As it happens, the state is the one we just created
(138)   attribute_instance -> LPAREN ASTERISK . attr_spec_list ASTERISK RPAREN
(139)   attr_spec_list -> . attr_spec_list COMMA attr_spec
(140)   attr_spec_list -> . attr_spec
(141)   attr_spec -> . attr_name
(142)   attr_spec -> . attr_name EQUALS constant_expression
(143)   attr_name -> . identifier
(297)   identifier -> . simple_identifier
(298)   identifier -> . escaped_identifier
(350)   simple_identifier -> . ID
(279)   escaped_identifier -> . ESCAPED_ID

and after we shift the simple_identifier, we end up with
(297)   identifier -> simple_identifier .

which is a state which requires a reduction to identifier, so once again back to the same state after which we find ourselves in
(143)   attr_name -> identifier .

and then
(141)   attr_spec -> attr_name .
(142)   attr_spec -> attr_name . EQUALS constant_expression

But how did the parser know which state to go back to on each of those reductions? The answer is that the parser pushes the current state onto the parsing stack with every symbol. When it does a reduction, it pops the symbols from the right-hand side, discarding each associated state number, until it gets to the beginning of the right-hand-side, at which point the stack indicates which state that right-hand side came from. It then takes a look at that state, shifts the reduced non-terminal, and pushes the new shifted state onto the parse stack.
So I think that answers the questions "What do the lines at the beginning of the state description mean?" and "What state does the parser go to after a reduction?" The other two questions are easy to answer: "No, it doesn't compute all the possible predecessor states", and "Yes, it could (although it might end up adding predecessors which are actually not possible with any input) but it isn't useful for the parse." but since they're not horribly relevant to solving the shift-reduce conflict, I won't explain the answer further.
Going back to the actual shift-reduce conflict, the situation is that we are in the state
(134) attribute_instance_optional_list -> attribute_instance_list .
(136) attribute_instance_list -> attribute_instance_list . attribute_instance
(138) attribute_instance -> . LPAREN ASTERISK attr_spec_list ASTERISK RPAREN

which has a possible reduction, and we are considering the case where we see an LPAREN, for which there is a possible shift, and it turns out that the lookahead set for the first item also include LPAREN. Although the lookahead set is not shown in the PLY output, we can dig around in the grammar to see where it might have come from. The immediate source is attribute_instance_optional_list, of course, and we can find that in the grammar,although there are quite a few possibilities:
(27)    module_nonansi_header -> attribute_instance_optional_list module_keyword lifetime module_identifier package_import_declaration_list parameter_port_list list_of_ports SEMICOLON
(28)    module_ansi_header -> attribute_instance_optional_list module_keyword lifetime module_identifier package_import_declaration_list parameter_port_list list_of_port_declarations_list SEMICOLON
(29)    module_implicit_header -> attribute_instance_optional_list module_keyword lifetime module_identifier LPAREN DOT ASTERISK RPAREN SEMICOLON
(36)    port_declaration -> attribute_instance_optional_list inout_declaration
(37)    port_declaration -> attribute_instance_optional_list input_declaration
(38)    port_declaration -> attribute_instance_optional_list output_declaration
(39)    port_declaration -> attribute_instance_optional_list ref_declaration
(40)    port_declaration -> attribute_instance_optional_list interface_port_declaration
(125)   struct_union_member -> attribute_instance_optional_list data_type_or_void list_of_variable_decl_assignments
(126)   struct_union_member -> attribute_instance_optional_list random_qualifier data_type_or_void list_of_variable_decl_assignments
(144)   inc_or_dec_expression -> inc_or_dec_operator attribute_instance_optional_list variable_lvalue
(145)   inc_or_dec_expression -> variable_lvalue attribute_instance_optional_list inc_or_dec_operator
(146)   conditional_expression -> cond_predicate INTERROGATION attribute_instance_optional_list expression COLON expression
(148)   constant_expression -> unary_operator attribute_instance_optional_list constant_primary
(149)   constant_expression -> constant_expression binary_operator attribute_instance_optional_list constant_expression
(150)   constant_expression -> constant_expression INTERROGATION attribute_instance_optional_list constant_expression COLON constant_expression
(167)   expression -> unary_operator attribute_instance_optional_list primary
(170)   expression -> expression binary_operator attribute_instance_optional_list expression
(181)   module_path_conditional_expression -> module_path_expression INTERROGATION attribute_instance_optional_list module_path_expression COLON module_path_expression
(183)   module_path_expression -> unary_module_path_operator attribute_instance_optional_list module_path_primary
(184)   module_path_expression -> module_path_expression binary_module_path_operator attribute_instance_optional_list module_path_expression

As far as I can see, attribute_instance_optional_list does not appear at the end of any of those productions, which simplifies working out where the LPAREN conflict comes from. In all those cases, it is followed by a non-terminal, the possibilities being:
module_keyword
inout_declaration
input_declaration
output_declaration
ref_declaration
interface_port_declaration
data_type_or_void
random_qualifier
variable_lvalue
inc_or_dec_operator
constant_primary
constant_expression
primary
expression
module_path_primary
module_path_expression

Now, if any of those non-terminals could start with an LPAREN, we have a possible shift-reduce conflict. And a couple of culprits spring out of the list: expression and similar.
So, there is the problem, in summary: an attribute_instance can start with a parenthesis, but an attribute_instance_list can also be followed by a parenthesis. So when you're in the middle of an attribute_instance_list and you see a (, you have no way of knowing whether to shift or reduce.


text:
Q: mongodump, BSONElement: bad type 107 Dump the database, there are many errors:
Wed Dec 12 02:03:35 Assertion: 10320:BSONElement: bad type 107
0xad0f71 0x67f28b 0x55beab 0x7036ef 0x5635d3 0x566ed0 0x568fd1 0xb42d62 0x5545f2 0x7f0288b39c8d 0x554459
 mongodump(_ZN5mongo15printStackTraceERSo+0x21) [0xad0f71]
 mongodump(_ZN5mongo11msgassertedEiPKc+0x9b) [0x67f28b]
 mongodump(_ZNK5mongo11BSONElement4sizeEv+0x1cb) [0x55beab]
 mongodump(_ZNK5mongo7BSONObj10jsonStringENS_16JsonStringFormatEi+0xff) [0x7036ef]
 mongodump(_ZN4Dump17writeMetadataFileESsN5boost11filesystem210basic_pathISsNS1_11path_traitsEEESt3mapISsN5mongo7BSONObjESt4lessISsESaISt4pairIKSsS7_EEESt8multimapISsS7_S9_SD_E+0x363) [0x5635d3]
 mongodump(_ZN4Dump2goESsN5boost11filesystem210basic_pathISsNS1_11path_traitsEEE+0x1e50) [0x566ed0]
 mongodump(_ZN4Dump3runEv+0x1b61) [0x568fd1]
 mongodump(_ZN5mongo4Tool4mainEiPPc+0x1712) [0xb42d62]
 mongodump(main+0x32) [0x5545f2]
 /lib/libc.so.6(__libc_start_main+0xfd) [0x7f0288b39c8d]
 mongodump(__gxx_personality_v0+0x421) [0x554459]
assertion: 10320 BSONElement: bad type 107

Then he took a dump on each collection individually. There was no error.
How, then, to know to what collection this error?
There is an idea why it appeared when dumping the entire database, but when dumping collections do not appear?


text:
Q: How do I trigger the browser context menu on an element. (As if the user right-clicked) I have the need to trigger the opening of the browser (IE, Firefox, Safari, etc) context-menu via javascript. The problem I am trying to solve, is when an overlaid element is right-clicked, the element below it shows its context menu. So if the top element is a label, when you right click, I need to show the context menu for the input element below.
I know how to keep the label's context menu from showing, but I don't know how to open a context menu arbitrarily.
Any help is appreciated!

A: I don't want to frustrate you, quite the contrary, especially because you answered my own question :)
I don't think that a browser's contect menu is accessible via an ordinary script on a web page.
If what you are asking for was actually doable, then the browser makers would possibly consider this a bug and remove this behavior. Cross-browser, this behavior is very unlikely to be available today.
Why don't you capture mouse events, and whenever the mouse is directly in the area of the element below that you want to show the context menu for, push the covering element below, otherwise back on top?
That is one possiblity I could think of, basically revealing/exposing the hidden element depending on mouse position. Like cutting a hole into the overlay.
Or why don't you make the text field transparent and put the overlay below the text field entirely?
If this does not work out technically, then at least you have a point in filing bugs or enhancements against the targeted browsers.
BTW it looks like the context menu actually works if the user right-clicks directly at the position of the caret, so this might be another loophole for you to consider.

A: Sorry to be the bearer of unfortunate news, but this is impossible to do with Javascript.

A: I have a possible solution that may suit your needs. It is not perfect yet, I have only done a few quick tests in a few browsers (Fox 3.6, IE7, IE8, Chrome 4, Safari 3 on xp) It will need to be tweaked and improved but its a start. Basically the idea is to remove the label on right-click mousedown so that the desired field is hit by the mouseup event and therefore fires up the context menu on the relevant field.
// Remove the contextmenu from "In-Field" Labels
base.$label.bind("contextmenu",function(e){
    return false;
});

// Detect right click on "In-Field" label:
// hide label on mousedown so mouseup will target the field underneath.
base.$label.mousedown(function(e){
    if ( e.which == 3 ){
        var elLbl = $(this);
        elLbl.hide();
        var elFid = $(this).attr("for");
        // bind blur event to replace the label when we are done.
        $("#" + elFid ).bind("blur.infieldlabel",function(){
            elLbl.show();
            $("#" + elFid ).unbind("blur.infieldlabel");
        });
        return false;
    }
});

The IE and Safari browsers experience a strange issue where you need to click in and out twice before the label will display again (something to do with event timing I think). You may be able to easily see why this is happening by looking at the code. Also noticed slight glitch sometimes in the fox after pasting into the field, on blur the label appeared for a split second when it should not. This should be a fairly simply thing to rectify if you decide to incorporate this method into your code.

A: You can make Your label/span element contenteditable="true" and handle any further actions with listeners. Making it contenteditable will enable normal, input-like contextmenu to show up on right click.
And if someone doesn't care for IE support:
pointer-events: none

A: Type the following in the console:
document.oncontextmenu = reEnable

That will print to the console the following:
reEnable()
{
    return true;
}

Done, you can now use the context menu.


text:
Q: Custom Scrollbar for UITableView the iTunes song list display is a TableView that has a dotted scrollbar on the right which allows me to jump to a relative position of the list (i.e. if I click the bar at 2/3 down I am scrolled to the 66% position of the list.
I want to do the same in my UITableView, but am not sure whether this is standard functionality that I can use (which class?) or whether this is a custom build ...
If the latter, has someone got some samplecode that I could use as a template?

A: I'm not 100% what you're talking about when you say dotted scrollbar, I think you're referring to the letters down the side, if so, take a look here:
iPhone UITableView. How do turn on the single letter alphabetical list like the Music App?


text:
Q: How to control Spring-WS namespace single or double quote with XSLT I want to change the double quotes to single quotes for a single namespace declaration in my document, while leaving all other namespace declarations as double quotes. How can I do this?
Here's the response document from the server:

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><InquiryResponse
  xmlns="http://www.openuri.org/"><HeaderAttr1>abcd</HeaderAttr1><HeaderAttr2>xxx</HeaderAttr2><HeaderAttr3>string</HeaderAttr3><InquiryResult><ResultItem1>theresulttext</ResultItem1><ResultItem2>abcd</ResultItem2><ResultItem3>0</ResultItem3></InquiryResult></InquiryResponse></soapenv:Body></soapenv:Envelope>

I need something like (note that open:InquiryResponse has ' not ").

<?xml version="1.0" encoding="utf-8"?> <SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">   <SOAP-ENV:Body>
  <open:InquiryResponse
  xmlns:open='http://www.openuri.org/'><open:Header><open:HeaderAttr1>abcd</open:HeaderAttr1><open:HeaderAttr2>xxx</open:HeaderAttr2><open:HeaderAttr3>string</open:HeaderAttr3></open:Header><open:Body><open:InquiryResult><open:ResultItem1>theresulttext</open:ResultItem1><open:ResultItem2>abcd</open:ResultItem2><open:ResultItem3>0</open:ResultItem3></open:InquiryResult></open:Body></open:InquiryResponse>
  </SOAP-ENV:Body> </SOAP-ENV:Envelope>

I have been able to do namespace prefix change, additional namespace declarations, whitespace fixups, character set change, all I need now is to change those two bytes.
I'm using Spring WS + Woodstox + Axiom to build a simple inquiry web service. It's a replacement for an existing service and I would like to make it byte-for-byte identical ($$ reasons). I can get the XML to identical type, but we don't know at this point which consumers use a grep or regex to find the data.
I am trying to attack this problem so far using an XSLT and PayloadTransformingInterceptor. I would be interested in other options as well.

A: Comments are pretty much correct: there is no "clean" programmatic solution to configuring low-levels with such precision. And given fragility, you are best off using textual mangling; most likely regexps would work well enough if this is for testing or such.

A: After re-reading your question and examples a few times I think I understand the problem :)
I think you should take a look at the PayloadTransformingInterceptor. You can transform the incoming and outgoing messages in that interceptor. A typical usage of that interceptor is to support an older version of your wsdl by transforming it to the new version. This interceptor can work both ways - in your case only outgoing.
I'm not sure if this can be fixed by using XSLT. If not, you can create your own Interceptor to provide the specific string replacement functionality you need.

A: The solution was to drop Spring-WS, and instead move to CXF. CXF allows interceptors at any stage of processing, and hence full access to the bytes of the message stream. Ugly, but working. Build an interceptor to hook the OutputStream at PRE_STREAM and then do the fix at PRE_STREAM_ENDING, and you will have full control over the SOAP Envelope.
Thank you all for your responses. It sucks but it works, and is reasonably easy to disconnect when we have the time to do it properly (!!).


text:
Q: gxt (extJS) Combobox throws unresponsive JS error in IE -8 I have a gxt combobox which has a large data store(350 objects) assigned. When I try to display the list by clicking the drop down icon, I get unresponsive js error in IE- 8. I know its trying to populate around 350 objects(lists) and its taking its time. If I ignore the error few times, it will eventually load. Is there a  workaround to avoid the js error other than cutting down the data store? I found some articles where some users suggest suspending/resuming layouts when loading data.But I am not quite sure how to do it.I am just setting the store and not touching it there after, so where do i suspend/resume layout?Should I modify the combobox class or something? I am using GXT 2.2.4
This is my code.
private ComboBox hierarchyName;
private ListStore<BeanModel> listStoreHierarchyName
hierarchyName.setStore(listStoreHierarchyName);--- has 350 objects
http://www.sencha.com/forum/showthread.php?226443-IE8-quot-Unresponsive-Script-quot-Prompt
http://www.sencha.com/forum/showthread.php?205909-IE-quot-Stop-running-this-script-quot-when-loading-large-store


text:
Q: DB schema for single player web RPG I'm creating a web rpg and want to save user stats in a MYSQL database.
I've created a table called users. Do I put their stats in that same table? Meaning, users table has columns playername, password, score, number of item a, number of item b. Or should I separate stats into a its own table stats, and relate the user id to the stats?
EDIT:
Is this how I would manage stats per user?

A: If stats has a single value by user, you should add it as another column in the users table.
If there are several stats values by user, you should create another table and add a column for the user id as a foreign key.
see http://www.databasejournal.com/features/mysql/article.php/3906761/Cardinality-in-MySQL-Data-Modeling.htm
UPDATE: complementing due to your edit.
if you want to keep track of different moments when a user had different levels and experiences in your game, yes. But if the idea is to keep just the current level and experience for each player, then no - they should be columns in the user table.


text:
Q: Get an class element's ID I have a group of divs' which belong to the 'userPosts' class and I'm dynamically creating a separate ID for each element. The element I want to animate has the same ID as the button clicked to perform the animation. I want to get the "ID" of all $("textarea") elements with the same ID as the button clicked and animate the textarea with the matching id.
@foreach(var post in posts){

            <button class="view"id="@post.ID">View Post!!!</button>

Name

@post.FirstName

@post.LastName

Subject

@post.Subject

            <textarea id=""rows="4" cols="40">@post.Comments</textarea>

           }

This doesn't work but this is what I came up with
 $(".view").on("click", function ()
{

    var selected = $(this).attr("id")
    stop().animate(selected, { height: '800px' }, 1000);
    stop().show(selected,"textarea");
    // $(".userPosts").stop().animate({ height: '800px' }, 1000);
    //$(".userPosts textarea").stop().show();
});

A: First, you don't need ids here - just use classes:
the code below selects the parent DIV (divCont) of the clicked .view button, then uses .find(), to select the textarea with the class .commentsBox. the alert is there just to show that the correct box was selected
see the jsfiddle for a working example:
 $(".view").on("click", function () {
  var divCont = $(this).closest("div")
  var txtBox = divCont.find(".commentsBox")
  alert(txtBox.val())

 });

once you have selected the correct textarea and give it the var txtBox, you can do whatever you want to to it (like show, animate, fill it--whatever)
keep in mind that this finds the next element with the .commentsBox class in the DIV. If you have more than one .commentsBox element, you would need to use .eq(0) to select the correct one based on index


text:
Q: How can I include inline assembly code in a C source code? This question is for educational purpose only. I want to know the way to include an inline assembly code (I am using Xcode, with i7 Intel processor) in a C source code.
For example:
main(){
int a = 2, b = 3, c = 0;

/*
*Sum c = a + b implemented using assembly
*/
{
mov eax, ??? (a)
mov ebx, ??? (b)
bla bla bla...
}

return 0;
}

A: Read the clang manuals (clang is the compiler used by xcode).
E.g., see here: http://clang.llvm.org/compatibility.html#inline-asm


text:
Q: How to fake SharePoint List (I need IEnumerable)? I'm writing Unit Tests for application, that gets data from SharePoint. Project has interface IListItemCollectionProvider with IEnumerable<Microsoft.SharePoint.Client.ListItem> GetListByTitle method. So, I want fake it and I just need to create my own IEnumerable<ListItem>. Unfortunately it's not so easy, because ListItem сan not be created manually.
I tried to use Microsoft.SharePoint.Emulators, but it doesnt help, because
1)Emulators requires .Net 3.5, instead project's 4.5 to work (this http://www.codeproject.com/Articles/545058/Couldplusnotplusloadplusfileplusorplusassemblyplus doesn't work).
2)Emulators supposes using Microsoft.SharePoint.SPList/SPListItemCollection/SPListItem, and I can't find any way to transform it to ListItem.
I  looking for another way get ListItem with my fake data.
Just in case code with Emulators:
          using (var emulationScope = new SharePointEmulationScope(EmulationMode.Enabled))
        //throws System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.2.0.0.0.Fakes
        {
            SPSite site = new Microsoft.SharePoint.SPSite("http://localhost");
            string listName = String.Format("List{0}", Guid.NewGuid());

            // create a new temporary list
            Guid listId = site.RootWeb.Lists.Add(listName, listName, SPListTemplateType.GenericList);
            Microsoft.SharePoint.SPList list = site.RootWeb.Lists[listId];
            Assert.IsNotNull(list, "Fail create fake SPList");

            // add fields to list
            list.Fields.Add("jobname", SPFieldType.Text, true);
            list.Fields.Add("timestamp", SPFieldType.Text, true);
            list.Update();

            // insert 1 item into list
            Microsoft.SharePoint.SPItem item = list.Items.Add();
            item["timestamp"] = "fake-guid";
            item["jobname"] = "fake-job";
            item.Update();

            Microsoft.SharePoint.SPListItemCollection listItemCollection = list.Items;
            var clientContext = new ClientContext(site.Url);
            foreach (var elem in listItemCollection)//var is System.Object somehow
            {
                var tmp = elem.ToString();
                tmp = "";
            }

            //need something like  "insert 1 item into list" from above, but ListItem type
            IEnumerable<ListItem> fakeTimeStampsList = null;

            //using moq here
            var mockDataProvider = new Mock<IListItemCollectionProvider>();
            mockDataProvider.Setup(foo => foo.GetListByTitle(It.IsAny<string>(), null, null))
                .Returns<IEnumerable<ListItem>>(_ => fakeTimeStampsList);

            //how it should work:
            //var result = mockDataProvider.Object.GetListByTitle("NoMetterWhatHere");,
            //where reult is IEnumerable<ListItem> with 1 ListItem inside
            //and it contains {[timestamp, fake-guid]}, {[jobname, fake-job]}

            //Finally instance class (by fake IListItemCollectionProvider), that should be tested
            var Page = new BaseReportPage(mockDataProvider.Object);
        }

A: Indeed, SharePoint.Emulators works with .NET Framework 3.5 only.
If you need to be able to fake SharePoint 2013 objects in a test project which uses .NET Framework 4.5 or later, you may be interested by a third-party NuGet package SPEmulators. The documentation is available here. The limitation of this package is that it requires .NET Framework 4.5, and won't work with .NET Framework 4.0.
For those who need a solution for .NET Framework 4.0, a related question on Sharepoint.StackExchange has an answer which consists of changing the version of .NET Framework just during the installation of Microsoft's SharePoint.Emulators package. As explained here:

After installing Sharepoint.Emulator in 3.5 I again change the framework to 4.0 and the project still works.


text:
Q: Fitting a bias in a weight decay regression using least-squares I'm calcualting the weights for a linear regression with weight-decay, i.e. normally I am trying to find beta = (X'X + lambda I)^-1 X'Y where X has n rows of D features each and Y is a vector of outputs for each row of X.
I've been fitting without a bias term by using:
def wd_fit(A, y, lamb=0):
    n_col = A.shape[1]
    return np.linalg.lstsq(A.T.dot(A) + lamb * np.identity(n_col), A.T.dot(y))

I'd like to also calculate a bias or intercept term for the fit, instead of having it pass through the origin.  I'd like to keep the same call to lstsq, so if there's some matrix transform I can carry out, that would be ideal.  My inclination is to append column of 1s somewhere, so that X_mod say would then have D+1 features where the last relates to the intercept value, but I'm not quite sure where that should be or even if it's correct.

A: If you don't want to mean-center your variables, adding a column of ones will work and is a perfectly acceptable solution.
The bias term will just be the coefficient at the position of the added column.


text:
Q: how checking a element exists or no with javaScript? I want to use javaScript inside Android.
I'm going to review after page load
Whether there is a Special tags, or not?
If there is to show the message "yes"
else showing message "no";
       web.loadUrl("my_url");

    web.setWebViewClient(new WebViewClient(){

        @Override
        public void onPageFinished(WebView view, String url) {
            // TODO Auto-generated method stub
            super.onPageFinished(view, url);
                 web.loadUrl("javascript:document.getElementById('Special_id');");
     if(){
             //if special_id exists showing toast.....yes
        }
       else{
        }

    });

I do not know how you should  do it(exists tag or no)

A: In order to check if the element is null, you will need to add a Javascript interface so that the page's Javascript can pass the element back to Java. You can define a Javascript interface in the same activity or fragment that you are using to manipulate the Webview:
public class JSInterface {
    @JavascriptInterface
    public void setElement(String element) {
        Log.i(TAG, "-----setElement");
        if(element != null){
            Toast.makeText(MainActivity.this,
                    "Object is not null",
                    Toast.LENGTH_LONG)
                    .show();
        } else{
            Log.i(TAG, "-----NULL");
        }
    }
}

You can check if an element with the id 'Special_id' exists by adding the following to your activity or fragment:
    webView.addJavascriptInterface(jsObject, "JSInterface");
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(new WebViewClient(){
        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            webView.loadUrl("javascript:var element = document.getElementById('Special_id');JSInterface.setElement(element);");
        }
    });

The page will call the method in your Javascript interface, passing in the element so that you can check if it is null.


text:
Q: How can I check my query history when using Robo 3T for MongoDB? When I use Robo 3T for MongoDB, can I have my query history scripts stored in Robo 3T, just like pl/sql developer for oracle?  this is a very key function cause often times I need to check my previously query inputs.

A: Here are some simple ways to check query history in Robo 3T:

*

*Switch to the View tab then choose Logs option.

*Click on Logs button in the bottom left corner of the screen to show the Logs panel.

*Shortcuts are Ctrl + L for trigger Logs panel.


text:
Q: "error": "$lookup argument 'pipeLine' must be a string I am getting this error I am trying to get seasons against series and episode against seasons. The seasons against series is working fine but when I am trying to get episodes against Seasons  I am getting this error: "error": "$lookup argument 'pipeLine' must be a string, found pipeLine: [ { $match: { $expr: { $eq: [ "$_id", "$$seasonId" ] } } } ]: array"
Code:
let query = [
                {
                    '$match': {
                        _id: objectId(series_id),
                    }
                },
                {
                    '$project': {
                        _id: 1,
                    }
                },
                {
                    '$lookup': {
                        "from": "seasons",
                        "let": {
                            "series_id": { '$toString': '$_id' }
                        },
                        "pipeline": [
                            {
                                '$match': {
                                    '$expr': {
                                        '$eq': [
                                            '$series_id',
                                            '$$series_id'
                                        ],
                                    },
                                },
                            },
                            {
                                "$project": {
                                    _id: 1,
                                    seasonName: 1,

                                }
                            },
                            {
                                '$lookup': {
                                    "from": "episodes",

                                    "let": {
                                        "seasonId": { "$convert": { input: '$_id', to: 'objectId', onError: '', onNull: '' } },
                                    },
                                    "pipeLine": [
                                        {
                                            '$match': {
                                                '$expr': {
                                                    '$eq': [
                                                        '$_id',
                                                        '$$seasonId'
                                                    ],
                                                },
                                            },
                                        },

                                    ],
                                    'as': 'Episodes'
                                }
                            }
                        ],
                        'as': 'Seasons'
                    }
                }

            ]


text:
Q: Correct Way to Call InputBox with Async/Await in VS Code In a VS Code extension I'm writing, I am trying to understand the right way to use an async function with an await in order to get data from an inputbox presented to the user.
The main part of my code that isn't working as I thought it would:
function runGitConfigCheck() {
    console.log('\nChecking for .gitconfig file');
    let requiredgitTags = ['user', 'http', 'https', 'core'];
    let requiredgitConfigItems =
    [
    'http.sslbackend=thebestSSLofcourse',
    'http.proxy=http://myproxy.website.example:1234',
    'https.proxy=http://myproxy.website.example:1234',
    'http.sslcainfo=C:\\Users\\myusername\\path\\to\\folder'
    ];
    /**
        TODO: other things here
     */

    let gitConfigExists: boolean = checkFileExistsInTargetFolder(userProfile, '\\.gitconfig');
    if (gitConfigExists === false) {
        // create new empty git config
        fs.appendFileSync(userProfile + '\\.gitconfig', '');
        requiredgitConfigItems.forEach(function (value) {
            console.log('Writing value to config: ' + value);
            fs.appendFileSync(userProfile + '\\.git', '\n' + value);
        });
    }
    else if (gitConfigExists === true) {
        console.log('.gitconfig file found');
        var gitconfig = ini.parse(fs.readFileSync(userProfile+"\\.gitconfig",'utf-8'));
        let attributes = getGitConfigAttributeNames(gitconfig);

        // check for the [user], [http], [https], and [core] attributes
        let tagsNotFound = new Array();
        let tagsFound = new Array();

        for (var tag in requiredgitTags) {
            let tagValue = requiredgitTags[tag];
            console.log('searching for tag '+tagValue);
            let search = searchForGitTag(tagValue, attributes);

            if(search === true) {
                tagsFound.push(tagValue);
            }
            else {
                tagsNotFound.push(tagValue);
            }
        }

        addGitTagsNotFound(tagsNotFound, userProfile+'\\.gitconfig');

        console.log('Finished doing all the things!');
    }
}

function appendItemsToConfigFile(file: fs.PathLike, configItems: string[], firstItemStartsNewLine?: boolean)
{
    let counter: number = 0;
    configItems.forEach(function (item) {
        if(firstItemStartsNewLine === true && counter === 0) {
            fs.writeFileSync(file, `\n${item}\n`, {encoding: 'utf-8', flag: 'as'});
        }
        else {
            fs.writeFileSync(file, `${item}\n`, {encoding: 'utf-8', flag: 'as'});
        }
        counter++;
    });
    return;
}

async function getUserInfo(myplaceholder: string) {
    let userInputWindow = vscode.window.showInputBox({ placeHolder: myplaceholder, prompt: 'Here is the prompt' });
    return userInputWindow;
}

function addGitTagsNotFound(tags: string[], configFile: fs.PathLike) {
    tags.forEach(function (tag) {
        switch(tag) {
            case 'user':
                let currentName = getUserInfo('Message1')
                .then(function (result) {
                    return result;
                });
                let currentEmail = getUserInfo('Message2')
                .then(function (result) {
                    return result;
                });
                console.log(currentEmail + ' ' currentEmail);
                break;
            case 'http':
                console.log('Adding config items for [http] tag');
                appendItemsToConfigFile(configFile, [`[${tag}]`,
                                                    '\tsslBackend=myconfig',
                                                    `\tsslCAInfo=${userProfile}\\path\\to\\folder`,
                                                    '\tproxy=http://myproxy.website.example:1234'], true);
                break;
            case 'https':
                console.log('Adding config items for [https] tag');
                appendItemsToConfigFile(configFile, [`[${tag}]`,
                                                    `\tsslCAInfo=${userProfile}\\path\\to\\folder`,
                                                    '\tproxy=proxy=http://myproxy.website.example:1234'], true);
                break;
            case 'core':
                console.log('Adding config items for [core] tag');
                appendItemsToConfigFile(configFile, [`[${tag}]`,
                                                    `\teditor=${userProfile}\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe -w`], true);
                break;
        }
    });
}

When calling addGitTagsNotFound() with an array and a file, the input box only appears after what seems the rest of the function  runGitConfigCheck() finishes in the extension's parent activate() function.
I think I am just not understanding async/await properly, and since I'm synchronously appending to the config file, my guess is that it's blocking the input box from popping up.
Anyone that could help explain this to me, I would really appreciate it!

A: I stepped into this question while looking for similar issue.
Basically you should add async prefix to the addGitTagsNotFound function
and add await to each call to async function: vscode.window.showInputBox() and getUserInfo()
Working example:
async function getUserInfo(myplaceholder: string) {
    let userInputWindow =  await vscode.window.showInputBox({ placeHolder: myplaceholder, prompt: 'Here is the prompt' });
    return userInputWindow;
}

async function addGitTagsNotFound(tags: string[], configFile: fs.PathLike) {
    tags.forEach(function (tag) {
        switch(tag) {
            case 'user':
                let currentName = await getUserInfo('Message1')
                .then(function (result) {
                    return result;
                });
                let currentEmail = await getUserInfo('Message2')
                .then(function (result) {
                    return result;
                });
                console.log(currentEmail + ' ' currentEmail);
                break;
            case 'http':
                console.log('Adding config items for [http] tag');
                appendItemsToConfigFile(configFile, [`[${tag}]`,
                                                    '\tsslBackend=myconfig',
                                                    `\tsslCAInfo=${userProfile}\\path\\to\\folder`,
                                                    '\tproxy=http://myproxy.website.example:1234'], true);
                break;
            case 'https':
                console.log('Adding config items for [https] tag');
                appendItemsToConfigFile(configFile, [`[${tag}]`,
                                                    `\tsslCAInfo=${userProfile}\\path\\to\\folder`,
                                                    '\tproxy=proxy=http://myproxy.website.example:1234'], true);
                break;
            case 'core':
                console.log('Adding config items for [core] tag');
                appendItemsToConfigFile(configFile, [`[${tag}]`,
                                                    `\teditor=${userProfile}\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe -w`], true);
                break;
        }
    });
}


text:
Q: SVG images not showing in SharePoint 2010 Content Editor Web Part with IE11 Ultimately, I am trying to use D3js.org in a SharePoint 2010 CEWP to visualize some data. However, after loading a script I just get a blank web part. I can successfully run jQuery in CEWP so I assume I am setting everything up correctly.
I've narrowed it down to what I think is an issue with SharePoint 2010 displaying SVG images correctly as I cannot display a simple SVG from the below script. I am aware that D3 is dependent on SVG functionality. I am running IE11. Any help would be hugely appreciated and please go easy on the explanation, I'm a bit of a noob.

A: You can change document mode to IE9. Add below to your master page
<meta http-equiv="X-UA-Compatible" content="IE=9">


text:
Q: Apache Ignite over hive database : How to connect Hive database in Ignite? How to connect Hive database in Ignite framework?
Can we use already existing hive database and hive tables over Ignite?

A: There are two options I think:

*

*Load all data from Hive database and recreate the same schema in Ignite and stream all data to it with DataStreamer

*Connect to Hive Database by using CacheJdbcPojoStore and Hive JDBC Driver.


text:
Q: How do I detect if a specific buffer exists in Vimscript? I want to detect if a specific file is already opened (visible) in a Vim window with Vimscript. If the file isn't open (visible) in a vim-window, I want to open it via :edit.
I have a variable with the expanded file path and want to check whether a file with that expanded filepath is already opened (visible) in a Vim window.
How can I do that?
A second question about that is how I can get a list with all opened (visible) files and all not visible but open files (buffers).
I think this is mainly about buffers.
SOLUTION (2016.02.18)
thx @muru for pointing in to the needed functions.
my test solution looks like that in the moment
function! ChooseBuffer(buffername)
    let bnr = bufwinnr(a:buffername)
    if bnr > 0
       :exe bnr . "wincmd w"
    else
       echo a:buffername . ' is not existent'
       silent execute 'split ' . a:buffername
    endif
 endfunction
:nnoremap <leader><leader>d :call ChooseBuffer("divramod.vim")<cr>
:nnoremap <leader><leader>1 :call ChooseBuffer("vim/plugin/divramod/test1.vim")<cr>
:nnoremap <leader><leader>2 :call ChooseBuffer("vim/plugin/divramod/test2.vim")<cr>
:nnoremap <leader><leader>t :call ChooseBuffer("vim/plugin/divramod/test.vim")<cr>

It seems to be the case, that bufwinnr() finds "divramod.vim" despite the fact, that the buffername in the bufferlist is called "vim/plugin/divramod/divramod.vim". It seems to use a regex for searching inside the buffername. i have to experiment, what happens when two buffers with the same filename but different file pathes are opened.

A: If you want to know if a buffer exists, not that it both exists and is open in some window, use bufexists(buffer_number). I recommend  using bufexists(str2nr(buffer_number)), in case your buffer variable happens to be a string. This will return 1, even if your buffer exists, but isn't open in any current windows.

A: bufwinnr() doesn't take into account other tab pages. Since Vim patch 7.4.1558 there's a new function called win_findbuf({bufnr}), which will return a list of all window-IDs that contain buffer, from all tab pages.

A: You can use the bufwinnr() function:
bufwinnr({expr})                                        bufwinnr()
            The result is a Number, which is the number of the first
            window associated with buffer {expr}.  For the use of {expr},
            see bufname() above.  If buffer {expr} doesn't exist or
            there is no such window, -1 is returned.

And from bufname():
            If the {expr} argument is a string it must match a buffer name
            exactly.  The name can be:
            - Relative to the current directory.
            - A full path.
            - The name of a buffer with 'buftype' set to "nofile".
            - A URL name.

So, something like:
if bufwinnr(myfile) > 0
  echo "Already open"
endif


text:
Q: Running a Python program in Unity on Android TLDR: How many different ways can I run a Python program in Unity on an Android device?
This is for a Android app that stores a geolocation, which is to be queried later on other devices.
I know about IronPython but it is not updated for Python 3+, which is what I used to write the Python program I need to run.
More backstory:
I am trying to use AWS dynamoDB which has an SDK for Unity as it's built on .net. However, specifically for query search, they have not implemented < or > or compound searches, whereas that implementation is available in Python.
The following Python script works.
import boto3
import json
import decimal
from boto3.dynamodb.conditions import Key, Attr
import sys

lat = sys.argv[1]
lon = sys.argv[2]
r = sys.argv[3]

# Helper class to convert a DynamoDB item to JSON.
class DecimalEncoder(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, decimal.Decimal):
            if o % 1 > 0:
                return float(o)
            else:
                return int(o)
        return super(DecimalEncoder, self).default(o)

dynamodb = boto3.resource('dynamodb')

table = dynamodb.Table('tree')

fe = Key('lon').between((decimal.Decimal(lat) - decimal.Decimal(r)), (decimal.Decimal(lat) + decimal.Decimal(r)))
 #THIS IS THE BETWEEN SEARCH THAT IS NOT AVAILABLE IN UNITY
fe1 = Key('lat').between((decimal.Decimal(lon) - decimal.Decimal(r)), (decimal.Decimal(lon) + decimal.Decimal(r)))
pe = "#l, lon, treeStage"
# Expression Attribute Names for Projection Expression only.
ean = { "#l": "lat", }
esk = None

response = table.scan(
    FilterExpression=fe,
    ProjectionExpression=pe,
    ExpressionAttributeNames=ean
    )

for i in response['Items']:
    print(json.dumps(i, cls=DecimalEncoder))

while 'LastEvaluatedKey' in response:
    response = table.scan(
        ProjectionExpression=pe,
        FilterExpression=fe and fe1, #THIS IS THE COMPOUND SEARCH THAT DOESNT WORK IN UNITY
        ExpressionAttributeNames= ean,
        ExclusiveStartKey=response['LastEvaluatedKey']

        )

    for i in response['Items']:
        print(json.dumps(i, cls=DecimalEncoder))

My question is: what available options do I have to build this Python program into a file type that could be run on an Android device through Unity's C#?
Currently I'm just printing the info received from dynamoDB, but I would be open to reading it directly or writing to a file to read in Unity if necessary.

A: Yes, you can use python language to program in unity.
Check this out → http://forum.unity3d.com/threads...
Alternatively, you can use this Python Interpreter but its reviews are not that great.
Also, you can call Python from C# using IronPython → Running IronPython Scripts from a C# 4.0 Program
But I would NOT propose to use Python...
Unity's primary development language is C#. I'll recommend you to learn C#. Read more here → If I want to develop in Unity, should I learn basics of C# or start developing right away?
Or If you are familiar and good at Open GL and Open CV → refer to this Augmented reality with Python and OpenCV (part 1) to create AR app using Python. or use Pygame AR example.

A: There no performant and maintained solution to do this. There are some community-made solutions but they are too unstable for a production game.
You can host this python script on a webservices. You can call webserives, it will get data and process it then returns to you. This way is probably the easiest and most efficient.
If not possible, you can use python-for-android. But this complicates things alot and not performant at all.


text:
Q: Running protractor with spring-boot i wan´t to run end2end-test for my angular (7) application in a buildserver (bamboo). The application runs with spring-boot (2.1.x) as backend (java - microfrontend). So my problem is, how can i call protractor-tests from my (integration-)tests which runs an embedded sping-boot.
I know there is selenium (and also two other projects which aren´t maintenanced) for java but protractor has much more features for angular.
Can i call single tests from protractor in a command-line which i call from the java-code? Or anything else?
Thanks (and sorry for my english)
René

A: You can try maven execute command plug-in. Call your spring Boot with profile to run first (i.e local profile with H2 database) and then call ng e2e with environment that points to your local spring Boot you started.
This approach is still not as integrated though. I am also looking for better way of doing this.


text:
Q: iOS - Constraints - Two Views next to each other in UITableViewCell I have a problem with using constraints. I want to put two UIViews next to each other in a UITableViewCell. It should look like this:

But after I add the suggested constraints, or when I add them manually, the cell always looks like this:

Why is it like that? The width of both UIViews should be flexible depending on the width of the screen.
Can someone help me? Which constraints are missing?
Thanks!

A: I think the main thing you need is to add an "Equal Width" constraint between the two views.
If you are using Interface Builder, press CTRL and drag one view to the other, a menu will appear and select "Equal Widths".
After that, you just need to pin your views borders to the Cell borders (except right border of left view to left border of right view)
Picture showing pin constraints
http://i.stack.imgur.com/lhpVk.png

A: do not use suggested constraints, clear all constraints of both view.
Add constrains using "pin" 2nd option from left side(autolayout)
for left side view add constraints
1) from left
2) from top
3) height
4) width
for right side view add constraints
1) from right
2) from top
3) height
4) width


text:
Q: Do we have a sanbox for HERE Map Feedback API Am I right that for developers' purposes: testing and actual development we just need to use credentials posted here https://developer.here.com/documentation/examples/rest/map_feedback/place-details-feedback?
E.g we do not have any special endpoint AKA sandbox?

A: There is no sandbox or CIT environment for the HERE Map Feedback API available that is correct.
The credentials which you see in the example page are not for external usage nor development purpose. Please use your own credentails for acessing the service.


text:
Q: Centering axis title relative to the entire plot area in R Plotly I have a horizontal bar chart in Plotly with quite long axis labels and a long x-axis title. I'm using this figure in Shiny so it's width vary depending on the users screen sie. The problem is that on smaller screens the axis title is cut. I want it to be centered relative to the entire plot area instead of the axis to prevent this.
Minimal example:
data <- data.frame(
    x = c(0.5, 0.3, 0.1),
    y = c("Long axis label 1", "Long axis label 2", "Long axis label 3")
)

plot_ly(
    data,
    y = ~ y,
    x = ~ x,
    type = "bar"
) %>% layout(
        margin = list(l = 160, r = 20, b = 50, t = 20),
        xaxis = list(title = "Preeeeeeeeeeeeeety long X axis label", tickformat = "%"),
        yaxis = list(title = "Y axis label", tickprefix = "    ", tickwidth = 1, tickcolor = toRGB("white"))

    )

How it looks on smaller screens:

Here's how I would like it to be:

I've already figured out that I can move the title to the left by adding non breaking spaces like list(title = "Preeeeeeeeeeeeeety long X axis label   ") but that's not what I need. Any ideas on how to center it properly?

A: This is not exacty what you want but is the only way I know. Hope it helps:
library(dplyr)
library(plotly)

data <- data.frame(
  x = c(0.5, 0.3, 0.1),
  y = c("Long axis label 1", "Long axis label 2", "Long axis label 3")
)

plot_ly(
  data,
  y = ~ y,
  x = ~ x,
  type = "bar"
) %>% layout(
  margin = list(l = 160, r = 20, b = 50, t = 20),
  annotations = list(text = 'Preeeeeeeeeeeeeety long X axis label',
                     font = list(size = 12),
                     showarrow = F,
                     xref = 'paper', x = -0.3,
                     yref = 'paper', y = -0.2))

)