qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
37,484,134 | I have this table structure, where all the columns have a different click method to them. The first column is not so wide, so it's pretty hard to click on it in a mobile browser, but i want to keep it like that, because of the borders.
Is there a way, where the clickable area of the first column could overlap invisibl... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37484134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3609107/"
] | The first thing that comes to mind is to:
1. Give the first col a greater z-index then the second col
```
.firstcolumn{
z-index : 2;
}
.secondcolumn{
z-index : 1;
}
```
2. Extend the padding-right of col1 to cover the bit of col2 you want to be clickable for col1.
I think that's most of the work you would ... | I have had a quick play with w3schools TryIt editor and have come up with the following as a start:
```html
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style type="text/css">
table td {
position:relative;
border:1px solid black;
height:20px;
width:200px;
}
.overLap {
position:absolute;
... |
7,771,607 | I've already do my research but I think I don't know how to ask so I'll try to explain...
Im looking for a way to ask for the first entry saved on a Scaffold...
Like
If I have in the table Products:
* Sweeter
* Pants
* Scarf
* Tennis
and I write `@first_prod = Products.first` (or something like that) on my model or... | 2011/10/14 | [
"https://Stackoverflow.com/questions/7771607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/992653/"
] | In rails you can define a few default ways to get the content from a model.
In your case i would create a scope.
in your model enter the following:
```
scope ordered, :order => "Product.created_at ASC"
```
When you call
```
Product.ordered
```
It will return all your products ordered by when they were created.
... | Okay. Let's assume that when you call `Product.all` that it returns the products in the order you've specified above. So, to get Sweeter, you could call `Product.all.first`. Or, if in your controller you've done `@products = Product.all` and you want it in your view you can use `@products.first`. Or if you're looping t... |
7,771,607 | I've already do my research but I think I don't know how to ask so I'll try to explain...
Im looking for a way to ask for the first entry saved on a Scaffold...
Like
If I have in the table Products:
* Sweeter
* Pants
* Scarf
* Tennis
and I write `@first_prod = Products.first` (or something like that) on my model or... | 2011/10/14 | [
"https://Stackoverflow.com/questions/7771607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/992653/"
] | In rails you can define a few default ways to get the content from a model.
In your case i would create a scope.
in your model enter the following:
```
scope ordered, :order => "Product.created_at ASC"
```
When you call
```
Product.ordered
```
It will return all your products ordered by when they were created.
... | You answered your own question, I think...
If you know you want access to the first saved item of a specific model, then you would just call `Product.first`. So, in the controller action for the view you want to access that data in, just type `@product = Product.first`... for example
```
def index
@products = Produ... |
16,308,375 | I'm writing a simple MVC4 application in which I chose the internet application template when I created the project. When I right click **\_Layout.cshtml** and go to **view in page inspector**, I receive a screen in the page inspector view that says
>
> "Server Error in '/' Application.
> ---------------------------... | 2013/04/30 | [
"https://Stackoverflow.com/questions/16308375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691849/"
] | Okay, I still stand by my comment that it is not meant to view the layout file as a standalone piece. However, I was a little curious as to the issue of viewing the layout.
If you look at the provided link, you will see how to properly use the Page Inspector. Please look at item number 5. That will give you some deta... | I also could not open .cshtml files. Maybe page inspector is not supposed to do that. I think it is supposed to load the website in your local host the same way a browser would. Instead of trying to open the .cshtml file, try opening the website by opening the namespace/assembly name. When I do that page inspector work... |
1,520,231 | I am trying to integrate a calendar plugin like google calendar with custom database and code with asp.net MVC in C#.
It needs to handle Day/Week/Month Events in the Calendar as like google calendar.
I found the similar plugin in jquery <http://www.webappers.com/2009/08/04/jquery-weekly-calendar-plugin-inspired-by-g... | 2009/10/05 | [
"https://Stackoverflow.com/questions/1520231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | I answered a similar question a while ago, "[ASP.net weekly schedule control](https://stackoverflow.com/questions/700810/asp-net-weekly-schedule-control)", and the answer there would still be relevant to yourself.
>
> [DayPilot](http://www.daypilot.org/) is a pretty good general
> purpose calendaring/schedule contro... | Use Google's [Calendar API](http://code.google.com/apis/calendar/) |
1,520,231 | I am trying to integrate a calendar plugin like google calendar with custom database and code with asp.net MVC in C#.
It needs to handle Day/Week/Month Events in the Calendar as like google calendar.
I found the similar plugin in jquery <http://www.webappers.com/2009/08/04/jquery-weekly-calendar-plugin-inspired-by-g... | 2009/10/05 | [
"https://Stackoverflow.com/questions/1520231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | I'd try [FullCalendar](http://arshaw.com/fullcalendar/) | I answered a similar question a while ago, "[ASP.net weekly schedule control](https://stackoverflow.com/questions/700810/asp-net-weekly-schedule-control)", and the answer there would still be relevant to yourself.
>
> [DayPilot](http://www.daypilot.org/) is a pretty good general
> purpose calendaring/schedule contro... |
1,520,231 | I am trying to integrate a calendar plugin like google calendar with custom database and code with asp.net MVC in C#.
It needs to handle Day/Week/Month Events in the Calendar as like google calendar.
I found the similar plugin in jquery <http://www.webappers.com/2009/08/04/jquery-weekly-calendar-plugin-inspired-by-g... | 2009/10/05 | [
"https://Stackoverflow.com/questions/1520231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | I answered a similar question a while ago, "[ASP.net weekly schedule control](https://stackoverflow.com/questions/700810/asp-net-weekly-schedule-control)", and the answer there would still be relevant to yourself.
>
> [DayPilot](http://www.daypilot.org/) is a pretty good general
> purpose calendaring/schedule contro... | I am using this jquery plugin.
<http://www.web-delicious.com/jquery-events-calendar-wdcalendar/>
It provide php mvc sample, you can convert it to .net mvc |
1,520,231 | I am trying to integrate a calendar plugin like google calendar with custom database and code with asp.net MVC in C#.
It needs to handle Day/Week/Month Events in the Calendar as like google calendar.
I found the similar plugin in jquery <http://www.webappers.com/2009/08/04/jquery-weekly-calendar-plugin-inspired-by-g... | 2009/10/05 | [
"https://Stackoverflow.com/questions/1520231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | I answered a similar question a while ago, "[ASP.net weekly schedule control](https://stackoverflow.com/questions/700810/asp-net-weekly-schedule-control)", and the answer there would still be relevant to yourself.
>
> [DayPilot](http://www.daypilot.org/) is a pretty good general
> purpose calendaring/schedule contro... | The best one I found is [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler/). It is highly customizable, fires events and works cross-browser. It is free for GPL projects, otherwise there are commercial licenses available with affordable prices. And their customer support is excellent! |
1,520,231 | I am trying to integrate a calendar plugin like google calendar with custom database and code with asp.net MVC in C#.
It needs to handle Day/Week/Month Events in the Calendar as like google calendar.
I found the similar plugin in jquery <http://www.webappers.com/2009/08/04/jquery-weekly-calendar-plugin-inspired-by-g... | 2009/10/05 | [
"https://Stackoverflow.com/questions/1520231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | I'd try [FullCalendar](http://arshaw.com/fullcalendar/) | Use Google's [Calendar API](http://code.google.com/apis/calendar/) |
1,520,231 | I am trying to integrate a calendar plugin like google calendar with custom database and code with asp.net MVC in C#.
It needs to handle Day/Week/Month Events in the Calendar as like google calendar.
I found the similar plugin in jquery <http://www.webappers.com/2009/08/04/jquery-weekly-calendar-plugin-inspired-by-g... | 2009/10/05 | [
"https://Stackoverflow.com/questions/1520231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | The best one I found is [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler/). It is highly customizable, fires events and works cross-browser. It is free for GPL projects, otherwise there are commercial licenses available with affordable prices. And their customer support is excellent! | Use Google's [Calendar API](http://code.google.com/apis/calendar/) |
1,520,231 | I am trying to integrate a calendar plugin like google calendar with custom database and code with asp.net MVC in C#.
It needs to handle Day/Week/Month Events in the Calendar as like google calendar.
I found the similar plugin in jquery <http://www.webappers.com/2009/08/04/jquery-weekly-calendar-plugin-inspired-by-g... | 2009/10/05 | [
"https://Stackoverflow.com/questions/1520231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | I'd try [FullCalendar](http://arshaw.com/fullcalendar/) | I am using this jquery plugin.
<http://www.web-delicious.com/jquery-events-calendar-wdcalendar/>
It provide php mvc sample, you can convert it to .net mvc |
1,520,231 | I am trying to integrate a calendar plugin like google calendar with custom database and code with asp.net MVC in C#.
It needs to handle Day/Week/Month Events in the Calendar as like google calendar.
I found the similar plugin in jquery <http://www.webappers.com/2009/08/04/jquery-weekly-calendar-plugin-inspired-by-g... | 2009/10/05 | [
"https://Stackoverflow.com/questions/1520231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | I'd try [FullCalendar](http://arshaw.com/fullcalendar/) | The best one I found is [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler/). It is highly customizable, fires events and works cross-browser. It is free for GPL projects, otherwise there are commercial licenses available with affordable prices. And their customer support is excellent! |
1,520,231 | I am trying to integrate a calendar plugin like google calendar with custom database and code with asp.net MVC in C#.
It needs to handle Day/Week/Month Events in the Calendar as like google calendar.
I found the similar plugin in jquery <http://www.webappers.com/2009/08/04/jquery-weekly-calendar-plugin-inspired-by-g... | 2009/10/05 | [
"https://Stackoverflow.com/questions/1520231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | The best one I found is [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler/). It is highly customizable, fires events and works cross-browser. It is free for GPL projects, otherwise there are commercial licenses available with affordable prices. And their customer support is excellent! | I am using this jquery plugin.
<http://www.web-delicious.com/jquery-events-calendar-wdcalendar/>
It provide php mvc sample, you can convert it to .net mvc |
41,282,587 | I have a 2-dimensional lattice (L\*L) with fixed boundaries and considering N-S-W-E sites as 4 neighbours to each site. Each site is assigned an float value. For each site I am calculating average of values of its neighbouring sites added to its own value. I want to solve this using convolv2d from scipy.signal. Followi... | 2016/12/22 | [
"https://Stackoverflow.com/questions/41282587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7245071/"
] | [jQuery.getJSON()](http://api.jquery.com/jquery.getjson/) load JSON-encoded data from the server using a GET HTTP request.
As you post in your JSON structure you can access to the array by calling `json.data`:
```
$.getJSON("/ajax/data/myjasonfile.json", function(json) {
console.log(json.data); // Logs your arra... | you can try this:
```
$.getJSON("test.json", function(json) {
console.log(json); // this will show the info it in firebug console
});
```
I think, Some issue is in your path to call json file. you need to check again of path.
You can check this link: [Loading local JSON file](https://stackoverflow.com/questions... |
41,282,587 | I have a 2-dimensional lattice (L\*L) with fixed boundaries and considering N-S-W-E sites as 4 neighbours to each site. Each site is assigned an float value. For each site I am calculating average of values of its neighbouring sites added to its own value. I want to solve this using convolv2d from scipy.signal. Followi... | 2016/12/22 | [
"https://Stackoverflow.com/questions/41282587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7245071/"
] | Try this to understand your response structure.
```
$.getJSON("myjasonfile.json", function(json) {
console.log(json); // access the response object
console.log(json.data); // access the array
console.log(json.data[0]); // access the first object of the array
console.log(json.data[0].nu... | [jQuery.getJSON()](http://api.jquery.com/jquery.getjson/) load JSON-encoded data from the server using a GET HTTP request.
As you post in your JSON structure you can access to the array by calling `json.data`:
```
$.getJSON("/ajax/data/myjasonfile.json", function(json) {
console.log(json.data); // Logs your arra... |
41,282,587 | I have a 2-dimensional lattice (L\*L) with fixed boundaries and considering N-S-W-E sites as 4 neighbours to each site. Each site is assigned an float value. For each site I am calculating average of values of its neighbouring sites added to its own value. I want to solve this using convolv2d from scipy.signal. Followi... | 2016/12/22 | [
"https://Stackoverflow.com/questions/41282587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7245071/"
] | Try this to understand your response structure.
```
$.getJSON("myjasonfile.json", function(json) {
console.log(json); // access the response object
console.log(json.data); // access the array
console.log(json.data[0]); // access the first object of the array
console.log(json.data[0].nu... | you can try this:
```
$.getJSON("test.json", function(json) {
console.log(json); // this will show the info it in firebug console
});
```
I think, Some issue is in your path to call json file. you need to check again of path.
You can check this link: [Loading local JSON file](https://stackoverflow.com/questions... |
41,282,587 | I have a 2-dimensional lattice (L\*L) with fixed boundaries and considering N-S-W-E sites as 4 neighbours to each site. Each site is assigned an float value. For each site I am calculating average of values of its neighbouring sites added to its own value. I want to solve this using convolv2d from scipy.signal. Followi... | 2016/12/22 | [
"https://Stackoverflow.com/questions/41282587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7245071/"
] | Store The json Data in Array:
```
$.getJSON("/ajax/data/myjasonfile.json", function(Data) {
var array=[];
for(var i=1;i<Data.length;i++)
{
var b=Data[i];
var c=[];
c.push(b.number);
c.push(b.nameOne);
c.push(b.type);
c.push(b.flagName);
c.push(b.... | you can try this:
```
$.getJSON("test.json", function(json) {
console.log(json); // this will show the info it in firebug console
});
```
I think, Some issue is in your path to call json file. you need to check again of path.
You can check this link: [Loading local JSON file](https://stackoverflow.com/questions... |
41,282,587 | I have a 2-dimensional lattice (L\*L) with fixed boundaries and considering N-S-W-E sites as 4 neighbours to each site. Each site is assigned an float value. For each site I am calculating average of values of its neighbouring sites added to its own value. I want to solve this using convolv2d from scipy.signal. Followi... | 2016/12/22 | [
"https://Stackoverflow.com/questions/41282587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7245071/"
] | Try this to understand your response structure.
```
$.getJSON("myjasonfile.json", function(json) {
console.log(json); // access the response object
console.log(json.data); // access the array
console.log(json.data[0]); // access the first object of the array
console.log(json.data[0].nu... | Store The json Data in Array:
```
$.getJSON("/ajax/data/myjasonfile.json", function(Data) {
var array=[];
for(var i=1;i<Data.length;i++)
{
var b=Data[i];
var c=[];
c.push(b.number);
c.push(b.nameOne);
c.push(b.type);
c.push(b.flagName);
c.push(b.... |
51,487 | I have a document library containing a lot of personal information. Originally only admins could see the library but now it has been decided that users need to see their own information. Admins have Full Control and users have Read. The default view shows only documents where the user's name appears in a certain field.... | 2012/11/13 | [
"https://sharepoint.stackexchange.com/questions/51487",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/7433/"
] | ^ Disregard the first, I think I misread your question. The answer in this link may help you instead: <http://social.msdn.microsoft.com/Forums/gu-IN/sharepoint2010customization/thread/5faea89f-f3ea-4b4b-b4c0-2c0cc7e6ceee> | Fooling around with the SharePoint masterpage is a delicate matter if you don't understand its structure. Thus trying to remove the Quicklaunch from the masterpage is not a good idea.
What I can recommend you do is to hide the quicklaunch with some CSS, and then on the pages that you actually want it to appear you ins... |
1,266,731 | I moved to Kubuntu 20.04 recently.Two days ago I installed pyenv and using pyenv i installed python(3.6.8) then I looked for available python versions from pyenv using this command.
```
samip@samip-Inspiron-3521:~$ pyenv versions
3.6.8
```
But it only showed me this recently installed version but my system has pytho... | 2020/08/13 | [
"https://askubuntu.com/questions/1266731",
"https://askubuntu.com",
"https://askubuntu.com/users/1116117/"
] | The problem on a fresh Kubuntu 20.04 installation is that there is no python executable. The `/usr/bin` only has `python2` and `python3` but pyenv checks for `python` to determine if a system version is available.
As a workaround create a python executable yourself:
```
ln -s /usr/bin/python3 /usr/bin/python
``` | The prior answers solve this manually; there is also a package that will make the link: `python-is-python3`. Useful for including in your standard set of packages to install when setting up a new system.
Related GitHub bug thread: [Pyenv can't find system python (3.8) on Ubuntu 20.04 (#1613)](https://github.com/pyenv/... |
24,762,520 | We have the demo [here](http://angular-ui.github.io/ui-utils/#/mask) on the angular-ui page.
Wondering how we can write a mask with optional extension number.
`(999) 999-9999 ext. 999` will make the extension required. | 2014/07/15 | [
"https://Stackoverflow.com/questions/24762520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863637/"
] | I shared this same problem with you. There is a completely undocumented optional character feature for this component. I could only find it by reading the source code.
The solution for your mask would be:
```
(999) 999-9999 ext. ?9?9?9
```
Question marks in your mask will flag the next character as optional. Trust... | Still no answer for this one after two weeks. I would assume all agreed this AngularUI is too limited in handling this situation.
I ended up using `jquery.inputmask` (<http://github.com/RobinHerbots/jquery.inputmask>).
We have been using this jQuery extension library since there is no Angular. It appears still the m... |
24,762,520 | We have the demo [here](http://angular-ui.github.io/ui-utils/#/mask) on the angular-ui page.
Wondering how we can write a mask with optional extension number.
`(999) 999-9999 ext. 999` will make the extension required. | 2014/07/15 | [
"https://Stackoverflow.com/questions/24762520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863637/"
] | Still no answer for this one after two weeks. I would assume all agreed this AngularUI is too limited in handling this situation.
I ended up using `jquery.inputmask` (<http://github.com/RobinHerbots/jquery.inputmask>).
We have been using this jQuery extension library since there is no Angular. It appears still the m... | A good solution for this problem is to use [ngMask](https://github.com/candreoliveira/ngMask) which allows you to do exactly what you want without jQuery. To do that just add an '?' after the character you want to be optional:
`mask="9?9999-9999`
This is great for inputs like Brazilian phone numbers, which can have b... |
24,762,520 | We have the demo [here](http://angular-ui.github.io/ui-utils/#/mask) on the angular-ui page.
Wondering how we can write a mask with optional extension number.
`(999) 999-9999 ext. 999` will make the extension required. | 2014/07/15 | [
"https://Stackoverflow.com/questions/24762520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863637/"
] | I shared this same problem with you. There is a completely undocumented optional character feature for this component. I could only find it by reading the source code.
The solution for your mask would be:
```
(999) 999-9999 ext. ?9?9?9
```
Question marks in your mask will flag the next character as optional. Trust... | A good solution for this problem is to use [ngMask](https://github.com/candreoliveira/ngMask) which allows you to do exactly what you want without jQuery. To do that just add an '?' after the character you want to be optional:
`mask="9?9999-9999`
This is great for inputs like Brazilian phone numbers, which can have b... |
24,762,520 | We have the demo [here](http://angular-ui.github.io/ui-utils/#/mask) on the angular-ui page.
Wondering how we can write a mask with optional extension number.
`(999) 999-9999 ext. 999` will make the extension required. | 2014/07/15 | [
"https://Stackoverflow.com/questions/24762520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863637/"
] | I shared this same problem with you. There is a completely undocumented optional character feature for this component. I could only find it by reading the source code.
The solution for your mask would be:
```
(999) 999-9999 ext. ?9?9?9
```
Question marks in your mask will flag the next character as optional. Trust... | ```
(999) 999-9999 ext. ?9?9?9
```
This will work good but if you want to clear on blur and put the mask back then you need a little more, I used like this
```
<input type='text'
ng-model='customer.phone'
ui-mask="{{phoneMask}}"
ng-blur="removeMask()"
ng-focus="placeMask()" />
```
And in my controller:
``... |
24,762,520 | We have the demo [here](http://angular-ui.github.io/ui-utils/#/mask) on the angular-ui page.
Wondering how we can write a mask with optional extension number.
`(999) 999-9999 ext. 999` will make the extension required. | 2014/07/15 | [
"https://Stackoverflow.com/questions/24762520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863637/"
] | ```
(999) 999-9999 ext. ?9?9?9
```
This will work good but if you want to clear on blur and put the mask back then you need a little more, I used like this
```
<input type='text'
ng-model='customer.phone'
ui-mask="{{phoneMask}}"
ng-blur="removeMask()"
ng-focus="placeMask()" />
```
And in my controller:
``... | A good solution for this problem is to use [ngMask](https://github.com/candreoliveira/ngMask) which allows you to do exactly what you want without jQuery. To do that just add an '?' after the character you want to be optional:
`mask="9?9999-9999`
This is great for inputs like Brazilian phone numbers, which can have b... |
84,796 | I seem to be asking questions that often belong to other overflow sites.
Where can I browse the list of current overflow sites so I can choose one where to ask the question? | 2011/03/25 | [
"https://meta.stackexchange.com/questions/84796",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/159333/"
] | Look up and left in this page. There you will see the Stack Exchange™ MultiCollider SuperDropdown™. Second tab is what you want.
Or hop on over to <http://stackexchange.com> and check the [Sites tab](https://stackexchange.com/sites).
The page footer also lists all sites which have been officially launched. | On Area 51 you can see the sites that have been launched and the ones which are currently in their beta phase, as well as proposals for new sites.
However Area 51 does not list sites which were created without an Area 51 proposal (i.e. the main triology). You can see all non-Area 51 sites as well as the launched Area ... |
1,956,757 | How can I replace the last two matched string
`string s= "{\"test\":\"value\"}";`
From this string "s" I need to remove the double quotes of the value.
But I need generic, like the value may be any string in feature.
I need this to be done in `C#`. | 2009/12/24 | [
"https://Stackoverflow.com/questions/1956757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/171365/"
] | This [example](http://answers.oreilly.com/topic/340-how-to-quickly-find-the-last-match-in-a-string-in-c/) shows how to search a string using regex from right to left. You might find it of use. | You could use [String.LastIndexOf](http://msdn.microsoft.com/en-us/library/system.string.lastindexof%28v=VS.71%29.aspx) and [String.Remove](http://msdn.microsoft.com/en-us/library/system.string.remove%28v=VS.71%29.aspx) methods:
```
for (int i = 0; i < 2; i++)
{
s = s.Remove(s.LastIndexOf("\""), 1);
}
```
I... |
1,228,440 | I am having trouble writing a typeof statement which would be using a variable from a config file the code is like this
```
Type t = new typeof ("My.other.class" + configValue[0]);
```
configValue being the dynamic value I get from the app.config file.
The error I get is "type expected" it is fine if I type out the... | 2009/08/04 | [
"https://Stackoverflow.com/questions/1228440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88765/"
] | The `typeof` keyword is for compile-time use. Use the [`Type.GetType(string)`](http://msdn.microsoft.com/en-us/library/system.type.gettype.aspx) API instead. | To do this using just a namespace and class name (like in the question), you'll also need to know which assembly contains the class.
If the currently running assembly (or mscorlib) contains the Type, then you can use [Type.GetType(string)](http://msdn.microsoft.com/en-us/library/w3f99sx1.aspx) to get the Type.
If th... |
1,228,440 | I am having trouble writing a typeof statement which would be using a variable from a config file the code is like this
```
Type t = new typeof ("My.other.class" + configValue[0]);
```
configValue being the dynamic value I get from the app.config file.
The error I get is "type expected" it is fine if I type out the... | 2009/08/04 | [
"https://Stackoverflow.com/questions/1228440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88765/"
] | The `typeof` keyword is for compile-time use. Use the [`Type.GetType(string)`](http://msdn.microsoft.com/en-us/library/system.type.gettype.aspx) API instead. | Is this what you're looking for?
```
Type t = Type.GetType("spork");
object myspork = Activator.CreateInstance(t);
``` |
1,228,440 | I am having trouble writing a typeof statement which would be using a variable from a config file the code is like this
```
Type t = new typeof ("My.other.class" + configValue[0]);
```
configValue being the dynamic value I get from the app.config file.
The error I get is "type expected" it is fine if I type out the... | 2009/08/04 | [
"https://Stackoverflow.com/questions/1228440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88765/"
] | Is this what you're looking for?
```
Type t = Type.GetType("spork");
object myspork = Activator.CreateInstance(t);
``` | To do this using just a namespace and class name (like in the question), you'll also need to know which assembly contains the class.
If the currently running assembly (or mscorlib) contains the Type, then you can use [Type.GetType(string)](http://msdn.microsoft.com/en-us/library/w3f99sx1.aspx) to get the Type.
If th... |
45,797,025 | This is my database table:
[](https://i.stack.imgur.com/fXsjl.jpg)
I want to display this table (5 columns) on my page when clicking a button (List Users).
But I'm getting the following as output:
[](https://i... | 2017/08/21 | [
"https://Stackoverflow.com/questions/45797025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1745446/"
] | I've reached out to Fabric support and got an answer:
>
> The Latest Releases page shows all builds that have been used by at
> least 10% of your Daily Active Users (DAU) on any single day in the
> past 30 days or at least 4% of DAU on the current day. What's likely
> happening is that 3.5.9 isn't hitting the crit... | This might help you, can you see this
[](https://i.stack.imgur.com/8MT0O.png) |
6,529,505 | I have a class that extends Activity and implements ViewFactory.
I have found some tutorials and code examples that show how to setup a [textSwitcher](http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/TextSwitcher1.html) and [imageSwitcher](http://developer.android.com/resources... | 2011/06/30 | [
"https://Stackoverflow.com/questions/6529505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/756623/"
] | As Stéphane stated before me, create an inner class implementing ViewFactory
```
public class TextSwitcherFactory implements ViewFactory
{
@Override
public View makeView() {
TextView t = new TextView(Latest.this);
t.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
t.setTextSize(36);... | You can't have the same object used as a `ViewFactory` and use it as two different factories for two different components.
I never tried it, but it here is some solution from a OO perspective :
* create two inner classes inside your activity
* both of them will implement `ViewFactory`,
* assign an instance of each in... |
194,987 | You are given a matrix of forward and back slashes, for instance:
```
//\\
\//\
//\/
```
A slash cuts along the diagonal of its cell corner-to-corner, splitting it in two pieces.
Pieces from adjacent (horizontally or vertically) cells are glued together.
Your task is to count the number of resulting pieces. For the ... | 2019/10/28 | [
"https://codegolf.stackexchange.com/questions/194987",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/24908/"
] | [MATL](https://github.com/lmendo/MATL), 21 bytes
================================================
```
3XytPJ*-X*Xj~4&1ZIunq
```
The input is a matrix with `1` for `\` and `j` (imaginary unit) for `/`.
[Try it online!](https://tio.run/##y00syfn/3ziisiTAS0s3Qisiq85EzTDKszSv8P//6CydLB1DHUNrBUMdMNNaASKSFQsA) Or [verify... | [Charcoal](https://github.com/somebody1234/Charcoal), 70 bytes
==============================================================
```
≔׳Lθη≔׳L§θ⁰ζBζηψFLθ«J¹⊕׳ιF§θι«¿κP\²P/²M³→»»Fη«J⁰ιFζ«⊞υ¬℅KK¤#→»»⎚IΣυ
```
[Try it online!](https://tio.run/##dY5PT8JAFMTP7ad4wctrssZWb3BCEhOMaKPcag9Nu3Q3bLewfwjW8Nlrlw0pHDzOmzfzm5IVqmwL0... |
194,987 | You are given a matrix of forward and back slashes, for instance:
```
//\\
\//\
//\/
```
A slash cuts along the diagonal of its cell corner-to-corner, splitting it in two pieces.
Pieces from adjacent (horizontally or vertically) cells are glued together.
Your task is to count the number of resulting pieces. For the ... | 2019/10/28 | [
"https://codegolf.stackexchange.com/questions/194987",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/24908/"
] | [MATL](https://github.com/lmendo/MATL), 21 bytes
================================================
```
3XytPJ*-X*Xj~4&1ZIunq
```
The input is a matrix with `1` for `\` and `j` (imaginary unit) for `/`.
[Try it online!](https://tio.run/##y00syfn/3ziisiTAS0s3Qisiq85EzTDKszSv8P//6CydLB1DHUNrBUMdMNNaASKSFQsA) Or [verify... | [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 292 bytes
=================================================================================================================
```cs
n=>{var x=n.SelectMany(l=>"\0".Select(g=>l.SelectMany(r=>r.Skip(g).Concat(r.Take(g)... |
194,987 | You are given a matrix of forward and back slashes, for instance:
```
//\\
\//\
//\/
```
A slash cuts along the diagonal of its cell corner-to-corner, splitting it in two pieces.
Pieces from adjacent (horizontally or vertically) cells are glued together.
Your task is to count the number of resulting pieces. For the ... | 2019/10/28 | [
"https://codegolf.stackexchange.com/questions/194987",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/24908/"
] | [MATL](https://github.com/lmendo/MATL), 21 bytes
================================================
```
3XytPJ*-X*Xj~4&1ZIunq
```
The input is a matrix with `1` for `\` and `j` (imaginary unit) for `/`.
[Try it online!](https://tio.run/##y00syfn/3ziisiTAS0s3Qisiq85EzTDKszSv8P//6CydLB1DHUNrBUMdMNNaASKSFQsA) Or [verify... | JavaScript (ES6), ~~175~~ 174 bytes
===================================
This is probably overcomplicated.
```javascript
a=>a.map((r,y)=>r.map((v,x)=>[2,4].map(s=>v&s||(n++,g=(x,y,s,i,v=(r=a[y])&&r[x])=>!(v&(s^=i%2==v%2&&6))/v&&g(x+1-(r[x]|=s,s&2),y++,s^6)|g(x,y-=v%2*2^s&2,s,v))(x,y,s))),n=0)|n
```
[Try it online!](... |
194,987 | You are given a matrix of forward and back slashes, for instance:
```
//\\
\//\
//\/
```
A slash cuts along the diagonal of its cell corner-to-corner, splitting it in two pieces.
Pieces from adjacent (horizontally or vertically) cells are glued together.
Your task is to count the number of resulting pieces. For the ... | 2019/10/28 | [
"https://codegolf.stackexchange.com/questions/194987",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/24908/"
] | [MATL](https://github.com/lmendo/MATL), 21 bytes
================================================
```
3XytPJ*-X*Xj~4&1ZIunq
```
The input is a matrix with `1` for `\` and `j` (imaginary unit) for `/`.
[Try it online!](https://tio.run/##y00syfn/3ziisiTAS0s3Qisiq85EzTDKszSv8P//6CydLB1DHUNrBUMdMNNaASKSFQsA) Or [verify... | [Jelly](https://github.com/DennisMitchell/jelly), ~~50~~ 46 bytes
=================================================================
```
®_ż+¥"SƝż€"Jż‘$$ḞṖ
ZJḤ©Żż‘$;€þJ;ÇẎfƇ@Ẏ¥€`Q$ÐLL
```
[Try it online!](https://tio.run/##y0rNyan8///Quvije7QPLVUKPjb36J5HTWuUvIBUwwwVlYc75j3cOY0ryuvhjiWHVh7dDRG2Bio5vM/L@nD7w119acfaHYD... |
194,987 | You are given a matrix of forward and back slashes, for instance:
```
//\\
\//\
//\/
```
A slash cuts along the diagonal of its cell corner-to-corner, splitting it in two pieces.
Pieces from adjacent (horizontally or vertically) cells are glued together.
Your task is to count the number of resulting pieces. For the ... | 2019/10/28 | [
"https://codegolf.stackexchange.com/questions/194987",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/24908/"
] | [MATL](https://github.com/lmendo/MATL), 21 bytes
================================================
```
3XytPJ*-X*Xj~4&1ZIunq
```
The input is a matrix with `1` for `\` and `j` (imaginary unit) for `/`.
[Try it online!](https://tio.run/##y00syfn/3ziisiTAS0s3Qisiq85EzTDKszSv8P//6CydLB1DHUNrBUMdMNNaASKSFQsA) Or [verify... | MSX-BASIC, ~~226~~ 199 bytes
============================
```
1SCREEN2:READC,L:W=256/C:H=192/L:FORJ=1TOL:FORI=1TOC:A=H:B=H:READD:IFDTHENA=0:B=-H
2LINE(I*W,J*H-A)-STEP(-W,B):NEXTI,J:FORY=0TO191:FORX=0TO255:IFPOINT(X,Y)=4THENR=R+1:PAINT(X,Y)
3NEXTX,Y:SCREEN0:?R
```
This script draw slashes on a whole screen and use PA... |
9,329,114 | Does anyone know of a 'pluck' plugin that matches the underscore array method?
```
pluck_.pluck(list, propertyName)
```
A convenient version of what is perhaps the most common use-case for map: extracting a list of property values.
```
var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'c... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135687/"
] | You can do it with an expression;
```
var arr = $.map(stooges, function(o) { return o["name"]; })
``` | It's quite simple to implement this functionality yourself:
```
function pluck(originalArr, prop) {
var newArr = [];
for(var i = 0; i < originalArr.length; i++) {
newArr[i] = originalArr[i][prop];
}
return newArr;
}
```
All it does is iterate over the elements of the original array (each of w... |
9,329,114 | Does anyone know of a 'pluck' plugin that matches the underscore array method?
```
pluck_.pluck(list, propertyName)
```
A convenient version of what is perhaps the most common use-case for map: extracting a list of property values.
```
var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'c... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135687/"
] | just write your own
```
$.pluck = function(arr, key) {
return $.map(arr, function(e) { return e[key]; })
}
``` | It's quite simple to implement this functionality yourself:
```
function pluck(originalArr, prop) {
var newArr = [];
for(var i = 0; i < originalArr.length; i++) {
newArr[i] = originalArr[i][prop];
}
return newArr;
}
```
All it does is iterate over the elements of the original array (each of w... |
9,329,114 | Does anyone know of a 'pluck' plugin that matches the underscore array method?
```
pluck_.pluck(list, propertyName)
```
A convenient version of what is perhaps the most common use-case for map: extracting a list of property values.
```
var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'c... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135687/"
] | It's quite simple to implement this functionality yourself:
```
function pluck(originalArr, prop) {
var newArr = [];
for(var i = 0; i < originalArr.length; i++) {
newArr[i] = originalArr[i][prop];
}
return newArr;
}
```
All it does is iterate over the elements of the original array (each of w... | In simple case:
```
var arr = stooges.map(function(v) { return v.name; });
```
More generalized:
```
function pluck(list, propertyName) {
return list.map(function (v) { return v[propertyName]; })
}
```
But, IMHO, you should not implement it as tool function, but use the simple case *always*.
2018 update:
``... |
9,329,114 | Does anyone know of a 'pluck' plugin that matches the underscore array method?
```
pluck_.pluck(list, propertyName)
```
A convenient version of what is perhaps the most common use-case for map: extracting a list of property values.
```
var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'c... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135687/"
] | You can do it with an expression;
```
var arr = $.map(stooges, function(o) { return o["name"]; })
``` | just write your own
```
$.pluck = function(arr, key) {
return $.map(arr, function(e) { return e[key]; })
}
``` |
9,329,114 | Does anyone know of a 'pluck' plugin that matches the underscore array method?
```
pluck_.pluck(list, propertyName)
```
A convenient version of what is perhaps the most common use-case for map: extracting a list of property values.
```
var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'c... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135687/"
] | You can do it with an expression;
```
var arr = $.map(stooges, function(o) { return o["name"]; })
``` | In simple case:
```
var arr = stooges.map(function(v) { return v.name; });
```
More generalized:
```
function pluck(list, propertyName) {
return list.map(function (v) { return v[propertyName]; })
}
```
But, IMHO, you should not implement it as tool function, but use the simple case *always*.
2018 update:
``... |
9,329,114 | Does anyone know of a 'pluck' plugin that matches the underscore array method?
```
pluck_.pluck(list, propertyName)
```
A convenient version of what is perhaps the most common use-case for map: extracting a list of property values.
```
var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'c... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135687/"
] | just write your own
```
$.pluck = function(arr, key) {
return $.map(arr, function(e) { return e[key]; })
}
``` | In simple case:
```
var arr = stooges.map(function(v) { return v.name; });
```
More generalized:
```
function pluck(list, propertyName) {
return list.map(function (v) { return v[propertyName]; })
}
```
But, IMHO, you should not implement it as tool function, but use the simple case *always*.
2018 update:
``... |
28,914 | I have read Steven Pinker's Sense of Style, which is a great book.
In chapter 4, he talks about how to form lucid coherent sentences, and in chapter 5, called "Arcs of Coherence", he extends his analysis of coherence to relations between sentences within a paragraph (and also somewhat about coherence between subseque... | 2017/06/26 | [
"https://writers.stackexchange.com/questions/28914",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/24575/"
] | It seems to me that what Pinker is describing at the sentence and paragraph level is substantially what most books on story are describing at the level of a document as a whole. Stories have a coherent shape and that shape has been mapped in various ways by different authors, but broadly the same shape underlies what a... | The misconception at the heart of your question is that there has to be coherence between chapters, similar to the coherence between paragraphs.
In **technical and academic writing** there is indeed coherence, usually, and then *the same principles apply* for the transition from the last paragraph of the preceding cha... |
28,914 | I have read Steven Pinker's Sense of Style, which is a great book.
In chapter 4, he talks about how to form lucid coherent sentences, and in chapter 5, called "Arcs of Coherence", he extends his analysis of coherence to relations between sentences within a paragraph (and also somewhat about coherence between subseque... | 2017/06/26 | [
"https://writers.stackexchange.com/questions/28914",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/24575/"
] | [My PhD thesis](http://etheses.whiterose.ac.uk/12277/1/Infrared%20problem%20in%20the%20Faddeev--Popov%20sector%20in%20Yang--Mills%20Theory%20and%20Perturbative%20Gravity%20-%20Jos%20Gibbons%20-%20PhD%20-%202015.pdf) was divided in a nested manner into parts, chapters, sections and subsections. Whatever you're working o... | The misconception at the heart of your question is that there has to be coherence between chapters, similar to the coherence between paragraphs.
In **technical and academic writing** there is indeed coherence, usually, and then *the same principles apply* for the transition from the last paragraph of the preceding cha... |
13,623,126 | I have a two variables:
```
boost::array my_boost_array_variable_1<float, 3>;
boost::array my_boost_array_variable_2<float, 3>;
```
now I want to call a C function with the following signature:
```
int MPI_Allreduce ( void *sendbuf, void *recvbuf, ...);
```
I want to pass the address of a particular element of my... | 2012/11/29 | [
"https://Stackoverflow.com/questions/13623126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18775/"
] | For me first is more clear then second. But in reality i think they are equal. | It is system-depended which one is faster, you can see the assembly code for your self.
First method is safer, since it will throw you exception if you will try to address not legal index.
Second method usually is faster, since you have only a single de-reference. |
13,623,126 | I have a two variables:
```
boost::array my_boost_array_variable_1<float, 3>;
boost::array my_boost_array_variable_2<float, 3>;
```
now I want to call a C function with the following signature:
```
int MPI_Allreduce ( void *sendbuf, void *recvbuf, ...);
```
I want to pass the address of a particular element of my... | 2012/11/29 | [
"https://Stackoverflow.com/questions/13623126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18775/"
] | according to <http://www.boost.org/doc/libs/1_52_0/doc/html/boost/array.html> NEITHER version will throw.
(could not comment with my little reputation :-)) | It is system-depended which one is faster, you can see the assembly code for your self.
First method is safer, since it will throw you exception if you will try to address not legal index.
Second method usually is faster, since you have only a single de-reference. |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | I usually work with this one.
Also I can choose if I don't want certain characters
```
function rstr5($length = 1) {
return substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", $length)), 0, $length);
}
``` | This is how I'm doing it, though it's not exactly cryptographic; The Mersenne Twister is fast and reliable, but not the most secure.
```
function str_rand($chars, $len)
{
$str = '';
for ($max = strlen($chars) - 1, $i = 0; $i < $len; ++$i)
{
$str .= $chars[mt_rand(0, $max)];
}
return $str;
... |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | This supposed to be secure on most of the systems and fast:
```
bin2hex(openssl_random_pseudo_bytes($length / 2));
```
benchmarks (1000000 records, string length 100 chars)
```
rstr1: 198.93383002281
rstr2: 35.5827729702
rstr3: 6.8811790943146
rstr4: 5.4545040130615
this:: 3.9310231208801
``` | I usually work with this one.
Also I can choose if I don't want certain characters
```
function rstr5($length = 1) {
return substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", $length)), 0, $length);
}
``` |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | For anyone looking for an updated version of the "best" algorithm:
```
function randomString($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64_encode(random_bytes($length)));
}
return substr($result, 0, $le... | I usually work with this one.
Also I can choose if I don't want certain characters
```
function rstr5($length = 1) {
return substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", $length)), 0, $length);
}
``` |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | From my tests, your function is already very fast, but i managed to get to a faster one, even if it decreases the entropy
```
fcn time
rstr1: 1.074s (slowest)
rstr2: 0.917s
rstr3: 0.028s (yours)
rstr4: 0.022s (mine)
```
In my scenario, i needed 1k strings, as fast as possible.
```
function rstr1($length)
... | This is how I'm doing it, though it's not exactly cryptographic; The Mersenne Twister is fast and reliable, but not the most secure.
```
function str_rand($chars, $len)
{
$str = '';
for ($max = strlen($chars) - 1, $i = 0; $i < $len; ++$i)
{
$str .= $chars[mt_rand(0, $max)];
}
return $str;
... |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | 1. base64\_encoding won't decrease entropy, it is just a different representation of the same data.
2. It is OS specific, but I think the random values created are good enough with this function. Under PHP 5.3 you have to seed the generator beforehand, it can be a problem if you use this code on different servers. | From my tests, your function is already very fast, but i managed to get to a faster one, even if it decreases the entropy
```
fcn time
rstr1: 1.074s (slowest)
rstr2: 0.917s
rstr3: 0.028s (yours)
rstr4: 0.022s (mine)
```
In my scenario, i needed 1k strings, as fast as possible.
```
function rstr1($length)
... |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | 1. base64\_encoding won't decrease entropy, it is just a different representation of the same data.
2. It is OS specific, but I think the random values created are good enough with this function. Under PHP 5.3 you have to seed the generator beforehand, it can be a problem if you use this code on different servers. | I usually work with this one.
Also I can choose if I don't want certain characters
```
function rstr5($length = 1) {
return substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", $length)), 0, $length);
}
``` |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | For anyone looking for an updated version of the "best" algorithm:
```
function randomString($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64_encode(random_bytes($length)));
}
return substr($result, 0, $le... | This is how I'm doing it, though it's not exactly cryptographic; The Mersenne Twister is fast and reliable, but not the most secure.
```
function str_rand($chars, $len)
{
$str = '';
for ($max = strlen($chars) - 1, $i = 0; $i < $len; ++$i)
{
$str .= $chars[mt_rand(0, $max)];
}
return $str;
... |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | For anyone looking for an updated version of the "best" algorithm:
```
function randomString($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64_encode(random_bytes($length)));
}
return substr($result, 0, $le... | From my tests, your function is already very fast, but i managed to get to a faster one, even if it decreases the entropy
```
fcn time
rstr1: 1.074s (slowest)
rstr2: 0.917s
rstr3: 0.028s (yours)
rstr4: 0.022s (mine)
```
In my scenario, i needed 1k strings, as fast as possible.
```
function rstr1($length)
... |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | 1. base64\_encoding won't decrease entropy, it is just a different representation of the same data.
2. It is OS specific, but I think the random values created are good enough with this function. Under PHP 5.3 you have to seed the generator beforehand, it can be a problem if you use this code on different servers. | This is how I'm doing it, though it's not exactly cryptographic; The Mersenne Twister is fast and reliable, but not the most secure.
```
function str_rand($chars, $len)
{
$str = '';
for ($max = strlen($chars) - 1, $i = 0; $i < $len; ++$i)
{
$str .= $chars[mt_rand(0, $max)];
}
return $str;
... |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | This supposed to be secure on most of the systems and fast:
```
bin2hex(openssl_random_pseudo_bytes($length / 2));
```
benchmarks (1000000 records, string length 100 chars)
```
rstr1: 198.93383002281
rstr2: 35.5827729702
rstr3: 6.8811790943146
rstr4: 5.4545040130615
this:: 3.9310231208801
``` | This is how I'm doing it, though it's not exactly cryptographic; The Mersenne Twister is fast and reliable, but not the most secure.
```
function str_rand($chars, $len)
{
$str = '';
for ($max = strlen($chars) - 1, $i = 0; $i < $len; ++$i)
{
$str .= $chars[mt_rand(0, $max)];
}
return $str;
... |
18,471 | According to Catholic thought, if we are washed of Original Sin at the time of baptism, why do we transmit Original Sin to our children? In other words, how is it that my child is born with Original Sin when I was freed from Original Sin at the time of my baptism? | 2013/08/18 | [
"https://christianity.stackexchange.com/questions/18471",
"https://christianity.stackexchange.com",
"https://christianity.stackexchange.com/users/5459/"
] | I think you misunderstood the role of Baptism in Catholicism.
Cathecism of the Catholic Church-1263 says
>
> [1263] By Baptism all sins are **forgiven**, original sin and all personal
> sins, as well as all punishment for sin. In those who have been
> reborn nothing remains that would impede their entry into the ... | Not being a Roman Catholic, I cannot give you an answer from the RC perspective and tradition. I can, however, give you a brief overview about what the Bible has to say about Christian baptism.
As a wise man once told me,
>
> "Baptism doesn't *make* you a Christian; it *marks* you as a Christian."
>
>
>
As good ... |
18,471 | According to Catholic thought, if we are washed of Original Sin at the time of baptism, why do we transmit Original Sin to our children? In other words, how is it that my child is born with Original Sin when I was freed from Original Sin at the time of my baptism? | 2013/08/18 | [
"https://christianity.stackexchange.com/questions/18471",
"https://christianity.stackexchange.com",
"https://christianity.stackexchange.com/users/5459/"
] | Original sin is a state of human nature passed to all mankind, but it is not like a gene passed on from our immediate parents. It affects the nature of all humans. The Catholic Catechism discusses this in and around paragraphs 396 to 408.
In paragraph 404 talks a bit about what Original Sin is and its source:
>
> Bu... | Not being a Roman Catholic, I cannot give you an answer from the RC perspective and tradition. I can, however, give you a brief overview about what the Bible has to say about Christian baptism.
As a wise man once told me,
>
> "Baptism doesn't *make* you a Christian; it *marks* you as a Christian."
>
>
>
As good ... |
18,471 | According to Catholic thought, if we are washed of Original Sin at the time of baptism, why do we transmit Original Sin to our children? In other words, how is it that my child is born with Original Sin when I was freed from Original Sin at the time of my baptism? | 2013/08/18 | [
"https://christianity.stackexchange.com/questions/18471",
"https://christianity.stackexchange.com",
"https://christianity.stackexchange.com/users/5459/"
] | I think you misunderstood the role of Baptism in Catholicism.
Cathecism of the Catholic Church-1263 says
>
> [1263] By Baptism all sins are **forgiven**, original sin and all personal
> sins, as well as all punishment for sin. In those who have been
> reborn nothing remains that would impede their entry into the ... | Original sin is a state of human nature passed to all mankind, but it is not like a gene passed on from our immediate parents. It affects the nature of all humans. The Catholic Catechism discusses this in and around paragraphs 396 to 408.
In paragraph 404 talks a bit about what Original Sin is and its source:
>
> Bu... |
11,369,040 | I need to return the actual text description of the db connection, and any other relevant info about the DB.
Why? I call a service and the expected data comes back perfectly.
Now, when I do the same call inside of a secure tunnel, I get completely different results.
All indications say that the code is working in bo... | 2012/07/06 | [
"https://Stackoverflow.com/questions/11369040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/777828/"
] | I hope I've understood correctly:
```
function test() {
var db = ScriptDb.getMyDb();
var result = db.query({id: 434})
var quals = result.next().qualifications;
var hasQual = false;
for (var i = 0; i < quals.length; i++) {
if (quals[i].name == 'QUAL1' && quals[i].issueDate > 20050101) {
hasQual = ... | It isn't currently possible to construct a query that looks for a value within an array. You can file a feature request for that on the [issue tracker](http://code.google.com/p/google-apps-script-issues/issues/list). |
32,876,250 | I downloaded a Pycharm community mac OSX version. But after installation, each time I try to open it. It gives me this error. I can't find any information about this error after I google the error.
[](https://i.stack.imgur.com/QzNEO.png)
Thank you. | 2015/09/30 | [
"https://Stackoverflow.com/questions/32876250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1076975/"
] | OK. It turn out be a permission problem. Just chmod 777 the directory(mkdir before). Then this problem is solved | Start --> Search "idea.log". In this file change the path. |
56,100,559 | I've migrated to `androidx` and after a ton of time with it, I can't move away from the error below. I've integrated `multidex` but I still get the error.
This is the exception:
>
> FAILURE: Build failed with an exception.
>
>
>
>
What went wrong:
>
> Execution failed for task ':app:transformDexArchiveWithE... | 2019/05/12 | [
"https://Stackoverflow.com/questions/56100559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2064171/"
] | This is a great question!
Your rectangle can be thought of as 4 lines:
```
(x, y) → (x+width, y) # top
(x+width, y) → (x+width, y+height) # right
(x, y+height) → (x+width, y+height) # bottom
(x, y) → (x, y+height) # left
```
Taking your intersecting line, it's possible to use the [two-l... | Basically, is doesn't exist a method nor any pygame functionality to detect collisions with lines, that's why I had to come up with the solution I'm about to show.
Using the following [link](https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection), at section *formulas / Given two points on each line segment*, yo... |
56,100,559 | I've migrated to `androidx` and after a ton of time with it, I can't move away from the error below. I've integrated `multidex` but I still get the error.
This is the exception:
>
> FAILURE: Build failed with an exception.
>
>
>
>
What went wrong:
>
> Execution failed for task ':app:transformDexArchiveWithE... | 2019/05/12 | [
"https://Stackoverflow.com/questions/56100559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2064171/"
] | This is a great question!
Your rectangle can be thought of as 4 lines:
```
(x, y) → (x+width, y) # top
(x+width, y) → (x+width, y+height) # right
(x, y+height) → (x+width, y+height) # bottom
(x, y) → (x, y+height) # left
```
Taking your intersecting line, it's possible to use the [two-l... | The easiest way to detect the collision between a rectangle and a line is to use [`pygame.Rect.clipline`](https://www.pygame.org/docs/ref/rect.html#pygame.Rect.clipline):
>
> Returns the coordinates of a line that is cropped to be completely inside the rectangle. **If the line does not overlap the rectangle, then an ... |
42,504 | Ce [proverbe](http://www.linternaute.fr/proverbe/377/au-royaume-des-aveugles-les-borgnes-sont-rois/#:%7E:text=Au%20royaume%20des%20aveugles%2C%20les%20borgnes%20sont%20rois.%22&text=Entour%C3%A9%20de%20personnes%20ignorantes%20ou,intelligence%20passe%20pour%20un%20g%C3%A9nie.&text=Ce%20proverbe%20provient%20de%20la,par... | 2020/07/08 | [
"https://french.stackexchange.com/questions/42504",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/16020/"
] | J’ai déjà entendu plusieurs fois cette expression et elle est pour moi toujours couramment utilisée, en tout cas comprise.
En revanche, elle est effectivement politiquement peu correcte. Pour cela, je ne la vois être utilisée que dans certains cas : car (1) elle dénote toujours un certain sarcasme et (2) relève plutôt... | As far as I understand there is also the old saying
>
> Leur savoir n’estoit que besterie et leur sapience n’estoit que moufles ([Rabelais](http://agora.qc.ca/documents/Francois_Rabelais--Leducation_selon_Rabelais_par_Gabriel_Compayre#:%7E:text=Car%20leur%20savoir%20n%27estoit,meilleur%20langagee%20que%20votre%20fils... |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | I use this command for simple rotate a file:
```
mv output.log `date +%F`-output.log
```
In local folder I have `2019-09-25-output.log` | First, thanks for the answers above! They lead to my solution.
I added this alias to my .bashrc file:
```
alias now='date +%Y-%m-%d-%H.%M.%S'
```
Now when I want to put a time stamp on a file such as a build log I can do this:
```
mvn clean install | tee build-$(now).log
```
and I get a file name like:
build-20... |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | ```
mv server.log logs/$(date -d "today" +"%Y%m%d%H%M").log
``` | Well, it's not a direct answer to your question, but there's a tool in GNU/Linux whose job is to rotate log files on regular basis, keeping old ones zipped up to a certain limit. It's `logrotate` |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | The few lines you posted from your script look okay to me. It's probably something a bit deeper.
You need to find which line is giving you this error. Add `set -xv` to the top of your script. This will print out the line number and the command that's being executed to *STDERR*. This will help you identify where in you... | Well, it's not a direct answer to your question, but there's a tool in GNU/Linux whose job is to rotate log files on regular basis, keeping old ones zipped up to a certain limit. It's `logrotate` |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | A single line method within bash works like this.
[some out put] >$(date "+%Y.%m.%d-%H.%M.%S").ver
will create a file with a timestamp name with ver extension.
A working file listing snap shot to a date stamp file name as follows can show it working.
`find . -type f -exec ls -la {} \; | cut -d ' ' -f 6- >$(date "+%Y... | Well, it's not a direct answer to your question, but there's a tool in GNU/Linux whose job is to rotate log files on regular basis, keeping old ones zipped up to a certain limit. It's `logrotate` |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | I use this command for simple rotate a file:
```
mv output.log `date +%F`-output.log
```
In local folder I have `2019-09-25-output.log` | You can write your scripts in notepad but just make sure you convert them
using this ->
$ sed -i 's/\r$//' yourscripthere
I use it all they time when I'm working in cygwin and it works. Hope this helps |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | ```
mv server.log logs/$(date -d "today" +"%Y%m%d%H%M").log
``` | A single line method within bash works like this.
[some out put] >$(date "+%Y.%m.%d-%H.%M.%S").ver
will create a file with a timestamp name with ver extension.
A working file listing snap shot to a date stamp file name as follows can show it working.
`find . -type f -exec ls -la {} \; | cut -d ' ' -f 6- >$(date "+%Y... |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | The few lines you posted from your script look okay to me. It's probably something a bit deeper.
You need to find which line is giving you this error. Add `set -xv` to the top of your script. This will print out the line number and the command that's being executed to *STDERR*. This will help you identify where in you... | You can write your scripts in notepad but just make sure you convert them
using this ->
$ sed -i 's/\r$//' yourscripthere
I use it all they time when I'm working in cygwin and it works. Hope this helps |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | ```
mv server.log logs/$(date -d "today" +"%Y%m%d%H%M").log
``` | The few lines you posted from your script look okay to me. It's probably something a bit deeper.
You need to find which line is giving you this error. Add `set -xv` to the top of your script. This will print out the line number and the command that's being executed to *STDERR*. This will help you identify where in you... |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | The few lines you posted from your script look okay to me. It's probably something a bit deeper.
You need to find which line is giving you this error. Add `set -xv` to the top of your script. This will print out the line number and the command that's being executed to *STDERR*. This will help you identify where in you... | First, thanks for the answers above! They lead to my solution.
I added this alias to my .bashrc file:
```
alias now='date +%Y-%m-%d-%H.%M.%S'
```
Now when I want to put a time stamp on a file such as a build log I can do this:
```
mvn clean install | tee build-$(now).log
```
and I get a file name like:
build-20... |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | ```
mv server.log logs/$(date -d "today" +"%Y%m%d%H%M").log
``` | First, thanks for the answers above! They lead to my solution.
I added this alias to my .bashrc file:
```
alias now='date +%Y-%m-%d-%H.%M.%S'
```
Now when I want to put a time stamp on a file such as a build log I can do this:
```
mvn clean install | tee build-$(now).log
```
and I get a file name like:
build-20... |
34,372,419 | I would like to make an ImageView ? AND WHEN i touch it it change background, when i drag finger far of it it become normal i don't know how to do, thanks
```
imgButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
cmp++;
... | 2015/12/19 | [
"https://Stackoverflow.com/questions/34372419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872660/"
] | You could go with `serverVersion`. But as you can see in the picture, you still get `Glassfish V3.1` with Glassfish 4.1.
[](https://i.stack.imgur.com/WwqDv.png)
Now, `ApplicationServerFullVersion` will bring better results: `GlassFish Server Open Source Edit... | If you want to get the GlassFish version from code not via JMX there is a Version class in package com.sun.appserv.server.util this has many version related methods; [See the source on GitHub](https://github.com/payara/Payara/blob/8a403bf75d3734e564a9fb95d60498987cc4287e/nucleus/common/common-util/src/main/java/com/sun... |
414,742 | In [J.J. Sakurai's](https://en.wikipedia.org/wiki/J._J._Sakurai) *[Modern Quantum Mechanics](https://en.wikipedia.org/wiki/J._J._Sakurai#Textbooks)*, the same operator $X$ acts on both, elements of the [ket](https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation#Ket_notation) space and the [bra](https://en.wikipedia.or... | 2018/07/02 | [
"https://physics.stackexchange.com/questions/414742",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/170225/"
] | The action (to the right) on the ket space naturally induces an action (to the left) on the bra space. The bra space is the dual space of the ket space (that is the space of linear functionals over the kets). We can simply define $\left< \psi \right| X$ by its action on kets (or, since it's linear, on a basis of ket sp... | Just think of the operator as a matrix (as per your "matrix-elements" tag). Then it operates to the right on a column-vector $\left|\mbox{ket}\right>$, and to the left on a row-vector $\left<\mbox{bra}\right|$ |
414,742 | In [J.J. Sakurai's](https://en.wikipedia.org/wiki/J._J._Sakurai) *[Modern Quantum Mechanics](https://en.wikipedia.org/wiki/J._J._Sakurai#Textbooks)*, the same operator $X$ acts on both, elements of the [ket](https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation#Ket_notation) space and the [bra](https://en.wikipedia.or... | 2018/07/02 | [
"https://physics.stackexchange.com/questions/414742",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/170225/"
] | This is what computer scientists would call [(ad-hoc) polymorphic](https://en.wikipedia.org/wiki/Polymorphism_(computer_science)) or “overloaded” functions: basically, an operator $X$ on the Hilbert space $\mathcal{H}$ is not just one function $X: \mathcal{H}\to\mathcal{H}$, but a family of two functions
$$
X = \{ X\_... | The action (to the right) on the ket space naturally induces an action (to the left) on the bra space. The bra space is the dual space of the ket space (that is the space of linear functionals over the kets). We can simply define $\left< \psi \right| X$ by its action on kets (or, since it's linear, on a basis of ket sp... |
414,742 | In [J.J. Sakurai's](https://en.wikipedia.org/wiki/J._J._Sakurai) *[Modern Quantum Mechanics](https://en.wikipedia.org/wiki/J._J._Sakurai#Textbooks)*, the same operator $X$ acts on both, elements of the [ket](https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation#Ket_notation) space and the [bra](https://en.wikipedia.or... | 2018/07/02 | [
"https://physics.stackexchange.com/questions/414742",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/170225/"
] | This is what computer scientists would call [(ad-hoc) polymorphic](https://en.wikipedia.org/wiki/Polymorphism_(computer_science)) or “overloaded” functions: basically, an operator $X$ on the Hilbert space $\mathcal{H}$ is not just one function $X: \mathcal{H}\to\mathcal{H}$, but a family of two functions
$$
X = \{ X\_... | Just think of the operator as a matrix (as per your "matrix-elements" tag). Then it operates to the right on a column-vector $\left|\mbox{ket}\right>$, and to the left on a row-vector $\left<\mbox{bra}\right|$ |
19,440,525 | I have a bean whose business logic loads beans of a certain type from the ApplicationContext in order to process them.
For my jUnit tests, I would like to create some dummy beans within my unit test class and see if my bean under test properly processes them. However, I am not sure what the best way to accomplish this... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19440525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827480/"
] | You need to make your inner class `static`; Spring can't instantiate a non-`static` inner class as a bean. If there really is a valid reason why it needs to be non-`static`, you could create it manually in an `@Bean` method. | I also met this problem, and below is my solution :
```
@RunWith(SpringRunner.class)
@SpringBootTest
@ComponentScan
@ImportAutoConfiguration
public class FooTest {
@Component
public static class Bar {
}
}
```
I used spring boot `2.1.4.RELEASE` |
724,698 | I have genuine windows 10 in my lappy. I tried to dual boot with Ubuntu but accidentally I replaced my windows with ubuntu. So now I have only ubuntu in my pc and I lost my genuine windows. How to get back my windows OS.I dont even have my back up image of my windows | 2016/01/23 | [
"https://askubuntu.com/questions/724698",
"https://askubuntu.com",
"https://askubuntu.com/users/496793/"
] | If you really deleted the Windows partition, Ubuntu is not going to get it back for you. Sorry.
Not knowing if this computer originally came with Windows 10, I will make the assumption it's fairly new and did. You could post more info per <https://askubuntu.com/help/how-to-ask> :>)
When you start there should be a re... | Download testdisk from : <http://www.cgsecurity.org/wiki/TestDisk_Download> unpack it, launch ubuntu from live, change to folder where testdisk was unpacked and run:
```
sudo ./testdisk_static
```
from program menu chose analyse and try to recover your partition
This tutorial will help:
<http://www.cgsecu... |
148,438 | My home’s A/C has an external circuit breaker. Do I need to switch it off for the winter? | 2018/10/10 | [
"https://diy.stackexchange.com/questions/148438",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/44694/"
] | There is no need to switch off the external breaker serving the outside condensing unit. I have never done so in 40 years at our house. I have never heard of anyone doing so, and I have never heard it recommended. In our installation the external box adjacent to the condensing unit contains a double pole switch, not a ... | No, you should not be doing that. It will have no advantage to switch it off. Many of the houses run for long time with external circuit breaker that is working along the HVAC system. |
148,438 | My home’s A/C has an external circuit breaker. Do I need to switch it off for the winter? | 2018/10/10 | [
"https://diy.stackexchange.com/questions/148438",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/44694/"
] | There is no need to switch off the external breaker serving the outside condensing unit. I have never done so in 40 years at our house. I have never heard of anyone doing so, and I have never heard it recommended. In our installation the external box adjacent to the condensing unit contains a double pole switch, not a ... | No, there's no benefit to it whatsoever. Also, on most split systems, the compressor is still in use when the heat is on. For split gas systems, they normally "steal" power from a leg on the compressor circuit to power the blower. |
148,438 | My home’s A/C has an external circuit breaker. Do I need to switch it off for the winter? | 2018/10/10 | [
"https://diy.stackexchange.com/questions/148438",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/44694/"
] | No, there's no benefit to it whatsoever. Also, on most split systems, the compressor is still in use when the heat is on. For split gas systems, they normally "steal" power from a leg on the compressor circuit to power the blower. | No, you should not be doing that. It will have no advantage to switch it off. Many of the houses run for long time with external circuit breaker that is working along the HVAC system. |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | I had the same problem. All I did to solve it is remove `.enableAutoManage(this, 0 /* clientId */, this)` because it just doesn't work properly from what I assumed. Then, override these methods in your activity:
```
@Override
public void onStart() {
super.onStart();
if (mGoogleApiClient != null) {
mGoo... | I think you'd better watch this reference.
[reference page of "public GoogleApiClient.Builder enableAutoManage"](https://developer.android.com/reference/com/google/android/gms/common/api/GoogleApiClient.Builder.html#enableAutoManage(android.support.v4.app.FragmentActivity,%20int,%20com.google.android.gms.common.api.G... |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | I think you'd better watch this reference.
[reference page of "public GoogleApiClient.Builder enableAutoManage"](https://developer.android.com/reference/com/google/android/gms/common/api/GoogleApiClient.Builder.html#enableAutoManage(android.support.v4.app.FragmentActivity,%20int,%20com.google.android.gms.common.api.G... | If u are facing this problem when u try to reinitialize mGoogleApiClient, then just remove
`.enableAutoManage(this, 0 /* clientId */, this)`
Use
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallb... |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | If u are facing this problem when u try to reinitialize mGoogleApiClient, then just remove
`.enableAutoManage(this, 0 /* clientId */, this)`
Use
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallb... | `build()` calls `onConnected` immediately if you are already connected. Therefore, your variable might be null.
Better use
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_... |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | [Documentation](https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApiClient.Builder) says: At any given time, only one auto-managed client is allowed per id. To reuse an id you must first call `stopAutoManage(FragmentActivity)` on the previous client.
What I personally do is makin... | `build()` calls `onConnected` immediately if you are already connected. Therefore, your variable might be null.
Better use
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_... |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | I think you'd better watch this reference.
[reference page of "public GoogleApiClient.Builder enableAutoManage"](https://developer.android.com/reference/com/google/android/gms/common/api/GoogleApiClient.Builder.html#enableAutoManage(android.support.v4.app.FragmentActivity,%20int,%20com.google.android.gms.common.api.G... | I had the same problem (Already managing a GoogleApiClient with id 0) in a fragment, and finally I resolved it :
* Override `onStart()` and `onStop()` normally
* Add in `onStop()` call `yourApiGoogle.stopAutoManage(context);`
Have a nice day... |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | [Documentation](https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApiClient.Builder) says: At any given time, only one auto-managed client is allowed per id. To reuse an id you must first call `stopAutoManage(FragmentActivity)` on the previous client.
What I personally do is makin... | I think you'd better watch this reference.
[reference page of "public GoogleApiClient.Builder enableAutoManage"](https://developer.android.com/reference/com/google/android/gms/common/api/GoogleApiClient.Builder.html#enableAutoManage(android.support.v4.app.FragmentActivity,%20int,%20com.google.android.gms.common.api.G... |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | [Documentation](https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApiClient.Builder) says: At any given time, only one auto-managed client is allowed per id. To reuse an id you must first call `stopAutoManage(FragmentActivity)` on the previous client.
What I personally do is makin... | If u are facing this problem when u try to reinitialize mGoogleApiClient, then just remove
`.enableAutoManage(this, 0 /* clientId */, this)`
Use
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallb... |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | I had the same problem. All I did to solve it is remove `.enableAutoManage(this, 0 /* clientId */, this)` because it just doesn't work properly from what I assumed. Then, override these methods in your activity:
```
@Override
public void onStart() {
super.onStart();
if (mGoogleApiClient != null) {
mGoo... | [Documentation](https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApiClient.Builder) says: At any given time, only one auto-managed client is allowed per id. To reuse an id you must first call `stopAutoManage(FragmentActivity)` on the previous client.
What I personally do is makin... |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | I had the same problem. All I did to solve it is remove `.enableAutoManage(this, 0 /* clientId */, this)` because it just doesn't work properly from what I assumed. Then, override these methods in your activity:
```
@Override
public void onStart() {
super.onStart();
if (mGoogleApiClient != null) {
mGoo... | `build()` calls `onConnected` immediately if you are already connected. Therefore, your variable might be null.
Better use
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_... |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | I had the same problem (Already managing a GoogleApiClient with id 0) in a fragment, and finally I resolved it :
* Override `onStart()` and `onStop()` normally
* Add in `onStop()` call `yourApiGoogle.stopAutoManage(context);`
Have a nice day... | `build()` calls `onConnected` immediately if you are already connected. Therefore, your variable might be null.
Better use
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_... |
13,250,030 | I'm using this CoverFlow :
<http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html>
I want to be able to change View when I click on a button, the button being a back/forward icon which will take you to the previous/next item in the coverflow.
I have modded the coverflow slightly so that I use an XML lay... | 2012/11/06 | [
"https://Stackoverflow.com/questions/13250030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1067944/"
] | While I was trying to find out how to add the animation I came across this which does everything in just one line :
go left
`coverFlow.onKeyDown(KeyEvent.KEYCODE_DPAD_LEFT, new KeyEvent(0, 0));`
go right
`coverFlow.onKeyDown(KeyEvent.KEYCODE_DPAD_RIGHT, new KeyEvent(0, 0));`
(just add each line to their respectiv... | I hope i understand your question. if so, here's an idea:
you need to store a private instance variable that tracks the current position of the image that is being displayed from the coverflow. then, you update it from the `setOnItemSelectedListener()` method, which is inherited from Gallery. On the "back" or "forward... |
13,250,030 | I'm using this CoverFlow :
<http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html>
I want to be able to change View when I click on a button, the button being a back/forward icon which will take you to the previous/next item in the coverflow.
I have modded the coverflow slightly so that I use an XML lay... | 2012/11/06 | [
"https://Stackoverflow.com/questions/13250030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1067944/"
] | While I was trying to find out how to add the animation I came across this which does everything in just one line :
go left
`coverFlow.onKeyDown(KeyEvent.KEYCODE_DPAD_LEFT, new KeyEvent(0, 0));`
go right
`coverFlow.onKeyDown(KeyEvent.KEYCODE_DPAD_RIGHT, new KeyEvent(0, 0));`
(just add each line to their respectiv... | Thanks David, I'm one of the Mike colleagues but I've never written a line of Java.
I work in the iOS department of our company.
I understood what you were talking about. Your answer was helpful and well written!
I just had to add :
```
if ( currentimageposition < coverFlow.getcount()-1) {
coverFlow.setSelection... |
32,537,729 | I installed libsql-translator-perl on Ubuntu 15.04 and ran it with
```
sqlt -f SQLite -t MySql /tmp/test.sql /tmp/out.sql
```
test.sql contains only this:
```
CREATE TABLE X (id INTEGER);
```
It failed with
```
Use of uninitialized value $name in pattern match (m//) at /usr/share/perl5/SQL/Translator.pm line 610... | 2015/09/12 | [
"https://Stackoverflow.com/questions/32537729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/458742/"
] | The error message tells you that `$name` is undefined; it is set to the first argument, i.e. the value of `$module` in `_load_sub`, which is set to the second captured match in `m/((.*)::)?(\w+)$/`: everything in the value of `$tool` before the first occurrence of `::`, if `::` occurs, and undefined otherwise.
So `$to... | The SQL::Translator parser for MySQL is called "MySQL", not "MySql".
```
sqlt -f SQLite -t MySQL /tmp/test.sql /tmp/out.sql
```
Running `sqlt -l` will give you a complete list of the parsers available.
But I certainly agree that the error message could be better. It's worth raising a bug against this. |
32,506,415 | I'm trying to load google font to my webapp (angular based but not relevant) and I'm getting this error:
```
Failed to decode downloaded font: https://fonts.googleapis.com/css?family=Open+Sans
```
The relevant part of my webpack.config.js is:
```
loaders: [
{test: /\.less$/, loader: "style!css!less", exclud... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32506415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4470201/"
] | I'd suggest you have a look at this article by Paul Irish from 2009 named [Bulletproof @font-face syntax](http://www.paulirish.com/2009/bulletproof-font-face-implementation-syntax/)
It explains very well and in all detail how to get webfonts up and running across all (or at least all capable) browsers. | Another way is to use `link` tag to load the CSS. Then define the font in custom CSS.
Example:
```
<link href='http://fonts.googleapis.com/css?family=Abel' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
font-family:'Abel',Sans;
}
</style>
``` |
15,746,542 | I have a problem with sorting my sentence values in descending order:
I typed this command in unix:
```
sort fileInput -t"(" -k2r >fileSort
```
Here's the input file:
```
comité de conciliation de décision du parlement européen et du (0.00098379)
les amendements CARD CARD CARD CARD CARD CARD et CARD (-0.00025... | 2013/04/01 | [
"https://Stackoverflow.com/questions/15746542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2215112/"
] | Add `-n` and `-g` options for numeric sort like this:
```
sort -t"(" -ngk2r
``` | use -rk2 instead of -k2r, that is
```
sort fileInput -t"(" -k2r >fileSort
``` |
1,003,201 | Is there a way to list runtime-only (i.e. no `--permanent`) changes in firewalld? I would like to see a diff in my configuration to make sure no change will get lost in case of a `--reload`. | 2020/02/15 | [
"https://serverfault.com/questions/1003201",
"https://serverfault.com",
"https://serverfault.com/users/364632/"
] | as far as I can see no tool that offers you that possibility, but you can create it yourself.
I add a runtime acl to port 54/tcp:
```
# firewall-cmd --add-port=54/tcp
```
Then I can save the runtime rules to a file:
```
# firewall-cmd --list-all > /tmp/runtime_rules
```
And I save the permanent rules to another ... | I'd like to propose a one-liner alternative usable in a bash shell:
```sh
diff -u <(firewall-cmd --list-all --permanent) <(firewall-cmd --list-all)
```
```
--- /dev/fd/63 2022-02-20 14:05:38.106385643 +0000
+++ /dev/fd/62 2022-02-20 14:05:38.110385485 +0000
@@ -3,7 +3,7 @@
icmp-block-inversion: no
interfaces... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.