text:
Q: Karabiner-Elements map a key to a combination keys I'm new to Karabiner. As I understand it this program can change the keyboard mapping.
I understand and able to use the "Simple modification" "From key" "To key".
But If I want to remap my Home button to CTRL+LEFT_ARROW how do I do that?
Currently on MacOs Mojave

A: Open ~/.config/karabiner/karabiner.json
Edit that file, from the root level > "profiles" > "complex_modifications" > under parameters:{ ... }, add:
"rules": [
                    {
                        "description": "Home to Control Left",
                        "manipulators": [
                            {
                                "from": {
                                    "key_code": "home"
                                },
                                "to": [
                                    {
                                        "key_code": "left_arrow",
                                        "modifiers": "control"
                                    }
                                ],
                                "type": "basic"
                            }
                        ]
                    },
                    {
                        "description": "End to Control Right",
                        "manipulators": [
                            {
                                "from": {
                                    "key_code": "end"
                                },
                                "to": [
                                    {
                                        "key_code": "right_arrow",
                                        "modifiers": "control"
                                    }
                                ],
                                "type": "basic"
                            }
                        ]
                    }
                ]

Please note that, this will map:

*

*HOME to CTRL+LEFT

*END to CTRL+RIGHT

A: Create ~/.config/karabiner/line.json as:
{
  "title": "Line-related mappings",
  "rules": [
    {
      "description": "Home to Cmd+Left: Move to line start",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "home",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": "command"
            }
          ]
        }
      ]
    },
    {
      "description": "Shift+Home to Shift+Cmd+Left: Select to line start",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "home",
            "modifiers": {
              "mandatory": [
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                "shift",
                "command"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "End to Cmd+Right: Move to line end",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "end",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": "command"
            }
          ]
        }
      ]
    },
    {
      "description": "Shift+End to Shift+Cmd+Right: Select to line end",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "end",
            "modifiers": {
              "mandatory": [
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                "shift",
                "command"
              ]
            }
          ]
        }
      ]
    }
  ]
}

Then in Karabiner, go to Preferences -> Complex Modifications -> Add Rules -> Enable All.
The above and others can be found in https://github.com/noel-yap/karabiner.


text:
Q: Proper way to define xsd schema in my situation <Item id="G1@MIT" type="GROUP">
   <Item id="B1@MIT" type="BLOCKSEGMENT"/>
   <Item id="S1@MIT" type="SWITCH"/>
</Item>

xml content above is an example of my xml data.
As you see I have Items that can contain other items.
My first question is how to define xml schema in this situation.
My second question is I want my id attribute to contain '@' character.
How can I achieve this?

A: Defining recursive structures in XML Schema is trivial. It's just a matter of defining a type that contains an element of that type:
<xs:complexType name="ItemType">
  <xs:sequence minOccurs="0">
    <xs:element name="Item" type="ItemType"></xs:element>
  </xs:sequence>
</xs:complexType>

Attributes can contain the @ character by default without any issues. If you want to force the attribute to contain that character then you should read up on XML Schema restrictions. In particular you'll want to look at the xs:pattern element.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I test Repository pattern in .NET Core I am trying to setup tests using Moq + Nunit.
I am using the Repository pattern
public interface IRepository<T> where T : class
{
    Task<List<T>> FindByConditionAsync(Expression<Func<T, bool>> expression);
    Task<List<T>> GetAllAsync();
    //...
}

public class Repository<TEntity, TContext> : IRepository<TEntity>
{
    //...Omitted other code from this snippet

    public async Task<List<TEntity>> FindByConditionAsync(Expression<Func<TEntity, bool>> expression)
    {
        return await _context.Set<TEntity>().Where(expression).ToListAsync();
    }
}

public interface IUserRepository : IRepository<User>
{

}

public class UserRepository : Repository<User, MyDatabase>, IUserRepository
{
    public UserRepository(MyDatabase context) : base(context)
    {
    }
}

My test file
public class UserProviderTests
{
    private IMapper _mapper;
    private UserProvider _userProvider;
    private Mock<MyDatabase> _mockContext;
    private UserRepository _userRepository;

    [SetUp]
    public void Setup()
    {
        var user1Guid = Guid.NewGuid();
        var user2Guid = Guid.NewGuid();
        var data = new List<User>
        {
            new User
            {
                Id = user1Guid,
                FirstName = "Optimus",
                LastName = "Prime"
            },
            new User
            {
                Id = user2Guid,
                FirstName = "John",
                LastName = "Doe",
            }
        }.AsQueryable();

        var mockSet = new Mock<DbSet<User>>();
        mockSet.As<IQueryable<User>>().Setup(m => m.Provider).Returns(data.Provider);
        mockSet.As<IQueryable<User>>().Setup(m => m.Expression).Returns(data.Expression);
        mockSet.As<IQueryable<User>>().Setup(m => m.ElementType).Returns(data.ElementType);
        mockSet.As<IQueryable<User>>().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

        var options = new DbContextOptionsBuilder<MyDatabase>()
            .UseSqlServer("fakestring")
            .Options;

        _mockContext = new Mock<MyDatabase>(options);

        _mockContext.Setup(c => c.Users).Returns(mockSet.Object);
        _userRepository = new UserRepository(_mockContext.Object);

        var config = new MapperConfiguration(cfg => {
            cfg.AddProfile<MappingProfile>();
        });
        _mapper = new Mapper(config);

        _userProvider = new UserProvider(_mapper, _userRepository);
    }

    [Test]
    public async Task GetUsers_ReturnsSingleUser()
    {
        var users = await _userProvider.FindUser("xxx");
        Assert.AreEqual("xxx", users.FirstOrDefault()?.FirstName);
    }
}

UserProvider is a service I am using that uses UserRepository to perform CRUD operations.
But When I try to run this test, I get error saying -

System.ArgumentNullException : Value cannot be null. (Parameter 'source')
Stack Trace:
Queryable.Where[TSource](IQueryable'1 source, Expression'1 predicate)
Repository'2.FindByConditionAsync(Expression'1 expression) line 48

Sorry for the long question, but am I missing something here? I don't understand why TSource(USer object) is null.

A: In my opinion, you should write a test for services in your project. In fact, you shouldn't write any business in the RepositoryLayer because there isn't any business rule in the Repository. If you need to help more please contact me.
dpournabi@gmail.com


text:
Q: EF with oracle - "The specified store provider cannot be found in the configuration, or is not valid." I am using entity framework with oracle client (odp.net) in a .net 4.5 program.
In production machine I get the following error:
System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.
   at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)

No error on development machine.
There are other .net programs on the production machine that run successfully against oracle using odp.net.
These old programs are with .net 3.5.
I understood that because .net 4.5 was installed after the Orcale client installation the oracle
data access components are not registered in .net 4.5 machine.config  .
I tried copying the system.data section from the 3.5 machine.config into the application's config file  - but it did not help.
Reinstalling Oracle client is not something we would like to do - because of the other appllcations that work fine.
I also noticed that that there is a minor difference in the ODP.Net version between the development machine and production.
My project does not have any reference to oracle.dataaccess.dll.

A: Can you run the Oracle installer for ODAC on the production machine? That will create the required machine.config entries.
Also in a the currently available beta, we offer a "local" install which modifies the web or app config rather than the machine config.

A: May be you just installed the 32 bit version on the 64 operating system. In run time you also need to install 64 bit version.
be sure you add the tns file and reastart after installation

A: If you are on a 64-bit system, make sure the application pool that your ASP.NET app is using allows 32-bit applications. Use Internet Information Services (IIS) Manager tool under Administration Tools to configure your web app and the corresponding pool. (Find the pool in the IIS Manager, right-click on it and select Advanced Settings.) Otherwise your application may run in the 64-bit mode and seek a 64-bit version of the Oracle data provider which may not be present on your machine.


text:
Q: Не подключаются стили в теме wordpress с использованием wp_enqueue_style Пишу в functions.php код:
function add_theme_styles()
{
    wp_register_style('main', get_template_directory_uri() . '/css/main.css');
    wp_enqueue_style('main');
}
add_action('wp_enqueue_scripts', 'add_theme_styles');

Стили не грузятся. В header.php есть wp_head(). Подскажите, пожалуйста, в чем может быть проблема?

A: Я проверил, метод работает. Проверьте путь и наличие самого файла. Так же wp_head(). Если вы видите, что файл физически есть, но выдается 404, тогда измените постоянные ссылки на стандартные в wordpress на время разработки и верните обратно, после чего должно заработать. Это частая проблема при переносе и добавлении новых файлов.
Чтобы запустить механизм сканирования url нужно пройти сюда
http://example.com/wp-admin/options-permalink.php

После чего поменять местами параметры и вернуть исходные, если необходимо.

После чего потерянные страницы и классы будут отображены по назначеному вами адресу.


text:
Q: How to echo (a (executable-)string) to the prompt, so that the cursor flashes at the end of the line? How to echo (a (executable-)string) to the prompt to make the cursor sit at the end of the line?
So that I can hit Enter to execute or Ctrl-C to throw away the line.
Is this possible at all?
I know an (interactive) bash-script would probably be nicer,  but I'd like to keep it simple.
Example:
echo_to_prompt "rm -R ./tmp/logs/delete_me_every_once_in_a_while/"

would result in:
user@machine:~$ rm -R ./tmp/logs/delete_me_every_once_in_a_while/[CURSOR]

A: If you need the echo_to_prompt() command in a shell script or on the normal command line, you can simply use read:
#!/bin/sh

echo_to_prompt() {
        echo -n "$USER@$HOSTNAME:$PWD $" $@
        read && $@
}

echo_to_prompt rm -R ./tmp/logs/delete_me_every_once_in_a_while/

You can add the echo_to_prompt() function to your .bashrc/.profile/... if you want it on the command line.

A: There are a few control sequences that you can send to a terminal, and it will simulate some input. You cannot directly simulate any input, however: this would not be particularly useful, and it would be dangerous to generate arbitrary input when displaying a file that contains control characters.
Most such control sequences (Device Status Report, mouse position reporting, etc.) send back control sequences that are harmless if typed. Some traditional terminals (including older versions of xterm) had a control sequence to send back the window title, which can be set by another control sequence, but modern terminals ignore this command.
To cut a long story short, this is not possible, precisely to avoid what you're trying to do.

A: With zsh.
zle-line-init() {
  ((SECONDS - last < 300)) && return
  LBUFFER="rm -R ./... "
  last=$SECONDS
  zle -R
}
zle -N zle-line-init

(to do it (at most) every 5 minutes).
I don't like the idea of a command appearing suddenly in my prompt though.


text:
Q: API для подсказок при вводе адреса Как лучше реализовать ввод пользователем адреса доставки? Использую React. Адрес вводится в input. Но можно сделать подсказку. Когда вводишь символ в input предлагаются сразу варианты, чтобы человеку не нужно было долго писать. Как это осуществить? Каким инструментом пользоваться? Что посоветуете?

A: На событие ввода символа (а лучше спустя небольшой таймаут) вешаешь обработчик, который спрашивает у сервера об api варианты значений, подходящих под введённые символы. Результат рендеришь в "выпадающем меню".
Ну а вообще, можно конечно воспользоваться вот этим: https://kladr-api.ru/examples

A: Вот хорошая библиотека React Autosuggest Ссылка на рабочий пример codepen

const languages = [
  {
    name: 'C',
    year: 1972
  },
  {
    name: 'C#',
    year: 2000
  },
  {
    name: 'C++',
    year: 1983
  },
  {
    name: 'Clojure',
    year: 2007
  },
  {
    name: 'Elm',
    year: 2012
  },
  {
    name: 'Go',
    year: 2009
  },
  {
    name: 'Haskell',
    year: 1990
  },
  {
    name: 'Java',
    year: 1995
  },
  {
    name: 'Javascript',
    year: 1995
  },
  {
    name: 'Perl',
    year: 1987
  },
  {
    name: 'PHP',
    year: 1995
  },
  {
    name: 'Python',
    year: 1991
  },
  {
    name: 'Ruby',
    year: 1995
  },
  {
    name: 'Scala',
    year: 2003
  }
];

// https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions#Using_Special_Characters
const escapeRegexCharacters = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');

const getSuggestions = value => {
  const escapedValue = escapeRegexCharacters(value.trim());

  if (escapedValue === '') {
    return [];
  }

  const regex = new RegExp('^' + escapedValue, 'i');
  const suggestions = languages.filter(language => regex.test(language.name));

  if (suggestions.length === 0) {
    return [
      { isAddNew: true }
    ];
  }

  return suggestions;
}

class App extends React.Component {
  constructor() {
    super();

    this.state = {
      value: '',
      suggestions: []
    };
  }

  onChange = (event, { newValue, method }) => {
    this.setState({
      value: newValue
    });
  };

  getSuggestionValue = suggestion => {
    if (suggestion.isAddNew) {
      return this.state.value;
    }

    return suggestion.name;
  };

  renderSuggestion = suggestion => {
    if (suggestion.isAddNew) {
      return (

          [+] Add new: {this.state.value}

      );
    }

    return suggestion.name;
  };

  onSuggestionsFetchRequested = ({ value }) => {
    this.setState({
      suggestions: getSuggestions(value)
    });
  };

  onSuggestionsClearRequested = () => {
    this.setState({
      suggestions: []
    });
  };

  onSuggestionSelected = (event, { suggestion }) => {
    if (suggestion.isAddNew) {
      console.log('Add new:', this.state.value);
    }
  };

  render() {
    const { value, suggestions } = this.state;
    const inputProps = {
      placeholder: "Type 'c'",
      value,
      onChange: this.onChange
    };

    return (
      <Autosuggest
        suggestions={suggestions}
        onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
        onSuggestionsClearRequested={this.onSuggestionsClearRequested}
        getSuggestionValue={this.getSuggestionValue}
        renderSuggestion={this.renderSuggestion}
        onSuggestionSelected={this.onSuggestionSelected}
        inputProps={inputProps}
      />
    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));
body {
  font-family: Helvetica, sans-serif;
}

.react-autosuggest__container {
  position: relative;
}

.react-autosuggest__input {
  width: 240px;
  height: 30px;
  padding: 10px 20px;
  font-family: Helvetica, sans-serif;
  font-weight: 300;
  font-size: 16px;
  border: 1px solid #aaa;
  border-radius: 4px;
}

.react-autosuggest__input--focused {
  outline: none;
}

.react-autosuggest__input--open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.react-autosuggest__suggestions-container {
  display: none;
}

.react-autosuggest__suggestions-container--open {
  display: block;
  position: absolute;
  top: 51px;
  width: 280px;
  border: 1px solid #aaa;
  background-color: #fff;
  font-family: Helvetica, sans-serif;
  font-weight: 300;
  font-size: 16px;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  z-index: 2;
}

.react-autosuggest__suggestions-list {
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.react-autosuggest__suggestion {
  cursor: pointer;
  padding: 10px 20px;
}

.react-autosuggest__suggestion--highlighted {
  background-color: #ddd;
}

.footer {
  margin: 9px 20px;
  font-size: 12px;
  color: #777;
}

Add new option


text:
Q: Conditional expectation involving Order Statistics Let $X_1,X_2,...,X_n$ be a random sample of size $n \geq 2$ from $\exp(1/\theta)$, where $\theta \in (0,\infty)$.
Let $$Y = \min\{X_1,X_2,...,X_n\} \qquad \textrm{and} \qquad T = \sum_{i=1}^{n} X_i .$$ I am supposed to find $E[Y|T]$.
I tried using the Basu's theorem, but then I realized that I could apply it only when $T$ took a particular value. Also, I tried finding the joint pdf of first order stats and $T$, but couldn't do that either.


text:
Q: Can Ubuntu 16.04 32/64-bit be installed in Pentium D I want to install Ubuntu 16.04 in the system
Configuration of the system

Memory -2Gb
Processor -Intel® Pentium(R) D CPU 2.80GHz × 2
Graphics -Intel® 945G
Disk Size -77Gb

Currently I have "Oracle Linux Server 7.2" 64-bit in this system, but it lags a lot.
Thanks


text:
Q: Function whose sets of discontinuities and zeros are the rationals Question: Is there a real valued function $f:\mathbb{R}\to\mathbb{R}$ such that its set of discontinuities is $\mathbb{Q}$ and its set of zeros $\{x\in \mathbb{R}\mid f(x)=0\}$ is also $\mathbb{Q}$?
It's well known that the Thomae function has as discontinuities the rationals. However, its zero set is $\mathbb{R}\setminus\mathbb{Q}$. On the other hand, the characteristic function of the set of irrational numbers has the rationals as zero set but its set of discontinuities is $\mathbb{R}$. So none of the candidates, that come to mind first, work.

A: There isn't such a function. If $f$ is nonzero and continuous at some point $x$, then there is a neighbourhood of $f$ on which $x$ doesn't vanish. Hence if the zero set of $f$ is dense, then the function has to be discontinuous at every value on which it doesn't vanish.


text:
Q: I get Error 403 Forbidden when try to reach Pastebin links Since yesterday when I try to get some text from Pastebin I get the "Error 403 Forbidden" message.
My current code which worked for months:
//...
    var url_main = "raw_pastebin_link";
    var client_main = new WebClient();
    using (var stream_main = client_main.OpenRead(url_main))
    using (var reader_main = new StreamReader(stream_main))
    {
    //Some code
    }
//...

I try to add some headers like this but the problem is still.
//...
            var client_main = new WebClient();
            client_main.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/6.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36.");
            using (var stream_main = client_main.OpenRead(url_main))
//...

Maybe the Pastebin servers banned my IP?
(The links are good when I open them in a browser)
Is there any way to solve this error?
Thanks!

A: I have recently also experienced this and this is the solution I am currently using in my project.
using System.Net.Http;

string urlData = String.Empty;
WebClient WebClient = new WebClient();

// Add headers to impersonate a web browser. Some web sites
// will not respond correctly without these headers
WebClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12");
WebClient.Headers.Add("Accept", "*/*");
WebClient.Headers.Add("Accept-Language", "en-gb,en;q=0.5");
WebClient.Headers.Add("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");

urlData = WebClient.DownloadString("enter your URL here");

Let me know if this worked for you!


text:
Q: How to read/calculte data using loop in python? I am the new for python. I try to process data (g in following) using difference method, that subtracts one array from others. I have the following codes. The difference between code 1 and code 2 is: code 1 preallocates a space for list, and in the loop  replace every value. Code 2 only defines an empty list at first, and appends data to defined list in loop. The results are the same. However, I'm not familiar with python and do not know which is good. Could  someone give me an advice? or a more developed modification about this code?
BR
XJ
#Same part:
g = range(1,12)
width  = [0.1, 0.1, 0.1, 0.2, 0.2, 0.2, 0.3, 0.3, 0.3]
length = [1, 2, 3, 1, 2, 3, 1, 2, 3]
width  = set(width)
length = set(width)
nr_w = len(width)
nr_l = len(length)
#different parts:
# %%
#Code 1:
i = 0
g_new_1 = [0]*nr_w*(nr_l-1) # preallocating
for i_w in range(nr_w):
    for i_l in range(nr_l):
        if i_l != 0:
            g_new_1[i] = g[i_w*nr_l+i_l] - g[i_w*nr_w]
            i=i+1
# %%
#Code 2:
g_new_2 = []
for i_w in range(nr_w):
    for i_l in range(nr_l):
        if i_l != 0:
            g_new_2.append( g[i_w*nr_l+i_l] - g[i_w*nr_w] )

print(g_new_1 == g_new_2)


text:
Q: SVG s refX/refX attribute and placing a  relative to its center According to SVG's symbol documentation, I can add the refX/refY attributes to it.
If I understand correctly, I can use these attributes to define a reference point in the symbol's coordinate system so when I reference it with <use> element, it will be placed relative to that reference point (instead of the default upper left corner).
But these attributes don't seem to do that or have any effect on the symbol's placement at all. I can't find any additional information about these attributes (for symbol) or whether they are supported in any browser.
Is this how refX/refY actually suppose to work? Are they implemented in any browsers?
If not, Is there any other way to place a symbol with <use> element relative to the symbol's center without knowing/calculating its actual width/height in advance?

A: I also found that the refX and refY don't work with the symbols. I did find a workaround to effectively do the same thing though. The key is setting the symbol "overflow" variable equal to "visible". The insertion point of the symbol, when using the "use" function, is the always the origin (0,0 coordinate) of the symbols coordinate system, so you simply have to set your symbol up in a way that makes the symbols origin on top of the point where you would like to insert it. I found it easies to do this using a transform because you simply need to use the negative values for the insertion point you want.
Example of making the insertion point the center of a square:
<symbol id="test" overflow="visible" >
   <g transform="translate(-50 -50)" >
      <rect x="0" y="0" width="100" height="100" stroke="black"/>
   </g>
</symbol>


text:
Q: How to call Shell Script from Java Program using Hive JDBC I have implemented a task in Hive.
But now I need to call a Shell Script which I have written for importing the tables in Hive from SQL Server using SQOOP. In that Shell Script I have written a SQOOP Command for importing the tables in HIve.
I tried to call a Shell Script in one of the Demo Application but as the Program runs no action taken place. I just see the blank console.
Do I need to do something extra in case of Hive?
Please help me out from this.
Thanks.

A: Try to run /bin/sh /home/....TableToExport.sh.
This explicitly defines the shell that interprets your script. This should work.
If it does not work try to simplify your command line. Start from running simple command like ls or hostname. When it works try to execute something more complicated.
Generally it should work. You are on the right way.


text:
Q: Would it have a solution to read the ".sol" type file of the HaxelFlixel software in javascript? I try to extract data from a ".sol" file, this file comes out of the data stored in the game Friday night funkin.
I try to get the score of each week from this file to display it from a web page
For information I use the packet "electron" to help me to do this.
I would be happy to learn how to read this type of data to continue!
Thanks to those who took the time to read !
By opening the ".sol" file, I understood at first that it was not easy to read, and that it was probably made only for HaxelFlixel (Software that uses the game), time after time I understood that the ":" separate the total data, and that the stored data was between an "i".
So I tried to do this in javascript but not all data do this.
It gave me a very untidy code (I am bad):
//namesearch: name of the folder where the file we need is located
  async function writescoreweek(namesearch) {
    try {
      var current = [];
      const search = ["week9", "week8", "week7", "week6", "week5", "week4", "week3", "week2", "week1", "week0"];
      for (var i = 0; i < search.length; i++) {
        var searchfct = searchscoreweek(`${namesearch}`, search[i]);
        if (searchfct != "") {
          let student = {
            name: search[i],
            score: searchfct
          };
          (current).push(student);
        }
      }
    } catch (err) {
      console.log(err)
    } finally {
      await fs.writeFileSync(`./data/${namesearch}.json`, JSON.stringify(current, null, 4));
      var weekjson = await require(`./data/${namesearch}.json`);
      return weekjson
    }
  }

  function searchscoreweek(game, search) {
    try {
      const helloPath = path.resolve(__dirname, `${process.env.APPDATA}/ShadowMario/${game}/ninjamuffin99/`, 'funkin.sol');
      const helloSource = fs.readFileSync(helloPath, 'utf8');
      var debut = helloSource.substring(
        helloSource.indexOf("i") + 1,
        helloSource.lastIndexOf("y")
      );
      debut = debut.split(":")
      //console.log(debut)
      var after = [];
      for (var i = 0; i < debut.length; i++) {
        if (debut[i].search(`${search}`) != -1) {
          after.push(debut[i])
        }
      }
    } catch (err) {

    } finally {
      //console.log(after)
      var fin = [];
      for (var i = 0; i < after.length; i++) {
        fin.push(after[i].substring(
          after[i].indexOf("i") + 1,
          after[i].lastIndexOf("y")
        ));
      }
      var apresfin = [];
      for (var i = 0; i < fin.length; i++) {
        if (fin[i].search(`${search}`) == -1) {
          apresfin.push(fin[i])
        }

      }
      return apresfin;
    }
  }

So I concluded that it must be a file type propietaire!
I'm thinking of using "hxnodejs" but I don't see how I can do it at all.
oy11:timeBarTypey11:Time%20Lefty11:comboOffsetazzzzhy8:arrowHSVaazzzhazzzhazzzhazzzhhy12:middleScrollfy9:scoreZoomty10:noteOffsetzy12:ghostTappingty14:healthBarAlphai1y12:noteSplashesty16:gameplaySettingsby12:opponentplayfy9:instakillfy11:scrollspeedi1y9:songspeedi1y7:botplayfy8:practicefy10:healthgaini1y10:scrolltypey14:multiplicativey10:healthlossi1hy10:lowQualityfy7:showFPSty10:goodWindowi90y9:frameratei144y7:noResetfy7:shadersfy10:sickWindowi45y10:downScrollfy12:ratingOffsetzy8:camZoomsty10:songRatingby8:foreplayd0.887971698113208y11:malfunctiond0.8996138996139y11:donnie-softd0.834459459459459y14:encounter-nullzy9:encounterd0.955947136563877y14:encounter-hardzy3:sexzy10:drift-easyd0.87639405204461y16:malfunction-hardzy16:donnie-soft-hardzy5:driftzy6:insaned0.854901960784314y8:aye-papid0.91304347826087y17:kagayaku-kassettod0.875y4:uhohd0.822265625y9:uhoh-hardzy22:kagayaku-kassetto-hardzy8:collapsezy11:insane-hardzy16:malfunction-easyzy10:drift-hardzhy8:flashingty10:safeFramesi10y13:henchmenDeathzy10:weekScoresby10:week9-easyzy6:week10zy10:week8-easyzy10:week9-hardzy5:week7zy11:week10-easyzy10:week8-hardzy10:week7-easyi278330y5:week8i157270y11:week10-hardzy10:week7-hardzy5:week9zhy7:hideHudfy9:badWindowi135y14:hitsoundVolumezy10:songScoresbR32i61930R33i77360R34i40520R35zR36i73500R37zR38zR39i77510R40zR41zR42zR43i71110R44i34550R45i43510R46i67800R47zR48zR49zR50zR51zR52zhy13:weekCompletedbR65tR61thy18:globalAntialiasingty15:achievementsMapby17:friday_night_playthy10:fullscreenfy13:imagesPersistfy14:controllerModefg

I would like to be able to read this type of file as you would read a ".json" file

A: In haxe you could use Unserializer haxe function (specification of format) to get data.
On online Haxe sandbox (https://try.haxe.org/#288Ba882) you could check tab "JS Source" to see code compiled in js.


text:
Q: git force merge - Already Up To Date Is it possible to merge a tag to a branch when the changes are already incorporated into the branch? I'm trying to populate the Precedes line in gitk
Edit: When I do git merge <TAG> it fails to merge since the branch doesn't have any differences.
Edit2:
We are using a gitflow process where we have master, develop, and PTR branches.
Our process is to make a release branch from develop. Once tested the release branch is squashed and merged to master. The squashed commit is tagged on master. Then tag is then merged back to the release branch and then merged to develop. The issue we're running into is commits on release do not Precede the tag. It makes it difficult to verify if a commit was part of a build

A:
when the changes are already incorporated into the branch?

That means:
-x--x--x--x--x (master)
         /
 -y--y--y--y--y (abranch)
        |
     (tagT)

Since the tag reference a commit which was already merged to master, ant git merge <atag> will be a no-op.
And the tag won't be part of the master branch, it remains part of abranch.
That means git branch --contain <aTag> won't include master.
See also "Verify if a tag was done in the master branch".

In the new gitflow context provided by the OP:

Our process is to make a release branch from develop.
Once tested the release branch is squashed and merged to master
The squashed commit is tagged on master

                 (aTag)
                   |
   -m--m--m--m--m--R (master, with release squashed-commit)

     r--r--r--r (release)
    /
-d--d--d (develop)

Then tag is then merged back to the release branch and then merged to develop

                 (aTag)
                   |
   -m--m--m--m--m--R   (master, with release squashed-commit)
                    \------------\
     r--r--r--r-----r' (release)  \
    /                              \
-d--d--d---------------------------d' (develop)

The issue we're running into is commits on release do not Precede the tag. It makes it difficult to verify if a commit was part of a build

From the schema:

*

*if a commit has two parents

*aTag is reachable from the second parent (git describe aCommit^2)

Then that commit is part of the "aTag" build.
The problem, indeed:

The problem is in gitk, r1,r2,r3,r4 do not show a Precedes: <tag> that was merged in r'

I agree. Gitk won't be able to show that tag.
I would put a tag to r', with a similar name as aTag, in order to get a better idea of the "Precedes" part in Gitk.


text:
Q: How does one save a reference to an object in another class? This should be a very simple solution for the avid C# developer.  I am looking to change the value of a string within a class, so within a thread, the string can change without me doing anything.  Here is a small example of what I mean, simplified, but you should get the idea.
class A_CLass
{
    string keptString;

    void keepString( ref string theString )
    {
        keptString = theString;
    }

    // This will get called when the thread is triggered
    void changeString( string theString )
    {
        keptString = theString;
    }
}

void f1()
{
    A_Class a = new A_Class();
    string base_string = "asdf";

    a.keepString( ref base_string );
    ...
    // Thread is signaled
    ...
    // Now base_string should be "fdsa"
}

void threadedFunction()
{
    // When the thread is triggered ...
    a.changeString( "fdsa" );
}

Basically I want to keep a reference of 'base_string' in the A_Class, so threaded methods can change the value, and within f1(), I can see the changed value, in this case "fdsa".
Thanks!

A: Use a StringBuilder for this purpose.

Represents a mutable string of characters.

A: It looks like you are wanting to store a reference to the reference (like a pointer to a pointer).  One way to do something like this would be to pass a method that sets the string into your class like this:
class A_Class
{
    Action<string> setter;
    void storeSetter( Action<string> setter )
    {
        this.setter = setter;
    }
    void callSetter( string str )
    {
        setter(str);
    }
}

Then pass in a lambda that sets the string like:
public class OtherClass
{
    private string someString;
    private void test()
    {
        var a = new A_Class();
        a.keepString((s)=>{someString = s;});
    }
}

Once your class has this string setting method, you can call the method to set the string.

A: You'll have to use an intermediate wrapper class:
public class Wrapper<T> // generic, so can be used with any type
{
    public T Value { get; set; }
    public Wrapper(T val) { Value = val; }
}

class A_CLass
{
    Wrapper<string> keptString;

    void keepString(string theString)
    {
        keptString = new Wrapper<string>(theString);
    }

    void changeString(string theString)
    {
        keptString.Value = theString;
    }
}

A: class A_Class
{
    Ref<string> link;
    void  A_Class( Ref<string> link)
    {
        this.link= link;
    }
    void somefunction( string str )
    {
        if(link.Value.Length > 2)
            link.Value = str;
    }
}

public class Ref<T>
{
    private Func<T> getter;
    private Action<T> setter;
    public Ref(Func<T> getter, Action<T> setter)
    {
        this.getter = getter;
        this.setter = setter;
    }
    public T Value
    {
        get
        {
            return getter();
        }
        set
        {
            setter(value);
        }
    }
}


text:
Q: azure virtual machine availability set I'm using the java api for Azure to automate the creation of vnets, subnets, and vm instances. What I want to be able to do is run code that creates a vnet, establishes an initial subnet inside that vnet, and then creates a VM with an Nic in that subnet. I was able to do this once with no issue, but when I tried it again I got this error:
Subnet  referenced by resource  is not in the same Virtual Network  as the subnets of other VMs in the availability set.
I haven't even created any availability sets. Why is it giving me this issue?
Thanks,
Adam
Here's the full text of the error response:
17:02:01,249 ERROR WFLYEJB0034: EJB Invocation failed on component AzureDriver for method public abstract java.util.concurrent.Future net.maxgigapop.mrs.driver.IHandleDriverSystemCall.commitDelta(net.maxgigapop.mrs.bean.DriverSystemDelta): javax.ejb.EJBException: com.microsoft.azure.CloudException: Subnet subnet-d39c3ca7-39c9-494a-9a82-a5812e9346f8 referenced by resource /subscriptions/08d719ed-dc6a-40a9-8e12-4e3a28ad01a6/resourceGroups/StackV/providers/Microsoft.Network/networkInterfaces/nic0/ipConfigurations/primary is not in the same Virtual Network /subscriptions/08d719ed-dc6a-40a9-8e12-4e3a28ad01a6/resourceGroups/StackV/providers/Microsoft.Network/virtualNetworks/vpc-d530ea45-2a89-4360-8a71-8dcd62b9019a as the subnets of other VMs in the availability set.: Subnet subnet-d39c3ca7-39c9-494a-9a82-a5812e9346f8 referenced by resource /subscriptions/08d719ed-dc6a-40a9-8e12-4e3a28ad01a6/resourceGroups/StackV/providers/Microsoft.Network/networkInterfaces/nic0/ipConfigurations/primary is not in the same Virtual Network /subscriptions/08d719ed-dc6a-40a9-8e12-4e3a28ad01a6/resourceGroups/StackV/providers/Microsoft.Network/virtualNetworks/vpc-d530ea45-2a89-4360-8a71-8dcd62b9019a as the subnets of other VMs in the availability set.
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:67)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)
at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:198)
at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.LogDiagnosticContextRecoveryInterceptor.processInvocation(LogDiagnosticContextRecoveryInterceptor.java:82)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.AsyncFutureInterceptorFactory$1$2.runInvocation(AsyncFutureInterceptorFactory.java:104)
at org.jboss.as.ejb3.component.interceptors.AsyncInvocationTask.run(AsyncInvocationTask.java:74)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: com.microsoft.azure.CloudException: Subnet subnet-d39c3ca7-39c9-494a-9a82-a5812e9346f8 referenced by resource /subscriptions/08d719ed-dc6a-40a9-8e12-4e3a28ad01a6/resourceGroups/StackV/providers/Microsoft.Network/networkInterfaces/nic0/ipConfigurations/primary is not in the same Virtual Network /subscriptions/08d719ed-dc6a-40a9-8e12-4e3a28ad01a6/resourceGroups/StackV/providers/Microsoft.Network/virtualNetworks/vpc-d530ea45-2a89-4360-8a71-8dcd62b9019a as the subnets of other VMs in the availability set.: Subnet subnet-d39c3ca7-39c9-494a-9a82-a5812e9346f8 referenced by resource /subscriptions/08d719ed-dc6a-40a9-8e12-4e3a28ad01a6/resourceGroups/StackV/providers/Microsoft.Network/networkInterfaces/nic0/ipConfigurations/primary is not in the same Virtual Network /subscriptions/08d719ed-dc6a-40a9-8e12-4e3a28ad01a6/resourceGroups/StackV/providers/Microsoft.Network/virtualNetworks/vpc-d530ea45-2a89-4360-8a71-8dcd62b9019a as the subnets of other VMs in the availability set.
at com.microsoft.azure.AzureClient.createExceptionFromResponse(AzureClient.java:724)
at com.microsoft.azure.AzureClient.access$100(AzureClient.java:33)
at com.microsoft.azure.AzureClient$3.call(AzureClient.java:160)
at com.microsoft.azure.AzureClient$3.call(AzureClient.java:157)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:173)
at rx.Subscriber.setProducer(Subscriber.java:211)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)
at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeSingle.call(OnSubscribeSingle.java:81)
at rx.internal.operators.OnSubscribeSingle.call(OnSubscribeSingle.java:27)
at rx.internal.operators.SingleToObservable.call(SingleToObservable.java:39)
at rx.internal.operators.SingleToObservable.call(SingleToObservable.java:27)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.DeferredScalarSubscriber.subscribeTo(DeferredScalarSubscriber.java:153)
at rx.internal.operators.OnSubscribeTakeLastOne.call(OnSubscribeTakeLastOne.java:32)
at rx.internal.operators.OnSubscribeTakeLastOne.call(OnSubscribeTakeLastOne.java:22)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10142)
at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:230)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: rx.exceptions.OnErrorThrowable$OnNextValue: OnError while emitting onNext value: retrofit2.Response.class
at rx.exceptions.OnErrorThrowable.addValueAsLastCause(OnErrorThrowable.java:118)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:73)
... 46 more


text:
Q: Java - Is there Java equivalent for C# new keyword in method signature? How I can replace final methods in Java? As you maybe know, as Java language perspective all method in C# are final by default (also vice versa, all methods in Java are virtual as C# language perspective).
In C# we can replace final (non-virtual) methods by new keyword (please see this). There is not anyway to replace final methods in Java?
Edit 1:
I just want to mention that method replacing is not same with method overriding. Please run this C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ComapreOverrideWithNew
{
    class Program
    {
        static void Main(string[] args)
        {
            var cat = new Cat();
            cat.PrintNameByNew();
            Console.WriteLine(cat.GetNameByNew());
            cat.PrintNameByOverride();
            Console.WriteLine(cat.GetNameByOverride());
            Console.ReadKey();
        }
    }
    class Animal
    {
        public String GetNameByNew()
        {
            return "Animal";
        }
        public void PrintNameByNew()
        {
            Console.WriteLine(GetNameByNew());
        }

        public virtual String GetNameByOverride()
        {
            return "Animal";
        }
        public void PrintNameByOverride()
        {
            Console.WriteLine(GetNameByOverride());
        }
    }
    class Cat : Animal
    {
        new public String GetNameByNew()
        {
            return "Cat";
        }

        public override String GetNameByOverride()
        {
            return "Cat";
        }
    }
}

For example http://docs.oracle.com/javase/tutorial/java/IandI/final.html is just talking about overriding. Also this code have not any compiler warning on compilation.

A: You cannot replace final methods in Java.

A: There's no such thing in Java. A final method cannot be overridden.

A: All the new keyword does in C# is suppress a compiler warning.

A: The only way to create a "new" final method in java is if the method is marked private.  The following is legal:
public class A
{
   private final void go(){};
}

class B extends A
{
    private final void go() {};
}


text:
Q: Calculating time complexity in case of recursion algorithms? How do you calculate time complexity in case of recursion algorithms?
for eg t(n) = t(3n/2) + 0(1)   (Heapsort)

A: Use the Master Theorem.
Anyway, your equation looks broken, since recursive calls have higher input values than that of the caller, so your complexity is O(infinity).
Please fix it.

A: usually you can guess the answer and use induction to prove it.
but there is a theorem which solves a lot of situations as heap sort, named Master Theorem:
 http://en.wikipedia.org/wiki/Master_theorem

A: Master's theorm is the quick and short way. But since you are trying to learn the complexity for all recursive functions, I would rather suggest  you to learn the working of recursion tree, which forms the foundation of Master's Theorm . This link goes on to explain it in detail. Rather than using the Master's theorm blindly, learn this for your better understanding in the future ! This link about recursion tree is a good read too

A: Complexity of Heapsort


text:
Q: Terminal stuck on installing ri documentation for rails OSX Mavericks, trying to upgrade from Rails 4.0.4 to either 4.1.0.beta1 or 4.1.0.rc2 with ruby version ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0].
In both instances (beta1 and rc1 builds), Terminal gets stuck at  Installing ri documentation for rails-4.1.0.rc2
and I have to quit the process (command + > ).
Any suggestions?

A: This has happened to me a few times. I believe it is a known issue which has never been resolved properly.
Simply install the gem without the documentation, if you don't mind, like the other answer suggests.
gem install rails --no-ri --no-rdoc

UPDATE (2020-04-29)
The new way of generating no documentation is adding the --no-document (in short -N) option, like so:
gem install rails --no-document # or -N in short

A: Are you sure it's stuck? The documentation takes ages to install (upwards of 4 mins even on a high end MBPr). You could also install the rails gem without documentation using:
gem install --no-ri --no-rdoc rails


text:
Q: Aligning iframes side by side in wordpress I have two iframes on a wordpress site using the twenty thirteen theme and can't get them to be aligned next to each other! they seem to be stacked vertically and this happens with other elements also! here is the html for the iframes..

I have tried divs and floating left in css in wordpress to no avail
here is the current css in wordpress....

#page {
      width: 1060px;
}

#content {
     width:  620px;
}

A: Wrap them in a container. And use the css below

.iframe-cont {
  display: flex;
}

You can change their width and height with this
    .iframe-cont > iframe {
      height: ;
      width: ;
/**display: inline-block;**/
    }

A: Is your page wide enough? Look at this snippet, works as planned - otherwise you probably have some other css causing issues

iframe {
  border: 1px solid red;
}


text:
Q: Access control for each Tables with SonataAdminBundle For example I have two tables accessed by SonataAdminBundle
now I would like to change the editable tables depending on user roll
Manager(ROLL_Admin) ->  can edit both tables
User(ROLL_User) -> can edit only Item table.
services:
    sonata.admin.user:
        class: Acme\AdminBundle\Admin\UserAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: Manager Editable, label: "User" }
        arguments:
            - ~
            - Acme\UserBundle\Entity\User
            - 'SonataAdminBundle:CRUD'
        calls:
            - [ setTranslationDomain, [AcmeAdminBundle]]
    sonata.admin.armarket:
        class: Acme\AdminBundle\Admin\ArMarkerAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: User Editable, label: "Item" }
        arguments:

Is it possible??
I know secutiry.yml offers the access control for each url though,
I think this is a bit defferent from security.yml layer.

A: you can setup sonata to use security voters link
This will allow finetuning over who gets to access what


text:
Q: What kind of values can "Duration" accept in Rally? I am using the RallyRestAPI and ideally I want to pass to a test case I am creating through the API a duration time in this format "MM:SS".  I am passing for example, "9:45" (9 minutes, 45 seconds), but I get an error that .."9:45 cannot convert to a double".  Does the duration field in Rally only accept double values or what other type of values can it accept?  Thanks.
My code is something like this:
DynamicJsonObject tcresults = new DynamicJsonObject();

// ...

tcresults["Duration"] = "9:45";

I get the error when doing this line below:
CreateResult cr = _RallyApi.Create(_workspace, "TestCaseResults", tcresults);

A: According to the web service docs here it has to be a double.  So "9:45" would be 9.75 instead.


text:
Q: How to associate user to news? I want to link each news with some particular user.
I linked comments to particular news, but this doesn't work
_form.html.erb
<%= form_for([@user , @user.newss.build]) do |form| %>
  <%# if news.errors.any? %>

<%#= pluralize(news.errors.count, "error") %> prohibited this
news from being saved:

      <%# news.errors.full_messages.each do |message| %>

<%#= message %>

      <%# end %>

   <%# end %>

    <%= form.label :title %>
    <%= form.text_field :title %>

    <%= form.label :description %>
    <%= form.text_area :description %>

    <%= form.submit %>

<% end %>

my user.rb
class User < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable
  has_many :news
end
#my news.rb
class News < ApplicationRecord
    has_many :comments
    belongs_to :user
end

It shows different kind of errors I can't understand that...

A: I will recommend doing this at controller level, if you have a user logged in and you have a news controller initiate news object and create object like below,
class NewsController < ApplicationController

  def new
   @news = News.new #place this inside your form
  end

  def create
   @news = current_user.news.create permit_params
   if @news.errors.blank?
    # Redirect or concerned logic here
   else
    # Rerender errors to the form
   end
  end

  private
  def permit_params
     params.require(:news).permit(:title, :description)
  end
end

This will make sure only the news is binded to the user who is creating it otherwise the for will be passing user_id that is an exposed vulnerability. Hope this helps :)

A: Ruby on rails follows the convention over configuration that means you just need to follow proper conventions to get proper result.
For Example:
Here News belongs to user and user has many news
so to fetch news of particular user you will do user.news and for news you will do news.user
Here we use the plural of news while the singular form of user
So in your code you just made a little convention mistake in your form for.
Just remove extra 's' from newss in your following code.
<%= form_for([@user , @user.newss.build]) do |form| %>

this has to be:
<%= form_for([@user , @user.news.build]) do |form| %>


text:
Q: How to change jest.mock value for different tests when mocked class is a dependency on on the SUT? I am testing a class DogService.ts. But DogService has a private dependency called CatService that gets new'ed up in the constructor. I can successfully mock the dependency using:
jest.mock('../CatService', () => {
    return {
        CatService: jest.fn().mockImplementation(() => {
            return {
                someFunction: (async (someArg) => {
                    return await someAsyncMethod();
                })
            }
        })
    }
});

And it gets injected fine in the test:
describe("", () => {
    it("", async () => {
        const dogService = new DogService();
        ...
    });
});

There's no import for the CatService in my jest test file. The mock I guess is the import. However, I want to swap out the implementation of CatService in different tests. I have tried jest.resetModules() and a bunch of other things. Further, the above only seems to work when the mock is outside any tests. If I move it into the describe() function the real CatService is used.
Any ideas how to do this? Most tutorials are for mocking classes or functions you directly use in the jest test, but obviously I am mocking a dependency.


text:
Q: Possible to create WPA2 secured, infrastructure Wi-FI network on Mac from Terminal? I have a Mac with Mavericks. It is a well-known fact that on a Mac, you can only create a WPA2 secured Wi-Fi network using Internet Sharing in System Preferences. No preinstalled, documented application on the command line can create an infrastructure mode network.
/usr/libexec/airportd has an undocumented option, startHostAPModeWithSSID that can create an ad-hoc network, optionally using WEP.
Note that this is just an interface to a CoreWLAN function of the same name, which is a public framework and is documented. Also, note that the flow of API's to access the wireless hardware on a mac goes like this: userspace program --> CoreWLAN.framework (public) or others --> Apple80211.framework (private, undocumented) --> IO80211Family.kext (kernelspace, private, undocumented, family-type kext: manages all Wi-Fi kexts) --> specific kext inside IO80211Family (could be AirportAtheros40.kext, AirportBrcm4360.kext, AppleAirportBrcm43224.kext, etc.)
Is there a way to make a WPA2 secured network on a Mac via the command line? Without all the overhead of internet sharing like NAT, dhcp, and others.
Many other questions like this have been answered incompletely. I tried to see what functions the internet sharing preference pane uses, and it uses a few private frameworks:
 $ otool -L /System/Library/PreferencePanes/SharingPref.prefPane
/Contents/MacOS/SharingPref

[shortened for legibility]

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Apple80211 (compatibility version 1.0.0, current version 1.0.0)
/System/Library/PrivateFrameworks/PreferencePanesSupport.framework/Versions/A/PreferencePanesSupport (compatibility version 1.0.0, current version 1.0.0)
/System/Library/PrivateFrameworks/CoreWLANKit.framework/Versions/A/CoreWLANKit (compatibility version 1.0.0, current version 1.0.0)
/System/Library/PrivateFrameworks/SystemAdministration.framework/Versions/A/SystemAdministration (compatibility version 1.0.0, current version 1.0.0)

It does use a long list of public frameworks like CoreWLAN, but these are the private frameworks it utilizes. However, none of these appear to handle anything related to the WPA2 security that can be utilized from the internet sharing options.
To try to devise how the WPA2 encryption is enabled, I looked at what the internet sharing preference pane depends on. I went for the launchdaemon com.apple.internetsharing.plist. It just calls /usr/libexec/internetsharing, which is undocumented but does offer some help:
$ /usr/libexec/internetsharing --help
/usr/libexec/internetsharing: illegal option -- -
Usage: /usr/libexec/internetsharing [-dDnv] [-e EXTIF] [-l LOGFILE] [-p LO] [-P HI] [-c THREADS] [-t TIMEOUT]

ptions: [sic]
    -d  Enable debugging
    -v  Enable verbose logging
    -6  Disable(Enable) IPv6 on iOS(MacOS)
    -e EXTIF    External interface name
    -l LOGFILE  Enable logging to file
    -p LO   Port forwarding range, LO
    -P HI   Port forwarding range, HI
    -c THREADS  max # of worker threads
    -t TIMEOUT  Idle timeout

[Yes, the "ptions" is actually how it was printed to stdout] It seems like it may have something to do with this after all. What it may not expose directly, we can reveal by what it depends on. So:
$ otool -L /usr/libexec/internetsharing
/usr/libexec/internetsharing:
    /System/Library/PrivateFrameworks/PacketFilter.framework/Versions/A/PacketFilter (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55456.0.0)
    /System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.0.0)
    /System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/PrivateFrameworks/EAP8021X.framework/Versions/A/EAP8021X (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1054.0.0)
    /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 596.12.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /usr/lib/libdns_services.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libbsm.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

As you can see, it uses 2 private frameworks: PacketFilter, which probably does what you'd expect, and EAP8021X. The latter is likely  responsible for enabling WPA2, however being a private framework it is devoid of any documentation. Note that /usr/libexec/internetsharing does (or calls the programs to do) NAT (natd,) dhcp (bootpd,) DNS (named a.k.a BIND,) ipfw, and many other little bits. Using /usr/libexec/internetsharing is not an option as it is finicky and does NAT, dhcp, dns, and all the funky things that are not necessary. Is there a way to create a WPA2 network on a mac using the command line only?


text:
Q: .[nodeTest] expression doesn't work xsl:apply-templates select=".[nodeTest]" mode="somemode" fails with could not compile select expression.
I've re-read "Abbreviated Syntax" chapter in the specification and still don't understand if it's an implementation bug or an appropriate behavior.
self::node[nodeTest] of course works well.
Is it somehow specified that shortened self axis shouldn't work with predicate?

A:
Is it somehow specified that shortened
  self axis shouldn't work with
  predicate?

Yes, this is determined by the grammar rules of XPath:
[20]    FilterExpr    ::=    PrimaryExpr
                            |  FilterExpr Predicate

[15]    PrimaryExpr    ::=    VariableReference
                              | '(' Expr ')'
                              | Literal
                              | Number
                              | FunctionCall

As can be seen from these, PrimaryExpr cannot be ..
This syntactic omission was corrected in XPath 2.0, where the expression .[someCondition] is perfectly legal.


text:
Q: Persistant Local Storage iOS 5.1 I am developing a mobile app and I hoped to use HTML5 Persistant Storage. I have read though that iOS 5.1+ doesn't support it as it removes it periodically.
Is there a solution or fix to this? I am using Phonegap/Apache Cordova.
Thanks.

A: This issue was fixed in recent PhoneGap installs. If you are using the latest version, you should be fine.


text:
Q: Moments of function of Poisson process
Mirror thread on Mathoverflow.

(I'm new to Poisson processes, so please edit if my terminology is incorrect.)
This is a special case of a problem I'm working on; hoping for intuition that will generalize to a multi-dimensional Poisson process.  The context is approximating a distribution defined by the $\arg\min$ of a (non-Poisson) process in Theorem 1 of this paper.
Setup:
consider a Poisson process on $[0,\infty)$, with points $\{ \Gamma_k\}_{k=1}^\infty$, $\Gamma_k=E_1+\cdots+E_k$, $E_i\stackrel{iid}{\sim}\rm{Exponential}(1)$.
Consider $u=\inf\{t:1\le\sum_{k=1}^\infty \mathbb 1(\Gamma_k\le t)\}$, where $1(\cdot)$ is the indicator function (one if true, zero if false).  In this special case, $u=\Gamma_1=E_1$, and thus $u\sim\rm{Exp}(1)$.  We have a closed form solution for $u$, and the first two (central) moments are $\mathbb E(u)=1$ and $\rm{Var}(u)=1$.
QUESTION:
can we derive $\mathbb E(u)=1$ and $\rm{Var}(u)=1$ without using the closed form of $u$?  (In my general problem, there is no closed form.)  So we know $u=\inf\{t:1\le\sum_{k=1}^\infty \mathbb 1(\Gamma_k\le t)\}$, but we can't just use $u=\Gamma_1$ to calculate moments.
Notes/thoughts:
As a reminder, the mean measure of the considered Poisson process is $m(A)=\lambda(A)$, where $\lambda$ is Lebesgue measure (e.g., $\lambda([a,b])=b-a$; just the total length of set $A\subset [0,\infty)$).  This means that the expected number of points in any interval is equal to the length of the interval.
Also, the probability of one event occurring in $[t,t+dt]$ is $dt$ since the rate is one here.
Also potentially helpful: define the random counting measure $\hat N(t)=\sum_{k=1}^\infty 1(\Gamma_k\le t)$.  Then, $\mathbb E(\hat N(t))=\lambda([0,t])=t$, and $u=\inf\{t:1\le \hat N(t)\}$.
For the first moment, I noticed that in this case, $\inf\{t:1\le \mathbb E(\hat N(t))\}=\inf\{t:1\le t\}=1=\mathbb E(u)$.  That is, solving for $u$ after plugging in the mean measure happens to yield the mean of $u$.  This struck me as not true generally: $\mathbb E(u(X))\ne u(\mathbb E(X))$.  But maybe some property of the Poisson process and/or $u$'s characterization means that $u$ is a ``linear'' function of the process, so this is generally true here?
For the second moment, I haven't made any progress.  Tried thinking about the expectation $\mathbb E\left[(u-\mathbb E(u))^2\right]=\mathbb E[(u-1)^2]$, but don't know how I could get that without cheating.  Also wondered if there was a ``variance of the process,'' if the plug-in approach for the first moment turns out to be valid.  But basically stuck.
Last, recall either $\rm{Var}(u)$ or $\mathbb E(u^2)$ is sufficient, since $\rm{Var}(u)=\mathbb E(u^2)-(\mathbb E(u))^2$.


text:
Q: null pointer exception in soapui groovy script I am receiving this null pointer exception and not sure how to resolve/debug it. The script contains a class with two methods. Code is doing what it is supposed to do.  Any pointers on geeting started to resolve this?
 java.lang.NullPointerException
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:154)
    at com.eviware.soapui.model.testsuite.TestStep$run.call(Unknown Source)
    at Script48.run(Script48.groovy:22)
    at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92)
    at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.assertScript(GroovyScriptAssertion.java:116)
    at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.internalAssertResponse(GroovyScriptAssertion.java:128)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlMessageAssertion.assertResponse(WsdlMessageAssertion.java:150)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequest.assertResponse(WsdlTestRequest.java:176)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.propertyChange(WsdlTestRequestStep.java:339)
    at com.eviware.soapui.impl.wsdl.support.assertions.AssertionsSupport.propertyChange(AssertionsSupport.java:79)
    at java.beans.PropertyChangeSupport.fire(Unknown Source

Script looks like this.
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner
    import com.eviware.soapui.support.types.StringToObjectMap
    import com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext

    context.setProperty("searchChange", new searchChange())
    class searchChange{

        def search(a,b,TCRunner){

            def search_TestCase = TCRunner.testCase.testSuite.getTestCaseByName("TestCaseName")
              search_TestCase.setPropertyValue("a", a)
              search_TestCase.setPropertyValue("b", b)
              search_TestCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false)

            }

        def runner(tCase,mExchange){

                     new WsdlTestCaseRunner( tCase, new StringToObjectMap() );

            }

    }

When using the above class,the line(groovy:22) in code that throws exception is
scripts.testCases["Library"].testSteps["Lib"].run(context.getTestRunner(),context)


text:
Q: r long to wide reshape This might possible be a duplicate question.
I am working with a dataset which is as shown below
Hunters <-  rnorm(20, 10,3)
Hoarders <- rnorm(20, 4, 5)
Truckers <- rnorm(20, 6, 2)
Ninja_Warriors <- rnorm(20, 8, 5)
Inventors   <-  rnorm(20, 5, 5)
y           <- rbinom(20, 1, 0.2)

df <- data.frame(cbind(y,Hunters, Hoarders, Truckers, Ninja_Warriors, Inventors ))

head(df)
  y   Hunters  Hoarders Truckers Ninja_Warriors   Inventors
  0 10.683681  2.436301 5.728774      12.072325  5.77553574
  0 11.795734  3.160194 7.224706       9.162267  3.02488425
  0  6.385799 -1.133548 7.074739       5.007134 -2.67054701
  0 13.949215  7.903503 4.648848       7.886313  4.71579763
  1 11.091341  7.700549 3.460969       6.728078  3.95914947
  0 14.187529  3.503359 4.416457       2.637822  0.06991962

I need help transforming this dataset to a long format like this
 Variable       Group     Value
 Hunters        0         10.683681
 Hoarders       0         2.436301
 Truckers       0         5.728774
 Ninja_Warriors 0         12.072325
 Inventors      0         5.77553574
 .              .          .
 .              .          .
 .              .          .
 .              .          .

A: For instance, using reshape2:
library(reshape2)
library(dplyr)
melt(df, id.vars = "y", variable.name = "Variable", value.name = "Value") %>% rename(Group = y)
    Group          Variable       Value
1       0        Hunters  9.65692150
2       0        Hunters 10.17101981
3       0        Hunters  6.54119659
4       0        Hunters  8.14213268
5       0        Hunters  2.54939639

    ...

Alternatively, using tidyr:
library(tidyr)
gather(df, key=Variable, value=Value, -y ) %>% rename(Group = y)
    Group       Variable       Value
1       0        Hunters  9.65692150
2       0        Hunters 10.17101981
3       0        Hunters  6.54119659
4       0        Hunters  8.14213268
5       0        Hunters  2.54939639
...


text:
Q: Using Multibinding.StringFormat in codebehind I have this application that has dynamic language switching built in.  Based on the selected Culture, strings throughout the application will change.  Translated strings and their original values come out of resource files.  I use bindings to attach the resource values to buttons, labels, etc.  Most of this binding occurs in the code behind.
I've been able to concatenate localized strings with data using the Binding.StringFormat property:
mybinding.StringFormat = "# {0}";

for "# of items".  My problem is that I now need to concatenate two (or more) localized strings in the code behind.  I quickly realized I could use MultiBinding and add my bindings to it, keeping with how things currently work, however, using MultiBinding.StringFormat doesn't seem to work.  I'm trying to use myMultiBinding.StringFormat = "{0} {1}"; to insert a space between the two binding values, but it just appears blank when bound to the "Greetings" Label.
Binding b = GetBinding("HelloWorld");
Binding b2 = GetBinding("Name");

MultiBinding multib = new MultiBinding();
multib.StringFormat = "{0} {1}";
multib.Bindings.Add(b);
multib.Bindings.Add(b2);
Greetings.SetBinding(Label.ContentProperty, multib);

and here's the GetBinding() function which grabs a binding based on the path value:
public Binding GetBinding(string name)
{
    Binding binding = new Binding();
    binding.Source = mySource;
    binding.Path = new PropertyPath(name);
    return binding;
}

Also, I should note I'm using .NET 4.  Doesn't seem to work in Xaml either.  I have also tried this in .NET 3.5 after it didn't work in 4.0.  Both child bindings are working... if I supply a converter, the values show up.  I'd rather use the StringFormat property though.

A: It's a problem with the Label.  StringFormat on TextBlock seems to work...
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/69bca541-379f-4f8d-ab19-2f55b566e2c9/#1c06f05e-631c-4e51-95f4-cac83a3f457b


text:
Q: XYZ bounding box of a spherical polygon I'm looking for an algorithm to calculate the 3d bounding box of a spherical polygon
 - i.e. the min/max X, Y and Z over that part of the surface of a unit sphere.
The purpose is to aid fast area-overlap calculations for large numbers of simple (convex) spherical polygons :
Having all the bounding boxes will let you quickly calculate, for a given target polygon, a large majority of the other polygons which definitely do not intersect it (because their bounding boxes are disjoint).
I already have a calculation that does this type of selection, using polygon centres and maximum-radii.
However, that will take O(N^2) time to calculate (for all source polygons; for all target polygons).
Whereas, this approach would hopefully run in O(N.log N) time, as the XYZ information can be ordered and then sorted/searched (e.g. using kdtrees).
I think this is a bit less trivial than it sounds.
For instance, the max X value on a polygon boundary segment (which is a great circle) can obviously occur at a point somewhere between the two endpoints.
But also, in fact, an extreme value can occur somewhere inside the polygon away from the boundary
-- for example, we must be able to get a max Z=1.0 for a polygon drawn around the North pole, even though its boundary lies entirely South of the pole.
Can anyone help with this ?


text:
Q: How to Copy a File that is In Use I want to provide my users with the ability to post a log file onto my server rather than requiring them to find it and email it to me.
I am using this library http://ftplib.codeplex.com/ to open an ftp session on the server and send the file.  There is a bit of renaming involved but that is it.
Unfortunately the log file to be sent is actually open so I got a 'file is being used by another process' exception.  This makes sense when I think about it in so far as the log is open while my app is running.  I closed it but, of course, uploading is a long process.  I put the upload code into a background thread so that the user may continue. However the log cannot be re-opened until the upload is complete.  In the meantime there could be some event that should be written to the log.
So I am looking for a way to copy the log and then upload it.  What would be the best way to do that?  The log is a binary file BTW.

A: If you don't own the code that has the log file open (ie, it's another app or a closed source dll), you can try doing a File.Copy(<log>, <tempdest>) and send that file, deleting it when you're done.  This only sometimes works when you don't have read access to the file.
If you do own the code that is accessing the file in the first place, you want to open it with an explicit ShareMode ie
 File.Open(path, FileMode.Open, FileAccess.ReadWrite, FileShare.Read)


text:
Q: Multiple buttons with same class don't work I created multiple buttons with the same class from a list of words.
var words = $(this).val().split(' ');
    $.each(words, function(i, v) {
         if ($.trim(v) !== '') {
            html += "<button class='wordbtn'>"+ v +"</button>" + " "
         }
    });

$("p").html(html);

The buttons are displayed in my view, but when I click the button does not work.
$(".wordbtn").click(function(){
    console.log('clicked')
})

When I inspect my code buttons are shown, but when I view the source code the buttons are not displayed.
If I insert a pre button to test, it works.

<button class='wordbtn'>Test</button>

A: i think the problem is that the wordbtn buttons still doesn't exists when you are running the code
$(".wordbtn").click(function(){
    console.log('clicked')
})

so the click event is not assigned to any element in your page.
try replace the click event for your button with:
$(document).on("click", ".wordbtn", function(event){
    console.log('clicked');
});

now the click event will fired even with a new added button, this because the event is handled by the a present document element after it bubbles to there.

A: I assume that you are running this code:
$(".wordbtn").click(function(){
    console.log('clicked')
})

before you are creating the buttons.
This can't work, because those buttons don't exist and, thus, you can't add an event to them.
Using something called 'event delegation' you can get the effect you want.
https://learn.jquery.com/events/event-delegation/

A: All events won't listen to generated elements after the event listener added. See below examples with JQuery and pure JavaScript
Try Pure Javascript e.target with docuemnt.event

document.getElementById("input").addEventListener("keyup", function() {
  var words = this.value.replace(/\s+/g, " ").trim().split(" ");
  var html = "";
  for (var i = 0; i < words.length; i++) {
    html += "<button class='wordbtn'>" + words[i] + "</button>" + " ";
  }

  document.getElementById("p").innerHTML = html;
});
// add click event to DOM
window.onclick = function(e) {
  //detect if mouse clicked on element has class "wordbtn"
  if (e.target.className.indexOf("wordbtn") > -1) {
    console.log('clicked')
  }

}
<input id='input' />

JQuery $(document).on(event,target,callbak);

var str = "some words from user inputs";

$("#input").keyup(function() {
  var words = $.trim($(this).val().replace(/\s+/g, " ")).split(' ');
  var html = "";
  $.each(words, function(i, v) {
    html += "<button class='wordbtn'>" + v + "</button>" + " "
  });

  $("p").html(html);

});

$(document).on("click", ".wordbtn", function() {
  console.log('clicked')
});

<input id='input' />


text:
Q: Product rule for Banach space-valued differentiable functions? Let $\Omega \subset \mathbb{R}^n$ be a bounded open set and let $f(\cdot,\cdot)$ and $g(\cdot,\cdot)$ be functions from $[0,T]\times \Omega$ into $\mathbb{R}$.
Suppose that $f \in C^1([0,T];H^s(\Omega))$ and $g \in C^1([0,T];H^1(\Omega))$.
The multiplcation $(fg)(t,x) = f(t,x)g(t,x)$ is sensible, and we can consider $(fg)(t) := f(t,\cdot)g(t,\cdot)$ so that $(fg)\colon [0,T] \to L^1(\Omega)$.
Is it true that $fg$ is in $C^1([0,T];L^1(\Omega))$, and does the product rule
$$(fg)'(t) = f'(t)g(t) + f(t)g'(t)$$
hold, in what sense?


text:
Q: Swift 2 - Uber-like location picker with MKMapView I'm trying to make an uber-like location picker from a small MKMapView in my class. My problem is the following :
Since I want to have the initial region to be centered at the user current location, I set the initial region inside the location manager function like this:
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
            let locValue:CLLocationCoordinate2D = (locations.last?.coordinate)!
            let latDelta = 0.005
            let lonDelta = 0.005
            let span:MKCoordinateSpan = MKCoordinateSpan(latitudeDelta: latDelta, longitudeDelta: lonDelta)
            let region:MKCoordinateRegion = MKCoordinateRegionMake(locValue, span)
            self.locationMap.setRegion(region, animated: false)
           }

The problem with this is that every time that the user tries to drag the map region to pick a location, obviously since the location is being always updated and the function is being called at everytime the location is updates, the map region goes back to its initial point as the function above states.
Another thing is that if I try to extract the locValue variable and assign it to a instance variable of the class within the function adding a line like this :
self.userLocation = locValue

self.userLocation won't change. If you have any suggestion on how to get a single location without updating it or how to fix either one of these problems it would be really appreciated if you could let me know.
Thanks.


text:
Q: Adding to Github from Visual Studio 2013 not working as documented This is the online reference I am using. However when I enter the remote repository and hit publish I get an error

You cannot publish local branch master to the remote repository origin
  because a branch with the same name already exists there. You might
  want to rename your local branch and try again.

I dont want to rename anything as yet. I want the first version of the code to go into the master branch and at the same time create an upstream tracking branch locally.
Then I tried using the command line only. After creating a fresh repository, I ran the following commands
$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'
$ git remote add origin <url>
$ git push --force

This worked but now I have all my obj,bin,packages directories along with it. I don't want all those directories to go. Editing the git ignore did not help either. What I am doing wrong? Its taken more twice the amount of time to get the code into the repository than it has taken to write the code!
I only want my sources in the repository and have a tracking local branch to begin with.


text:
Q: Permissions issues for shared directory on a server The setup is we have a VPS running Debian Squeeze, and I've set up a shared directory for us to share files.  So far I've followed this guide:
http://www.cyberciti.biz/faq/linux-setup-shared-directory/
I've also set the umask to 002 correctly (see the comments on that guide), so we can both now create files and directories directly on the server and we both have read/write permissions on them.
The only problem is that a lot of our files are created on our local machines (both running Ubuntu 10.10), and then dumped on the server.  This results in only the creator of the file/directory having write permissions on, and the other member of the group I set up for sharing this folder only having read access.
My next thought would be to change the default umask on our local machines, but it seems a bit extreme to have to do that, and I don't know if it's a security risk.
Can someone tell me if there's a better solution to what I'm trying to achieve, or if this really is the way to go?
Many thanks in advance

A: I'd use a different approach and share the files through an access control list on the directory.
First make sure access control lists are enabled on the filesystem where the directory resides (make sure that the corresponding entry in /etc/fstab contains acl in the fourth column). Also make sure you have the acl utilities installed (on Debian, install the acl package). Then give both users an inheritable write permission on the directory.
setfacl -m user:other_user:rwx /path/to/directory
setfacl -d -m user:other_user:rwx /path/to/directory

If there are more than two users, either repeat this command for each user (the ACL is implicit for the user who created the directory); or put the users in a group (as you already did), and use -m group:group_name:rwx in the setfacl command.

A: Sorry I was being thick in the comments. the sftp-server is being run by root and you pick up root's umask. You should be able to fix this by editing your /etc/ssh/sshd_config file and changing the line
Subsystem sftp /usr/lib/openssh/sftp-server
to
Subsystem sftp /bin/sh -c `umask 0002; /usr/libexec/openssh/sftp-server`

A: In addition to Iain's answer, which should work (but watch out for the smart-quotes, and see below for a caveat), at the top of /etc/init.d/ssh you will find:
### BEGIN INIT INFO
# Provides:     sshd
# Required-Start:   $remote_fs $syslog
# Required-Stop:    $remote_fs $syslog
# Default-Start:    2 3 4 5
# Default-Stop:
# Short-Description:    OpenBSD Secure Shell server
### END INIT INFO

...

umask 022

and you can change the value here.
Caveat:
many S/FTP clients will try to set the permissions on newly uploaded files to match the permissions on the local system, so check if this is what's happening.  If it is, you can usually disable this option in the settings of the client you're using to upload.
edit:
as another suggestion, when creating a set-up like this, I always make full use of the sticky-bit for group ownership (i.e., I set all directory permissions to 2775) so that newly created files and directories inherit the correct group ownership.


text:
Q: Not able to remove the black screen at loding view in android app I have this problem, when I try to load new view, before I get service response I get black screen. Now to solve this issue I have used AsyncTask and I have solved the issue but the problem is I'm not getting Output from my service. Below is my code.
class GetInfo extends AsyncTask<String, String, String> {
    /**
             * Before starting background thread Show Progress Dialog
             * */
            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                pDialog = new ProgressDialog(NewHomeView.this);
                pDialog.setMessage("Loading...");
                pDialog.setIndeterminate(false);
                pDialog.setCancelable(true);
                pDialog.show();
            }

            /**
             * Creating player
             * */
            protected String doInBackground(String... args) {

                        goal = MMBusinessFacade.baseURL;
                        goal = goal + "getGoal.jsp?acno=" + acnt;
                        goal = goal.replaceAll(" ", "%20");
                        res = MMBusinessFacade.getXML(goal, NewHomeView.this);
                        NewHomeView.res1 = gp.getOutput(res);
                        System.out.println("URL:" + goal);
                        System.out.println("Output:" + res1);

                        /********************************************************************************************/
                        spnrshi1 = MMBusinessFacade.baseURL;
                        spnrshi1 = spnrshi1 + "getFunds.jsp?acno=" + acnt;
                        spnrshi1 = spnrshi1.replaceAll(" ", "%20");
                        res = MMBusinessFacade.getXML(spnrshi1, NewHomeView.this);
                        System.out.println("URL" + spnrshi1);
                        list1 = fdp.getOutputOrg1(res);
                        list = fdp.getOutputOrg(res);

                        if (list1 != null && list1.size() > 0) {
                            for (int j = 0; j < list1.size(); j++) {
                                FundsAvailable prpobj = (FundsAvailable) list1.get(j);
                                FundDetail prpobj1 = (FundDetail) list.get(j);
                                ite = prpobj.getAmount() + "  " + prpobj.getCurrency();
                                System.out.println("Item:" + ite);
                                NewHomeView.favail = prpobj1.getAmount() + " " + prpobj1.getCurrency();
                                NewHomeView.cur = prpobj.getCurrency();
                            }
                        }

                return null;
      }
            /**
             * After completing background task Dismiss the progress dialog
             * **/
            protected void onPostExecute(String file_url)
            {
                // dismiss the dialog once done
                pDialog.dismiss();
                gl.setText(NewHomeView.res1);
                avilfund.setText(NewHomeView.ite);
                fndraised.setText(NewHomeView.favail);
            }

        }

Plz give your valuable advise.
Thanks

A: I think:
U should not use runOnUiThread in doInBackground function.Otherwise,doInBackground will return immediately。And you will get null with onPostExecute(null).So,failed.
right code:
protected String doInBackground(String... args) {

                        goal = MMBusinessFacade.baseURL;
                        goal = goal + "getGoal.jsp?acno=" + acnt;
                        goal = goal.replaceAll(" ", "%20");
                        res = MMBusinessFacade.getXML(goal, NewHomeView.this);
                        NewHomeView.res1 = gp.getOutput(res);
                        System.out.println("URL:" + goal);
                        System.out.println("Output:" + res1);

                        /********************************************************************************************/
                        spnrshi1 = MMBusinessFacade.baseURL;
                        spnrshi1 = spnrshi1 + "getFunds.jsp?acno=" + acnt;
                        spnrshi1 = spnrshi1.replaceAll(" ", "%20");
                        res = MMBusinessFacade.getXML(spnrshi1, NewHomeView.this);
                        System.out.println("URL" + spnrshi1);
                        list1 = fdp.getOutputOrg1(res);
                        list = fdp.getOutputOrg(res);

                        if (list1 != null && list1.size() > 0) {
                            for (int j = 0; j < list1.size(); j++) {
                                FundsAvailable prpobj = (FundsAvailable) list1.get(j);
                                FundDetail prpobj1 = (FundDetail) list.get(j);
                                ite = prpobj.getAmount() + "  " + prpobj.getCurrency();
                                System.out.println("Item:" + ite);
                                NewHomeView.favail = prpobj1.getAmount() + " " + prpobj1.getCurrency();
                                NewHomeView.cur = prpobj.getCurrency();
                            }
                        }

           }
      }

A: You should not use runOnUiThread in your doInBackground, it make you loose interest in using AsyncTask. The best way to communicate with UI in doInBackground is to use the progress update process:
just implement in your asynTask:
@Override
protected void onProgressUpdate(MyProgressObject... mpo) {
    super.onProgressUpdate(mpo);
    //my UI update here
}

and when you need to update UI from within doInBackground just call publishProgress(MyProgressObject mpo)


text:
Q: PHP - same value in mysqli bind param Can I optimize this code ?
mysqli_stmt_bind_param($statement, "iiiiiii", $user, $user, $user, $user, $user, $user, $user);

Used for this request :
$statement = mysqli_prepare($conn, "SELECT u_id, u_lastname, u_firstname,
    (SELECT f_id from friend where (f_friend_one = u_id AND f_friend_two = ?) OR (f_friend_one = ? AND f_friend_two = u_id)),
    (SELECT f_type from friend where (f_friend_one = u_id AND f_friend_two = ?) OR (f_friend_one = ? AND f_friend_two = u_id))
FROM    user
WHERE   (( u_id = ( SELECT f_friend_one FROM friend WHERE f_friend_one = u_id AND f_friend_two = ? AND (f_type = 1 OR f_type = 4)))
OR      ( u_id = ( SELECT f_friend_two FROM friend WHERE f_friend_one = ? AND f_friend_two = u_id AND (f_type = 1 OR f_type = 3))))
AND     u_id != ? ")
    or die(mysqli_error($conn));

A: I think you can simplify it to this:
SELECT u_id, u_lastname, f_id, f_type
FROM user
JOIN friend
    ON (u_id = f_friend_one AND f_friend_two = ? AND f_type IN (1, 4))
        OR
       (u_id = f_friend_two AND f_friend_one = ? AND f_type IN (1, 3))
WHERE u_id != ?

It's possible that the WHERE clause at the end isn't needed, since someone can't send a friend request to themselves.
The OR may make this hard for MySQL to optimize, so it may be better to split it into two subqueries connected with UNION.
SELECT u_id, u_lastname, f_id, f_type
FROM user
JOIN friend ON u_id = f_friend_one
WHERE f_friend_two = ? AND f_type IN (1, 4))
    AND u_id != ?

UNION

SELECT u_id, u_lastname, f_id, f_type
FROM user
JOIN friend ON u_id = f_friend_two
WHERE f_friend_one = ? AND f_type IN (1, 3))
    AND u_id != ?


text:
Q: Is it possible to make Progressive Web Apps from third party sites? Chrome has a feature that if you have a PWA you can actually bookmark it in your Windows Taskbar and are not cluttering your browser anymore with websites that you actually use like apps - like i.e. Whatsapp.
To create a PWA you only need a simple manifest file with a few JSON lines - really no effort. But a lot of sites haven't done this.
Is it possible to somehow "load" my own manifest.json for i.e. web.whatsapp.com so I can have the benefits of a PWA for sites that haven't implemented it?

A: You can install any site in chrome using Add a shortcut to a website as an app.

*

*Open Chrome.

*Navigate to the website you want to add as an app.

*At the top right, click More.

*Click More Tools.

*Click Create shortcut.

*Enter a name for the shortcut and click Create.


text:
Q: XML Literals LINQ - use variables in Enumerable.Range(int, int) Help me please - how can I use in this code:
Dim doc As XDocument = _
    New XDocument( _
    New XElement("root"))
    doc.Root.Add(From i In Enumerable.Range(0, 10) _
                 Select New XElement("foo", i))

                 Dim doc As XDocument = <?xml version="1.0"?>
                       <root>
                           <values>
                               <%= From i In Enumerable.Range(1, 3) Select <value>
                                                                               <%= cells(i, 1).Value %>
                                                                           </value> %>
                           </values>

                       </root>

here in stead of numbers variables? Enumerable.Range(1, 3) something like this:
Dim iCount = 5
    Enumerable.Range(1, iCount)

I have an error if use like this - 'iCount' is not declared. It may be inaccessible due to its protection level.

A: now all ok but here there is an error on this Row: (...) == "y"
.....
</Header>
                                            <Request>
                                                <%= From i In Enumerable.Range(1, LastRow) Select
                                                    <%= If(LCase(Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet.Cells(iRow, 25).Value) == "y",
                                                        <ID>
                                                            <%= Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet.Cells(i, 1).Value %>
                                                        </ID>,
                                                        Nothing)
                                                    %>
                                                %>
                                            </Request>
                                        </RequestMessage>
                                    </soapenv:Body>
                                </soapenv:Envelope>


text:
Q: How to produce same width pages in wkhtmltopdf in different computers wkhtmltopdf 0.12.3.2 is used to create pdf files in Windows 7 x64 and Windows 10 x64 from same html with options:
C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe --lowquality -L 0mm -R 0mm -T 0mm -B 0mm --dpi 96 --zoom 1.6 - -

exe file is invoked from from ASP.NET MVC 4 controller.
In Windows 10 developement computer running from Visual Studio/IIS Express text zoom is less and there is appox 2 cm right margin (empty space)
In Windows 7 production computer runnning from IIS pdf zoom is bigger and text ends in right edge of page.
How to fix this so that same width page is created always ?
html code used to generate pdf and wkhtml version are same in both Windows computers.
However result pdf sizes are dirrerent: 36663 and 30814 bytes.
How to compare pdf and find reason why pdfs differs ?
posted also in
https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3165


text:
Q: Use IF operator to diverge actions on alphanumeric and non-alphanumeric elements in a given array I need help working on arrays that can contain both ALPHANUMERIC and NON-ALPHANUMERIC elements.
I need to perform an action for ALPHANUMERIC, and a different action for NON-ALPHANUMERIC.
I have been trying different ways to declare the statement If to diverge the two options, but I don't come up with the right formula.
The closest solution I can get is too dirty, I just tell the program the element has to be different from " " and diferent from "!" and different from "?". Not a clean solution. Could someone help? Maybe using a RegEx Expression?
  var myArray=["H","O","W"," ","A","R","E"," ","U","?"];
  var i=0;

  while(i<myArray.length){

  if(myArray[i]!=" " && myArray[i]!="!"&& myArray[i]!="?"&& myArray[i]!="."){
  //PERFORM ACTION 1 Example:
  return: "Hello";
  }

  else{
  //PERFORM ACTION 2 Example:
  return: "Goodbye";
  }

  i++;
  }

I have tried with the following Regex, and not succeded:
if(myArray[i]!=[A-Za-z0-9_])

and also:
if(myArray[i]!=/\W/g)

None of them work :( Help, please.
Thank you.

A: SOLUTION:
var myArray=["H","O","W"," ","A","R","E"," ","U","?"];
var i=0;
var alphaChecker = new RegExp("^[a-zA-Z0-9_]*$");

while(i<myArray.length){

if(alphaChecker.test(myArray[i])){
//PERFORM ACTION 1 Example:
myArray[i]= "Hello";
}

else{
//PERFORM ACTION 2 Example:
myArray[i]= "Goodbye";
}

i++;
}

return myArray;

This works well.