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 |
|---|---|---|---|---|---|
5,062,100 | I have web pages that may or may not need to do some pre-processing before it can be displayed to the user. What I have done is to display this page with a message (e.g. "please wait ..."), then do an http-equiv refresh **to the same page**. When it refreshes to the same page, the pre-processing is done and the actual ... | 2011/02/21 | [
"https://Stackoverflow.com/questions/5062100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/253976/"
] | I suppose the best way to think of it is that "static" means unchanging, and it is the *location* of the variable that is unchanging when when you switch between the different instances of a class. The main thing is to eradicate any thought from your mind that the *value* of a static variable is unchanging: it may even... | >
> Definition of STATIC 1 : exerting
> force by reason of weight alone
> without motion 2 : of or relating to
> bodies at rest or forces in
> equilibrium 3 : showing little change
> 4 a :
> characterized by a lack of movement,
> animation, or progression b :
> producing an effect of repose or
> quiescence 5 ... |
5,062,100 | I have web pages that may or may not need to do some pre-processing before it can be displayed to the user. What I have done is to display this page with a message (e.g. "please wait ..."), then do an http-equiv refresh **to the same page**. When it refreshes to the same page, the pre-processing is done and the actual ... | 2011/02/21 | [
"https://Stackoverflow.com/questions/5062100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/253976/"
] | I suppose the best way to think of it is that "static" means unchanging, and it is the *location* of the variable that is unchanging when when you switch between the different instances of a class. The main thing is to eradicate any thought from your mind that the *value* of a static variable is unchanging: it may even... | In Head First Java, there is a nice explanation of static. Static means stable not changing thats obvious from meaning and its quite obvious that it does not change.
Static mean sharing in Java. There is a nice picture where two child sharing one ice cream and showed static variable analogy. For more info please read ... |
29,767,059 | Chisel generate always blocks with only clock in sensivity list :
```
always @posedge(clk) begin
[...]
end
```
Is it possible to configure Module to use an asynchronous reset and generate an always block like this ?
```
always @(posedge clk or posedge reset) begin
[...]
end
``` | 2015/04/21 | [
"https://Stackoverflow.com/questions/29767059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4422957/"
] | Since Chisel 3.2.0, there is support for synchronous, asynchronous, and abstract reset types. Based on the type of reset explicitly specified or inferred, you will get canonical synchronous or asynchronous Verilog output.
To try to show this more fully, consider the following `MultiIOModule` which has three resets:
*... | Chisel versions prior to 3.2.0 do not have support for asynchronous resets.
It looks like the way to do this in Chisel is to use synchronous resets:
```
always @posedge(clk) begin
if (reset) begin
[...]
end
else
[...]
end
end
```
For more discussion on the topic:
<https://groups.google.com/forum/#!top... |
12,894,120 | I want to send an SMS, but not using the SmsManager class. I want to do it with the native SMS app which is there on an Android phone.
And here is the twist : I do NOT want to launch the native app while doing it. Is there some format of intent which can send an sms directly (given the sms-body and the phone number t... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12894120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/877972/"
] | Ok, so you want to send a SMS, without using SmsManager and plus it should show up in your native SMS app list?
Firstly, you cannot send SMS bypassing **SmsManager**. If you look at the source code of all native messaging app for Samsung Galaxy Nexus, it will invoke SmsManager on button click.
so, the below piece of... | If you only have `ACTION_SENDTO`, then, of course, any application that can send will pop up.
You need to add a filter for SMS
* with URL. See <https://stackoverflow.com/a/2372665/94363>
* or with content type <https://stackoverflow.com/a/10613013/94363> |
12,894,120 | I want to send an SMS, but not using the SmsManager class. I want to do it with the native SMS app which is there on an Android phone.
And here is the twist : I do NOT want to launch the native app while doing it. Is there some format of intent which can send an sms directly (given the sms-body and the phone number t... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12894120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/877972/"
] | Using the SmsManager will send the sms through the system but will not put it in the SMS content provider as was mentioned earlier. Hence any native messaging app will not see it.
To do so, you have to add it manually via the SMS content provider AFTER you send the message normally via SmsManager. Here's some sample c... | If you only have `ACTION_SENDTO`, then, of course, any application that can send will pop up.
You need to add a filter for SMS
* with URL. See <https://stackoverflow.com/a/2372665/94363>
* or with content type <https://stackoverflow.com/a/10613013/94363> |
12,894,120 | I want to send an SMS, but not using the SmsManager class. I want to do it with the native SMS app which is there on an Android phone.
And here is the twist : I do NOT want to launch the native app while doing it. Is there some format of intent which can send an sms directly (given the sms-body and the phone number t... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12894120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/877972/"
] | Ok, so you want to send a SMS, without using SmsManager and plus it should show up in your native SMS app list?
Firstly, you cannot send SMS bypassing **SmsManager**. If you look at the source code of all native messaging app for Samsung Galaxy Nexus, it will invoke SmsManager on button click.
so, the below piece of... | I have done something similar in a project I was working on. You need to use [SmsManager](http://developer.android.com/reference/android/telephony/gsm/SmsManager.html)
It would be something like this -
```
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNumber, null,... |
12,894,120 | I want to send an SMS, but not using the SmsManager class. I want to do it with the native SMS app which is there on an Android phone.
And here is the twist : I do NOT want to launch the native app while doing it. Is there some format of intent which can send an sms directly (given the sms-body and the phone number t... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12894120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/877972/"
] | Using the SmsManager will send the sms through the system but will not put it in the SMS content provider as was mentioned earlier. Hence any native messaging app will not see it.
To do so, you have to add it manually via the SMS content provider AFTER you send the message normally via SmsManager. Here's some sample c... | I have done something similar in a project I was working on. You need to use [SmsManager](http://developer.android.com/reference/android/telephony/gsm/SmsManager.html)
It would be something like this -
```
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNumber, null,... |
12,894,120 | I want to send an SMS, but not using the SmsManager class. I want to do it with the native SMS app which is there on an Android phone.
And here is the twist : I do NOT want to launch the native app while doing it. Is there some format of intent which can send an sms directly (given the sms-body and the phone number t... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12894120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/877972/"
] | Using the SmsManager will send the sms through the system but will not put it in the SMS content provider as was mentioned earlier. Hence any native messaging app will not see it.
To do so, you have to add it manually via the SMS content provider AFTER you send the message normally via SmsManager. Here's some sample c... | Ok, so you want to send a SMS, without using SmsManager and plus it should show up in your native SMS app list?
Firstly, you cannot send SMS bypassing **SmsManager**. If you look at the source code of all native messaging app for Samsung Galaxy Nexus, it will invoke SmsManager on button click.
so, the below piece of... |
12,894,120 | I want to send an SMS, but not using the SmsManager class. I want to do it with the native SMS app which is there on an Android phone.
And here is the twist : I do NOT want to launch the native app while doing it. Is there some format of intent which can send an sms directly (given the sms-body and the phone number t... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12894120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/877972/"
] | Ok, so you want to send a SMS, without using SmsManager and plus it should show up in your native SMS app list?
Firstly, you cannot send SMS bypassing **SmsManager**. If you look at the source code of all native messaging app for Samsung Galaxy Nexus, it will invoke SmsManager on button click.
so, the below piece of... | Try this:
```
String phoneNo = textPhoneNo.getText().toString();
String sms = textSMS.getText().toString();
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, sms, null, null);
Toast.makeText(getApplicationContext(), "SMS Sent!",
Toast.LENGTH_LONG).sho... |
12,894,120 | I want to send an SMS, but not using the SmsManager class. I want to do it with the native SMS app which is there on an Android phone.
And here is the twist : I do NOT want to launch the native app while doing it. Is there some format of intent which can send an sms directly (given the sms-body and the phone number t... | 2012/10/15 | [
"https://Stackoverflow.com/questions/12894120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/877972/"
] | Using the SmsManager will send the sms through the system but will not put it in the SMS content provider as was mentioned earlier. Hence any native messaging app will not see it.
To do so, you have to add it manually via the SMS content provider AFTER you send the message normally via SmsManager. Here's some sample c... | Try this:
```
String phoneNo = textPhoneNo.getText().toString();
String sms = textSMS.getText().toString();
try {
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, sms, null, null);
Toast.makeText(getApplicationContext(), "SMS Sent!",
Toast.LENGTH_LONG).sho... |
20,955 | My cat, Marty, is a real fraidy cat. He doesn't like most new people, but eventually he'll grow to like them.
We recently moved into my grandpa's house a city over from where we used to live. Currently, my cat is hiding under my bed. Usually at night, he'll come out from hiding and come downstairs when he knows it's j... | 2018/07/25 | [
"https://pets.stackexchange.com/questions/20955",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/12615/"
] | Two weeks isn't all that long. Our first two cats were incredibly shy (they lived in the wild in a prison, where they had learned to stay quiet and out of sight).
It took them *months* to just be out in the open in the living room. We had kept them in a single room for the first two weeks. We then also gave them the h... | Cats, unlike dogs, are teritorial creatures - they get used to the place. They do not take well when moving. Two weeks is normal, it may take months. I would suggest you do not force him. He will explore when and where he feels comfortable. As long as he eats and drinks water, uses his litter box he will be fine.
It i... |
20,955 | My cat, Marty, is a real fraidy cat. He doesn't like most new people, but eventually he'll grow to like them.
We recently moved into my grandpa's house a city over from where we used to live. Currently, my cat is hiding under my bed. Usually at night, he'll come out from hiding and come downstairs when he knows it's j... | 2018/07/25 | [
"https://pets.stackexchange.com/questions/20955",
"https://pets.stackexchange.com",
"https://pets.stackexchange.com/users/12615/"
] | If he has something he likes: toys, bed or even litter in another litter box, placing it out in the open where you want him to be could help him feel more comfortable. If your kitty likes treats you could encourage him by putting some treats where you want him to be. You could also try this with catnip instead of treat... | Cats, unlike dogs, are teritorial creatures - they get used to the place. They do not take well when moving. Two weeks is normal, it may take months. I would suggest you do not force him. He will explore when and where he feels comfortable. As long as he eats and drinks water, uses his litter box he will be fine.
It i... |
19,784,868 | I'm trying to convert the following MATLAB code to Python and am having trouble finding a solution that works in any reasonable amount of time.
```
M = diag(sum(a)) - a;
where = vertcat(in, out);
M(where,:) = 0;
M(where,where) = 1;
```
Here, a is a sparse matrix and where is a vector (as are in/out). The solution I ... | 2013/11/05 | [
"https://Stackoverflow.com/questions/19784868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2137996/"
] | The solution I use for similar task [attributes to @seberg](https://stackoverflow.com/a/12130287/1265154) and do not convert to `lil` format:
```
import scipy.sparse
import numpy
import time
def csr_row_set_nz_to_val(csr, row, value=0):
"""Set all nonzero elements (elements currently in the sparsity pattern)
... | A slightly different take on alko/seberg's approach. I find for loops disturbing, so I spent the better part of this morning figuring a way to get rid of it. The following is not always faster than the other approach. It performs better the more rows there are to be zeroed and the sparser the matrix:
```
def csr_zero_... |
19,784,868 | I'm trying to convert the following MATLAB code to Python and am having trouble finding a solution that works in any reasonable amount of time.
```
M = diag(sum(a)) - a;
where = vertcat(in, out);
M(where,:) = 0;
M(where,where) = 1;
```
Here, a is a sparse matrix and where is a vector (as are in/out). The solution I ... | 2013/11/05 | [
"https://Stackoverflow.com/questions/19784868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2137996/"
] | The solution I use for similar task [attributes to @seberg](https://stackoverflow.com/a/12130287/1265154) and do not convert to `lil` format:
```
import scipy.sparse
import numpy
import time
def csr_row_set_nz_to_val(csr, row, value=0):
"""Set all nonzero elements (elements currently in the sparsity pattern)
... | If you dislike digging around in the guts of the sparse matrices, you can also use sparse matrix multiplication with a diagonal matrix:
```
def zero_rows(M, rows_to_zero):
ixs = numpy.ones(M.shape[0], int)
ixs[rows_to_zero] = 0
D = sparse.diags(ixs)
res = D * M
return res
``` |
19,784,868 | I'm trying to convert the following MATLAB code to Python and am having trouble finding a solution that works in any reasonable amount of time.
```
M = diag(sum(a)) - a;
where = vertcat(in, out);
M(where,:) = 0;
M(where,where) = 1;
```
Here, a is a sparse matrix and where is a vector (as are in/out). The solution I ... | 2013/11/05 | [
"https://Stackoverflow.com/questions/19784868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2137996/"
] | A slightly different take on alko/seberg's approach. I find for loops disturbing, so I spent the better part of this morning figuring a way to get rid of it. The following is not always faster than the other approach. It performs better the more rows there are to be zeroed and the sparser the matrix:
```
def csr_zero_... | If you dislike digging around in the guts of the sparse matrices, you can also use sparse matrix multiplication with a diagonal matrix:
```
def zero_rows(M, rows_to_zero):
ixs = numpy.ones(M.shape[0], int)
ixs[rows_to_zero] = 0
D = sparse.diags(ixs)
res = D * M
return res
``` |
48,101,266 | I am building an app on Glitch with express js which requires the user to upload multiple files. Here is my code:
```js
var express = require('express');
var cors= require('cors');
var bodyParser= require('body-parser');
var contexts= require('./contexts');
var path= require('path');
var fileUpload= require('ex... | 2018/01/04 | [
"https://Stackoverflow.com/questions/48101266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8371765/"
] | The reason why multer was not working is because express-fileupload was already being used as middleware for file uploading, so commenting out this line:
```
app.use(fileUpload())
```
fixed the problem for me. | This is from multer doc:
>
> Multer accepts an options object, the most basic of which is the dest
> property, which tells Multer where to upload the files. **In case you
> omit the options object, the files will be kept in memory and never
> written to disk.**
>
>
>
that's mean you need to define at least `de... |
47,466,630 | i am developing plugin where i have to update the single record onchanging the select option element , i tried using wordpres codex way ,but i am struck can please anyone help me out here, below is my code
```js
function ajaxFunction(str,id) {
var payment_selected = str;
var id=id;
var queryString = '&... | 2017/11/24 | [
"https://Stackoverflow.com/questions/47466630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6737108/"
] | AS it is clear from the html that id and classnames are same for the elements :
so you can modify below code as per your requirement (Whether you want to click first , second or third element )
ReadOnlyCollection allelements = driver.FindElement(By.Id("txtSearch"));
```
foreach (IWebElement element in allelem... | Always better to use Id instead of ClassName, Because Id is unique but ClassName may be multiple.
```
var searchBox = driver.FindElement(By.Id("txtSearch"));
searchBox.Clear();
searchBox.SendKeys("xyz");
```
One more question, in your html I see two input text with the same Id. You should commenting one input. |
66,957,425 | I need to calculate the mean per group (i.e, per Coordinates) of the sample table below without losing any of the columns (the real table has over 40,000 rows with different states,location coordinates and type) So this:
| State | Location Coordinates | Type | 2002 | 2003 | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 | 20... | 2021/04/05 | [
"https://Stackoverflow.com/questions/66957425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14032099/"
] | Use [`Series.dt.time`](https://pandas.pydata.org/docs/reference/api/pandas.Series.dt.time.html):
```
import pandas as pd
# sample
df = pd.DataFrame({'Time': ['00:00:05', '00:00:10', '00:10:00']})
df['Time'] = pd.to_datetime(df['Time'], format='%H:%M:%S').dt.time
print(type(df.Time[0]))
[out]:
<class 'datetime.time'... | you can use `timedelta`:
```
df['Time'] = pd.to_timedelta(df['Time'])
```
---
To calculate minutes:
```
pd.to_timedelta(df.time).dt.seconds/60
``` |
823,004 | For example, I want the first entry in Column B (B1) to show A5, then B2 shows A10, then B3 shows A15.
How would I go about doing this? | 2014/10/09 | [
"https://superuser.com/questions/823004",
"https://superuser.com",
"https://superuser.com/users/147795/"
] | For excel you can put this in B1 and drag down
```
=INDEX($A$1:$A$100,5*(ROWS($B$1:B1)-1))
```
To start with A5 instead of A1, use this
```
=INDEX($A$1:$A$100,5*(ROWS($B$1:B1)))
``` | Do you want the cell to take the value of A5, A10 etc? or the actual value "A5", "A10". If you want the value from the cells Raystafarian has a good answer. If you want the values "A5" etc use
```
= "A" & 5*rows("$B$1:$B$1)
``` |
28,949,902 | We are receiving an SMTP 4.4.1 connection time out exception every so often when attempting to send mail in C#. So far we have found no pattern as to when the issue occurs, such as the time of day.
The exception thrown is:
>
> System.Net.Mail.SmtpException: Service not available, closing transmission channel. The s... | 2015/03/09 | [
"https://Stackoverflow.com/questions/28949902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4598265/"
] | You must use a major upgrade if you remove components. See [Changing the Product Code](https://msdn.microsoft.com/en-us/library/aa367850%28v=vs.85%29.aspx) for the list of things that cannot be done with minor upgrades. | Actually, it's not logical :) If you have a) really done a successful major upgrade and b) those Dlls were only in the older version and not in the newer upgrade you installed then they should not be there at all. The old product is no longer there if the upgrade was successful, and there is no old version to have thos... |
28,949,902 | We are receiving an SMTP 4.4.1 connection time out exception every so often when attempting to send mail in C#. So far we have found no pattern as to when the issue occurs, such as the time of day.
The exception thrown is:
>
> System.Net.Mail.SmtpException: Service not available, closing transmission channel. The s... | 2015/03/09 | [
"https://Stackoverflow.com/questions/28949902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4598265/"
] | Actually, it's not logical :) If you have a) really done a successful major upgrade and b) those Dlls were only in the older version and not in the newer upgrade you installed then they should not be there at all. The old product is no longer there if the upgrade was successful, and there is no old version to have thos... | @Bob Arnson: I don't want to do a major upgrade as I want the previous version to be not uninstalled but upgraded. So I came up with a fix for now using RemoveFile tag under those components that specifies those file ids to be deleted in case they are present.
```
<RemoveFile Id = "id_to_be_removed" On = "uninstall" N... |
28,949,902 | We are receiving an SMTP 4.4.1 connection time out exception every so often when attempting to send mail in C#. So far we have found no pattern as to when the issue occurs, such as the time of day.
The exception thrown is:
>
> System.Net.Mail.SmtpException: Service not available, closing transmission channel. The s... | 2015/03/09 | [
"https://Stackoverflow.com/questions/28949902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4598265/"
] | You must use a major upgrade if you remove components. See [Changing the Product Code](https://msdn.microsoft.com/en-us/library/aa367850%28v=vs.85%29.aspx) for the list of things that cannot be done with minor upgrades. | @Bob Arnson: I don't want to do a major upgrade as I want the previous version to be not uninstalled but upgraded. So I came up with a fix for now using RemoveFile tag under those components that specifies those file ids to be deleted in case they are present.
```
<RemoveFile Id = "id_to_be_removed" On = "uninstall" N... |
421,206 | I have a Linux VPS serving data on the internet that has a legitimate Domain name and SSL Certificate ( from GoDaddy.com ). I will refere to this server as "**www.myserver.com**". I also have a local Linux machine ( on my own LAN ) that I want to use to DNS spoof my internet facing Domain name ( www.myserver.com ) to i... | 2018/02/01 | [
"https://unix.stackexchange.com/questions/421206",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/63801/"
] | When nginx sends a redirect, it simply tells the client to visit the new URL. So now on the client the new hostname is resolved, and as that client is not using the spoofing DNS server, it goes to the real host.
Perhaps you want to use nginx in proxy mode, so that nginx is fetching the content from the backend and rel... | Your nginx won't need to resolve anything at all when it sends the redirect - it literally just tells the clients "go to <https://myserver.com> instead".
Then the client, on its own, uses the DNS servers it has been configured with, to look up the IP address of myserver.com.
You need to make sure the client will use... |
421,206 | I have a Linux VPS serving data on the internet that has a legitimate Domain name and SSL Certificate ( from GoDaddy.com ). I will refere to this server as "**www.myserver.com**". I also have a local Linux machine ( on my own LAN ) that I want to use to DNS spoof my internet facing Domain name ( www.myserver.com ) to i... | 2018/02/01 | [
"https://unix.stackexchange.com/questions/421206",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/63801/"
] | When nginx sends a redirect, it simply tells the client to visit the new URL. So now on the client the new hostname is resolved, and as that client is not using the spoofing DNS server, it goes to the real host.
Perhaps you want to use nginx in proxy mode, so that nginx is fetching the content from the backend and rel... | If I correctly understand, you have two machines of interest on your LAN: Let's call them 142 (which stands for 192.168.2.142) and 131 (standing for 192.168.1.131).
If I still correctly understand, when you connect from 131 to 131:8080 you want to be forwarded to 142, spoofing www.myserver.com.
If that is the case, y... |
46,346,064 | I'm trying to define a regex in php to extract words but i didn't succeed...
My string is always in this format: "toto=on test=on azerty=on gogo=on"
what I would like to do is to get in an array the values toto, test,azerty and gogo. Can someone help ?
that's what i tried so far : `/([^\s]|[w]*?=)/` | 2017/09/21 | [
"https://Stackoverflow.com/questions/46346064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5555681/"
] | It's simple
```
preg_match_all("/(\w*)=/", "toto=on test=on azerty=on gogo=on", $output_array)[1];
```
It will get all word before "=", the parentheses is for defining a group and put in key "1" , "\w" is for a letter and "\*" is for "many"
or You can improve that and use like that
```
preg_match_all("/(\w*)=on/",... | Sure! Here's a working regex: <https://regex101.com/r/IWP1Mh/1>
And here's the working code: <https://3v4l.org/QQZj5>
```
<?php
$regex = '#(?<names>\w*)=\w*#';
$string = 'toto=on test=on azerty=on gogo=on';
preg_match_all($regex, $string, $matches);
$names = $matches['names'];
var_dump($names);
```
Which outputs:
... |
46,346,064 | I'm trying to define a regex in php to extract words but i didn't succeed...
My string is always in this format: "toto=on test=on azerty=on gogo=on"
what I would like to do is to get in an array the values toto, test,azerty and gogo. Can someone help ?
that's what i tried so far : `/([^\s]|[w]*?=)/` | 2017/09/21 | [
"https://Stackoverflow.com/questions/46346064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5555681/"
] | A different approach to this question would be this way
```
<?php
$str = "toto=on test=on azerty=on gogo=on";
$res = str_replace("=on","", $str);
$array = explode(" ", $res);
print_r($array); //Array ( [0] => toto [1] => test [2] => azerty [3] => gogo )
?>
``` | Sure! Here's a working regex: <https://regex101.com/r/IWP1Mh/1>
And here's the working code: <https://3v4l.org/QQZj5>
```
<?php
$regex = '#(?<names>\w*)=\w*#';
$string = 'toto=on test=on azerty=on gogo=on';
preg_match_all($regex, $string, $matches);
$names = $matches['names'];
var_dump($names);
```
Which outputs:
... |
46,346,064 | I'm trying to define a regex in php to extract words but i didn't succeed...
My string is always in this format: "toto=on test=on azerty=on gogo=on"
what I would like to do is to get in an array the values toto, test,azerty and gogo. Can someone help ?
that's what i tried so far : `/([^\s]|[w]*?=)/` | 2017/09/21 | [
"https://Stackoverflow.com/questions/46346064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5555681/"
] | It's simple
```
preg_match_all("/(\w*)=/", "toto=on test=on azerty=on gogo=on", $output_array)[1];
```
It will get all word before "=", the parentheses is for defining a group and put in key "1" , "\w" is for a letter and "\*" is for "many"
or You can improve that and use like that
```
preg_match_all("/(\w*)=on/",... | A different approach to this question would be this way
```
<?php
$str = "toto=on test=on azerty=on gogo=on";
$res = str_replace("=on","", $str);
$array = explode(" ", $res);
print_r($array); //Array ( [0] => toto [1] => test [2] => azerty [3] => gogo )
?>
``` |
46,346,064 | I'm trying to define a regex in php to extract words but i didn't succeed...
My string is always in this format: "toto=on test=on azerty=on gogo=on"
what I would like to do is to get in an array the values toto, test,azerty and gogo. Can someone help ?
that's what i tried so far : `/([^\s]|[w]*?=)/` | 2017/09/21 | [
"https://Stackoverflow.com/questions/46346064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5555681/"
] | It's simple
```
preg_match_all("/(\w*)=/", "toto=on test=on azerty=on gogo=on", $output_array)[1];
```
It will get all word before "=", the parentheses is for defining a group and put in key "1" , "\w" is for a letter and "\*" is for "many"
or You can improve that and use like that
```
preg_match_all("/(\w*)=on/",... | You can juse use `explode()`:
```
$str = 'toto=on test=on azerty=on gogo=on';
$words = array_map(function($item){ return substr($item, 0, -3); }, explode(' ', $str));
``` |
46,346,064 | I'm trying to define a regex in php to extract words but i didn't succeed...
My string is always in this format: "toto=on test=on azerty=on gogo=on"
what I would like to do is to get in an array the values toto, test,azerty and gogo. Can someone help ?
that's what i tried so far : `/([^\s]|[w]*?=)/` | 2017/09/21 | [
"https://Stackoverflow.com/questions/46346064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5555681/"
] | A different approach to this question would be this way
```
<?php
$str = "toto=on test=on azerty=on gogo=on";
$res = str_replace("=on","", $str);
$array = explode(" ", $res);
print_r($array); //Array ( [0] => toto [1] => test [2] => azerty [3] => gogo )
?>
``` | You can juse use `explode()`:
```
$str = 'toto=on test=on azerty=on gogo=on';
$words = array_map(function($item){ return substr($item, 0, -3); }, explode(' ', $str));
``` |
2,697,571 | What is the limit of $$\lim\_{x \to \infty} \frac{\sum\_{k=0}^{x} (k+1){e^k}}{x{e^x}}\quad \text{?}$$ I think that it may go to infinity but not sure and i don't know how to solve it. | 2018/03/18 | [
"https://math.stackexchange.com/questions/2697571",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/466808/"
] | The numerator is an arithmetico-geometric series.
\begin{align\*}
(1-e)\sum\_{k=0}^{x} (k+1){e^k}&=\sum\_{k=0}^{x} (k+1){e^k}-\sum\_{k=0}^{x} (k+1){e^{k+1}}\\
&=\sum\_{k=0}^{x} (k+1){e^k}-\sum\_{k=1}^{x+1} k{e^{k}}\\
&=\sum\_{k=0}^{x} (k+1){e^k}-\sum\_{k=0}^{x} k{e^{k}}-(x+1)e^{x+1}\\
&=\sum\_{k=0}^{x} {e^k}-(x+1)e^{x... | For $x$ a natural.
$$
\sum\_{k=0}^{x}\left(k+1\right)e^{k}=\frac{1}{\left(e-1\right)^2}\left(\left(x+1\right)e^{x+2}-\left(x+2\right)e^{x+1}+1\right)
$$
So
$$\frac{\displaystyle \sum\_{k=0}^{x}\left(k+1\right)e^{k}}{xe^x}=\frac{1}{\left(e-1\right)^2}\left(\frac{x+1}{x}e^{2}-\left(x+2\right)\frac{e}{x}+\frac{1}{xe^{x}}... |
5,661,101 | Is it possible to represent an unsigned character array as a string?
When I searched for it, I found out that only memset() was able to do this (But character by character).
Assuming that is not the correct way, is there a way to do the conversion?
Context: I am trying to store the output of a cryptographic hash func... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5661101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420157/"
] | In C, a string is an array of `char`, terminated with a character whose value is 0.
Whether or not `char` is a signed or unsigned type is not specified by the language, you have to be explicit and use `unsigned char` or `signed char` if you really care.
It's not clear what you mean by "representing" an unsigned chara... | An example as you've asked:
unsigned char arr [SIZE]; |
5,661,101 | Is it possible to represent an unsigned character array as a string?
When I searched for it, I found out that only memset() was able to do this (But character by character).
Assuming that is not the correct way, is there a way to do the conversion?
Context: I am trying to store the output of a cryptographic hash func... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5661101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420157/"
] | So, based on your update, are you talking about trying to convert a unsigned char buffer into a hexadecimal interpretation, something like this:
```
#define bufferSize 10
int main() {
unsigned char buffer[bufferSize]={1,2,3,4,5,6,7,8,9,10};
char converted[bufferSize*2 + 1];
int i;
for(i=0;i<bufferSize;i++) {
... | In C, a string is an array of `char`, terminated with a character whose value is 0.
Whether or not `char` is a signed or unsigned type is not specified by the language, you have to be explicit and use `unsigned char` or `signed char` if you really care.
It's not clear what you mean by "representing" an unsigned chara... |
5,661,101 | Is it possible to represent an unsigned character array as a string?
When I searched for it, I found out that only memset() was able to do this (But character by character).
Assuming that is not the correct way, is there a way to do the conversion?
Context: I am trying to store the output of a cryptographic hash func... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5661101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420157/"
] | In C, a string is an array of `char`, terminated with a character whose value is 0.
Whether or not `char` is a signed or unsigned type is not specified by the language, you have to be explicit and use `unsigned char` or `signed char` if you really care.
It's not clear what you mean by "representing" an unsigned chara... | I successfully use this to convert unsigned char array to std:string
```
unsigned char array[128];
std::stringstream buffer;
for (int i = 0; i < 128; i++)
{
buffer << std::hex << std::setfill('0');
buffer << std::setw(2) << static_cast<unsigned>(array[i]);
}
std::string hexString = buffer.str(... |
5,661,101 | Is it possible to represent an unsigned character array as a string?
When I searched for it, I found out that only memset() was able to do this (But character by character).
Assuming that is not the correct way, is there a way to do the conversion?
Context: I am trying to store the output of a cryptographic hash func... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5661101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420157/"
] | Well a string in C is nothing else than a few chars one after another. If they are unsigned or signed is not much of a problem, you can easily cast them.
So to get a string out of a unsigned char array all you have to do is to make sure that the last byte is a terminating byte '\0' and then cast this array to char \*... | An example as you've asked:
unsigned char arr [SIZE]; |
5,661,101 | Is it possible to represent an unsigned character array as a string?
When I searched for it, I found out that only memset() was able to do this (But character by character).
Assuming that is not the correct way, is there a way to do the conversion?
Context: I am trying to store the output of a cryptographic hash func... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5661101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420157/"
] | So, based on your update, are you talking about trying to convert a unsigned char buffer into a hexadecimal interpretation, something like this:
```
#define bufferSize 10
int main() {
unsigned char buffer[bufferSize]={1,2,3,4,5,6,7,8,9,10};
char converted[bufferSize*2 + 1];
int i;
for(i=0;i<bufferSize;i++) {
... | Well a string in C is nothing else than a few chars one after another. If they are unsigned or signed is not much of a problem, you can easily cast them.
So to get a string out of a unsigned char array all you have to do is to make sure that the last byte is a terminating byte '\0' and then cast this array to char \*... |
5,661,101 | Is it possible to represent an unsigned character array as a string?
When I searched for it, I found out that only memset() was able to do this (But character by character).
Assuming that is not the correct way, is there a way to do the conversion?
Context: I am trying to store the output of a cryptographic hash func... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5661101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420157/"
] | Well a string in C is nothing else than a few chars one after another. If they are unsigned or signed is not much of a problem, you can easily cast them.
So to get a string out of a unsigned char array all you have to do is to make sure that the last byte is a terminating byte '\0' and then cast this array to char \*... | I successfully use this to convert unsigned char array to std:string
```
unsigned char array[128];
std::stringstream buffer;
for (int i = 0; i < 128; i++)
{
buffer << std::hex << std::setfill('0');
buffer << std::setw(2) << static_cast<unsigned>(array[i]);
}
std::string hexString = buffer.str(... |
5,661,101 | Is it possible to represent an unsigned character array as a string?
When I searched for it, I found out that only memset() was able to do this (But character by character).
Assuming that is not the correct way, is there a way to do the conversion?
Context: I am trying to store the output of a cryptographic hash func... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5661101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420157/"
] | So, based on your update, are you talking about trying to convert a unsigned char buffer into a hexadecimal interpretation, something like this:
```
#define bufferSize 10
int main() {
unsigned char buffer[bufferSize]={1,2,3,4,5,6,7,8,9,10};
char converted[bufferSize*2 + 1];
int i;
for(i=0;i<bufferSize;i++) {
... | An example as you've asked:
unsigned char arr [SIZE]; |
5,661,101 | Is it possible to represent an unsigned character array as a string?
When I searched for it, I found out that only memset() was able to do this (But character by character).
Assuming that is not the correct way, is there a way to do the conversion?
Context: I am trying to store the output of a cryptographic hash func... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5661101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420157/"
] | I successfully use this to convert unsigned char array to std:string
```
unsigned char array[128];
std::stringstream buffer;
for (int i = 0; i < 128; i++)
{
buffer << std::hex << std::setfill('0');
buffer << std::setw(2) << static_cast<unsigned>(array[i]);
}
std::string hexString = buffer.str(... | An example as you've asked:
unsigned char arr [SIZE]; |
5,661,101 | Is it possible to represent an unsigned character array as a string?
When I searched for it, I found out that only memset() was able to do this (But character by character).
Assuming that is not the correct way, is there a way to do the conversion?
Context: I am trying to store the output of a cryptographic hash func... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5661101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420157/"
] | So, based on your update, are you talking about trying to convert a unsigned char buffer into a hexadecimal interpretation, something like this:
```
#define bufferSize 10
int main() {
unsigned char buffer[bufferSize]={1,2,3,4,5,6,7,8,9,10};
char converted[bufferSize*2 + 1];
int i;
for(i=0;i<bufferSize;i++) {
... | I successfully use this to convert unsigned char array to std:string
```
unsigned char array[128];
std::stringstream buffer;
for (int i = 0; i < 128; i++)
{
buffer << std::hex << std::setfill('0');
buffer << std::setw(2) << static_cast<unsigned>(array[i]);
}
std::string hexString = buffer.str(... |
709,855 | Prove that if $H$ is a subgroup of index $2$ in a finite group $G$, then $gH = Hg \; \forall \; g \in G$.
I know that $H$ itself is one coset of the subgroup and the other is the compliment of the subgroup, but I don't really understand why the second coset is the compliment. I know that the union of the cosets must b... | 2014/03/12 | [
"https://math.stackexchange.com/questions/709855",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/80327/"
] | Remember, Langrange's theorem? There was an equivalence relation $a \sim b$ if $a^{-1}b \in H$
So $G\backslash H$ are the equivalence classes induced by $a \sim b$ if $a^{-1}b \in H$ In other words, the cosets represent the different equivalence classes induced by this equivalence relation. What do we know from equival... | As you already know the number of left cosets is equal to the number of right ones, just take into account that
$$aH=H\iff a\in H$$
$$Ha=H\iff a\in H$$ |
3,569,212 | >
> Count the number of arrangements of the $10$ letters ABCDEFGHIJ in which none of the patterns ABE, BED, or HID occur.
>
>
>
I thought that the answer would be $\_{10}P\_{10} - (\_{10}P\_{3} + \_{10}P\_{3} + \_{10}P\_{3} - \_{10}P\_{2}$), since we have $\_{10}P\_{10}$ total arrangements, and $\_{10}P\_{3}$ arra... | 2020/03/04 | [
"https://math.stackexchange.com/questions/3569212",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/742306/"
] | $\_{10}P\_3$ is not the number of arrangements where $ABE$ occurs. You have $7!$ ways to put the other letters in order and $8$ places to put the unit $ABE$ so $8!$ ways to put all the letters in order including $ABE$. Alternately, you can group $ABE$ into one letter, have $8$ letters, which again gives $8!$ orders.
... | Since $ABE$ and $HID$ are disjoint, all Permutations where both patterns occur are subtracted twice. |
3,569,212 | >
> Count the number of arrangements of the $10$ letters ABCDEFGHIJ in which none of the patterns ABE, BED, or HID occur.
>
>
>
I thought that the answer would be $\_{10}P\_{10} - (\_{10}P\_{3} + \_{10}P\_{3} + \_{10}P\_{3} - \_{10}P\_{2}$), since we have $\_{10}P\_{10}$ total arrangements, and $\_{10}P\_{3}$ arra... | 2020/03/04 | [
"https://math.stackexchange.com/questions/3569212",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/742306/"
] | There are $10!$ permutations of the ten distinct letters. From these, we must subtract those arrangements in which the substrings ABE, BED, or HID appear.
*Arrangements with a prohibited substring*: We count arrangements in which ABE appears. We have eight objects to arrange: ABE, C, D, F, G, H, I, J. Since the object... | Since $ABE$ and $HID$ are disjoint, all Permutations where both patterns occur are subtracted twice. |
3,569,212 | >
> Count the number of arrangements of the $10$ letters ABCDEFGHIJ in which none of the patterns ABE, BED, or HID occur.
>
>
>
I thought that the answer would be $\_{10}P\_{10} - (\_{10}P\_{3} + \_{10}P\_{3} + \_{10}P\_{3} - \_{10}P\_{2}$), since we have $\_{10}P\_{10}$ total arrangements, and $\_{10}P\_{3}$ arra... | 2020/03/04 | [
"https://math.stackexchange.com/questions/3569212",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/742306/"
] | $\_{10}P\_3$ is not the number of arrangements where $ABE$ occurs. You have $7!$ ways to put the other letters in order and $8$ places to put the unit $ABE$ so $8!$ ways to put all the letters in order including $ABE$. Alternately, you can group $ABE$ into one letter, have $8$ letters, which again gives $8!$ orders.
... | If you're just interested in the result: Brute force tells me $3513600$.
But let's figure this out. There are $10!$ permutations in total. We have to subtract those with $ABE$. There are $8!$ of them (just treat $ABE$ as a single letter). Likewise, we have $8!$ for each of the other two three letter patterns. That lea... |
3,569,212 | >
> Count the number of arrangements of the $10$ letters ABCDEFGHIJ in which none of the patterns ABE, BED, or HID occur.
>
>
>
I thought that the answer would be $\_{10}P\_{10} - (\_{10}P\_{3} + \_{10}P\_{3} + \_{10}P\_{3} - \_{10}P\_{2}$), since we have $\_{10}P\_{10}$ total arrangements, and $\_{10}P\_{3}$ arra... | 2020/03/04 | [
"https://math.stackexchange.com/questions/3569212",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/742306/"
] | There are $10!$ permutations of the ten distinct letters. From these, we must subtract those arrangements in which the substrings ABE, BED, or HID appear.
*Arrangements with a prohibited substring*: We count arrangements in which ABE appears. We have eight objects to arrange: ABE, C, D, F, G, H, I, J. Since the object... | $\_{10}P\_3$ is not the number of arrangements where $ABE$ occurs. You have $7!$ ways to put the other letters in order and $8$ places to put the unit $ABE$ so $8!$ ways to put all the letters in order including $ABE$. Alternately, you can group $ABE$ into one letter, have $8$ letters, which again gives $8!$ orders.
... |
3,569,212 | >
> Count the number of arrangements of the $10$ letters ABCDEFGHIJ in which none of the patterns ABE, BED, or HID occur.
>
>
>
I thought that the answer would be $\_{10}P\_{10} - (\_{10}P\_{3} + \_{10}P\_{3} + \_{10}P\_{3} - \_{10}P\_{2}$), since we have $\_{10}P\_{10}$ total arrangements, and $\_{10}P\_{3}$ arra... | 2020/03/04 | [
"https://math.stackexchange.com/questions/3569212",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/742306/"
] | There are $10!$ permutations of the ten distinct letters. From these, we must subtract those arrangements in which the substrings ABE, BED, or HID appear.
*Arrangements with a prohibited substring*: We count arrangements in which ABE appears. We have eight objects to arrange: ABE, C, D, F, G, H, I, J. Since the object... | If you're just interested in the result: Brute force tells me $3513600$.
But let's figure this out. There are $10!$ permutations in total. We have to subtract those with $ABE$. There are $8!$ of them (just treat $ABE$ as a single letter). Likewise, we have $8!$ for each of the other two three letter patterns. That lea... |
31,571,321 | The question's prompt is:
>
> Write a method that takes an array of numbers. If a pair of numbers in the array sums to zero, return the positions of those two numbers. If no pair of numbers sums to zero, return `nil`.
>
>
>
I'm not sure how to approach this problem and what would be the simplest way. Would this ... | 2015/07/22 | [
"https://Stackoverflow.com/questions/31571321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5042162/"
] | As with a lot of things in Ruby, there are a couple different ways of doing this. The "classic" approach to this problem would be to use two nested loops:
```
def two_sum(nums)
for i1 in 0...nums.length
for i2 in i1...nums.length
# Inside this loop, nums[i1] represents one number in the array
# and n... | Here is another way to do this:
```
def two_sum(nums)
seen = {}
nums.each_with_index do |n, i|
return seen[-1*n], i if seen.key?(-1*n)
seen[n] = i
end
nil
end
```
It's faster that the above (you do it in one pass) so O(n).
It does use O(n) additional space compared to the naive approach that checks... |
31,571,321 | The question's prompt is:
>
> Write a method that takes an array of numbers. If a pair of numbers in the array sums to zero, return the positions of those two numbers. If no pair of numbers sums to zero, return `nil`.
>
>
>
I'm not sure how to approach this problem and what would be the simplest way. Would this ... | 2015/07/22 | [
"https://Stackoverflow.com/questions/31571321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5042162/"
] | As with a lot of things in Ruby, there are a couple different ways of doing this. The "classic" approach to this problem would be to use two nested loops:
```
def two_sum(nums)
for i1 in 0...nums.length
for i2 in i1...nums.length
# Inside this loop, nums[i1] represents one number in the array
# and n... | This returns offsets for all pairs of values that sum to zero. The return value is not unique, however. If, for example, `a = [1,1,1,-1,-1]`, pairs summing to zero might be at offsets `[[0,3],[1,4]]` or `[[1,3],[2,4]]` or other values.
**Code**
```
def match_zero_sums(arr)
h = arr.each_with_index.group_by(&:first)
... |
31,571,321 | The question's prompt is:
>
> Write a method that takes an array of numbers. If a pair of numbers in the array sums to zero, return the positions of those two numbers. If no pair of numbers sums to zero, return `nil`.
>
>
>
I'm not sure how to approach this problem and what would be the simplest way. Would this ... | 2015/07/22 | [
"https://Stackoverflow.com/questions/31571321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5042162/"
] | As with a lot of things in Ruby, there are a couple different ways of doing this. The "classic" approach to this problem would be to use two nested loops:
```
def two_sum(nums)
for i1 in 0...nums.length
for i2 in i1...nums.length
# Inside this loop, nums[i1] represents one number in the array
# and n... | As always, there are usually many ways to solve a problem, especially with Ruby. If you had come from another language like Java or Python, there is a great chance you might not be already familiar with the `each_with_index` or `each.with_index` methods. Without over complicating the solution, just break the problem do... |
64,576,412 | To preface, I have reviewed the post [here](https://stackoverflow.com/questions/52908923/check-if-asset-exist-in-flutter), but am still having trouble.
I am building a container that is decorated with an image, only if that image exists in the assets/images/ folder. If it does not exist, the container is decorated wit... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64576412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11615071/"
] | You should know if the asset exists as you're the responsible for adding those.
One option you have is by using: [**FlutterGen**](https://github.com/FlutterGen/flutter_gen) This library will create variables, method, etc for all your assets, if the variable is null, then, there you go.
You can also try to get the ima... | You can [list](https://stackoverflow.com/a/56555070/7314211) all of the assets. Then you can check if certain asset is exist or not. |
64,576,412 | To preface, I have reviewed the post [here](https://stackoverflow.com/questions/52908923/check-if-asset-exist-in-flutter), but am still having trouble.
I am building a container that is decorated with an image, only if that image exists in the assets/images/ folder. If it does not exist, the container is decorated wit... | 2020/10/28 | [
"https://Stackoverflow.com/questions/64576412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11615071/"
] | You should know if the asset exists as you're the responsible for adding those.
One option you have is by using: [**FlutterGen**](https://github.com/FlutterGen/flutter_gen) This library will create variables, method, etc for all your assets, if the variable is null, then, there you go.
You can also try to get the ima... | You are responsible for adding assets. Thus you will know if it's there or not. |
8,467,908 | I have some utility methods that use `Microsoft.Web.Administration.ServerManager` that I've been having some issues with. Use the following dead simple code for illustration purposes.
```
using(var mgr = new ServerManager())
{
foreach(var site in mgr.Sites)
{
Console.WriteLine(site.Name);
}
}
```
... | 2011/12/11 | [
"https://Stackoverflow.com/questions/8467908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55142/"
] | Make sure you are adding the reference to the correct Microsoft.Web.Administration, should be v7.0.0.0 that is located under c:\windows\system32\inetsrv\
It looks like you are adding a reference to IIS Express's Microsoft.Web.Administraiton which will give you that behavior | Your question helped me find the answer for PowerShell, so if the Internet is searching for how to do that:
```
$assembly = [System.Reflection.Assembly]::LoadFrom("$env:systemroot\system32\inetsrv\Microsoft.Web.Administration.dll")
# load IIS express
$iis = new-object Microsoft.Web.Administration.ServerManager
$iis.... |
8,467,908 | I have some utility methods that use `Microsoft.Web.Administration.ServerManager` that I've been having some issues with. Use the following dead simple code for illustration purposes.
```
using(var mgr = new ServerManager())
{
foreach(var site in mgr.Sites)
{
Console.WriteLine(site.Name);
}
}
```
... | 2011/12/11 | [
"https://Stackoverflow.com/questions/8467908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55142/"
] | Make sure you are adding the reference to the correct Microsoft.Web.Administration, should be v7.0.0.0 that is located under c:\windows\system32\inetsrv\
It looks like you are adding a reference to IIS Express's Microsoft.Web.Administraiton which will give you that behavior | **CAUTION! Using this approach we have seen seemingly random issues such as "unsupported operation" exceptions, failure to add/remove HTTPS bindings, failure to start/stop application pools when running in IIS Express, and other problems. It is unknown whether this is due to IIS being generally buggy or due to the unor... |
8,467,908 | I have some utility methods that use `Microsoft.Web.Administration.ServerManager` that I've been having some issues with. Use the following dead simple code for illustration purposes.
```
using(var mgr = new ServerManager())
{
foreach(var site in mgr.Sites)
{
Console.WriteLine(site.Name);
}
}
```
... | 2011/12/11 | [
"https://Stackoverflow.com/questions/8467908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55142/"
] | Make sure you are adding the reference to the correct Microsoft.Web.Administration, should be v7.0.0.0 that is located under c:\windows\system32\inetsrv\
It looks like you are adding a reference to IIS Express's Microsoft.Web.Administraiton which will give you that behavior | ```
var iisManager = new ServerManager(Environment.SystemDirectory + "\\inetsrv\\config\\applicationhost.config");
```
This works perfectly. No need to change any references |
8,467,908 | I have some utility methods that use `Microsoft.Web.Administration.ServerManager` that I've been having some issues with. Use the following dead simple code for illustration purposes.
```
using(var mgr = new ServerManager())
{
foreach(var site in mgr.Sites)
{
Console.WriteLine(site.Name);
}
}
```
... | 2011/12/11 | [
"https://Stackoverflow.com/questions/8467908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55142/"
] | Your question helped me find the answer for PowerShell, so if the Internet is searching for how to do that:
```
$assembly = [System.Reflection.Assembly]::LoadFrom("$env:systemroot\system32\inetsrv\Microsoft.Web.Administration.dll")
# load IIS express
$iis = new-object Microsoft.Web.Administration.ServerManager
$iis.... | **CAUTION! Using this approach we have seen seemingly random issues such as "unsupported operation" exceptions, failure to add/remove HTTPS bindings, failure to start/stop application pools when running in IIS Express, and other problems. It is unknown whether this is due to IIS being generally buggy or due to the unor... |
8,467,908 | I have some utility methods that use `Microsoft.Web.Administration.ServerManager` that I've been having some issues with. Use the following dead simple code for illustration purposes.
```
using(var mgr = new ServerManager())
{
foreach(var site in mgr.Sites)
{
Console.WriteLine(site.Name);
}
}
```
... | 2011/12/11 | [
"https://Stackoverflow.com/questions/8467908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55142/"
] | Your question helped me find the answer for PowerShell, so if the Internet is searching for how to do that:
```
$assembly = [System.Reflection.Assembly]::LoadFrom("$env:systemroot\system32\inetsrv\Microsoft.Web.Administration.dll")
# load IIS express
$iis = new-object Microsoft.Web.Administration.ServerManager
$iis.... | ```
var iisManager = new ServerManager(Environment.SystemDirectory + "\\inetsrv\\config\\applicationhost.config");
```
This works perfectly. No need to change any references |
8,467,908 | I have some utility methods that use `Microsoft.Web.Administration.ServerManager` that I've been having some issues with. Use the following dead simple code for illustration purposes.
```
using(var mgr = new ServerManager())
{
foreach(var site in mgr.Sites)
{
Console.WriteLine(site.Name);
}
}
```
... | 2011/12/11 | [
"https://Stackoverflow.com/questions/8467908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55142/"
] | **CAUTION! Using this approach we have seen seemingly random issues such as "unsupported operation" exceptions, failure to add/remove HTTPS bindings, failure to start/stop application pools when running in IIS Express, and other problems. It is unknown whether this is due to IIS being generally buggy or due to the unor... | ```
var iisManager = new ServerManager(Environment.SystemDirectory + "\\inetsrv\\config\\applicationhost.config");
```
This works perfectly. No need to change any references |
27,212,037 | What is the difference between the 2 lines below? They do the same thing so is there any difference ?
```
string filename = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
string filename = FileUpload1.PostedFile.FileName;
``` | 2014/11/30 | [
"https://Stackoverflow.com/questions/27212037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3994909/"
] | In BASH you can use this utility function:
```
decodeURL() {
printf "$(sed 's#^file://##;s/+/ /g;s/%\(..\)/\\x\1/g;' <<< "$@")\n";
}
```
**Then call this function as:**
```
decodeURL 'file:///home/sashoalm/Has%20Spaces.txt'
/home/sashoalm/Has Spaces.txt
``` | [Urlencode](http://linux.die.net/man/1/urlencode) should do it (-d option)
>
> -d Do URL-decoding rather than encoding, according to RFC 1738. %HH and %hh strings are converted and other characters are passed through
> unmodified, with the exception that + is converted to space.
>
>
> |
27,212,037 | What is the difference between the 2 lines below? They do the same thing so is there any difference ?
```
string filename = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
string filename = FileUpload1.PostedFile.FileName;
``` | 2014/11/30 | [
"https://Stackoverflow.com/questions/27212037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3994909/"
] | [Urlencode](http://linux.die.net/man/1/urlencode) should do it (-d option)
>
> -d Do URL-decoding rather than encoding, according to RFC 1738. %HH and %hh strings are converted and other characters are passed through
> unmodified, with the exception that + is converted to space.
>
>
> | GNU awk
```perl
#!/usr/bin/awk -fn
@include "ord"
BEGIN {
RS = "%.."
}
{
printf RT ? $0 chr("0x" substr(RT, 2)) : $0
}
```
Or
```
#!/bin/sh
awk -niord '{printf RT?$0chr("0x"substr(RT,2)):$0}' RS=%..
```
[How to decode URL-encoded string in shell?](https://stackoverflow.com/q/6250698/#14000368) |
27,212,037 | What is the difference between the 2 lines below? They do the same thing so is there any difference ?
```
string filename = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
string filename = FileUpload1.PostedFile.FileName;
``` | 2014/11/30 | [
"https://Stackoverflow.com/questions/27212037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3994909/"
] | In BASH you can use this utility function:
```
decodeURL() {
printf "$(sed 's#^file://##;s/+/ /g;s/%\(..\)/\\x\1/g;' <<< "$@")\n";
}
```
**Then call this function as:**
```
decodeURL 'file:///home/sashoalm/Has%20Spaces.txt'
/home/sashoalm/Has Spaces.txt
``` | Perl to the rescue:
```
echo file:///home/sashoalm/Has%20Spaces.txt |\
perl -MURI -MURI::Escape -lne \
'print uri_unescape(URI->new($_)->path)'
```
See [URI](http://p3rl.org/URI) and [URI::Escape](http://p3rl.org/URI::Escape). |
27,212,037 | What is the difference between the 2 lines below? They do the same thing so is there any difference ?
```
string filename = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
string filename = FileUpload1.PostedFile.FileName;
``` | 2014/11/30 | [
"https://Stackoverflow.com/questions/27212037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3994909/"
] | In BASH you can use this utility function:
```
decodeURL() {
printf "$(sed 's#^file://##;s/+/ /g;s/%\(..\)/\\x\1/g;' <<< "$@")\n";
}
```
**Then call this function as:**
```
decodeURL 'file:///home/sashoalm/Has%20Spaces.txt'
/home/sashoalm/Has Spaces.txt
``` | GNU awk
```perl
#!/usr/bin/awk -fn
@include "ord"
BEGIN {
RS = "%.."
}
{
printf RT ? $0 chr("0x" substr(RT, 2)) : $0
}
```
Or
```
#!/bin/sh
awk -niord '{printf RT?$0chr("0x"substr(RT,2)):$0}' RS=%..
```
[How to decode URL-encoded string in shell?](https://stackoverflow.com/q/6250698/#14000368) |
27,212,037 | What is the difference between the 2 lines below? They do the same thing so is there any difference ?
```
string filename = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
string filename = FileUpload1.PostedFile.FileName;
``` | 2014/11/30 | [
"https://Stackoverflow.com/questions/27212037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3994909/"
] | Perl to the rescue:
```
echo file:///home/sashoalm/Has%20Spaces.txt |\
perl -MURI -MURI::Escape -lne \
'print uri_unescape(URI->new($_)->path)'
```
See [URI](http://p3rl.org/URI) and [URI::Escape](http://p3rl.org/URI::Escape). | GNU awk
```perl
#!/usr/bin/awk -fn
@include "ord"
BEGIN {
RS = "%.."
}
{
printf RT ? $0 chr("0x" substr(RT, 2)) : $0
}
```
Or
```
#!/bin/sh
awk -niord '{printf RT?$0chr("0x"substr(RT,2)):$0}' RS=%..
```
[How to decode URL-encoded string in shell?](https://stackoverflow.com/q/6250698/#14000368) |
10,741,179 | i have some jquery thats expanding/collapsing on click. i would like the first item to be expanded by default but im having trouble with the jquery. i've tried a few different angles to no avail. any help would be much appreciated!
<http://jsfiddle.net/trrJp/1/> | 2012/05/24 | [
"https://Stackoverflow.com/questions/10741179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1211700/"
] | The original poster didn't select an answer I'm going to combine the previous two into one ***super*** answr! :P
You can enable word wrapping on all columns on the Spark DataGrid with variableRowHeight:
```
<s:DataGrid variableRowHeight="true">
</s:DataGrid>
```
Or you can enable word wrapping on an individual colu... | **[Edit]**
Oops, my original answer was referring to the MX `DataGridColumn` component, not the Spark `GridColumn`. Revised answer...
The default item renderer for the grid is `DataGridItemRenderer` and it has a word wrap property that you need to set to true. Not sure, but you might also have to set the `variableRow... |
10,741,179 | i have some jquery thats expanding/collapsing on click. i would like the first item to be expanded by default but im having trouble with the jquery. i've tried a few different angles to no avail. any help would be much appreciated!
<http://jsfiddle.net/trrJp/1/> | 2012/05/24 | [
"https://Stackoverflow.com/questions/10741179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1211700/"
] | The original poster didn't select an answer I'm going to combine the previous two into one ***super*** answr! :P
You can enable word wrapping on all columns on the Spark DataGrid with variableRowHeight:
```
<s:DataGrid variableRowHeight="true">
</s:DataGrid>
```
Or you can enable word wrapping on an individual colu... | Until *flex4.6*, there is no **s**:DataGridItemRenderer, but there is **mx**:DataGridItemRenderer. So, the code would be:
```
<s:GridColumn headerText="foo" labelFunction="fooLabelFunction">
<s:itemRenderer>
<fx:Component>
<mx:DataGridItemRenderer wordWrap="true" />
</fx:Component>
... |
21,642,329 | Let`s say I have the following table
```
+----+-------+
| Id | Value |
+----+-------+
| 1 | 2.0 |
| 2 | 8.0 |
| 3 | 3.0 |
| 4 | 9.0 |
| 5 | 1.0 |
| 6 | 4.0 |
| 7 | 2.5 |
| 8 | 6.5 |
+----+-------+
```
I want to plot these values, but since my real table has thousands of values, I thought abou... | 2014/02/08 | [
"https://Stackoverflow.com/questions/21642329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2278986/"
] | Depending on your DBMS, something like this will work:
```
SELECT
ChunkStart = Min(Id),
ChunkEnd = Max(Id),
Value = Avg(Value)
FROM
(
SELECT
Chunk = NTILE(5) OVER (ORDER BY Id),
*
FROM
YourTable
) AS T
GROUP BY
Chunk
ORDER BY
ChunkStart;
```
This creates 5... | You can use modulos operator to act on every Nth row of the table. This example would get the average value for every 10th row:
```
select avg(Value) from some_table where id % 10 = 0;
```
You could then do a count of the rows in the table, apply some factor to that, and use that value as a dynamic interval:
```
se... |
21,642,329 | Let`s say I have the following table
```
+----+-------+
| Id | Value |
+----+-------+
| 1 | 2.0 |
| 2 | 8.0 |
| 3 | 3.0 |
| 4 | 9.0 |
| 5 | 1.0 |
| 6 | 4.0 |
| 7 | 2.5 |
| 8 | 6.5 |
+----+-------+
```
I want to plot these values, but since my real table has thousands of values, I thought abou... | 2014/02/08 | [
"https://Stackoverflow.com/questions/21642329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2278986/"
] | You can use modulos operator to act on every Nth row of the table. This example would get the average value for every 10th row:
```
select avg(Value) from some_table where id % 10 = 0;
```
You could then do a count of the rows in the table, apply some factor to that, and use that value as a dynamic interval:
```
se... | Look at the NTILE function (as in quartile, quintile, decile, percentile). You can use it to split your data evenly into a number of buckets - in your case it seems you would like five.
Then you can use AVG to calculate an average for each bucket.
NTILE is in SQL-99 so most DBMSes should have it. |
21,642,329 | Let`s say I have the following table
```
+----+-------+
| Id | Value |
+----+-------+
| 1 | 2.0 |
| 2 | 8.0 |
| 3 | 3.0 |
| 4 | 9.0 |
| 5 | 1.0 |
| 6 | 4.0 |
| 7 | 2.5 |
| 8 | 6.5 |
+----+-------+
```
I want to plot these values, but since my real table has thousands of values, I thought abou... | 2014/02/08 | [
"https://Stackoverflow.com/questions/21642329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2278986/"
] | You can use modulos operator to act on every Nth row of the table. This example would get the average value for every 10th row:
```
select avg(Value) from some_table where id % 10 = 0;
```
You could then do a count of the rows in the table, apply some factor to that, and use that value as a dynamic interval:
```
se... | You can try that
```
CREATE TABLE #YourTable
(
ID int
,[Value] float
)
INSERT #YourTable (ID, [Value]) VALUES
(1,2.0)
,(2,8.0)
,(3,3.0)
,(4,9.0)
,(5,1.0)
,(6,4.0)
,(7,2.5)
,(8,6.5)
SELECT
ID = MIN(ID) + '-' + MAX(ID)
,[Value] = AVG([Value])
FROM
(
SELECT
GRP = ((ROW_NUMBER() OVER(ORDER ... |
21,642,329 | Let`s say I have the following table
```
+----+-------+
| Id | Value |
+----+-------+
| 1 | 2.0 |
| 2 | 8.0 |
| 3 | 3.0 |
| 4 | 9.0 |
| 5 | 1.0 |
| 6 | 4.0 |
| 7 | 2.5 |
| 8 | 6.5 |
+----+-------+
```
I want to plot these values, but since my real table has thousands of values, I thought abou... | 2014/02/08 | [
"https://Stackoverflow.com/questions/21642329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2278986/"
] | Depending on your DBMS, something like this will work:
```
SELECT
ChunkStart = Min(Id),
ChunkEnd = Max(Id),
Value = Avg(Value)
FROM
(
SELECT
Chunk = NTILE(5) OVER (ORDER BY Id),
*
FROM
YourTable
) AS T
GROUP BY
Chunk
ORDER BY
ChunkStart;
```
This creates 5... | Look at the NTILE function (as in quartile, quintile, decile, percentile). You can use it to split your data evenly into a number of buckets - in your case it seems you would like five.
Then you can use AVG to calculate an average for each bucket.
NTILE is in SQL-99 so most DBMSes should have it. |
21,642,329 | Let`s say I have the following table
```
+----+-------+
| Id | Value |
+----+-------+
| 1 | 2.0 |
| 2 | 8.0 |
| 3 | 3.0 |
| 4 | 9.0 |
| 5 | 1.0 |
| 6 | 4.0 |
| 7 | 2.5 |
| 8 | 6.5 |
+----+-------+
```
I want to plot these values, but since my real table has thousands of values, I thought abou... | 2014/02/08 | [
"https://Stackoverflow.com/questions/21642329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2278986/"
] | Depending on your DBMS, something like this will work:
```
SELECT
ChunkStart = Min(Id),
ChunkEnd = Max(Id),
Value = Avg(Value)
FROM
(
SELECT
Chunk = NTILE(5) OVER (ORDER BY Id),
*
FROM
YourTable
) AS T
GROUP BY
Chunk
ORDER BY
ChunkStart;
```
This creates 5... | You can try that
```
CREATE TABLE #YourTable
(
ID int
,[Value] float
)
INSERT #YourTable (ID, [Value]) VALUES
(1,2.0)
,(2,8.0)
,(3,3.0)
,(4,9.0)
,(5,1.0)
,(6,4.0)
,(7,2.5)
,(8,6.5)
SELECT
ID = MIN(ID) + '-' + MAX(ID)
,[Value] = AVG([Value])
FROM
(
SELECT
GRP = ((ROW_NUMBER() OVER(ORDER ... |
21,642,329 | Let`s say I have the following table
```
+----+-------+
| Id | Value |
+----+-------+
| 1 | 2.0 |
| 2 | 8.0 |
| 3 | 3.0 |
| 4 | 9.0 |
| 5 | 1.0 |
| 6 | 4.0 |
| 7 | 2.5 |
| 8 | 6.5 |
+----+-------+
```
I want to plot these values, but since my real table has thousands of values, I thought abou... | 2014/02/08 | [
"https://Stackoverflow.com/questions/21642329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2278986/"
] | Look at the NTILE function (as in quartile, quintile, decile, percentile). You can use it to split your data evenly into a number of buckets - in your case it seems you would like five.
Then you can use AVG to calculate an average for each bucket.
NTILE is in SQL-99 so most DBMSes should have it. | You can try that
```
CREATE TABLE #YourTable
(
ID int
,[Value] float
)
INSERT #YourTable (ID, [Value]) VALUES
(1,2.0)
,(2,8.0)
,(3,3.0)
,(4,9.0)
,(5,1.0)
,(6,4.0)
,(7,2.5)
,(8,6.5)
SELECT
ID = MIN(ID) + '-' + MAX(ID)
,[Value] = AVG([Value])
FROM
(
SELECT
GRP = ((ROW_NUMBER() OVER(ORDER ... |
1,584,983 | 1. I have an open folder in VSCode, eg `/folders/project1`, this is my workspace.
2. I want to add a file from outside of this folder, eg `/media/files/file1`.
I wish there was a VSCode command that displays a file picker that I can select any file on my computer's memory, and that file ends up in a folder opened as w... | 2020/09/12 | [
"https://superuser.com/questions/1584983",
"https://superuser.com",
"https://superuser.com/users/1050966/"
] | You can use [PowerToys](https://github.com/microsoft/PowerToys) from Microsoft. One of the toys Keyboard Manager is made just for what you are looking for:
>
> Keyboard Manager allows you to customize the keyboard to be more productive by remapping keys and creating your own keyboard shortcuts. This PowerToy requires... | Sure, you can use a scripting language named AutoHotKey for creating custom hotkeys and remapping one keys to another. You can find tutorial and documentation in their [official website](https://www.autohotkey.com/docs/Tutorial.htm). |
37,099,617 | I'm having difficulties with some recoding (filling in empty cells in R or SPSS)
I'm working with a long format data-set (in order to run a multilevel model) where each respondent (ID-variable) has three rows, so three times the same ID number below each other (for three different momemts in time).
The problem is tha... | 2016/05/08 | [
"https://Stackoverflow.com/questions/37099617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5235404/"
] | We can use `na.locf` assuming that `.` implies `NA` values.
```
library(zoo)
df1$Ancestry <- na.locf(df1$Ancestry)
```
If the column is non-numeric i.e. have `.` as values, then we need to convert it to numeric so that the `.` coerce to NA and then we apply `na.locf` on it
```
df1$Ancestry <- na.locf(as.numeric(... | In SPSS this should do the job, assuming the "Ancestry" variable is numeric:
```
AGGREGATE /OUTFILE=* MODE=ADDVARIABLES OVERWRITEVARS=YES/BREAK=ID /Ancestry=MAX(Ancestry).
```
If "Ancestry" is a string, you could go this way:
```
sort cases by ID Ancestry (d).
if ID=lag(ID) and Ancestry="" Ancestry=lag(Ancestry).
e... |
37,099,617 | I'm having difficulties with some recoding (filling in empty cells in R or SPSS)
I'm working with a long format data-set (in order to run a multilevel model) where each respondent (ID-variable) has three rows, so three times the same ID number below each other (for three different momemts in time).
The problem is tha... | 2016/05/08 | [
"https://Stackoverflow.com/questions/37099617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5235404/"
] | We can use `na.locf` assuming that `.` implies `NA` values.
```
library(zoo)
df1$Ancestry <- na.locf(df1$Ancestry)
```
If the column is non-numeric i.e. have `.` as values, then we need to convert it to numeric so that the `.` coerce to NA and then we apply `na.locf` on it
```
df1$Ancestry <- na.locf(as.numeric(... | Another easy way of achieving this is in `R` the following, using the fact that the actual value always occurs in the first position for each ID:
```
library(dplyr)
df %>% group_by(ID) %>% mutate(Ancestry = Ancestry[1])
Source: local data frame [9 x 2]
Groups: ID [3]
ID Ancestry
(int) (chr)
1 1003 ... |
37,099,617 | I'm having difficulties with some recoding (filling in empty cells in R or SPSS)
I'm working with a long format data-set (in order to run a multilevel model) where each respondent (ID-variable) has three rows, so three times the same ID number below each other (for three different momemts in time).
The problem is tha... | 2016/05/08 | [
"https://Stackoverflow.com/questions/37099617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5235404/"
] | We can use `na.locf` assuming that `.` implies `NA` values.
```
library(zoo)
df1$Ancestry <- na.locf(df1$Ancestry)
```
If the column is non-numeric i.e. have `.` as values, then we need to convert it to numeric so that the `.` coerce to NA and then we apply `na.locf` on it
```
df1$Ancestry <- na.locf(as.numeric(... | Once you convert the `.`s to `NA` by your favorite method, this is exactly what `tidyr::fill` was designed to do:
```
library(tidyr)
df %>% extract(Ancestry, 'Ancestry', convert = TRUE) %>% fill(Ancestry)
#
# ID Ancestry
# 1 1003 1
# 2 1003 1
# 3 1003 1
# 4 1004 0
# 5 1004 0
# ... |
37,099,617 | I'm having difficulties with some recoding (filling in empty cells in R or SPSS)
I'm working with a long format data-set (in order to run a multilevel model) where each respondent (ID-variable) has three rows, so three times the same ID number below each other (for three different momemts in time).
The problem is tha... | 2016/05/08 | [
"https://Stackoverflow.com/questions/37099617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5235404/"
] | We can use `na.locf` assuming that `.` implies `NA` values.
```
library(zoo)
df1$Ancestry <- na.locf(df1$Ancestry)
```
If the column is non-numeric i.e. have `.` as values, then we need to convert it to numeric so that the `.` coerce to NA and then we apply `na.locf` on it
```
df1$Ancestry <- na.locf(as.numeric(... | ```
IF (ID EQ LAG(ID)) Ancestry=LAG(Ancestry).
```
Or alternatively:
```
IF (ID EQ LAG(ID) AND MISSING(Ancestry)) Ancestry=LAG(Ancestry).
``` |
80,649 | I am working on a physics reserach project for school and I have run into some troubles working Mathematica. I am a fairly inexperienced mathematica user so any help would very much be appreciated.
I need to find the roots of the transcendental equation
$$\zeta\_n \tan(\zeta) - \sqrt{R^2-\zeta^2\_n}=0$$
and then coll... | 2015/04/22 | [
"https://mathematica.stackexchange.com/questions/80649",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/27986/"
] | ```
With[{maxR = 10},
Manipulate[
expr = Sqrt[R^2 - zeta^2] - zeta Tan[zeta];
zero = zeta /. NSolve[{expr == 0,
R^2 - zeta^2 >= 0}, zeta] // Quiet;
Column[{
Plot[expr, {zeta, -maxR, maxR},
Exclusions -> {Cos[zeta] == 0},
PlotRange -> {{-maxR, maxR}, {-25, 40}},
Epilog -> {Red, AbsoluteP... | If the goal is only to obtain the sum of positive roots, then
```
f[r_] := Total[ζ /. NSolve[{Sqrt[r^2 - ζ^2] - ζ Tan[ζ] == 0,
r^2 - ζ^2 >= 0, ζ > 0}, ζ]]
```
produces this quantity. For instance,
```
Plot[f[r], {r, .1, 10}, AxesLabel -> {R, Total}]
```
 - \sqrt{R^2-\zeta^2\_n}=0$$
and then coll... | 2015/04/22 | [
"https://mathematica.stackexchange.com/questions/80649",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/27986/"
] | ```
With[{maxR = 10},
Manipulate[
expr = Sqrt[R^2 - zeta^2] - zeta Tan[zeta];
zero = zeta /. NSolve[{expr == 0,
R^2 - zeta^2 >= 0}, zeta] // Quiet;
Column[{
Plot[expr, {zeta, -maxR, maxR},
Exclusions -> {Cos[zeta] == 0},
PlotRange -> {{-maxR, maxR}, {-25, 40}},
Epilog -> {Red, AbsoluteP... | I'm going to guess that you're trying to solve for the even states of the finite square well in quantum mechanics. Note that the number of roots is just determined by $R$, and is `Floor[R/π]`; plot the graphs of $\zeta \tan \zeta$ and $\sqrt{R^2 - \zeta^2}$ to see why this is so. Moreover, it's not too hard from this g... |
80,649 | I am working on a physics reserach project for school and I have run into some troubles working Mathematica. I am a fairly inexperienced mathematica user so any help would very much be appreciated.
I need to find the roots of the transcendental equation
$$\zeta\_n \tan(\zeta) - \sqrt{R^2-\zeta^2\_n}=0$$
and then coll... | 2015/04/22 | [
"https://mathematica.stackexchange.com/questions/80649",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/27986/"
] | ```
With[{maxR = 10},
Manipulate[
expr = Sqrt[R^2 - zeta^2] - zeta Tan[zeta];
zero = zeta /. NSolve[{expr == 0,
R^2 - zeta^2 >= 0}, zeta] // Quiet;
Column[{
Plot[expr, {zeta, -maxR, maxR},
Exclusions -> {Cos[zeta] == 0},
PlotRange -> {{-maxR, maxR}, {-25, 40}},
Epilog -> {Red, AbsoluteP... | If you only want real solutions, then `NSolve` will find them if we help it by including the domain for `zeta`.
```
R = Sqrt[18];
sol = NSolve[Sqrt[R^2 - zeta^2] - zeta Tan[zeta] == 0 && -R <= zeta <= R]
(*
{{zeta -> -3.66808}, {zeta -> -1.26743},
{zeta -> 1.26743}, {zeta -> 3.66808}}
*)
```
You can save them ... |
80,649 | I am working on a physics reserach project for school and I have run into some troubles working Mathematica. I am a fairly inexperienced mathematica user so any help would very much be appreciated.
I need to find the roots of the transcendental equation
$$\zeta\_n \tan(\zeta) - \sqrt{R^2-\zeta^2\_n}=0$$
and then coll... | 2015/04/22 | [
"https://mathematica.stackexchange.com/questions/80649",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/27986/"
] | ```
With[{maxR = 10},
Manipulate[
expr = Sqrt[R^2 - zeta^2] - zeta Tan[zeta];
zero = zeta /. NSolve[{expr == 0,
R^2 - zeta^2 >= 0}, zeta] // Quiet;
Column[{
Plot[expr, {zeta, -maxR, maxR},
Exclusions -> {Cos[zeta] == 0},
PlotRange -> {{-maxR, maxR}, {-25, 40}},
Epilog -> {Red, AbsoluteP... | After a slight rearrangement, your equation is a good candidate for the Chebyshev approach, as detailed [here](https://mathematica.stackexchange.com/a/89692) and [here](https://mathematica.stackexchange.com/a/92042):
```
r = Sqrt[18]; f = Sqrt[r^2 - #^2] Cos[#] - # Sin[#] &;
n = 32;
cnodes = Rescale[N[Cos[Pi Range[0, ... |
80,649 | I am working on a physics reserach project for school and I have run into some troubles working Mathematica. I am a fairly inexperienced mathematica user so any help would very much be appreciated.
I need to find the roots of the transcendental equation
$$\zeta\_n \tan(\zeta) - \sqrt{R^2-\zeta^2\_n}=0$$
and then coll... | 2015/04/22 | [
"https://mathematica.stackexchange.com/questions/80649",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/27986/"
] | If the goal is only to obtain the sum of positive roots, then
```
f[r_] := Total[ζ /. NSolve[{Sqrt[r^2 - ζ^2] - ζ Tan[ζ] == 0,
r^2 - ζ^2 >= 0, ζ > 0}, ζ]]
```
produces this quantity. For instance,
```
Plot[f[r], {r, .1, 10}, AxesLabel -> {R, Total}]
```

```
You can save them ... |
80,649 | I am working on a physics reserach project for school and I have run into some troubles working Mathematica. I am a fairly inexperienced mathematica user so any help would very much be appreciated.
I need to find the roots of the transcendental equation
$$\zeta\_n \tan(\zeta) - \sqrt{R^2-\zeta^2\_n}=0$$
and then coll... | 2015/04/22 | [
"https://mathematica.stackexchange.com/questions/80649",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/27986/"
] | I'm going to guess that you're trying to solve for the even states of the finite square well in quantum mechanics. Note that the number of roots is just determined by $R$, and is `Floor[R/π]`; plot the graphs of $\zeta \tan \zeta$ and $\sqrt{R^2 - \zeta^2}$ to see why this is so. Moreover, it's not too hard from this g... | If you only want real solutions, then `NSolve` will find them if we help it by including the domain for `zeta`.
```
R = Sqrt[18];
sol = NSolve[Sqrt[R^2 - zeta^2] - zeta Tan[zeta] == 0 && -R <= zeta <= R]
(*
{{zeta -> -3.66808}, {zeta -> -1.26743},
{zeta -> 1.26743}, {zeta -> 3.66808}}
*)
```
You can save them ... |
80,649 | I am working on a physics reserach project for school and I have run into some troubles working Mathematica. I am a fairly inexperienced mathematica user so any help would very much be appreciated.
I need to find the roots of the transcendental equation
$$\zeta\_n \tan(\zeta) - \sqrt{R^2-\zeta^2\_n}=0$$
and then coll... | 2015/04/22 | [
"https://mathematica.stackexchange.com/questions/80649",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/27986/"
] | After a slight rearrangement, your equation is a good candidate for the Chebyshev approach, as detailed [here](https://mathematica.stackexchange.com/a/89692) and [here](https://mathematica.stackexchange.com/a/92042):
```
r = Sqrt[18]; f = Sqrt[r^2 - #^2] Cos[#] - # Sin[#] &;
n = 32;
cnodes = Rescale[N[Cos[Pi Range[0, ... | If you only want real solutions, then `NSolve` will find them if we help it by including the domain for `zeta`.
```
R = Sqrt[18];
sol = NSolve[Sqrt[R^2 - zeta^2] - zeta Tan[zeta] == 0 && -R <= zeta <= R]
(*
{{zeta -> -3.66808}, {zeta -> -1.26743},
{zeta -> 1.26743}, {zeta -> 3.66808}}
*)
```
You can save them ... |
65,126,618 | I have monthly data and I want to plot only certain regions, every 24 steps (2 years) or so, how can I find a quick way to plot every 20 steps using a for loop maybe?
For example, instead of doing this:
```
#first 24 indices
plt.plot(time_months[0:24], monthly[0:24])
plt.xticks(rotation=35)
plt.show()
#next set of 24... | 2020/12/03 | [
"https://Stackoverflow.com/questions/65126618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14714547/"
] | `pipenv` has no special option for it. But you can use these bash scripts (I made them using the venvs directory `~/.local/share/virtualenvs/` so you should change it if your venvs folder is different)
PRINT useless venvs:
====================
```
for f in $(find ~/.local/share/virtualenvs/*/.project -type f); do pro... | Here is a bash script to check and clean up abandoned pipenv environments interactively based on the [answer of @yestema](https://stackoverflow.com/a/67209898/12361118).
```sh
#!/usr/bin/env bash
# Author: TiDu Nguyen
# https://gist.github.com/tidunguyen/0fc018326f33c29e819be7f388360a5b
# get all pipenv environments... |
65,126,618 | I have monthly data and I want to plot only certain regions, every 24 steps (2 years) or so, how can I find a quick way to plot every 20 steps using a for loop maybe?
For example, instead of doing this:
```
#first 24 indices
plt.plot(time_months[0:24], monthly[0:24])
plt.xticks(rotation=35)
plt.show()
#next set of 24... | 2020/12/03 | [
"https://Stackoverflow.com/questions/65126618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14714547/"
] | `pipenv` has no special option for it. But you can use these bash scripts (I made them using the venvs directory `~/.local/share/virtualenvs/` so you should change it if your venvs folder is different)
PRINT useless venvs:
====================
```
for f in $(find ~/.local/share/virtualenvs/*/.project -type f); do pro... | I built a function for this based on the [answer of @yestema](https://stackoverflow.com/a/67209898/15034335). You can check it in my [repo](https://github.com/tw-yshuang/Automatic-Installation_basic-Ubuntu-setting/blob/main/config/.customfunction).
Save the code below into your profile, e.q. ~/.bashrc .
```
# extra pi... |
1,897,672 | Let $f$ be a separable monic polynomials with integer coefficient. Let $K$ be the splitting field of $f$ over $\mathbb{Q}$, and let $p$ be a prime. What is the relationship between the statements
$f$ splits over $\mathbb{F}\_p$ and
$p$ is not irreducible in $K$ (there is probably some fancy term for this, like $p$ ... | 2016/08/20 | [
"https://math.stackexchange.com/questions/1897672",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/116154/"
] | Let $ K = \mathbf Q(\alpha) $ be a number field with ring of integers $ \mathcal O\_K $, where $ \alpha $ is an algebraic integer with minimal polynomial $ \pi(X)$. Dedekind's factorization criterion tells us that if $ p $ is a prime which does not divide the index $ [\mathcal O\_K : \mathbf Z[\alpha]] $, then the way ... | Let’s look at a simple example, $f(X)=X^3-2$ and its splitting field $K=\Bbb Q(\lambda,\omega)$, over $\Bbb Q$, where $\lambda=\sqrt[3]2$ and $\omega$ is a primitive cube root of unity. Take $p=5$, and look at $f\in\Bbb F\_5[X]$, where it factors as $(X+2)(X^2+3X+4)$, so $f$ doesn’t split there.
Calling $\mathscr O$ t... |
7,858 | My title sums up my question pretty well. We're investigating whether we can use a Kanban-based system to manage and track some internal projects and one of our requirements is to track time spent on activities. This will allow us to collect stats on engineering cost.
Is anyone doing this and if so, how? | 2012/10/18 | [
"https://pm.stackexchange.com/questions/7858",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/4752/"
] | ### TL;DR
Don't think "time tracking." Think "cycle time" instead.
### Kanban Should Measure Cycle Time
Generally, Kanban is not about measuring "activities" at a granular level; it is about measuring cycle time for a pull through the entire system. There is legitimate debate about whether this time should include l... | I agree, that in general Kanban is not about tracking time spent on tasks. However, I understand a need for that. It seems to me that you need a virtual Kanban board with build-in time tracking and reports. The solution that offers such a powerful combination is [Kanban Tool](http://kanbantool.com/time-tracking). |
7,858 | My title sums up my question pretty well. We're investigating whether we can use a Kanban-based system to manage and track some internal projects and one of our requirements is to track time spent on activities. This will allow us to collect stats on engineering cost.
Is anyone doing this and if so, how? | 2012/10/18 | [
"https://pm.stackexchange.com/questions/7858",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/4752/"
] | I concur with [codegnome](https://pm.stackexchange.com/users/4271/codegnome "codegnome")'s answer above. Kanban is about outcomes, what the team delivers in terms of *throughput* and how fast they do this, measured as *cycle time*.
You could use this to support your financial analysis by asking 'Of our team's throughp... | I agree, that in general Kanban is not about tracking time spent on tasks. However, I understand a need for that. It seems to me that you need a virtual Kanban board with build-in time tracking and reports. The solution that offers such a powerful combination is [Kanban Tool](http://kanbantool.com/time-tracking). |
7,858 | My title sums up my question pretty well. We're investigating whether we can use a Kanban-based system to manage and track some internal projects and one of our requirements is to track time spent on activities. This will allow us to collect stats on engineering cost.
Is anyone doing this and if so, how? | 2012/10/18 | [
"https://pm.stackexchange.com/questions/7858",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/4752/"
] | Disclaimer: I'm the author of Breeze.
I had a similar problem where I internally use Kanban for software development but still needed somehow to bill clients based on estimates and actual work done. So, being a developer, I made a simple tool called [Breeze](http://letsbreeze.com). It's basically a Kanban board with t... | I agree, that in general Kanban is not about tracking time spent on tasks. However, I understand a need for that. It seems to me that you need a virtual Kanban board with build-in time tracking and reports. The solution that offers such a powerful combination is [Kanban Tool](http://kanbantool.com/time-tracking). |
7,858 | My title sums up my question pretty well. We're investigating whether we can use a Kanban-based system to manage and track some internal projects and one of our requirements is to track time spent on activities. This will allow us to collect stats on engineering cost.
Is anyone doing this and if so, how? | 2012/10/18 | [
"https://pm.stackexchange.com/questions/7858",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/4752/"
] | ### TL;DR
Don't think "time tracking." Think "cycle time" instead.
### Kanban Should Measure Cycle Time
Generally, Kanban is not about measuring "activities" at a granular level; it is about measuring cycle time for a pull through the entire system. There is legitimate debate about whether this time should include l... | I concur with [codegnome](https://pm.stackexchange.com/users/4271/codegnome "codegnome")'s answer above. Kanban is about outcomes, what the team delivers in terms of *throughput* and how fast they do this, measured as *cycle time*.
You could use this to support your financial analysis by asking 'Of our team's throughp... |
7,858 | My title sums up my question pretty well. We're investigating whether we can use a Kanban-based system to manage and track some internal projects and one of our requirements is to track time spent on activities. This will allow us to collect stats on engineering cost.
Is anyone doing this and if so, how? | 2012/10/18 | [
"https://pm.stackexchange.com/questions/7858",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/4752/"
] | My advice is to use whatever time tracking system you currently have rather than add unnecessary bells/whistles to Kanban because:
* It will cost you less in terms of time, effort, training and dollars.
* It will avoid giving people one less thing to complain about when you implement Kanban, so acceptance of this chan... | I agree, that in general Kanban is not about tracking time spent on tasks. However, I understand a need for that. It seems to me that you need a virtual Kanban board with build-in time tracking and reports. The solution that offers such a powerful combination is [Kanban Tool](http://kanbantool.com/time-tracking). |
7,858 | My title sums up my question pretty well. We're investigating whether we can use a Kanban-based system to manage and track some internal projects and one of our requirements is to track time spent on activities. This will allow us to collect stats on engineering cost.
Is anyone doing this and if so, how? | 2012/10/18 | [
"https://pm.stackexchange.com/questions/7858",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/4752/"
] | Disclaimer: I'm the author of Breeze.
I had a similar problem where I internally use Kanban for software development but still needed somehow to bill clients based on estimates and actual work done. So, being a developer, I made a simple tool called [Breeze](http://letsbreeze.com). It's basically a Kanban board with t... | I concur with [codegnome](https://pm.stackexchange.com/users/4271/codegnome "codegnome")'s answer above. Kanban is about outcomes, what the team delivers in terms of *throughput* and how fast they do this, measured as *cycle time*.
You could use this to support your financial analysis by asking 'Of our team's throughp... |
7,858 | My title sums up my question pretty well. We're investigating whether we can use a Kanban-based system to manage and track some internal projects and one of our requirements is to track time spent on activities. This will allow us to collect stats on engineering cost.
Is anyone doing this and if so, how? | 2012/10/18 | [
"https://pm.stackexchange.com/questions/7858",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/4752/"
] | Disclaimer: I am related to Eylean board development
There is a precise match solution launched instead of Eylean which covers the idea of using both Cycle time and time tracking as part of Kanban System. If it is still relevant option you can consider reviewing [Teamhood](https://teamhood.com)
One more tool is [Eyle... | I concur with [codegnome](https://pm.stackexchange.com/users/4271/codegnome "codegnome")'s answer above. Kanban is about outcomes, what the team delivers in terms of *throughput* and how fast they do this, measured as *cycle time*.
You could use this to support your financial analysis by asking 'Of our team's throughp... |
7,858 | My title sums up my question pretty well. We're investigating whether we can use a Kanban-based system to manage and track some internal projects and one of our requirements is to track time spent on activities. This will allow us to collect stats on engineering cost.
Is anyone doing this and if so, how? | 2012/10/18 | [
"https://pm.stackexchange.com/questions/7858",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/4752/"
] | ### TL;DR
Don't think "time tracking." Think "cycle time" instead.
### Kanban Should Measure Cycle Time
Generally, Kanban is not about measuring "activities" at a granular level; it is about measuring cycle time for a pull through the entire system. There is legitimate debate about whether this time should include l... | You can achieve this using [JIRA](http://www.atlassian.com/software/jira/overview/) (which will manage your issues/bugs/backlog) and [Greenhopper](http://www.atlassian.com/software/greenhopper/overview/kanban) (which will handle the Kanban side of it). Devs (or PMs) can log work on the issues that they're working on bu... |
7,858 | My title sums up my question pretty well. We're investigating whether we can use a Kanban-based system to manage and track some internal projects and one of our requirements is to track time spent on activities. This will allow us to collect stats on engineering cost.
Is anyone doing this and if so, how? | 2012/10/18 | [
"https://pm.stackexchange.com/questions/7858",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/4752/"
] | You can achieve this using [JIRA](http://www.atlassian.com/software/jira/overview/) (which will manage your issues/bugs/backlog) and [Greenhopper](http://www.atlassian.com/software/greenhopper/overview/kanban) (which will handle the Kanban side of it). Devs (or PMs) can log work on the issues that they're working on bu... | I concur with [codegnome](https://pm.stackexchange.com/users/4271/codegnome "codegnome")'s answer above. Kanban is about outcomes, what the team delivers in terms of *throughput* and how fast they do this, measured as *cycle time*.
You could use this to support your financial analysis by asking 'Of our team's throughp... |
7,858 | My title sums up my question pretty well. We're investigating whether we can use a Kanban-based system to manage and track some internal projects and one of our requirements is to track time spent on activities. This will allow us to collect stats on engineering cost.
Is anyone doing this and if so, how? | 2012/10/18 | [
"https://pm.stackexchange.com/questions/7858",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/4752/"
] | Disclaimer: I am related to Eylean board development
There is a precise match solution launched instead of Eylean which covers the idea of using both Cycle time and time tracking as part of Kanban System. If it is still relevant option you can consider reviewing [Teamhood](https://teamhood.com)
One more tool is [Eyle... | I agree, that in general Kanban is not about tracking time spent on tasks. However, I understand a need for that. It seems to me that you need a virtual Kanban board with build-in time tracking and reports. The solution that offers such a powerful combination is [Kanban Tool](http://kanbantool.com/time-tracking). |
8,859,384 | Is there such a thing as a 64-bit .dll for the YAJSW Java service wrapper? If so, where do I find it? I know that the Tanuki JSW provides .dll files that go with the .jar files it distributes. So, I am basically wondering if YAJSW has overcome this limitation and I dont need a .dll OR if I need to download one from som... | 2012/01/14 | [
"https://Stackoverflow.com/questions/8859384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/118228/"
] | I think you are misunderstanding that reference to "w86.dll". I think it is supposed to be an example of some 3rd party application specific DLL. The text is about how to configure YAJSW to deal with such things.
I've never tried to use YAJSW, but the indications from the documentation is that 64 bit is supported for ... | You can find a list of supported platforms for YAJSW [here](http://yajsw.sourceforge.net/#mozTocId768274).
YAJSW distribution comes with what you need to get it running so as long as you are on a supported platform you should be good to go. |
18,667,510 | I have a bunch of directories that I need to restructure. They're in a format as such:
```
./1993-02-22 - The Moon - Tallahassee, FL/**files**
./1993-02-23 - The Moon - Tallahassee, FL/**files**
./1993-02-24 - The Moon - Tallahassee, FL/**files**
./1993-02-25 - The Moon - Tallahassee, FL/**files**
./1993-03-01 - The T... | 2013/09/06 | [
"https://Stackoverflow.com/questions/18667510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240569/"
] | I understood the question in a different way than [Kent](https://stackoverflow.com/users/164835/kent). I thought that you wanted to create a new tree of directories from each original one and move all files that it contained. You could try following [perl](/questions/tagged/perl "show questions tagged 'perl'") script i... | like this?
```
kent$ awk '{gsub(/-/,"/",$1);sub(/^[^/]*\//,"/",$NF);print $1$NF}' file
./1993/02/22/**files**
./1993/02/23/**files**
./1993/02/24/**files**
./1993/02/25/**files**
./1993/03/01/**files**
``` |
18,667,510 | I have a bunch of directories that I need to restructure. They're in a format as such:
```
./1993-02-22 - The Moon - Tallahassee, FL/**files**
./1993-02-23 - The Moon - Tallahassee, FL/**files**
./1993-02-24 - The Moon - Tallahassee, FL/**files**
./1993-02-25 - The Moon - Tallahassee, FL/**files**
./1993-03-01 - The T... | 2013/09/06 | [
"https://Stackoverflow.com/questions/18667510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240569/"
] | Suppose your files are stored in "old" folder, then you may write a shell script (avoid using "for" loop that has difficulties with file names containing spaces):
```
mkdir -p new
ls -d -1 old/*/* | while read oldfile; do
newfile=`echo "$oldfile" | sed -r 's#^old/([0-9]{4})\-([0-9]{1,2})\-([0-9]{1,2})(.*)$#new/\1/... | like this?
```
kent$ awk '{gsub(/-/,"/",$1);sub(/^[^/]*\//,"/",$NF);print $1$NF}' file
./1993/02/22/**files**
./1993/02/23/**files**
./1993/02/24/**files**
./1993/02/25/**files**
./1993/03/01/**files**
``` |
18,667,510 | I have a bunch of directories that I need to restructure. They're in a format as such:
```
./1993-02-22 - The Moon - Tallahassee, FL/**files**
./1993-02-23 - The Moon - Tallahassee, FL/**files**
./1993-02-24 - The Moon - Tallahassee, FL/**files**
./1993-02-25 - The Moon - Tallahassee, FL/**files**
./1993-03-01 - The T... | 2013/09/06 | [
"https://Stackoverflow.com/questions/18667510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240569/"
] | I understood the question in a different way than [Kent](https://stackoverflow.com/users/164835/kent). I thought that you wanted to create a new tree of directories from each original one and move all files that it contained. You could try following [perl](/questions/tagged/perl "show questions tagged 'perl'") script i... | Here is a `sed+awk` after so much of comments :
```
awk 'BEGIN{FS="-"}{print $1"/"$2"/"$3}' file | awk 'BEGIN{FS="**files**"}{print $1"/"FS}' | sed -e 's/ \//\//g'
./1993/02/22/**files**
./1993/02/23/**files**
./1993/02/24/**files**
./1993/02/25/**files**
./1993/03/01/**files**
``` |
18,667,510 | I have a bunch of directories that I need to restructure. They're in a format as such:
```
./1993-02-22 - The Moon - Tallahassee, FL/**files**
./1993-02-23 - The Moon - Tallahassee, FL/**files**
./1993-02-24 - The Moon - Tallahassee, FL/**files**
./1993-02-25 - The Moon - Tallahassee, FL/**files**
./1993-03-01 - The T... | 2013/09/06 | [
"https://Stackoverflow.com/questions/18667510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240569/"
] | Suppose your files are stored in "old" folder, then you may write a shell script (avoid using "for" loop that has difficulties with file names containing spaces):
```
mkdir -p new
ls -d -1 old/*/* | while read oldfile; do
newfile=`echo "$oldfile" | sed -r 's#^old/([0-9]{4})\-([0-9]{1,2})\-([0-9]{1,2})(.*)$#new/\1/... | Here is a `sed+awk` after so much of comments :
```
awk 'BEGIN{FS="-"}{print $1"/"$2"/"$3}' file | awk 'BEGIN{FS="**files**"}{print $1"/"FS}' | sed -e 's/ \//\//g'
./1993/02/22/**files**
./1993/02/23/**files**
./1993/02/24/**files**
./1993/02/25/**files**
./1993/03/01/**files**
``` |
18,667,510 | I have a bunch of directories that I need to restructure. They're in a format as such:
```
./1993-02-22 - The Moon - Tallahassee, FL/**files**
./1993-02-23 - The Moon - Tallahassee, FL/**files**
./1993-02-24 - The Moon - Tallahassee, FL/**files**
./1993-02-25 - The Moon - Tallahassee, FL/**files**
./1993-03-01 - The T... | 2013/09/06 | [
"https://Stackoverflow.com/questions/18667510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240569/"
] | I understood the question in a different way than [Kent](https://stackoverflow.com/users/164835/kent). I thought that you wanted to create a new tree of directories from each original one and move all files that it contained. You could try following [perl](/questions/tagged/perl "show questions tagged 'perl'") script i... | Suppose your files are stored in "old" folder, then you may write a shell script (avoid using "for" loop that has difficulties with file names containing spaces):
```
mkdir -p new
ls -d -1 old/*/* | while read oldfile; do
newfile=`echo "$oldfile" | sed -r 's#^old/([0-9]{4})\-([0-9]{1,2})\-([0-9]{1,2})(.*)$#new/\1/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.