qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
63,324,647
I am plotting countries on map using plotly and r shiny. I would like subset of data containing rows about the country to appear in the form of data table on clicking on country on a map. But I am unable to implement it. I get the table but there is not data displayed in the table. Any help would be appreciated! ``` Mapbox_Token= 'Mapbox token' library(plotly) library("readxl") library(dplyr) library(readxl) library(writexl) library(shiny) library(htmlwidgets) data_1<- read.csv(".file.csv") print(data_1) library(formattable) Sys.setenv("MAPBOX_TOKEN" = Mapbox_Token) # for Orca ui <- fluidPage( plotlyOutput(outputId = "Plot"), DT::dataTableOutput('click') ) server <- function(input, output,session) { output$Plot <- renderPlotly({ df=read.csv("file2.csv") render_value(data_1) fig <- df%>% plot_mapbox(lat = ~lat, lon = ~lng,split = ~Country, size=0, type= 'scattermapbox',mode='markers',hoverinfo="none",showlegend=F,source='subset' ) fig <- fig %>% layout(title = 'No Of Companies',font= list(color='white'),plot_bgcolor = '#191A1A', paper_bgcolor = '#191A1A',mapbox = list(style = 'dark'),legend = list(orientation ='v',font = list(size = 6)),margin = list(l = 25, r = 25,b = 75, t = 25,pad = 2)) fig<-fig %>% add_annotations(text ='Map shows number of companies by country. The size of the circles correspond to the number of companies.',x=0.5,y=-0.2,showarrow=FALSE,font=list(color='red')) fig<- fig %>% add_markers(text = ~paste(paste('Country:',Country), paste("Number of Companies:",Name ), paste("Dataset:", Url),sep = " <br />"), size=~Name, hoverinfo = "text",marker=list(sizeref=0.1, sizemode="area"),showlegend=T)%>% onRender(fig, "function(el) {el.on('plotly_click', function(d) {var url = d.points[0].customdata;window.open(url);});}") fig <- fig %>% config(mapboxAccessToken = Sys.getenv("MAPBOX_TOKEN")) }) render_value=function(df){ output$click <- renderDataTable({ s <- event_data("plotly_click",source = "subset") print(s$y) return(DT::datatable(data_1[data_1$Country==s$y,])) }) } } shinyApp(ui,server) ```
2020/08/09
[ "https://Stackoverflow.com/questions/63324647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13017372/" ]
Try running the command `flutter pub get -v`. It shows the log and can even solve the problem.
Run the following command: ``` flutter pub global activate devtools ``` Then try to get the packages again. I hope this helps fix the issue
974,835
``` =IF(ISBLANK(CM7),"",IF(CN7=F7>1,-1, IF(CN7=F7>-1,1, IF(CN7=F7,0)))) ``` What I want to say is that if cell `CM7` is blank, then leave the cell where the calculation takes place blank. Otherwise, if `CN7 > F7`, enter `1`. If `CN7 = F7` type `0`. If `CN7 < F7` enter `-1` Whatever I enter in `CM7` at present, it always gives the answer of `-1`. How can I fix this?
2015/09/18
[ "https://superuser.com/questions/974835", "https://superuser.com", "https://superuser.com/users/498912/" ]
Since you're using EFI with an encrypted /boot, I'm assuming you're already familiar with `grub-mkstandalone` Add in `/etc/default/grub` : ``` GRUB_TERMINAL_INPUT=at_keyboard ``` Add in `/etc/grub.d/40_custom` : ``` insmod keylayouts keymap /boot/grub/de.gkb ``` Next run `grub-kbdcomp -o /tmp/de.gkb de` to generate the german grub layout. Now all you need to do is add `"boot/grub/de.gkb=/tmp/de.gkb"` to your `grub-mkstandalone` command. In my case it looks like this: ``` grub-mkstandalone -d /usr/lib/grub/x86_64-efi/ -O x86_64-efi --compress="xz" --modules="part_gpt part_msdos crypto cryptodisk luks disk diskfilter lvm" --fonts="unicode" -o "/boot/efi/EFI/linux/grubx64.efi" "boot/grub/grub.cfg=/tmp/grub.cfg" "boot/grub/de.gkb=/tmp/de.gkb" ```
It cannot be done, see [this Introduction to Grub2](https://www.suse.com/documentation/opensuse113/book_opensuse_reference/data/sec_grub_basic.html) which states explicitly: > > Important: Keyboard Layout during the Boot Procedure > > > The US keyboard layout is the only one available when booting > > >
3,106,234
WTS: For two metric spaces $X,Y$ If $f:X \rightarrow Y$ is continuous then for every open set $U\subset Y$, $f^{-1}(U)$ is open. May someone please verify if this proof is correct? > > Proof: Assume $f$ is continuous. Let $U$ be an open set in $Y$. Let > $x\in f^{-1}(U)$. Since $U$ is open, there exists an $\epsilon>0$ such > that $N\_{\epsilon}(f(x)) \subset U$. Since the function is continuous, > $\exists \delta >0$ such that whenever $p\in f^{-1}(U)$ and $p\in > N\_{\delta}(x)$ then $f(p)\in N\_{\epsilon}(f(x))$. Since $f(p)\in > N\_{\epsilon}(f(x))$ then $p\in f^{-1}(U)$ and so $N\_{\delta}(x) > \subset U$. > > > The question I have is that I think the proof is correct, but I don't see why the $p$ cannot be in the intersection of the $N\_{\delta}(x) $. and $f^{-1}(U)$. May someone please clarify and tell me what I should do to improve the proof? Please?
2019/02/09
[ "https://math.stackexchange.com/questions/3106234", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
The procedure is exactly the same as for square matrices. I'll do a simpler example for the nullspace, see if you can apply the idea to your case. Let's try to find the nullspace for $$ A=\begin{bmatrix}1&2&3&4\\1&1&1&4\\0&1&2&3\end{bmatrix}. $$ Do Gaussian Elimination to find the reduced row echelon form, $\operatorname{rref} A$. You should get $$\operatorname{rref}A=\begin{bmatrix}1&0&-1&-2\\0&1&2&3\\0&0&0&0\end{bmatrix}.$$ Now, put this in the form of equations. Say you have variables $w,x,y,z$, then $Ax=0$ (which is of course the system we want to consider since we're finding the nullspace of $A$) gives you the system $$\begin{cases}w=y+2z;\\x=-2y-3z.\end{cases}$$ Therefore, the vectors $x$ satisfying $Ax=0$ are exactly those of the form $$\begin{bmatrix}y+2z\\-2y-3z\\y\\z\end{bmatrix}=y\begin{bmatrix}1\\-2\\1\\0\end{bmatrix}+z\begin{bmatrix}2\\-3\\0\\1\end{bmatrix}.$$ But this tells you that the set $$\left\{\begin{bmatrix}1\\-2\\1\\0\end{bmatrix},\begin{bmatrix}2\\-3\\0\\1\end{bmatrix}\right\}$$ is a basis for the nullspace of $A$! We are done. Do the same steps with the different example in your case to get the desired solution.
The null space is the set of vectors $v$, such that $f\_A(v) = 0$. This means that you need to solve $Av = [0, 0, 0, 0]^T$. This amounts to Gaussian elimination. In this case, the echelon form of A is $$ A=\left(\begin{array}{rrrrr} 1 & 0 & -1 & 0 & 2 \\ 0 & 1 & 4 & 0 & -3 \\ 0 & 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 & 0 \end{array}\right) $$ Let $v = [v\_1, v\_2, v\_3, v\_4, v\_5]^T$. Solving $Av = 0$ means that $$ \begin{cases} v\_1 - v\_3 + 2v\_5 = 0\\ v\_2 + 4v\_3 -3v\_5 = 0\\ v\_4 + v\_5 = 0 \end{cases} $$ If $Av = 0$, that means that $$ v = [v\_3 - 2v\_5, -4v\_3 + 3v\_5, v\_3, -v\_5, v\_5]^T = v\_3\cdot[1,-4,1,0,0]^T + v\_5\cdot[-2,3,0,-1,1]^T $$ The two vectors are the basis of the null space.
64,323,360
I am trying to create Azure AD provisioning for our Saas product (using scim2). I want multiple customers to be able to connect with their Azure AD tenant. Microsoft has reference code here: <https://github.com/AzureAD/SCIMReferenceCode> However, that is setup to only allow one tenant and also to not use the "secret token" that you set up in azure ad. Even tho the comment specifically states the secret token should not be left empty for production. Here is the important piece of code from the reference project ``` // Leave the optional Secret Token field blank // Azure AD includes an OAuth bearer token issued from Azure AD with each request // The following code validates the Azure AD-issued token // NOTE: It's not recommended to leave this field blank and rely on a token generated by Azure AD. // This option is primarily available for testing purposes. services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { options.Authority = this.configuration["Token:TokenIssuer"]; options.Audience = this.configuration["Token:TokenAudience"]; options.Events = new JwtBearerEvents { OnTokenValidated = context => { // NOTE: You can optionally take action when the OAuth 2.0 bearer token was validated. return Task.CompletedTask; }, OnAuthenticationFailed = AuthenticationFailed }; }); ``` With that code it works assuming Token:TokenIssuer setting is <https://sts.windows.net/><tenant\_id>/ where tenant\_id is the actual tenant id and TokenAudience is 8adf8e6e-67b2-4cf2-a259-e3dc5476c621 (non gallery app). But it only works if I leave the "Secret token" empty when I set it up in azure ad (non gallery app under Entrprise applications). I have tried all sorts of things, adding OnChallenge tells me a challenge is sent if I set the "Secret token" but beyond that I am not getting much further. Any sample code for handling multiple tenants and secret tokens here would be amazing **Update:** Using options.TokenValidationParameters.IssuerValidator I can validate the issuer and thus make that work with multiple tenants. What I really can't get past right now is making a call work when I enter a "Secret token" here: (see picture) [![enter image description here](https://i.stack.imgur.com/6WsMU.png)](https://i.stack.imgur.com/6WsMU.png)
2020/10/12
[ "https://Stackoverflow.com/questions/64323360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/700320/" ]
So I figured out that what they want is a JWT token in that field that I generate. So first I created a method that generates a web token ``` private string GenerateJSONWebToken() { // Create token key SymmetricSecurityKey securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(configuration["Token:TokenSigningKey"])); SigningCredentials credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256); // Set token expiration DateTime startTime = DateTime.UtcNow; DateTime expiryTime = startTime.AddMinutes(120); // Generate the token JwtSecurityToken token = new JwtSecurityToken( configuration["Token:TokenIssuer"], configuration["Token:TokenAudience"], null, notBefore: startTime, expires: expiryTime, signingCredentials: credentials); string result = new JwtSecurityTokenHandler().WriteToken(token); return result; } ``` In my appsettings.json I added ``` { "Logging": { ... }, "Token": { "TokenAudience": "xxx-xxx-xxx-xxx", "TokenIssuer": "https://sts.windows.net/yyyy-yyyy-yyyy/", "TokenSigningKey": "zzz" } } ``` 1. Token Audience I set to 8adf8e6e-67b2-4cf2-a259-e3dc5476c621 as can be read about here <https://learn.microsoft.com/en-us/azure/active-directory/app-provisioning/use-scim-to-provision-users-and-groups>. **TL;DR** The audience for the token will be the application template ID for the application in the gallery, the application template ID for all custom apps is 8adf8e6e-67b2-4cf2-a259-e3dc5476c621 3. yyyy part of TokenIssuer is the tenant id of the azure ad tenant 4. zzz from signing key is simply a key of your choosing. Now finally I generated a token containing the values from appsettings.json. I then pasted this key into the "Secret token" field in Azure AD. **Finally, how to make this multi tenant (my next steps)** 1. Remove Token:TokenIssuer from appsettings.json 2. When you call GenerateJSONWebToken send in the client Azure AD tenant ID and use that instead of static value from appsettings.json (Either your client will give you this, or you have it from connecting your app to them) 3. In startup.cs notice I have already implemented IssuerValidator. Update this to validate not against appsettings.json but your data store.
You can visit [Managing user account provisioning for enterprise apps in the Azure portal](https://learn.microsoft.com/en-us/azure/active-directory/app-provisioning/configure-automatic-user-provisioning-portal#finding-your-apps-in-the-portal) know more about the setup: [![enter image description here](https://i.stack.imgur.com/X21D7.png)](https://i.stack.imgur.com/X21D7.png)
29,933,208
Say you have an char array, which holds 8 bytes. How would you convert that char array into an integer? I tried using sscanf - ``` int x; sscanf(char_array, "%d", &x); ``` I'm reading bytes from a binary file, storing them into a char array, and then I'm trying to print out an int value based on an offset value.
2015/04/29
[ "https://Stackoverflow.com/questions/29933208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3370603/" ]
The following converts a 4 byte array (4 chars) into a 32-bit unsigned integer. You should be able to easily extend this to 8 chars (i.e., 64-bit unsigned int). Iterate array backwards (can do forwards as well) and shift the int representation of the respective character accordingly and fit it into the resultant value. ``` #include <iostream> #include <cstdint> using namespace std; int main() { char arr[] = {0x00, 0x00, 0x1B, 0x1B}; // just for my testing convenience uint32_t val = 0; for (int i = 3; i >= 0; i--) { uint32_t tmp = arr[i]; int j = 4 - i; while (--j) { tmp <<= 8; } val |= tmp; } cout << val << endl; } ```
I generally thought you have to store as a char first, then you cast to int during the println().
29,933,208
Say you have an char array, which holds 8 bytes. How would you convert that char array into an integer? I tried using sscanf - ``` int x; sscanf(char_array, "%d", &x); ``` I'm reading bytes from a binary file, storing them into a char array, and then I'm trying to print out an int value based on an offset value.
2015/04/29
[ "https://Stackoverflow.com/questions/29933208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3370603/" ]
I think you just want to read hexadecimal numbers which are usually 8 bytes in text form. You can use this: ``` sscanf(char_array, "%x", &x); ``` If it's really binary, it would be 4 bytes each and it depends if the machine is little-endian or big-endian. Most computers are little-endian. To make a portable version, you can use these functions: ``` #ifdef BIG_ENDIAN #define memcpy_set(buf,v) memcpy(buf, &v, 4) #else #define memcpy_set(buf,v) { for (int i = 0; i < 4; i++) buf[i] = v >> (24 - 8 * i); } #endif #define memcpy_get(buf) (buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]) int main() { if (sizeof(int) != 4) return 0; char buf[5]; memset(buf, 0, 5); memcpy_set(buf, 0x41424344); printf("%s\n", buf);// buf = "ABCD" printf("%x\n", memcpy_get(buf)); //0x41424344 return 0; } ```
I generally thought you have to store as a char first, then you cast to int during the println().
29,933,208
Say you have an char array, which holds 8 bytes. How would you convert that char array into an integer? I tried using sscanf - ``` int x; sscanf(char_array, "%d", &x); ``` I'm reading bytes from a binary file, storing them into a char array, and then I'm trying to print out an int value based on an offset value.
2015/04/29
[ "https://Stackoverflow.com/questions/29933208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3370603/" ]
The following converts a 4 byte array (4 chars) into a 32-bit unsigned integer. You should be able to easily extend this to 8 chars (i.e., 64-bit unsigned int). Iterate array backwards (can do forwards as well) and shift the int representation of the respective character accordingly and fit it into the resultant value. ``` #include <iostream> #include <cstdint> using namespace std; int main() { char arr[] = {0x00, 0x00, 0x1B, 0x1B}; // just for my testing convenience uint32_t val = 0; for (int i = 3; i >= 0; i--) { uint32_t tmp = arr[i]; int j = 4 - i; while (--j) { tmp <<= 8; } val |= tmp; } cout << val << endl; } ```
Is it really char array and not unicode where 2 bytes represent one character? Are you sure result will fit into int? If so, then here is simple solution: ``` int x=0; for (int i=0; i<8; i++) x=x*10 + char_array[i]-'0'; ```
29,933,208
Say you have an char array, which holds 8 bytes. How would you convert that char array into an integer? I tried using sscanf - ``` int x; sscanf(char_array, "%d", &x); ``` I'm reading bytes from a binary file, storing them into a char array, and then I'm trying to print out an int value based on an offset value.
2015/04/29
[ "https://Stackoverflow.com/questions/29933208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3370603/" ]
I think you just want to read hexadecimal numbers which are usually 8 bytes in text form. You can use this: ``` sscanf(char_array, "%x", &x); ``` If it's really binary, it would be 4 bytes each and it depends if the machine is little-endian or big-endian. Most computers are little-endian. To make a portable version, you can use these functions: ``` #ifdef BIG_ENDIAN #define memcpy_set(buf,v) memcpy(buf, &v, 4) #else #define memcpy_set(buf,v) { for (int i = 0; i < 4; i++) buf[i] = v >> (24 - 8 * i); } #endif #define memcpy_get(buf) (buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]) int main() { if (sizeof(int) != 4) return 0; char buf[5]; memset(buf, 0, 5); memcpy_set(buf, 0x41424344); printf("%s\n", buf);// buf = "ABCD" printf("%x\n", memcpy_get(buf)); //0x41424344 return 0; } ```
If you are reading bytes from a binary file, I suggest to read directly from the file to the integer variable. As followed: ``` #include <stdio.h> int main() { FILE *file = fopen("myFile", "r"); int i; if (file) { fread(&i, sizeof(i), 1, file); printf("%d\n", i); fclose(file); } return (0); } ``` But if you cannot get rid of your char array as a source for the conversion, you can use a union to easily perform the conversion: ``` #include <stdio.h> #include <string.h> typedef union u_bytes_to_int_type { int value; char bytes[sizeof(int)]; } u_bytes_to_int_type; void reverseArray(char *array, unsigned int const size) { char tmp; unsigned int reverseIdx; for (unsigned int i = 0; i < size / 2; ++i) { reverseIdx = size - 1 - i; tmp = array[i]; array[i] = array[reverseIdx]; array[reverseIdx] = tmp; } } int main() { char endiannessIsDifferent = 0; // It's up to you how you determine the value of this variable. char array[sizeof(int)] = {0x2a, 0, 0, 0}; u_bytes_to_int_type v; memcpy(v.bytes, array, sizeof(array)); /* ** Will reverse the order of the bytes in case the endianness of ** the source array is different from the one you need. */ if (endiannessIsDifferent) { reverseArray(v.bytes, sizeof(v.bytes)); } printf("%i\n", v.value); return (0); } ```
29,933,208
Say you have an char array, which holds 8 bytes. How would you convert that char array into an integer? I tried using sscanf - ``` int x; sscanf(char_array, "%d", &x); ``` I'm reading bytes from a binary file, storing them into a char array, and then I'm trying to print out an int value based on an offset value.
2015/04/29
[ "https://Stackoverflow.com/questions/29933208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3370603/" ]
I think you just want to read hexadecimal numbers which are usually 8 bytes in text form. You can use this: ``` sscanf(char_array, "%x", &x); ``` If it's really binary, it would be 4 bytes each and it depends if the machine is little-endian or big-endian. Most computers are little-endian. To make a portable version, you can use these functions: ``` #ifdef BIG_ENDIAN #define memcpy_set(buf,v) memcpy(buf, &v, 4) #else #define memcpy_set(buf,v) { for (int i = 0; i < 4; i++) buf[i] = v >> (24 - 8 * i); } #endif #define memcpy_get(buf) (buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]) int main() { if (sizeof(int) != 4) return 0; char buf[5]; memset(buf, 0, 5); memcpy_set(buf, 0x41424344); printf("%s\n", buf);// buf = "ABCD" printf("%x\n", memcpy_get(buf)); //0x41424344 return 0; } ```
Is it really char array and not unicode where 2 bytes represent one character? Are you sure result will fit into int? If so, then here is simple solution: ``` int x=0; for (int i=0; i<8; i++) x=x*10 + char_array[i]-'0'; ```
29,933,208
Say you have an char array, which holds 8 bytes. How would you convert that char array into an integer? I tried using sscanf - ``` int x; sscanf(char_array, "%d", &x); ``` I'm reading bytes from a binary file, storing them into a char array, and then I'm trying to print out an int value based on an offset value.
2015/04/29
[ "https://Stackoverflow.com/questions/29933208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3370603/" ]
Is it really char array and not unicode where 2 bytes represent one character? Are you sure result will fit into int? If so, then here is simple solution: ``` int x=0; for (int i=0; i<8; i++) x=x*10 + char_array[i]-'0'; ```
I generally thought you have to store as a char first, then you cast to int during the println().
29,933,208
Say you have an char array, which holds 8 bytes. How would you convert that char array into an integer? I tried using sscanf - ``` int x; sscanf(char_array, "%d", &x); ``` I'm reading bytes from a binary file, storing them into a char array, and then I'm trying to print out an int value based on an offset value.
2015/04/29
[ "https://Stackoverflow.com/questions/29933208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3370603/" ]
Combining 8 char into an integer would result in a 64-bit integer, so you may need to declare it as `unsigned long long int`... ``` #include <stdio.h> void showBinary(unsigned long long x) { int i; for(i = 63; i >= 0; i--) printf("%d", x & (1ULL << i) ? 1 : 0); printf("\n"); } int main(void) { char c[8] = {1, 2, 3, 4, 'a', 'b', 'c', 'd'}; unsigned long long int x = 0; int char_i; for (char_i = 0; char_i < 8; char_i++) { x = (x << 8) | c[char_i]; showBinary(x); } printf("Result: x = %lld\n", x); return 0; } ``` ps. When you read bytes from file, you may need to be careful about the big-endian or little-endian representation.
Is it really char array and not unicode where 2 bytes represent one character? Are you sure result will fit into int? If so, then here is simple solution: ``` int x=0; for (int i=0; i<8; i++) x=x*10 + char_array[i]-'0'; ```
29,933,208
Say you have an char array, which holds 8 bytes. How would you convert that char array into an integer? I tried using sscanf - ``` int x; sscanf(char_array, "%d", &x); ``` I'm reading bytes from a binary file, storing them into a char array, and then I'm trying to print out an int value based on an offset value.
2015/04/29
[ "https://Stackoverflow.com/questions/29933208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3370603/" ]
Combining 8 char into an integer would result in a 64-bit integer, so you may need to declare it as `unsigned long long int`... ``` #include <stdio.h> void showBinary(unsigned long long x) { int i; for(i = 63; i >= 0; i--) printf("%d", x & (1ULL << i) ? 1 : 0); printf("\n"); } int main(void) { char c[8] = {1, 2, 3, 4, 'a', 'b', 'c', 'd'}; unsigned long long int x = 0; int char_i; for (char_i = 0; char_i < 8; char_i++) { x = (x << 8) | c[char_i]; showBinary(x); } printf("Result: x = %lld\n", x); return 0; } ``` ps. When you read bytes from file, you may need to be careful about the big-endian or little-endian representation.
I generally thought you have to store as a char first, then you cast to int during the println().
29,933,208
Say you have an char array, which holds 8 bytes. How would you convert that char array into an integer? I tried using sscanf - ``` int x; sscanf(char_array, "%d", &x); ``` I'm reading bytes from a binary file, storing them into a char array, and then I'm trying to print out an int value based on an offset value.
2015/04/29
[ "https://Stackoverflow.com/questions/29933208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3370603/" ]
The following converts a 4 byte array (4 chars) into a 32-bit unsigned integer. You should be able to easily extend this to 8 chars (i.e., 64-bit unsigned int). Iterate array backwards (can do forwards as well) and shift the int representation of the respective character accordingly and fit it into the resultant value. ``` #include <iostream> #include <cstdint> using namespace std; int main() { char arr[] = {0x00, 0x00, 0x1B, 0x1B}; // just for my testing convenience uint32_t val = 0; for (int i = 3; i >= 0; i--) { uint32_t tmp = arr[i]; int j = 4 - i; while (--j) { tmp <<= 8; } val |= tmp; } cout << val << endl; } ```
If you are reading bytes from a binary file, I suggest to read directly from the file to the integer variable. As followed: ``` #include <stdio.h> int main() { FILE *file = fopen("myFile", "r"); int i; if (file) { fread(&i, sizeof(i), 1, file); printf("%d\n", i); fclose(file); } return (0); } ``` But if you cannot get rid of your char array as a source for the conversion, you can use a union to easily perform the conversion: ``` #include <stdio.h> #include <string.h> typedef union u_bytes_to_int_type { int value; char bytes[sizeof(int)]; } u_bytes_to_int_type; void reverseArray(char *array, unsigned int const size) { char tmp; unsigned int reverseIdx; for (unsigned int i = 0; i < size / 2; ++i) { reverseIdx = size - 1 - i; tmp = array[i]; array[i] = array[reverseIdx]; array[reverseIdx] = tmp; } } int main() { char endiannessIsDifferent = 0; // It's up to you how you determine the value of this variable. char array[sizeof(int)] = {0x2a, 0, 0, 0}; u_bytes_to_int_type v; memcpy(v.bytes, array, sizeof(array)); /* ** Will reverse the order of the bytes in case the endianness of ** the source array is different from the one you need. */ if (endiannessIsDifferent) { reverseArray(v.bytes, sizeof(v.bytes)); } printf("%i\n", v.value); return (0); } ```
29,933,208
Say you have an char array, which holds 8 bytes. How would you convert that char array into an integer? I tried using sscanf - ``` int x; sscanf(char_array, "%d", &x); ``` I'm reading bytes from a binary file, storing them into a char array, and then I'm trying to print out an int value based on an offset value.
2015/04/29
[ "https://Stackoverflow.com/questions/29933208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3370603/" ]
If you are reading bytes from a binary file, I suggest to read directly from the file to the integer variable. As followed: ``` #include <stdio.h> int main() { FILE *file = fopen("myFile", "r"); int i; if (file) { fread(&i, sizeof(i), 1, file); printf("%d\n", i); fclose(file); } return (0); } ``` But if you cannot get rid of your char array as a source for the conversion, you can use a union to easily perform the conversion: ``` #include <stdio.h> #include <string.h> typedef union u_bytes_to_int_type { int value; char bytes[sizeof(int)]; } u_bytes_to_int_type; void reverseArray(char *array, unsigned int const size) { char tmp; unsigned int reverseIdx; for (unsigned int i = 0; i < size / 2; ++i) { reverseIdx = size - 1 - i; tmp = array[i]; array[i] = array[reverseIdx]; array[reverseIdx] = tmp; } } int main() { char endiannessIsDifferent = 0; // It's up to you how you determine the value of this variable. char array[sizeof(int)] = {0x2a, 0, 0, 0}; u_bytes_to_int_type v; memcpy(v.bytes, array, sizeof(array)); /* ** Will reverse the order of the bytes in case the endianness of ** the source array is different from the one you need. */ if (endiannessIsDifferent) { reverseArray(v.bytes, sizeof(v.bytes)); } printf("%i\n", v.value); return (0); } ```
I generally thought you have to store as a char first, then you cast to int during the println().
56,380,055
I've got 2 columns in a table, Financial\_Year and Financial\_Quarter. An example of the data is as follows: ``` Financial_Year Financial_Quarter 2018/2019 2 ``` I want to produce a third column called 'Year\_month' which is the last month of the quarter within each financial year, so in the above example I want the year\_month column to read 201809. Has anyone got any hints how to do this in Oracle SQL?
2019/05/30
[ "https://Stackoverflow.com/questions/56380055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8461548/" ]
Assuming the FINANCIAL\_YEAR column is a string (two numbers separated by slash) and the financial year 2018/2019 begins on 1 April 2018 and ends on 31 March 2019, you could do something like this: ``` with test_data (financial_year, financial_quarter) as ( select '2018/2019', 1 from dual union all select '2018/2019', 2 from dual union all select '2018/2019', 3 from dual union all select '2018/2019', 4 from dual ) select financial_year, financial_quarter, to_char(add_months(to_date(substr(financial_year, 1, 4) || '03', 'yyyymm'), 3 * financial_quarter), 'yyyymm') as year_month from test_data ; FINANCIAL_YEAR FINANCIAL_QUARTER YEAR_MONTH -------------- ----------------- ---------- 2018/2019 1 201806 2018/2019 2 201809 2018/2019 3 201812 2018/2019 4 201903 ``` Also, just for fun, here is a different solution that doesn't use any date computations - it's all string based. ``` select financial_year, financial_quarter, substr(financial_year, decode(financial_quarter, 4, 6, 1), 4) || decode(financial_quarter, 1, '06', 2, '09', 3, '12', 4, '03') as year_month from test_data ; ```
I guess there are many ways to skin this cat, here is one ``` SELECT CASE WHEN financial_quarter = '4' THEN SUBSTR(financial_year, 6, 4) || '03' ELSE SUBSTR(financial_year, 1, 4) || LPAD((financial_quarter + 1) * 3, 2, '0') END FROM some_table ``` Of course '4' needs to be replaced with 4 if `financial_quarter` is numeric
25,357,181
I have a program which computes perimeter, circumference, an area of different shapes like, square, circle, rectangle and soon. Any help with enabling the radiobutton to display an edittext to write the measurements.
2014/08/18
[ "https://Stackoverflow.com/questions/25357181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3888060/" ]
check below code don't use as it is, its just reference inyourxml.xml ``` <RadioGroup android:id="@+id/groupRadio" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/app_big_margin" android:layout_marginRight="@dimen/app_normal_margin" android:gravity="center" android:minHeight="30dp" android:orientation="horizontal" > <RadioButton android:id="@+id/circumferenceRadio" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/tab_selector_background" android:button="@null" android:checked="true" android:gravity="center" android:text="@string/choice_yes" android:textColor="@drawable/tab_selector_text" /> <RadioButton android:id="@+id/perimeterRadio" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/tab_selector_background" android:button="@null" android:checked="false" android:gravity="center" android:text="@string/choice_no" android:textColor="@drawable/tab_selector_text" /> </RadioGroup> <EditText android:id="@+id/perimeterEditText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/app_normal_margin" android:layout_marginRight="@dimen/app_normal_margin" android:background="@drawable/action_bar_background" android:inputType="textPassword" /> <EditText android:id="@+id/circumferenceEditText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/app_normal_margin" android:layout_marginRight="@dimen/app_normal_margin" android:background="@drawable/action_bar_background" android:inputType="textEmailAddress" /> ``` inyourjava.java ``` RadioGroup groupRadio=(RadioGroup)rootView.findViewById(R.id.groupRadio); EditText perimeterEditText=(EditText)rootView.findViewById(R.id.perimeterEditText); EditText circumferenceEditText=(EditText)rootView.findViewById(R.id.circumferenceEditText); groupRadio.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if(checkedId==R.id.circumferenceRadio) { circumferenceEditText.setVisibility(View.VISIBLE); perimeterEditText.setVisibility(View.INVISIBLE); } else if(checkedId==R.id.perimeterRadio) { perimeterEditText.setVisibility(View.VISIBLE); circumferenceEditText.setVisibility(View.INVISIBLE); } } }); ```
[Hide a EditText & make it visible by clicking a menu](https://stackoverflow.com/questions/4622517/hide-a-edittext-make-it-visible-by-clicking-a-menu) in case of menu ... you can declare setvisibility in xml and make it hide... then programatically make it visible...hope this helps
6,802,112
I run out of memory while finding the 10,001th prime number. ``` object Euler0007 { def from(n: Int): Stream[Int] = n #:: from(n + 1) def sieve(s: Stream[Int]): Stream[Int] = s.head #:: sieve(s.filter(_ % s.head != 0)) def primes = sieve(from(2)) def main(args: Array[String]): Unit = { println(primes(10001)) } } ``` Is this because after each "iteration" (is this the correct term in this context?) of `primes`, I increase the stack of functions to be called to get the next element by one? One solution that I've found on the web which doesn't resort to an iterative solution (which I'd like to avoid to get into functional programming/idiomatic scala) is [this](http://pavelfatin.com/scala-for-project-euler/) (Problem 7): ``` lazy val ps: Stream[Int] = 2 #:: Stream.from(3).filter(i => ps.takeWhile(j => j * j <= i).forall(i % _ > 0)) ``` From what I can see, this does not lead to this recursion-like way. Is this a good way to do it, or do you know of a better way?
2011/07/23
[ "https://Stackoverflow.com/questions/6802112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383124/" ]
One reason why this is slow is that it **isn't** the sieve of Eratosthenes. Read <http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf> for a detailled explanation (the examples are in Haskell, but can be translated directly into Scala). My old solution for Euler problem #7 wasn't the "true" sieve either, but it seems to work good enough for little numbers: ``` object Sieve { val primes = 2 #:: sieve(3) def sieve(n: Int) : Stream[Int] = if (primes.takeWhile(p => p*p <= n).exists(n % _ == 0)) sieve(n + 2) else n #:: sieve(n + 2) def main(args: Array[String]) { println(primes(10000)) //note that indexes are zero-based } } ``` I think the problem with your first version is that you have only `def`s and no `val` which collects the results and can be consulted by the generating function, so you always recalculate from scratch.
FWIW, here's a real Sieve of Eratosthenes: ``` def sieve(n: Int) = (2 to math.sqrt(n).toInt).foldLeft((2 to n).toSet) { (ps, x) => if (ps(x)) ps -- (x * x to n by x) else ps } ``` Here's an infinite stream of primes using a variation on the Sieve of Eratosthenes that preserves its fundamental properties: ``` case class Cross(next: Int, incr: Int) def adjustCrosses(crosses: List[Cross], current: Int) = { crosses map { case cross @ Cross(`current`, incr) => cross copy (next = current + incr) case unchangedCross => unchangedCross } } def notPrime(crosses: List[Cross], current: Int) = crosses exists (_.next == current) def sieve(s: Stream[Int], crosses: List[Cross]): Stream[Int] = { val current #:: rest = s if (notPrime(crosses, current)) sieve(rest, adjustCrosses(crosses, current)) else current #:: sieve(rest, Cross(current * current, current) :: crosses) } def primes = sieve(Stream from 2, Nil) ``` This is somewhat difficult to use, however, since each element of the `Stream` is composed using the `crosses` list, which has as many numbers as there have been primes up to a number, and it seems that, for some reason, these lists are being kept in memory for each number in the `Stream`. For example, prompted by a comment, `primes take 6000 contains 56993` would throw a GC exception whereas `primes drop 5000 take 1000 contains 56993` would return a result rather fast on my tests.
6,802,112
I run out of memory while finding the 10,001th prime number. ``` object Euler0007 { def from(n: Int): Stream[Int] = n #:: from(n + 1) def sieve(s: Stream[Int]): Stream[Int] = s.head #:: sieve(s.filter(_ % s.head != 0)) def primes = sieve(from(2)) def main(args: Array[String]): Unit = { println(primes(10001)) } } ``` Is this because after each "iteration" (is this the correct term in this context?) of `primes`, I increase the stack of functions to be called to get the next element by one? One solution that I've found on the web which doesn't resort to an iterative solution (which I'd like to avoid to get into functional programming/idiomatic scala) is [this](http://pavelfatin.com/scala-for-project-euler/) (Problem 7): ``` lazy val ps: Stream[Int] = 2 #:: Stream.from(3).filter(i => ps.takeWhile(j => j * j <= i).forall(i % _ > 0)) ``` From what I can see, this does not lead to this recursion-like way. Is this a good way to do it, or do you know of a better way?
2011/07/23
[ "https://Stackoverflow.com/questions/6802112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383124/" ]
One reason why this is slow is that it **isn't** the sieve of Eratosthenes. Read <http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf> for a detailled explanation (the examples are in Haskell, but can be translated directly into Scala). My old solution for Euler problem #7 wasn't the "true" sieve either, but it seems to work good enough for little numbers: ``` object Sieve { val primes = 2 #:: sieve(3) def sieve(n: Int) : Stream[Int] = if (primes.takeWhile(p => p*p <= n).exists(n % _ == 0)) sieve(n + 2) else n #:: sieve(n + 2) def main(args: Array[String]) { println(primes(10000)) //note that indexes are zero-based } } ``` I think the problem with your first version is that you have only `def`s and no `val` which collects the results and can be consulted by the generating function, so you always recalculate from scratch.
***Yes, it is*** because you "increase the stack of functions to be called to get the next element, by one after *each "iteration"* " - i.e. add a new filter on top of stack of filters each time after getting each prime. That's **way too many filters**. This means that each produced prime gets tested by all its preceding primes - but only those below its square root are really needed. For instance, to get the 10001-th prime, `104743`, **there will be 10000 filters created**, at run-time. But there are just 66 primes below `323`, the square root of `104743`, so **only 66 filters were really needed**. All the 9934 others will be there needlessly, taking up memory, hard at work producing absolutely no added value. ***This*** is the key deficiency of that "functional sieve", which seems to have originated in the 1970s code by David Turner, and later have found its way into [the SICP book](http://mitpress.mit.edu/sicp/full-text/sicp/book/node71.html) and other places. It is ***not*** that it's a *trial division* sieve (rather than *the sieve of Eratosthenes*). That's ***far too remote*** a concern for it. Trial division, when optimally implemented, is perfectly capable of producing the 10000th prime very fast. **The key deficiency of that code is that it does not postpone the creation of filters to the right moment, and ends up creating far too many of them.** Talking complexities now, the "old sieve" code is *O(n2)*, *in `n` primes produced*. The optimal trial division is *O(n1.5/log0.5(n))*, and the sieve of Eratosthenes is *O(n\*log(n)\*log(log(n)))*. As [*empirical orders of growth*](http://en.wikipedia.org/wiki/Analysis_of_algorithms#Empirical_orders_of_growth) the first is seen typically as `~ n^2`, the second as `~ n^1.45` and the third `~ n^1.2`. You can find Python generators-based code for optimal trial division implemented [in this answer (2nd half of it)](https://stackoverflow.com/questions/14648095/merge-of-lazy-streams-using-generators-in-python/14648519#14648519). It was [originally discussed here](https://stackoverflow.com/questions/1764163/help-explain-this-chunk-of-haskell-code-that-outputs-a-stream-of-primes/8871918#8871918) dealing with the Haskell equivalent of your sieve function. --- Just as an illustration, a ["readable pseudocode"](http://www.haskell.org/haskellwiki/Introduction#Quicksort_in_Haskell) :) for the old sieve is ```hs primes = sieve [2..] where sieve (x:xs) = x : sieve [ y | y <- xs, rem y x > 0 ] -- list of 'y's, drawn from 'xs', -- such that (y % x > 0) ``` and for optimal trial division (TD) sieve, synchronized on primes' squares, ```hs primes = sieve [2..] primes where sieve (x:xs) ps = x : (h ++ sieve [ y | y <- t, rem y p > 0 ] qs) where (p:qs) = ps -- 'p' is head elt in 'ps', and 'qs' the rest (h,t) = span (< p*p) xs -- 'h' are elts below p^2 in 'xs' -- and 't' are the rest ``` and for [a sieve of Eratosthenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes), [devised by Richard Bird](http://www.haskell.org/haskellwiki/Prime_numbers#Linear_merging), as seen in that JFP article mentioned in another answer here, ```hs primes = 2 : minus [3..] (foldr (\p r-> p*p : union [p*p+p, p*p+2*p..] r) [] primes) -- function of 'p' and 'r', that returns -- a list with p^2 as its head elt, ... ``` Short *and* fast. ([`minus a b`](http://en.wikipedia.org/wiki/Haskell_features#Prime_numbers) is a list `a` with all the elts of `b` progressively removed from it; [`union a b`](http://en.wikipedia.org/wiki/Haskell_features#Hamming_numbers) is a list `a` with all the elts of `b` progressively added to it without duplicates; both dealing with ordered, *non-decreasing* lists). `foldr` is [the right fold](http://en.wikipedia.org/wiki/Fold_(higher-order_function)) of a list. Because it is linear this runs at `~ n^1.33`, to make it run at `~ n^1.2` the [tree-like folding](http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29#Linear_vs._tree-like_folds) function [`foldi`](http://en.wikipedia.org/wiki/Fold_(higher-order_function)#Tree-like_folds) can be used). --- The answer to your second question is also a ***yes***. Your second code, re-written in same "pseudocode", ```hs ps = 2 : [i | i <- [3..], all ((> 0).rem i) (takeWhile ((<= i).(^2)) ps)] ``` is very similar to the optimal TD sieve above - both arrange for each candidate to be tested by all primes below its square root. While the sieve arranges that with a run-time sequence of postponed filters, the latter definition re-fetches the needed primes anew for each candidate. One might be faster than another depending on a compiler, but both are essentially the same. And the third is also a ***yes***: the sieve of Eratosthenes is better, ```hs ps = 2 : 3 : minus [5,7..] (unionAll [[p*p, p*p+2*p..] | p <- drop 1 ps]) unionAll = foldi union' [] -- one possible implementation union' (x:xs) ys = x : union xs ys -- unconditionally produce first elt of the 1st arg -- to avoid run-away access to infinite lists ``` It looks like it can be implemented in Scala too, judging by the similarity of other code snippets. (Though I don't know Scala). `unionAll` here implements tree-like folding structure [(click for a picture and full code)](https://stackoverflow.com/questions/12559788/parallel-algorithms-for-generating-prime-numbers-possibly-using-hadoops-map-re/12563800#12563800) but could also be implemented with a sliding array, working segment by segment along the streams of primes' multiples. ***TL;DR:*** yes, yes, and yes.
73,208,689
When running the flutter build apk command, I am getting the following error: Pubspec.yaml [![enter image description here](https://i.stack.imgur.com/8MkAR.png)](https://i.stack.imgur.com/8MkAR.png) Error code: [![enter image description here](https://i.stack.imgur.com/Ku70u.png)](https://i.stack.imgur.com/Ku70u.png)
2022/08/02
[ "https://Stackoverflow.com/questions/73208689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18796940/" ]
Open your `pubspec.yaml` search for this: [![Pubspec](https://i.stack.imgur.com/7QHaG.png)](https://i.stack.imgur.com/7QHaG.png) Then change the SDK to: `">=2.17.5 <3.0.0"`
You can write `flutter upgrade` command in terminal to update flutter sdk
35,763,305
How can I make my `$superhero_list` array updates after all the code on the superhero.php is done and I want to search for another name? The problem I find is that after Im done with the superhero.php and go back to superhero.html, it doesnt save the last name on the `$superhero_list` array. **superhero.html** ``` <html> <head> <title>Superhero List</title> </head> <body> <form method="post" action="superhero.php"> <label for="heroname">Check The Super Hero Name:</label> <input type="text" id="heroname" name="heroname"> </form> </body> </html> ``` **superhero.php** ``` <?php $superhero_list = array(); if (in_array($_POST ["heroname"], $superhero_list)) { echo 'Your hero was found.<br>'; echo "These are the Super Powers:<br> - Invisibility <br> - Xray Vision <br> - Flight <br> - Underwater Breathing <br> - Immortality <br> - Healing Power <br> - Mind Reading <br> - Supersmart <br> - Strenght<br>"; } else { echo "Hero was added to the Super Hero List!"; array_push($superhero_list,$_POST ["heroname"]); } echo '<br><br>'; echo 'This your Hero List:<br>'; echo implode("<br>",$superhero_list); ?> ``` Another thing, there is any better way to write this code? With functions or other loops? Thanks in advance guys!
2016/03/03
[ "https://Stackoverflow.com/questions/35763305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6011209/" ]
If you dont want to store in database then you need to store array value in cookie. <http://php.net/manual/en/features.cookies.php> For cookie you can store value until your browser will not close.
To my understanding you want to: * If the hero exists, echo the information about the hero. * If the hero does not exist, add them to the array. And you want to be able to keep track of every single hero that is added to the array, even after the user navigates away and back again. --- When you navigate away from the php file/page, any data within the variables/file/class is lost. You would have to have some method to store the list of heros (Like a database/some other form of storage). With a database, you would have fields for the name/each trait. When the user submits the form and sent to the superhero.php file, you would need to query the database for a list of entries/heros. Then you would be able to check if the hero exists or not. If the hero exists, echo that heros fields/data. If the hero does not exist, insert them into the database. I guess another option would be to save each set of data to a text file. Then you would have to manage reading/writing to the file each time the script is called. However, I wouldn't do it this way...
35,763,305
How can I make my `$superhero_list` array updates after all the code on the superhero.php is done and I want to search for another name? The problem I find is that after Im done with the superhero.php and go back to superhero.html, it doesnt save the last name on the `$superhero_list` array. **superhero.html** ``` <html> <head> <title>Superhero List</title> </head> <body> <form method="post" action="superhero.php"> <label for="heroname">Check The Super Hero Name:</label> <input type="text" id="heroname" name="heroname"> </form> </body> </html> ``` **superhero.php** ``` <?php $superhero_list = array(); if (in_array($_POST ["heroname"], $superhero_list)) { echo 'Your hero was found.<br>'; echo "These are the Super Powers:<br> - Invisibility <br> - Xray Vision <br> - Flight <br> - Underwater Breathing <br> - Immortality <br> - Healing Power <br> - Mind Reading <br> - Supersmart <br> - Strenght<br>"; } else { echo "Hero was added to the Super Hero List!"; array_push($superhero_list,$_POST ["heroname"]); } echo '<br><br>'; echo 'This your Hero List:<br>'; echo implode("<br>",$superhero_list); ?> ``` Another thing, there is any better way to write this code? With functions or other loops? Thanks in advance guys!
2016/03/03
[ "https://Stackoverflow.com/questions/35763305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6011209/" ]
You are resetting the array every time you run the PHP script. You need to save the data so that next time it runs it can pull the data back. You can either do this by building a database to hold all the names, or you can save them to a file. With something this small saving it to a file is probably the easiest and quickest option. To save the data to a file change your php script to ``` <?php $superhero_list = array(); //Load the list from the file $filename = 'heroNames.txt'; //First check if the file exists if (file_exists($filename)) { //If the file exists load the data //First open the file for reading using "r" $myfile = fopen($filename, "r") or die("Unable to open file!"); //Save it into the temp string $tempString = fgets($myfile); //turn that string into an array using ":" as the seperator. We will save using ":" later $superhero_list = explode(":", $tempString); //ALWAYS CLOSE THE FILE!!! fclose($myfile); } //Now the data is either empty since its the first time used or it has all the names of the old superheros if (in_array($_POST ["heroname"], $superhero_list)) { echo 'Your hero was found.<br>'; echo "These are the Super Powers:<br> - Invisibility <br> - Xray Vision <br> - Flight <br> - Underwater Breathing <br> - Immortality <br> - Healing Power <br> - Mind Reading <br> - Supersmart <br> - Strenght<br>"; } else { echo "Hero was added to the Super Hero List!"; array_push($superhero_list,$_POST ["heroname"]); } //Now to save the data. //With PHP if you open a file to write and the file does not exist, it will create the file... SO... //Open the file for writing using "w" $myfile = fopen($filename, "w"); //Convert the superhero array to a string using ":" to separate them $tempString = implode(":", $superhero_list); //Now save that string to the file fwrite($myfile, $tempString); //ALWAYS CLOSE THE FILE fclose($myfile); echo '<br><br>'; echo 'This your Hero List:<br>'; echo implode("<br>",$superhero_list); ?> ```
To my understanding you want to: * If the hero exists, echo the information about the hero. * If the hero does not exist, add them to the array. And you want to be able to keep track of every single hero that is added to the array, even after the user navigates away and back again. --- When you navigate away from the php file/page, any data within the variables/file/class is lost. You would have to have some method to store the list of heros (Like a database/some other form of storage). With a database, you would have fields for the name/each trait. When the user submits the form and sent to the superhero.php file, you would need to query the database for a list of entries/heros. Then you would be able to check if the hero exists or not. If the hero exists, echo that heros fields/data. If the hero does not exist, insert them into the database. I guess another option would be to save each set of data to a text file. Then you would have to manage reading/writing to the file each time the script is called. However, I wouldn't do it this way...
42,270,896
in my Robot framework tests I need some custom python keywords (e.g. to hold CTRL key) And everything worked before I started refactoring my "big" custom class (but I did not really change anything in this part around hold CTRL). Now I am getting `AttributeError: 'Selenium2Library' object has no attribute 'execute'` My code is: ``` class CustomSeleniumLibrary(object): def __init__(self): self.driver = None self.library = None def get_webdriver_instance(self): if self.library is None: self.library = BuiltIn().get_library_instance('Selenium2Library') return self.library def get_action_chain(self): if self.driver is None: self.driver = self.get_webdriver_instance() self.ac = ActionChains(self.driver) return self.ac def hold_ctrl(self): self.get_action_chain().key_down(Keys.LEFT_CONTROL) self.get_action_chain().perform() ``` and I just call "hold ctrl" directly in robot keyword then, the keyword file has my custom class imported as Library (and other custom keywords work)... Any idea why it fails on the "execute" please?
2017/02/16
[ "https://Stackoverflow.com/questions/42270896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5313317/" ]
The problem was in ActionChains, because it needs webdriver instance, not Se2Lib instance. Webdriver instance can be obtained by calling \_current\_browser(). I reworked it this way and it works: ``` def get_library_instance(self): if self.library is None: self.library = BuiltIn().get_library_instance('Selenium2Library') return self.library def get_action_chain(self): if self.ac is None: self.ac = ActionChains(self.get_library_instance()._current_browser()) return self.ac def hold_ctrl(self): actionChain = self.get_action_chain() actionChain.key_down(Keys.LEFT_CONTROL) actionChain.perform() ```
What about something like this: ``` class CustomSeleniumLibrary(Selenium2Library): def __init__(self): super(CustomSeleniumLibrary, self).__init__() def _parent(self): return super(CustomSeleniumLibrary, self) def hold_ctrl(self): ActionChains(self._current_browser()).send_keys(Keys.LEFT_CONTROL).perform() ```
13,784,752
I have a [news site](http://www.vincenttimes.com/living/healthy-living/2012/12/08/12373/e-cigarettes-are-they-harmful-to-our-health/) and have a 300x600 banner in the middle of every post on the left side. I want to move the banner 150px outside the 960px wide "page", so the banner is half in and half out.The only way I have figured out how to move the banner left is `position:absolute`, but the text doesnt wrap around the banner - which is what I need.
2012/12/09
[ "https://Stackoverflow.com/questions/13784752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1699495/" ]
Yes, `position:absolute` doesn't wrap text because you are removing the element from the flow of the [document](http://www.w3.org/wiki/CSS_absolute_and_fixed_positioning). You can margin it out by 150px using `margin-left:-150px` however, your css for the class `.entry` has `overflow:hidden` which will have to be removed in order for you to margin the banner ad outside the 960px post. Just be careful that removing that property doesn't cause other problems with your site.
Try with the property `margin-left:-150px;`
28,103,386
I trying to post form in yii but don't have any idea regarding validation, i go through some yii documentation but not getting it. can't we do validation without form object of yii? means in view i am using normal HTML for form of yii.
2015/01/23
[ "https://Stackoverflow.com/questions/28103386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4168892/" ]
Simulink/Stateflow prefer numeric data. You should use an integer representation of the ASCII value (using a uint8 or uint16 data type), which will make comparison almost trivial.
Matlab does not make a clear distinction between a string with just one char and a char, and as far as I know, it is not possible to use a string type in stateflow. Convert the input to integers then use only comparisons of integers inside the state chart. You can use this function to convert chars to integers in Matlab: ``` function [ integer ] = atoi( char ) %ATOI Ascii To Integer converts char to int % integer = char - '0' + '0' ; %matlab seems a bit lunatic when it comes to chars end ```
24,708
Is there a difference here: > > 1. ***It happened that*** he did not go to work today. > 2. ***As it happened***, he did not go to work today. > > > Do "it happened that" and "as it happened" have different meanings?
2014/06/03
[ "https://ell.stackexchange.com/questions/24708", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/6362/" ]
As stated in the definition, it means *to be in a specified circumstance*; in this case, *he* is in the circumstance of *probably losing ten dollars*. The use of *stand* here means that the loss of money has not occurred yet and is not assured, but is likely to happen, and soon. It's quite possible that he placed a $10 bet on something, but this is not necessarily the reason. For any case where someone is likely to lose ten dollars in the near future it's appropriate to say *they stand to lose ten dollars*.
In its fuller form, it could be said that "he stands **the chance of losing** ten dollars." In most cases it would be assumed that it's the result of a bet that he placed, unless there was contextual information indicating otherwise.
24,708
Is there a difference here: > > 1. ***It happened that*** he did not go to work today. > 2. ***As it happened***, he did not go to work today. > > > Do "it happened that" and "as it happened" have different meanings?
2014/06/03
[ "https://ell.stackexchange.com/questions/24708", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/6362/" ]
There's no "special reason", other than that's the way the phrase can be used. Incidentally, you can *stand to lose* things other than money: > > Mr Forrest [stands to lose](http://www.theaustralian.com.au/archive/news/top-silk-thwarted-in-cattle-showdown/story-e6frg6no-1225704498337) his right to serve as a company director. > > > Now he [stands to lose](http://oheraldo.in/News/Main%20Picture%20News/Faulty-injection-jab-by-GMC-nurse-could-cost-3-week-old-baby-his-arm/56152.html) his right arm, affected by suspected gangrene > > > The phrase *stands to lose* simply means that a loss is imminent. Similarly, *stands to win* (or *stands to gain*) means that there is potential for some benefit, usually in the near future: > > Proview Technology, which currently uses the iPad name on several of its products such as computer monitors, [stands to win](http://www.ibtimes.com/ipad-3-jeopardy-apple-could-lose-16-billion-china-trademark-lawsuit-406914) $1.6 billion and an apology from Apple, the creator of the iPad tablet, for allegedly infringing upon Proview's trademarked name. > > > This benefit need not be monetary: > > With little standing between him and electoral triumph in November, he also [stands to win](http://www.electionprojection.com/2014-elections/races/2014-gubernatorial-races.php) an unprecedented fourth term this year. > > > The phrase is sometimes used in headlines, too, where the exact nature of the potential loss or gain is left unstated: > > How Facebook [stands to gain](http://www.cnet.com/news/how-facebook-stands-to-gain-by-sharing-its-trade-secrets/) by sharing its trade secrets > > > Ukraine cabinet resignation resolution [stands to win](http://voiceofrussia.com/news/2013_12_03/Ukraine-cabinet-resignation-resolution-stands-to-win-enough-votes-deputy-speaker-0611/) enough votes > > > Climate change: [who stands to win and who to lose](http://voiceofrussia.com/radio_broadcast/no_program/265335864/)? > > > Sometimes the exact nature of the win/loss can be determined by reading the article; other times, a term like "stands to win big" is used simply as a way to say "will likely benefit greatly."
In its fuller form, it could be said that "he stands **the chance of losing** ten dollars." In most cases it would be assumed that it's the result of a bet that he placed, unless there was contextual information indicating otherwise.
56,406,188
I am new in the **tidyverse** data manipulation and I am using `gather()` function from the `tidyr` package for changing from wide to long form on my data. I have the following `data` dataframe: ``` id <- 1:10 stim_1_ACC <- 0.5:10 stim_2_ACC <- 10:19 stim_1_RT <- 0.4:10 stim_2_RT <- 15:24 data <- data.frame(id,stim_1_ACC,stim_2_ACC,stim_1_RT,stim_2_RT) ``` I would have one column for `stim` in which I have `stim1` and `stim2` as values, and two columns `ACC` and `RT` as numeric variables. With `gather()` function I can select only one `value` argument and so having doing what I want only for one variable. ``` data %>% gather(key = "Stimuli", value = "ACC", 2:5) ``` I reach my goal with multiple steps, splitting and then binding dataframe columns, but I'm looking for a more tidy approach. Final results would be like this: ``` id stim ACC RT 1 1 stim_1 1.5 900 2 2 stim_1 2.5 901 3 3 stim_1 3.5 902 4 4 stim_1 4.5 903 5 5 stim_1 5.5 904 6 6 stim_2 6.5 905 7 7 stim_2 7.5 906 8 8 stim_2 8.5 907 9 9 stim_2 9.5 908 10 10 stim_2 10.5 909 ``` Thanks!
2019/06/01
[ "https://Stackoverflow.com/questions/56406188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9032257/" ]
Probably , after gathering you'll need to use `extract`/`separate` to separate `"stim.."` and `"RT"/"ACC"` component and then use `spread` ``` library(dplyr) library(tidyr) data %>% gather(key, value, -id) %>% extract(key, into = c("stim", "temp"), regex = "(stim_\\d+)_(.*)") %>% spread(temp, value) ```
Here is an option with `separate` to split the 'key' column into 'stim' and 'temp' by splitting at the '\_' before the character element ``` library(tidyverse) data %>% gather(key, value, -id) %>% separate(key, into = c("stim", "temp"), sep="(_)(?=[A-Z])") %>% spread(temp, value) ```
21,810,112
``` while(cout << "How many elements do you want: " && !(cin >> el)) { cin.sync(); cin.clear(); cout << " Invalid input!\n"; } ``` el is an int, when I typed a character, the loop goes infinite. I followed one of the posts in SO to fix bad input, but it is not working, it goes infinite loop printing "How many elements do you want: Invalid input!" I tried ignore(10000, "\n") as well, but still not working...
2014/02/16
[ "https://Stackoverflow.com/questions/21810112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2720065/" ]
When an error occurs when reading from a stream, an error flag gets set and no more reading is possible until you clear the error flags. > > That's why you get an infinite loop. > > > Instead use : ``` cin.clear(); // clears the error flags // this line discards all the input waiting in the stream cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); ```
Perform `cin.clear()` before `cin.sync()`. It works for me.
4,534,370
The time I used to develop applications on iPhone I was converting String to SHA1 with two combination: * Data * Key Now I am developing an Android application and I did not any example for how to calculate SHA1 With key. I am greatly appreciative of any guidance or help. --- *[The code that I currently use]* ``` private void convertStringToSHA1() { String sTimeStamp = new SimpleDateFormat("MM/dd/yyyy HH:MM:SS").format(new java.util.Date()); String sStringToHash = String.format("%1$s\n%2$s", "Username",sTimeStamp); MessageDigest cript = MessageDigest.getInstance("SHA-1"); cript.reset(); cript.update(sStringToHash.getBytes("utf-8")); sStringToHash = new BigInteger(1, cript.digest()).toString(16); } ```
2010/12/26
[ "https://Stackoverflow.com/questions/4534370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/488434/" ]
Try something like that: ``` private String sha1(String s, String keyString) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException { SecretKeySpec key = new SecretKeySpec((keyString).getBytes("UTF-8"), "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(key); byte[] bytes = mac.doFinal(s.getBytes("UTF-8")); return new String( Base64.encodeBase64(bytes)); } ``` [SecretKeySpec](http://docs.oracle.com/javase/7/docs/api/javax/crypto/spec/SecretKeySpec.html) docs.
Another solution would be using apache commons codec library: ``` @Grapes( @Grab(group='commons-codec', module='commons-codec', version='1.10') ) import org.apache.commons.codec.digest.HmacUtils HmacUtils.hmacSha1Hex(key.bytes, message.bytes) ```
27,878,068
I have this table in my database: ``` GroupStandings +--------+----------+--------------+--------+ | TeamID | GoalsFor | GoalsAgainst | Points | +--------+----------+--------------+--------+ | 1 | 0 | 0 | 0 | | 2 | 0 | 0 | 0 | | 3 | 0 | 0 | 0 | | 4 | 0 | 0 | 0 | +--------+----------+--------------+--------+ ``` I want to write a query that updates the points based on what I update my GoalsFor and GoalsAgainst as. A very bad example for clarification: ``` update GroupStandings set GoalsFor = 3, GoalsAgainst = 1, if GoalsFor>GoalsAgainst set points = 3 else if GoalsFor=GoalsAgainst set points =1 else set points = 0 where TeamID = 1 ```
2015/01/10
[ "https://Stackoverflow.com/questions/27878068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4269298/" ]
There are many issues with your code, but the key one for the purposes of your bug is that each time through the loop you assign to `nw`, overwriting all previous assignments to it. So, of course, only the **last** assignment matters! Just fixing that will only keep exposing further and further layers of bugs -- it's amazing how many issues you managed to pack into such a small piece of code. For example, if you assigned to `ejmin` instead of to `nw`, that would break all the further-on indices. Moreover, `ejmin.replace(ejmin[i]` does not replace "the char at position `i`" -- it replaces **every occurrence** of a character equal to that one. &c -- this code as it stands is nearly unsalvageable. Better rewrite it from scratch based on the core idea that strings are immutable (so applying multiple edits to a string is fraught), while lists are mutable (so such editing is fine). So make your string into a list at the start, edit it, make it back into a string when done: ``` ejmin = "ej pj dj" aslist = list(ejmin) aslist[0] = '' for i, c in enumerate(aslist): if c == ' ': aslist[i] = '' nw = ''.join(aslist) ```
``` ejmin = "ej pj dj" a=ejmin.split() #split it by space for x in a: t=x[1:] #slicing it from first character to end of word print (t) ``` Output: ``` >>> j j j >>> ``` Splitting them by space character, and slicing from first character. Edit: ``` ejmin = "ej pj dj" a=ejmin.split() for x in a: z=x[0] h=x+z print (h) ``` Output: ``` >>> eje pjp djd >>> ```
27,878,068
I have this table in my database: ``` GroupStandings +--------+----------+--------------+--------+ | TeamID | GoalsFor | GoalsAgainst | Points | +--------+----------+--------------+--------+ | 1 | 0 | 0 | 0 | | 2 | 0 | 0 | 0 | | 3 | 0 | 0 | 0 | | 4 | 0 | 0 | 0 | +--------+----------+--------------+--------+ ``` I want to write a query that updates the points based on what I update my GoalsFor and GoalsAgainst as. A very bad example for clarification: ``` update GroupStandings set GoalsFor = 3, GoalsAgainst = 1, if GoalsFor>GoalsAgainst set points = 3 else if GoalsFor=GoalsAgainst set points =1 else set points = 0 where TeamID = 1 ```
2015/01/10
[ "https://Stackoverflow.com/questions/27878068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4269298/" ]
There are many issues with your code, but the key one for the purposes of your bug is that each time through the loop you assign to `nw`, overwriting all previous assignments to it. So, of course, only the **last** assignment matters! Just fixing that will only keep exposing further and further layers of bugs -- it's amazing how many issues you managed to pack into such a small piece of code. For example, if you assigned to `ejmin` instead of to `nw`, that would break all the further-on indices. Moreover, `ejmin.replace(ejmin[i]` does not replace "the char at position `i`" -- it replaces **every occurrence** of a character equal to that one. &c -- this code as it stands is nearly unsalvageable. Better rewrite it from scratch based on the core idea that strings are immutable (so applying multiple edits to a string is fraught), while lists are mutable (so such editing is fine). So make your string into a list at the start, edit it, make it back into a string when done: ``` ejmin = "ej pj dj" aslist = list(ejmin) aslist[0] = '' for i, c in enumerate(aslist): if c == ' ': aslist[i] = '' nw = ''.join(aslist) ```
> > I tried it by slicing > > > ``` ejmin = "ej pj dj" for word in ejmin.split(): print word[1:], ```
43,862,031
'OutOfMemoryError': Usually, this error is thrown when there is insufficient space to allocate an object in the Java heap. GC (Allocation Failure): Allocation Failure” means that there is an allocation request that is bigger than the available space in young generation. Does this mean Allocation Failure will be thrown when Young generation memory is full (Minor GC) and "OutOfMemoryError" is thrown in full GC?
2017/05/09
[ "https://Stackoverflow.com/questions/43862031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3024119/" ]
These *could* become related as far as I can tell; but they are entirely different things. `OutOfMemory` is an error you can not recover from - the JVM will die at this point. `GC (Allocation Failure): Allocation Failure` is the reason why GC will kick in (and do a minor collection). At this point some things might happen, like: enough space is freed for the new allocation to fit into `young generation`. Or that did not happen and some objects will be promoted to the `old generation`. If they `can't be promoted`, a `full GC` might be triggered - and if that does not free enough space an `OutOfMemory` *might* be thrown.
In general, an `OutOfMemoryError` occurs when you have exceeded the maximum memory you have already allocated to the JVM. This amount can be changed when starting java using jvm parameters. e.g. `-Xmx2G`. Note that this amount isn't used immediately. See below. GC (Allocation Failure) is similar, except it occurs when the garbage collector runs out of memory on the heap, and it attempts to allocate more. If your allocated memory is higher than your available system memory, this will fail. Essentially, the JVM tries to allocate memory which isn't there. [See for more information](http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/)
119,905
Assume that a given postdoctoral position does not require teaching/laboratory. > > Are there postdoc positions for someone who wishes to stay in his/her country and just be in touch with the post-doc advisor by e-mail or/and Skype? > > > Perhaps communicating only by e-mail may be slightly annoying for some people, so I also suggested Skype. In my opinion (but correct me if I am wrong), there should be no difference between live meetings and Skype meetings. **Remark:** Truly, I am asking about a post-doc position in mathematics, but I guess that my question is also relevant for other fields. **Edit:** I wish to thank all the people answering (or commenting on) my question.
2018/11/11
[ "https://academia.stackexchange.com/questions/119905", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/98810/" ]
There is a BIG difference between in-person and via Skype. I have seen this before on several occasions in industry and it simply does not work as well. I doubt it'd be different in academia. It's much harder to integrate a remote worker into a group, especially if they're in a different timezone. I suspect there would have to be a very compelling reason for most supervisors to agree to this. Maybe they'll do it, but you better be pretty special.
It is possible for a postdoc to be at a different university from the grant-holder (PI), and supervised virtually as a result. It probably requires an unusual source of funding, and entails either frequent visits or else a co-supervisor/collaborator based at the postdoc's institution. 1. An example Here is an old [job advert](https://web.archive.org/web/20180123180355/www.cgsp.ca/update/call-for-applications-2018-2019-postdoctoral-fellowships-at-the-cgsp) from the CGSP/CPSM, a Canadian research project in social policy. One can find by a little googling that one of the appointees is based on another continent, where they are co-supervised by a professor who is not listed as a collaborator or partner in the CGSP/CPSM. So their supervision by the PI would be mostly virtual (apart from one workshop planned as part of the programme). In the job advert, you can see some very careful wording about supervisors and co-supervisors to permit exactly this to happen. 2. Something similar in mathematics? In fact I know the PI in the example above (that's how I heard about it at all). She told me that those postdocs were in some measure based on the [Fields Institute postdocs](http://www.fields.utoronto.ca/honours-and-fellowships/postdoctoral-fellowships) in mathematics. These are not precisely what is being asked for in the question, but show some similarities. Academics apply to organise "thematic programs" at the Fields Institute in Toronto, and the institute hires postdocs to work on those programs. Unlike the scenario in the question, the postdocs do physically come to Fields. However the organisers could be anywhere in the world, so their supervision of the postdocs may be largely virtual. The postdocs also aim to work with faculty at "sponsor universities" of the Fields Institute and many of these are physically quite distant from Toronto. The supervision is not entirely virtual as there are workshops and lecture courses every month or two to bring people together physically. 3. Appendix Of course it can happen that a PI or postdoc has an extended visit at another university or institute, or that the PI moves and it's not possible for the postdoc to follow. If one wanted to see the different ways a "virtual postdoc" could go in practise then those cases might be the place to start.
119,905
Assume that a given postdoctoral position does not require teaching/laboratory. > > Are there postdoc positions for someone who wishes to stay in his/her country and just be in touch with the post-doc advisor by e-mail or/and Skype? > > > Perhaps communicating only by e-mail may be slightly annoying for some people, so I also suggested Skype. In my opinion (but correct me if I am wrong), there should be no difference between live meetings and Skype meetings. **Remark:** Truly, I am asking about a post-doc position in mathematics, but I guess that my question is also relevant for other fields. **Edit:** I wish to thank all the people answering (or commenting on) my question.
2018/11/11
[ "https://academia.stackexchange.com/questions/119905", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/98810/" ]
In person and Skype are completely different. Writing math that you can both see becomes a challenge (in person, it's called a blackboard). I get up to fetch a book: communication is lost. Meeting takes longer than expected and it'd be nice to continue talking over lunch? Very difficult with Skype. More than two people in a meeting? Complete nightmare. And a postdoc position is not just about talking with your supervisor every now and then. IMO, that's just a recipe for having a terrible time. You are expected to participate in your department's life. This means going to seminars, talk with people who you don't collaborate with, etc. Impossible if you are restricted to formal Skype meetings with your supervisor. Let's say you have a quick question about something you're reading. Are you going to call your supervisor about it? Or go to the office next door and ask, maybe even someone else, like another postdoc or a PhD student who works on the same kind of topic? What you are describing is a research collaboration with someone else. You check up every now and then for status updates. It's not what most people envision when they think of a postdoc.
It is possible for a postdoc to be at a different university from the grant-holder (PI), and supervised virtually as a result. It probably requires an unusual source of funding, and entails either frequent visits or else a co-supervisor/collaborator based at the postdoc's institution. 1. An example Here is an old [job advert](https://web.archive.org/web/20180123180355/www.cgsp.ca/update/call-for-applications-2018-2019-postdoctoral-fellowships-at-the-cgsp) from the CGSP/CPSM, a Canadian research project in social policy. One can find by a little googling that one of the appointees is based on another continent, where they are co-supervised by a professor who is not listed as a collaborator or partner in the CGSP/CPSM. So their supervision by the PI would be mostly virtual (apart from one workshop planned as part of the programme). In the job advert, you can see some very careful wording about supervisors and co-supervisors to permit exactly this to happen. 2. Something similar in mathematics? In fact I know the PI in the example above (that's how I heard about it at all). She told me that those postdocs were in some measure based on the [Fields Institute postdocs](http://www.fields.utoronto.ca/honours-and-fellowships/postdoctoral-fellowships) in mathematics. These are not precisely what is being asked for in the question, but show some similarities. Academics apply to organise "thematic programs" at the Fields Institute in Toronto, and the institute hires postdocs to work on those programs. Unlike the scenario in the question, the postdocs do physically come to Fields. However the organisers could be anywhere in the world, so their supervision of the postdocs may be largely virtual. The postdocs also aim to work with faculty at "sponsor universities" of the Fields Institute and many of these are physically quite distant from Toronto. The supervision is not entirely virtual as there are workshops and lecture courses every month or two to bring people together physically. 3. Appendix Of course it can happen that a PI or postdoc has an extended visit at another university or institute, or that the PI moves and it's not possible for the postdoc to follow. If one wanted to see the different ways a "virtual postdoc" could go in practise then those cases might be the place to start.
119,905
Assume that a given postdoctoral position does not require teaching/laboratory. > > Are there postdoc positions for someone who wishes to stay in his/her country and just be in touch with the post-doc advisor by e-mail or/and Skype? > > > Perhaps communicating only by e-mail may be slightly annoying for some people, so I also suggested Skype. In my opinion (but correct me if I am wrong), there should be no difference between live meetings and Skype meetings. **Remark:** Truly, I am asking about a post-doc position in mathematics, but I guess that my question is also relevant for other fields. **Edit:** I wish to thank all the people answering (or commenting on) my question.
2018/11/11
[ "https://academia.stackexchange.com/questions/119905", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/98810/" ]
I think that would be entirely up to whoever is funding and or supervising it. I doubt that many would wish to do so as there is little opportunity for direct supervision or keeping track of the activities of the post-doc. It would seem to depend on an inordinate amount of trust. If you were the funder, you should probably establish some very regular means of communication to see that your resources aren't being wasted. Such a thing might be more reasonable if the post-doc and the PI had a regular relationship in the past so that trust was already established. I don't think there is anything *wrong* with such a thing, I just don't guess anyone would be interested in supervising it. Interesting, but unrealistic.
It is possible for a postdoc to be at a different university from the grant-holder (PI), and supervised virtually as a result. It probably requires an unusual source of funding, and entails either frequent visits or else a co-supervisor/collaborator based at the postdoc's institution. 1. An example Here is an old [job advert](https://web.archive.org/web/20180123180355/www.cgsp.ca/update/call-for-applications-2018-2019-postdoctoral-fellowships-at-the-cgsp) from the CGSP/CPSM, a Canadian research project in social policy. One can find by a little googling that one of the appointees is based on another continent, where they are co-supervised by a professor who is not listed as a collaborator or partner in the CGSP/CPSM. So their supervision by the PI would be mostly virtual (apart from one workshop planned as part of the programme). In the job advert, you can see some very careful wording about supervisors and co-supervisors to permit exactly this to happen. 2. Something similar in mathematics? In fact I know the PI in the example above (that's how I heard about it at all). She told me that those postdocs were in some measure based on the [Fields Institute postdocs](http://www.fields.utoronto.ca/honours-and-fellowships/postdoctoral-fellowships) in mathematics. These are not precisely what is being asked for in the question, but show some similarities. Academics apply to organise "thematic programs" at the Fields Institute in Toronto, and the institute hires postdocs to work on those programs. Unlike the scenario in the question, the postdocs do physically come to Fields. However the organisers could be anywhere in the world, so their supervision of the postdocs may be largely virtual. The postdocs also aim to work with faculty at "sponsor universities" of the Fields Institute and many of these are physically quite distant from Toronto. The supervision is not entirely virtual as there are workshops and lecture courses every month or two to bring people together physically. 3. Appendix Of course it can happen that a PI or postdoc has an extended visit at another university or institute, or that the PI moves and it's not possible for the postdoc to follow. If one wanted to see the different ways a "virtual postdoc" could go in practise then those cases might be the place to start.
119,905
Assume that a given postdoctoral position does not require teaching/laboratory. > > Are there postdoc positions for someone who wishes to stay in his/her country and just be in touch with the post-doc advisor by e-mail or/and Skype? > > > Perhaps communicating only by e-mail may be slightly annoying for some people, so I also suggested Skype. In my opinion (but correct me if I am wrong), there should be no difference between live meetings and Skype meetings. **Remark:** Truly, I am asking about a post-doc position in mathematics, but I guess that my question is also relevant for other fields. **Edit:** I wish to thank all the people answering (or commenting on) my question.
2018/11/11
[ "https://academia.stackexchange.com/questions/119905", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/98810/" ]
In person and Skype are completely different. Writing math that you can both see becomes a challenge (in person, it's called a blackboard). I get up to fetch a book: communication is lost. Meeting takes longer than expected and it'd be nice to continue talking over lunch? Very difficult with Skype. More than two people in a meeting? Complete nightmare. And a postdoc position is not just about talking with your supervisor every now and then. IMO, that's just a recipe for having a terrible time. You are expected to participate in your department's life. This means going to seminars, talk with people who you don't collaborate with, etc. Impossible if you are restricted to formal Skype meetings with your supervisor. Let's say you have a quick question about something you're reading. Are you going to call your supervisor about it? Or go to the office next door and ask, maybe even someone else, like another postdoc or a PhD student who works on the same kind of topic? What you are describing is a research collaboration with someone else. You check up every now and then for status updates. It's not what most people envision when they think of a postdoc.
A research group or a PI typically wants a researcher who is more committed to the group and to his/her research projects. In-person presence means you are committing your *life* for the duration of the post-doc to that: * You're moving to a different city or a different country. * your daily routine will be very different. * your circle of human interaction will be people in your research group, department and university (well, not only them, but for most of the day). * You will be literally, physically, available for your research group members to walk in and bother you with things. * You will (possibly) be eating and drinking together and perhaps even the same food with your research group colleagues. * You will endure the same environmental, technical and political inconveniences as your research group colleagues. So it is an *entirely* different experience than a "virtual" post-doc. It is also why most institutions and researchers are skeptical or not willing to consider such arrangements.
119,905
Assume that a given postdoctoral position does not require teaching/laboratory. > > Are there postdoc positions for someone who wishes to stay in his/her country and just be in touch with the post-doc advisor by e-mail or/and Skype? > > > Perhaps communicating only by e-mail may be slightly annoying for some people, so I also suggested Skype. In my opinion (but correct me if I am wrong), there should be no difference between live meetings and Skype meetings. **Remark:** Truly, I am asking about a post-doc position in mathematics, but I guess that my question is also relevant for other fields. **Edit:** I wish to thank all the people answering (or commenting on) my question.
2018/11/11
[ "https://academia.stackexchange.com/questions/119905", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/98810/" ]
I know anecdotal answers aren't always approved of on Stack Exchange, but I do know of post-docs who have arranged to work remotely as standard within the same country (the UK), with occasional physical visits (on average once a week or less) due to independent instances of the two body problem for the PI and the post doc. It's just about conceivable that the same kind of arrangement could be made internationally between countries with sufficiently integrated travel and financial systems (I'm thinking specifically of EU-EU here).
I'm a postdoc in computer science, working remotely for a UK university, from a different continent. However, I've been a postdoc for 2 years and it's just the last 3 months of my contract that I've arranged with my supervisor to do remotely, before that I was in the UK. I'll add my direct experience to the chorus: being remote is hard, for motivation, for having constructive meetings, for being part of the community... there are conceivably tasks that can be done remotely, but research where you need to discuss hard problems with a supervisor are just not well suited for remote work. A few weeks at a time are manageable, but longer term is a bad idea. On the other hand, I think being on-site once a week or so, is very manageable. There are also a few administrative obstacles: * The terms of a fellowship / visa limit how long you're allowed to be away from the UK (it happens I'm not affect by that as I'm an EU citizen, but a friend of mine from Canada is). * There's a university policy that says that all academic staff have travel insurance when they travel: in this case I'm away without "travelling" and when I travel to the UK I'm at my official workplace, so why would they give me a separate insurance? * There could be more that I've avoided from doing the remote thing less than 3 months, and other constraints in other countries... I just mention the UK ones I know as examples.
119,905
Assume that a given postdoctoral position does not require teaching/laboratory. > > Are there postdoc positions for someone who wishes to stay in his/her country and just be in touch with the post-doc advisor by e-mail or/and Skype? > > > Perhaps communicating only by e-mail may be slightly annoying for some people, so I also suggested Skype. In my opinion (but correct me if I am wrong), there should be no difference between live meetings and Skype meetings. **Remark:** Truly, I am asking about a post-doc position in mathematics, but I guess that my question is also relevant for other fields. **Edit:** I wish to thank all the people answering (or commenting on) my question.
2018/11/11
[ "https://academia.stackexchange.com/questions/119905", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/98810/" ]
If you are a postdoc for industry, many things are possible. If you are a postdoc in a University or research institution, your institution is subject to rigorous control, which includes financial transparency and visa compliance. Sure, these problems may be solvable for Prof Famous joining the University of Notmuch. But bending those rules for an average postdoc is extremely unlikely. Finance won't like paying a guy who is not physically on-site for some work which is basically a couple of telephone calls per months. Such schemes are often used by dishonest PIs for tunnel research funds to their relatives or close friends, and they are always a subject of extra scrutiny and extra attention. Finance and HR will not support you or your PI in this, and this alone is the reason why such scheme — although theoretically possible — will not really happen.
It is possible for a postdoc to be at a different university from the grant-holder (PI), and supervised virtually as a result. It probably requires an unusual source of funding, and entails either frequent visits or else a co-supervisor/collaborator based at the postdoc's institution. 1. An example Here is an old [job advert](https://web.archive.org/web/20180123180355/www.cgsp.ca/update/call-for-applications-2018-2019-postdoctoral-fellowships-at-the-cgsp) from the CGSP/CPSM, a Canadian research project in social policy. One can find by a little googling that one of the appointees is based on another continent, where they are co-supervised by a professor who is not listed as a collaborator or partner in the CGSP/CPSM. So their supervision by the PI would be mostly virtual (apart from one workshop planned as part of the programme). In the job advert, you can see some very careful wording about supervisors and co-supervisors to permit exactly this to happen. 2. Something similar in mathematics? In fact I know the PI in the example above (that's how I heard about it at all). She told me that those postdocs were in some measure based on the [Fields Institute postdocs](http://www.fields.utoronto.ca/honours-and-fellowships/postdoctoral-fellowships) in mathematics. These are not precisely what is being asked for in the question, but show some similarities. Academics apply to organise "thematic programs" at the Fields Institute in Toronto, and the institute hires postdocs to work on those programs. Unlike the scenario in the question, the postdocs do physically come to Fields. However the organisers could be anywhere in the world, so their supervision of the postdocs may be largely virtual. The postdocs also aim to work with faculty at "sponsor universities" of the Fields Institute and many of these are physically quite distant from Toronto. The supervision is not entirely virtual as there are workshops and lecture courses every month or two to bring people together physically. 3. Appendix Of course it can happen that a PI or postdoc has an extended visit at another university or institute, or that the PI moves and it's not possible for the postdoc to follow. If one wanted to see the different ways a "virtual postdoc" could go in practise then those cases might be the place to start.
119,905
Assume that a given postdoctoral position does not require teaching/laboratory. > > Are there postdoc positions for someone who wishes to stay in his/her country and just be in touch with the post-doc advisor by e-mail or/and Skype? > > > Perhaps communicating only by e-mail may be slightly annoying for some people, so I also suggested Skype. In my opinion (but correct me if I am wrong), there should be no difference between live meetings and Skype meetings. **Remark:** Truly, I am asking about a post-doc position in mathematics, but I guess that my question is also relevant for other fields. **Edit:** I wish to thank all the people answering (or commenting on) my question.
2018/11/11
[ "https://academia.stackexchange.com/questions/119905", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/98810/" ]
One thing that hasn't been mentioned in other answers is that the university may have rules that require postdocs to be physically present. Mine does, so this kind of thing would be out of the question. I have no idea how common that is. I also agree with other answers that say working with an advisor long-distance would be a huge disadvantage. I am a mathematician.
It is possible for a postdoc to be at a different university from the grant-holder (PI), and supervised virtually as a result. It probably requires an unusual source of funding, and entails either frequent visits or else a co-supervisor/collaborator based at the postdoc's institution. 1. An example Here is an old [job advert](https://web.archive.org/web/20180123180355/www.cgsp.ca/update/call-for-applications-2018-2019-postdoctoral-fellowships-at-the-cgsp) from the CGSP/CPSM, a Canadian research project in social policy. One can find by a little googling that one of the appointees is based on another continent, where they are co-supervised by a professor who is not listed as a collaborator or partner in the CGSP/CPSM. So their supervision by the PI would be mostly virtual (apart from one workshop planned as part of the programme). In the job advert, you can see some very careful wording about supervisors and co-supervisors to permit exactly this to happen. 2. Something similar in mathematics? In fact I know the PI in the example above (that's how I heard about it at all). She told me that those postdocs were in some measure based on the [Fields Institute postdocs](http://www.fields.utoronto.ca/honours-and-fellowships/postdoctoral-fellowships) in mathematics. These are not precisely what is being asked for in the question, but show some similarities. Academics apply to organise "thematic programs" at the Fields Institute in Toronto, and the institute hires postdocs to work on those programs. Unlike the scenario in the question, the postdocs do physically come to Fields. However the organisers could be anywhere in the world, so their supervision of the postdocs may be largely virtual. The postdocs also aim to work with faculty at "sponsor universities" of the Fields Institute and many of these are physically quite distant from Toronto. The supervision is not entirely virtual as there are workshops and lecture courses every month or two to bring people together physically. 3. Appendix Of course it can happen that a PI or postdoc has an extended visit at another university or institute, or that the PI moves and it's not possible for the postdoc to follow. If one wanted to see the different ways a "virtual postdoc" could go in practise then those cases might be the place to start.
119,905
Assume that a given postdoctoral position does not require teaching/laboratory. > > Are there postdoc positions for someone who wishes to stay in his/her country and just be in touch with the post-doc advisor by e-mail or/and Skype? > > > Perhaps communicating only by e-mail may be slightly annoying for some people, so I also suggested Skype. In my opinion (but correct me if I am wrong), there should be no difference between live meetings and Skype meetings. **Remark:** Truly, I am asking about a post-doc position in mathematics, but I guess that my question is also relevant for other fields. **Edit:** I wish to thank all the people answering (or commenting on) my question.
2018/11/11
[ "https://academia.stackexchange.com/questions/119905", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/98810/" ]
If you are a postdoc for industry, many things are possible. If you are a postdoc in a University or research institution, your institution is subject to rigorous control, which includes financial transparency and visa compliance. Sure, these problems may be solvable for Prof Famous joining the University of Notmuch. But bending those rules for an average postdoc is extremely unlikely. Finance won't like paying a guy who is not physically on-site for some work which is basically a couple of telephone calls per months. Such schemes are often used by dishonest PIs for tunnel research funds to their relatives or close friends, and they are always a subject of extra scrutiny and extra attention. Finance and HR will not support you or your PI in this, and this alone is the reason why such scheme — although theoretically possible — will not really happen.
I'm a postdoc in computer science, working remotely for a UK university, from a different continent. However, I've been a postdoc for 2 years and it's just the last 3 months of my contract that I've arranged with my supervisor to do remotely, before that I was in the UK. I'll add my direct experience to the chorus: being remote is hard, for motivation, for having constructive meetings, for being part of the community... there are conceivably tasks that can be done remotely, but research where you need to discuss hard problems with a supervisor are just not well suited for remote work. A few weeks at a time are manageable, but longer term is a bad idea. On the other hand, I think being on-site once a week or so, is very manageable. There are also a few administrative obstacles: * The terms of a fellowship / visa limit how long you're allowed to be away from the UK (it happens I'm not affect by that as I'm an EU citizen, but a friend of mine from Canada is). * There's a university policy that says that all academic staff have travel insurance when they travel: in this case I'm away without "travelling" and when I travel to the UK I'm at my official workplace, so why would they give me a separate insurance? * There could be more that I've avoided from doing the remote thing less than 3 months, and other constraints in other countries... I just mention the UK ones I know as examples.
119,905
Assume that a given postdoctoral position does not require teaching/laboratory. > > Are there postdoc positions for someone who wishes to stay in his/her country and just be in touch with the post-doc advisor by e-mail or/and Skype? > > > Perhaps communicating only by e-mail may be slightly annoying for some people, so I also suggested Skype. In my opinion (but correct me if I am wrong), there should be no difference between live meetings and Skype meetings. **Remark:** Truly, I am asking about a post-doc position in mathematics, but I guess that my question is also relevant for other fields. **Edit:** I wish to thank all the people answering (or commenting on) my question.
2018/11/11
[ "https://academia.stackexchange.com/questions/119905", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/98810/" ]
In person and Skype are completely different. Writing math that you can both see becomes a challenge (in person, it's called a blackboard). I get up to fetch a book: communication is lost. Meeting takes longer than expected and it'd be nice to continue talking over lunch? Very difficult with Skype. More than two people in a meeting? Complete nightmare. And a postdoc position is not just about talking with your supervisor every now and then. IMO, that's just a recipe for having a terrible time. You are expected to participate in your department's life. This means going to seminars, talk with people who you don't collaborate with, etc. Impossible if you are restricted to formal Skype meetings with your supervisor. Let's say you have a quick question about something you're reading. Are you going to call your supervisor about it? Or go to the office next door and ask, maybe even someone else, like another postdoc or a PhD student who works on the same kind of topic? What you are describing is a research collaboration with someone else. You check up every now and then for status updates. It's not what most people envision when they think of a postdoc.
I know anecdotal answers aren't always approved of on Stack Exchange, but I do know of post-docs who have arranged to work remotely as standard within the same country (the UK), with occasional physical visits (on average once a week or less) due to independent instances of the two body problem for the PI and the post doc. It's just about conceivable that the same kind of arrangement could be made internationally between countries with sufficiently integrated travel and financial systems (I'm thinking specifically of EU-EU here).
119,905
Assume that a given postdoctoral position does not require teaching/laboratory. > > Are there postdoc positions for someone who wishes to stay in his/her country and just be in touch with the post-doc advisor by e-mail or/and Skype? > > > Perhaps communicating only by e-mail may be slightly annoying for some people, so I also suggested Skype. In my opinion (but correct me if I am wrong), there should be no difference between live meetings and Skype meetings. **Remark:** Truly, I am asking about a post-doc position in mathematics, but I guess that my question is also relevant for other fields. **Edit:** I wish to thank all the people answering (or commenting on) my question.
2018/11/11
[ "https://academia.stackexchange.com/questions/119905", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/98810/" ]
I know anecdotal answers aren't always approved of on Stack Exchange, but I do know of post-docs who have arranged to work remotely as standard within the same country (the UK), with occasional physical visits (on average once a week or less) due to independent instances of the two body problem for the PI and the post doc. It's just about conceivable that the same kind of arrangement could be made internationally between countries with sufficiently integrated travel and financial systems (I'm thinking specifically of EU-EU here).
A research group or a PI typically wants a researcher who is more committed to the group and to his/her research projects. In-person presence means you are committing your *life* for the duration of the post-doc to that: * You're moving to a different city or a different country. * your daily routine will be very different. * your circle of human interaction will be people in your research group, department and university (well, not only them, but for most of the day). * You will be literally, physically, available for your research group members to walk in and bother you with things. * You will (possibly) be eating and drinking together and perhaps even the same food with your research group colleagues. * You will endure the same environmental, technical and political inconveniences as your research group colleagues. So it is an *entirely* different experience than a "virtual" post-doc. It is also why most institutions and researchers are skeptical or not willing to consider such arrangements.
57,228
I recently (about 2 weeks ago) changed from regular road clipless pedals to SPD clipless pedals on my road bike. I didn't have time to change them myself so I just asked one of the workers to put it on and I know for sure that he didn't apply any grease or oil for where the pedal is inserted and tightened. Now (after 2 weeks of pedaling) my right hand pedal makes a creaking sound once I put my full weight on it, I don't even have to pedal, just putting my whole weight once the right hand pedal is at 6 o'clock will cause the sound (I specifically didn't touch the saddle to be sure it doesn't come from there). I searched on youtube and looks like the simple solution is to take off the pedal, apply grease to the inserted end of the pedal and tighten it back. My question is: Do I have to buy grease for it or can I use chain lube or WD-40 and if I have to buy grease, does it have to be a certain type of grease (I'm guessing motor vehicle grease is a no no)? **Solution:** I loosened and retightened the chainring bolts and afterwards greased the pedals. It wasn't hard at all for me to take out the right pedal with the wrench (where I presumed the clicking was) and it looks like that was the main problem. anyway, I took the time and greased everything anyway! thanks for the help, guys!
2018/09/22
[ "https://bicycles.stackexchange.com/questions/57228", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/-1/" ]
Don't ride before servicing thos-e pedals. A poorly greased or loose pedal will ruin the thread of the crank or may even cause breakage of the pedal axle. A correctly tightened but non-greased pedal thread may cause the threads to fuse. You should remove both pedals, clean the threads and the crank arms, apply grease and thread them back in. In case you own a torque wrench the tightening torque ranges normally from 35-40 Nm. Remember that the right pedal unscrews counter-clockwise and for the left pedal it is clockwise. Grease: chain lube isn't adequate because it contains a large proportion of volatile components. WD-40 is an absolute no-go, it isn't grease. White cycle grease is best this case, it is generally available in smaller portions. You should apply the grease to the threads of the pedal and screw them in by hand for the first turns. It should fit in easily without the use of a tool. Tighten and check again after a 10-15km ride.
The shop mechanic may have judged there was already enough grease on the crank threads and more was not required. Only a small amount is sufficient. It will not hurt to check and apply a bit more though. What is more important is tightening the pedals to the correct torque. As mention in other answers loose steel pedals axles can destroy alloy crank arms threads. As the creak is on the right you might find it’s not the pedal. Chainring bolts are common culprits.
107,126
In *The Newsroom*, what is meant when Herb counts down to a broadcast by saying "Roll VTRx right before the intro sequence to News Night begins playing?
2020/03/07
[ "https://movies.stackexchange.com/questions/107126", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/4083/" ]
> > Are we supposed to know what happened to his left hand, and what exactly are those tubes in his right arm? > > > His left hand seems to have been removed by John Doe. Remember that the reason the police are visiting the Sloth victim are because his fingerprints were identified at the Greed murder scene. The tubes are an IV line carrying nutrients, fluids, and whatever drugs John Doe was using to keep the victim alive and placid for the year he was trapped in the apartment.
The Sloth death isn't exactly clear...generally we're supposed to assume that deaths to the victims are supposed to be a sort of...'poetic' justice and a part of John Doe's larger spectacle and how each represents their respective sin. We don't know very much with him, besides he was forced on drugs and rotted away in bed for a year or something. He should represent slothness (even this sin as a description isn't exactly clear)...whatever that means. And I assume in this particular case it should be the laziness. The complete and utter lack of doing nothing and wasting all possibilities on nothing. Doe shows this by having a person 'presumably' be able to escape, but does not and simple wastes his body and brain. But Se7en has several missing links....this particular one is probably one of them. However I would say yes, don't think about it so much...the film is 25 years old now...there are bound to be some plot holes. :)
50,583,347
I've been trying to import a .class via absolute path while code is running and I don't know how to do it. I found a way to import a class when it's already in project's build path by `Class.forName();`but I need to find a way to load a class that is not in build path. The goal is: 1. User is able to upload his own .class file which is then saved locally to a specific folder and path is saved in database 2. Via GUI user can select this file to be used while code is running 3. My code should load a class via this given absolute path while code is running The problem is with 3rd point because I don't know if it is possible to load a class while code is running. I've tried using `URLClassLoader` but I'm getting ClassNotFound error. **EDIT:** Basically, I have this static function which should return Class by it's name, but urlClassLoader.loadClass() throws error. Name of a file is J48.class so for className argument I've tried using "J48", "J48.class" but none work. Additionaly I've tried setting folder classifiers to build path and setting argument to "weka.classifiers.trees.J48" which is full path with package to this class (package structure is weka.classifiers.trees). ``` `public static Class getClassByName(String className) throws MalformedURLException, ClassNotFoundException { URLClassLoader urlClassLoader = URLClassLoader.newInstance(new URL[] { new URL("file:///D:\\xampp\\htdocs\\prog-ing\\classifiers\\") }); Class class = urlClassLoader.loadClass(className); return class; }` ```
2018/05/29
[ "https://Stackoverflow.com/questions/50583347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7111456/" ]
`data.table` approach could be ```r library(data.table) name1 <- setdiff(names(setDT(b)), names(setDT(a))) #perform left outer join and then select required columns a[b, (name1) := mget(name1), on = .(x > start, x < end)][, .(x, y)] ``` which gives ``` x y 1: 1 a 2: 3 <NA> 3: 5 b ``` **Sample data:** ``` a <- data.frame(x = c(1, 3, 5)) b <- data.frame(start = c(0, 4), end = c(2, 6), y = c("a", "b")) ``` --- **Update:** In case you want to join both dataframes on `(x=start+1)|(x=end+1)` condition then you can try ``` library(data.table) DT1 <- as.data.table(a) DT2 <- as.data.table(b) #Perform 1st join on "x = start+1" and then another on "x = end+1". Finally row-bind both results. DT <- rbindlist(list(DT1[DT2[, start_temp := start+1], on = c(x = "start_temp"), .(x, y), nomatch = 0], DT1[DT2[, end_temp := end+1], on = c(x = "end_temp"), .(x, y), nomatch = 0])) DT # x y #1: 1 a #2: 5 b #3: 3 a ```
You can try a `GenomicRanges` solution ``` library(GenomicRanges) # setup GRanges objects a_gr <- GRanges(1, IRanges(a$x,a$x)) b_gr <- GRanges(1, IRanges(b$start, b$end)) # find overlaps between the two data sets res <- as.data.frame(findOverlaps(a_gr,b_gr)) # create the expected output a$y <- NA a$y[res$queryHits] <- as.character(b$y)[res$subjectHits] a x y 1 1 a 2 3 <NA> 3 5 b ```
50,583,347
I've been trying to import a .class via absolute path while code is running and I don't know how to do it. I found a way to import a class when it's already in project's build path by `Class.forName();`but I need to find a way to load a class that is not in build path. The goal is: 1. User is able to upload his own .class file which is then saved locally to a specific folder and path is saved in database 2. Via GUI user can select this file to be used while code is running 3. My code should load a class via this given absolute path while code is running The problem is with 3rd point because I don't know if it is possible to load a class while code is running. I've tried using `URLClassLoader` but I'm getting ClassNotFound error. **EDIT:** Basically, I have this static function which should return Class by it's name, but urlClassLoader.loadClass() throws error. Name of a file is J48.class so for className argument I've tried using "J48", "J48.class" but none work. Additionaly I've tried setting folder classifiers to build path and setting argument to "weka.classifiers.trees.J48" which is full path with package to this class (package structure is weka.classifiers.trees). ``` `public static Class getClassByName(String className) throws MalformedURLException, ClassNotFoundException { URLClassLoader urlClassLoader = URLClassLoader.newInstance(new URL[] { new URL("file:///D:\\xampp\\htdocs\\prog-ing\\classifiers\\") }); Class class = urlClassLoader.loadClass(className); return class; }` ```
2018/05/29
[ "https://Stackoverflow.com/questions/50583347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7111456/" ]
I eventually went to the code of fuzzy\_join and found a way to make what I want even without proper documentation. fuzzy\_let\_join doesn't work but there is the following way (not really pretty and it actually does a cartesian product): ``` g <- function(x,y) (x>y[,"start"])&(x<y[,"end"]) fuzzy_join(a,b, multi_by = list(x="x",y=c("start","end")) , multi_match_fun = g, mode = "left") %>% select(x,y) ```
You can try a `GenomicRanges` solution ``` library(GenomicRanges) # setup GRanges objects a_gr <- GRanges(1, IRanges(a$x,a$x)) b_gr <- GRanges(1, IRanges(b$start, b$end)) # find overlaps between the two data sets res <- as.data.frame(findOverlaps(a_gr,b_gr)) # create the expected output a$y <- NA a$y[res$queryHits] <- as.character(b$y)[res$subjectHits] a x y 1 1 a 2 3 <NA> 3 5 b ```
50,583,347
I've been trying to import a .class via absolute path while code is running and I don't know how to do it. I found a way to import a class when it's already in project's build path by `Class.forName();`but I need to find a way to load a class that is not in build path. The goal is: 1. User is able to upload his own .class file which is then saved locally to a specific folder and path is saved in database 2. Via GUI user can select this file to be used while code is running 3. My code should load a class via this given absolute path while code is running The problem is with 3rd point because I don't know if it is possible to load a class while code is running. I've tried using `URLClassLoader` but I'm getting ClassNotFound error. **EDIT:** Basically, I have this static function which should return Class by it's name, but urlClassLoader.loadClass() throws error. Name of a file is J48.class so for className argument I've tried using "J48", "J48.class" but none work. Additionaly I've tried setting folder classifiers to build path and setting argument to "weka.classifiers.trees.J48" which is full path with package to this class (package structure is weka.classifiers.trees). ``` `public static Class getClassByName(String className) throws MalformedURLException, ClassNotFoundException { URLClassLoader urlClassLoader = URLClassLoader.newInstance(new URL[] { new URL("file:///D:\\xampp\\htdocs\\prog-ing\\classifiers\\") }); Class class = urlClassLoader.loadClass(className); return class; }` ```
2018/05/29
[ "https://Stackoverflow.com/questions/50583347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7111456/" ]
A possible answer to explain what I am trying to do : extending dplyr in some way. And I will be happy to know if there are ways to improve this solution or some problems I didn't see. The solution avoids the cartesian product, but duplicates into lists of data frames both one of the input data frame and the result. I didn't include the final column selection of x and y that is easy to code. ``` my_left_join <- function(.DATA1,.DATA2,.WHERE) { call = as.list(match.call()) df1 <- .DATA1 df1$._row_ <- 1:nrow(df1) dfl1 <- replyr::replyr_split(df1,"._row_") eval(substitute( dfl2 <- mapply(function(.x) {filter(.DATA2,with(.x,WHERE)) %>% mutate(._row_=.x$._row_)} , dfl1, SIMPLIFY=FALSE) ,list(WHERE=call$.WHERE))) df2 <- replyr::replyr_bind_rows(dfl2) left_join(df1,df2,by="._row_") %>% select(-._row_) } my_left_join(a,b,(x>start)&(x<end)) # x start end y #1 1 0 2 a #2 3 NA NA <NA> #3 5 4 6 b my_left_join(a,b,(x==(start+1))|(x==(end+1))) # x start end y #1 1 0 2 a #2 3 0 2 a #3 5 4 6 b ```
You can try a `GenomicRanges` solution ``` library(GenomicRanges) # setup GRanges objects a_gr <- GRanges(1, IRanges(a$x,a$x)) b_gr <- GRanges(1, IRanges(b$start, b$end)) # find overlaps between the two data sets res <- as.data.frame(findOverlaps(a_gr,b_gr)) # create the expected output a$y <- NA a$y[res$queryHits] <- as.character(b$y)[res$subjectHits] a x y 1 1 a 2 3 <NA> 3 5 b ```
50,583,347
I've been trying to import a .class via absolute path while code is running and I don't know how to do it. I found a way to import a class when it's already in project's build path by `Class.forName();`but I need to find a way to load a class that is not in build path. The goal is: 1. User is able to upload his own .class file which is then saved locally to a specific folder and path is saved in database 2. Via GUI user can select this file to be used while code is running 3. My code should load a class via this given absolute path while code is running The problem is with 3rd point because I don't know if it is possible to load a class while code is running. I've tried using `URLClassLoader` but I'm getting ClassNotFound error. **EDIT:** Basically, I have this static function which should return Class by it's name, but urlClassLoader.loadClass() throws error. Name of a file is J48.class so for className argument I've tried using "J48", "J48.class" but none work. Additionaly I've tried setting folder classifiers to build path and setting argument to "weka.classifiers.trees.J48" which is full path with package to this class (package structure is weka.classifiers.trees). ``` `public static Class getClassByName(String className) throws MalformedURLException, ClassNotFoundException { URLClassLoader urlClassLoader = URLClassLoader.newInstance(new URL[] { new URL("file:///D:\\xampp\\htdocs\\prog-ing\\classifiers\\") }); Class class = urlClassLoader.loadClass(className); return class; }` ```
2018/05/29
[ "https://Stackoverflow.com/questions/50583347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7111456/" ]
For this case you don't need `multi_by` or `multy_match_fun`, this works : ``` library(fuzzyjoin) fuzzy_left_join(a, b, by = c(x = "start", x = "end"), match_fun = list(`>`, `<`)) # x start end y # 1 1 0 2 a # 2 3 NA NA <NA> # 3 5 4 6 b ```
You can try a `GenomicRanges` solution ``` library(GenomicRanges) # setup GRanges objects a_gr <- GRanges(1, IRanges(a$x,a$x)) b_gr <- GRanges(1, IRanges(b$start, b$end)) # find overlaps between the two data sets res <- as.data.frame(findOverlaps(a_gr,b_gr)) # create the expected output a$y <- NA a$y[res$queryHits] <- as.character(b$y)[res$subjectHits] a x y 1 1 a 2 3 <NA> 3 5 b ```
50,583,347
I've been trying to import a .class via absolute path while code is running and I don't know how to do it. I found a way to import a class when it's already in project's build path by `Class.forName();`but I need to find a way to load a class that is not in build path. The goal is: 1. User is able to upload his own .class file which is then saved locally to a specific folder and path is saved in database 2. Via GUI user can select this file to be used while code is running 3. My code should load a class via this given absolute path while code is running The problem is with 3rd point because I don't know if it is possible to load a class while code is running. I've tried using `URLClassLoader` but I'm getting ClassNotFound error. **EDIT:** Basically, I have this static function which should return Class by it's name, but urlClassLoader.loadClass() throws error. Name of a file is J48.class so for className argument I've tried using "J48", "J48.class" but none work. Additionaly I've tried setting folder classifiers to build path and setting argument to "weka.classifiers.trees.J48" which is full path with package to this class (package structure is weka.classifiers.trees). ``` `public static Class getClassByName(String className) throws MalformedURLException, ClassNotFoundException { URLClassLoader urlClassLoader = URLClassLoader.newInstance(new URL[] { new URL("file:///D:\\xampp\\htdocs\\prog-ing\\classifiers\\") }); Class class = urlClassLoader.loadClass(className); return class; }` ```
2018/05/29
[ "https://Stackoverflow.com/questions/50583347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7111456/" ]
I eventually went to the code of fuzzy\_join and found a way to make what I want even without proper documentation. fuzzy\_let\_join doesn't work but there is the following way (not really pretty and it actually does a cartesian product): ``` g <- function(x,y) (x>y[,"start"])&(x<y[,"end"]) fuzzy_join(a,b, multi_by = list(x="x",y=c("start","end")) , multi_match_fun = g, mode = "left") %>% select(x,y) ```
`data.table` approach could be ```r library(data.table) name1 <- setdiff(names(setDT(b)), names(setDT(a))) #perform left outer join and then select required columns a[b, (name1) := mget(name1), on = .(x > start, x < end)][, .(x, y)] ``` which gives ``` x y 1: 1 a 2: 3 <NA> 3: 5 b ``` **Sample data:** ``` a <- data.frame(x = c(1, 3, 5)) b <- data.frame(start = c(0, 4), end = c(2, 6), y = c("a", "b")) ``` --- **Update:** In case you want to join both dataframes on `(x=start+1)|(x=end+1)` condition then you can try ``` library(data.table) DT1 <- as.data.table(a) DT2 <- as.data.table(b) #Perform 1st join on "x = start+1" and then another on "x = end+1". Finally row-bind both results. DT <- rbindlist(list(DT1[DT2[, start_temp := start+1], on = c(x = "start_temp"), .(x, y), nomatch = 0], DT1[DT2[, end_temp := end+1], on = c(x = "end_temp"), .(x, y), nomatch = 0])) DT # x y #1: 1 a #2: 5 b #3: 3 a ```
50,583,347
I've been trying to import a .class via absolute path while code is running and I don't know how to do it. I found a way to import a class when it's already in project's build path by `Class.forName();`but I need to find a way to load a class that is not in build path. The goal is: 1. User is able to upload his own .class file which is then saved locally to a specific folder and path is saved in database 2. Via GUI user can select this file to be used while code is running 3. My code should load a class via this given absolute path while code is running The problem is with 3rd point because I don't know if it is possible to load a class while code is running. I've tried using `URLClassLoader` but I'm getting ClassNotFound error. **EDIT:** Basically, I have this static function which should return Class by it's name, but urlClassLoader.loadClass() throws error. Name of a file is J48.class so for className argument I've tried using "J48", "J48.class" but none work. Additionaly I've tried setting folder classifiers to build path and setting argument to "weka.classifiers.trees.J48" which is full path with package to this class (package structure is weka.classifiers.trees). ``` `public static Class getClassByName(String className) throws MalformedURLException, ClassNotFoundException { URLClassLoader urlClassLoader = URLClassLoader.newInstance(new URL[] { new URL("file:///D:\\xampp\\htdocs\\prog-ing\\classifiers\\") }); Class class = urlClassLoader.loadClass(className); return class; }` ```
2018/05/29
[ "https://Stackoverflow.com/questions/50583347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7111456/" ]
For this case you don't need `multi_by` or `multy_match_fun`, this works : ``` library(fuzzyjoin) fuzzy_left_join(a, b, by = c(x = "start", x = "end"), match_fun = list(`>`, `<`)) # x start end y # 1 1 0 2 a # 2 3 NA NA <NA> # 3 5 4 6 b ```
`data.table` approach could be ```r library(data.table) name1 <- setdiff(names(setDT(b)), names(setDT(a))) #perform left outer join and then select required columns a[b, (name1) := mget(name1), on = .(x > start, x < end)][, .(x, y)] ``` which gives ``` x y 1: 1 a 2: 3 <NA> 3: 5 b ``` **Sample data:** ``` a <- data.frame(x = c(1, 3, 5)) b <- data.frame(start = c(0, 4), end = c(2, 6), y = c("a", "b")) ``` --- **Update:** In case you want to join both dataframes on `(x=start+1)|(x=end+1)` condition then you can try ``` library(data.table) DT1 <- as.data.table(a) DT2 <- as.data.table(b) #Perform 1st join on "x = start+1" and then another on "x = end+1". Finally row-bind both results. DT <- rbindlist(list(DT1[DT2[, start_temp := start+1], on = c(x = "start_temp"), .(x, y), nomatch = 0], DT1[DT2[, end_temp := end+1], on = c(x = "end_temp"), .(x, y), nomatch = 0])) DT # x y #1: 1 a #2: 5 b #3: 3 a ```
50,583,347
I've been trying to import a .class via absolute path while code is running and I don't know how to do it. I found a way to import a class when it's already in project's build path by `Class.forName();`but I need to find a way to load a class that is not in build path. The goal is: 1. User is able to upload his own .class file which is then saved locally to a specific folder and path is saved in database 2. Via GUI user can select this file to be used while code is running 3. My code should load a class via this given absolute path while code is running The problem is with 3rd point because I don't know if it is possible to load a class while code is running. I've tried using `URLClassLoader` but I'm getting ClassNotFound error. **EDIT:** Basically, I have this static function which should return Class by it's name, but urlClassLoader.loadClass() throws error. Name of a file is J48.class so for className argument I've tried using "J48", "J48.class" but none work. Additionaly I've tried setting folder classifiers to build path and setting argument to "weka.classifiers.trees.J48" which is full path with package to this class (package structure is weka.classifiers.trees). ``` `public static Class getClassByName(String className) throws MalformedURLException, ClassNotFoundException { URLClassLoader urlClassLoader = URLClassLoader.newInstance(new URL[] { new URL("file:///D:\\xampp\\htdocs\\prog-ing\\classifiers\\") }); Class class = urlClassLoader.loadClass(className); return class; }` ```
2018/05/29
[ "https://Stackoverflow.com/questions/50583347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7111456/" ]
I eventually went to the code of fuzzy\_join and found a way to make what I want even without proper documentation. fuzzy\_let\_join doesn't work but there is the following way (not really pretty and it actually does a cartesian product): ``` g <- function(x,y) (x>y[,"start"])&(x<y[,"end"]) fuzzy_join(a,b, multi_by = list(x="x",y=c("start","end")) , multi_match_fun = g, mode = "left") %>% select(x,y) ```
A possible answer to explain what I am trying to do : extending dplyr in some way. And I will be happy to know if there are ways to improve this solution or some problems I didn't see. The solution avoids the cartesian product, but duplicates into lists of data frames both one of the input data frame and the result. I didn't include the final column selection of x and y that is easy to code. ``` my_left_join <- function(.DATA1,.DATA2,.WHERE) { call = as.list(match.call()) df1 <- .DATA1 df1$._row_ <- 1:nrow(df1) dfl1 <- replyr::replyr_split(df1,"._row_") eval(substitute( dfl2 <- mapply(function(.x) {filter(.DATA2,with(.x,WHERE)) %>% mutate(._row_=.x$._row_)} , dfl1, SIMPLIFY=FALSE) ,list(WHERE=call$.WHERE))) df2 <- replyr::replyr_bind_rows(dfl2) left_join(df1,df2,by="._row_") %>% select(-._row_) } my_left_join(a,b,(x>start)&(x<end)) # x start end y #1 1 0 2 a #2 3 NA NA <NA> #3 5 4 6 b my_left_join(a,b,(x==(start+1))|(x==(end+1))) # x start end y #1 1 0 2 a #2 3 0 2 a #3 5 4 6 b ```
50,583,347
I've been trying to import a .class via absolute path while code is running and I don't know how to do it. I found a way to import a class when it's already in project's build path by `Class.forName();`but I need to find a way to load a class that is not in build path. The goal is: 1. User is able to upload his own .class file which is then saved locally to a specific folder and path is saved in database 2. Via GUI user can select this file to be used while code is running 3. My code should load a class via this given absolute path while code is running The problem is with 3rd point because I don't know if it is possible to load a class while code is running. I've tried using `URLClassLoader` but I'm getting ClassNotFound error. **EDIT:** Basically, I have this static function which should return Class by it's name, but urlClassLoader.loadClass() throws error. Name of a file is J48.class so for className argument I've tried using "J48", "J48.class" but none work. Additionaly I've tried setting folder classifiers to build path and setting argument to "weka.classifiers.trees.J48" which is full path with package to this class (package structure is weka.classifiers.trees). ``` `public static Class getClassByName(String className) throws MalformedURLException, ClassNotFoundException { URLClassLoader urlClassLoader = URLClassLoader.newInstance(new URL[] { new URL("file:///D:\\xampp\\htdocs\\prog-ing\\classifiers\\") }); Class class = urlClassLoader.loadClass(className); return class; }` ```
2018/05/29
[ "https://Stackoverflow.com/questions/50583347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7111456/" ]
For this case you don't need `multi_by` or `multy_match_fun`, this works : ``` library(fuzzyjoin) fuzzy_left_join(a, b, by = c(x = "start", x = "end"), match_fun = list(`>`, `<`)) # x start end y # 1 1 0 2 a # 2 3 NA NA <NA> # 3 5 4 6 b ```
I eventually went to the code of fuzzy\_join and found a way to make what I want even without proper documentation. fuzzy\_let\_join doesn't work but there is the following way (not really pretty and it actually does a cartesian product): ``` g <- function(x,y) (x>y[,"start"])&(x<y[,"end"]) fuzzy_join(a,b, multi_by = list(x="x",y=c("start","end")) , multi_match_fun = g, mode = "left") %>% select(x,y) ```
50,583,347
I've been trying to import a .class via absolute path while code is running and I don't know how to do it. I found a way to import a class when it's already in project's build path by `Class.forName();`but I need to find a way to load a class that is not in build path. The goal is: 1. User is able to upload his own .class file which is then saved locally to a specific folder and path is saved in database 2. Via GUI user can select this file to be used while code is running 3. My code should load a class via this given absolute path while code is running The problem is with 3rd point because I don't know if it is possible to load a class while code is running. I've tried using `URLClassLoader` but I'm getting ClassNotFound error. **EDIT:** Basically, I have this static function which should return Class by it's name, but urlClassLoader.loadClass() throws error. Name of a file is J48.class so for className argument I've tried using "J48", "J48.class" but none work. Additionaly I've tried setting folder classifiers to build path and setting argument to "weka.classifiers.trees.J48" which is full path with package to this class (package structure is weka.classifiers.trees). ``` `public static Class getClassByName(String className) throws MalformedURLException, ClassNotFoundException { URLClassLoader urlClassLoader = URLClassLoader.newInstance(new URL[] { new URL("file:///D:\\xampp\\htdocs\\prog-ing\\classifiers\\") }); Class class = urlClassLoader.loadClass(className); return class; }` ```
2018/05/29
[ "https://Stackoverflow.com/questions/50583347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7111456/" ]
For this case you don't need `multi_by` or `multy_match_fun`, this works : ``` library(fuzzyjoin) fuzzy_left_join(a, b, by = c(x = "start", x = "end"), match_fun = list(`>`, `<`)) # x start end y # 1 1 0 2 a # 2 3 NA NA <NA> # 3 5 4 6 b ```
A possible answer to explain what I am trying to do : extending dplyr in some way. And I will be happy to know if there are ways to improve this solution or some problems I didn't see. The solution avoids the cartesian product, but duplicates into lists of data frames both one of the input data frame and the result. I didn't include the final column selection of x and y that is easy to code. ``` my_left_join <- function(.DATA1,.DATA2,.WHERE) { call = as.list(match.call()) df1 <- .DATA1 df1$._row_ <- 1:nrow(df1) dfl1 <- replyr::replyr_split(df1,"._row_") eval(substitute( dfl2 <- mapply(function(.x) {filter(.DATA2,with(.x,WHERE)) %>% mutate(._row_=.x$._row_)} , dfl1, SIMPLIFY=FALSE) ,list(WHERE=call$.WHERE))) df2 <- replyr::replyr_bind_rows(dfl2) left_join(df1,df2,by="._row_") %>% select(-._row_) } my_left_join(a,b,(x>start)&(x<end)) # x start end y #1 1 0 2 a #2 3 NA NA <NA> #3 5 4 6 b my_left_join(a,b,(x==(start+1))|(x==(end+1))) # x start end y #1 1 0 2 a #2 3 0 2 a #3 5 4 6 b ```
44,114
``` [1 . 6 . 7] [. . . 0 .] [3 . . . .] [. . . . 1] [. 7 . 8 .] ``` fill the dots on the table above with 1 digit numbers, so: > > Number in every cell = last digit of (sum of its neighbors (including diagonals)) > or > > Number in every cell = The remainder of the sum of its neighbors divided by 10 > > > > Here are the examples ``` [0,1,6,4,8] [1,2,1,3,2] [1,0,9,0,1] [4,5,6,0,4] [4,5,1,0,9] [6,5,9,5,6] [4,4,0,6,6] [3,3,0,7,7] [5,5,0,5,5] [1,0,4,5,1] [1,0,9,5,6] [9,0,1,0,9] [2,1,4,4,0] [8,7,9,8,9] [4,5,1,5,4] ``` use the fact [here](https://puzzling.stackexchange.com/questions/44052/curios-observation-about-a-special-grid-why) to solve this puzzle. **Note :** I think this puzzle can be solved without computer, but I am not sure.
2016/10/11
[ "https://puzzling.stackexchange.com/questions/44114", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/28756/" ]
My answer to your previous question about these grids showed that there are only two "independent" grids of this type mod 5, and all others are linear combinations of them. By looking at the middle numbers on the top and left sides we can see what combination we need. We could do the same mechanical thing for mod 2, but actually it's just as easy to work it out by hand. I think there are actually two solutions mod 2, leading to two solutions mod 10 to your problem: > > 1 2 6 3 7 > > 4 5 6 0 4 > > 3 3 0 7 7 > > 1 0 4 5 1 > > 8 7 4 8 4 > > > and > > 1 7 6 8 7 > > 9 5 6 0 9 > > 3 3 0 7 7 > > 1 5 4 0 1 > > 3 7 4 8 9 > > >
This is my code in Haskell to generate all table with this properties ``` import Data.List {- a b c d e f g h i j k l m n o p q r s t u v w x y -} ldig xx = mod (sum xx) 10 jawab = [[[a,b,c,d,e],[f,g,h,i,j],[k,l,m,n,o],[p,q,r,s,t],[u,v,w,x,y]]| let hm = [0..9], a<-hm,b<-hm,f<-hm,g<-hm, a == ldig [b,f,g], c<-hm,h<-hm, b == ldig[a,f,g,h,c], d<-hm, i <-hm, c == ldig [b,g,h,i,d], e<-hm, j<-hm, d == ldig [c,h,i,e,j], e == ldig [d,i,j], k<-hm,l<-hm, f == ldig [a,b,g,k,l], m<-hm, g == ldig [a,b,c,f,h,k,l,m], n<-hm, h == ldig [b,c,d,g,i,l,m,n], o<-hm, i == ldig [c,d,e,h,j,m,n,o], j == ldig [d,e,i,n,o], p<-hm,q<-hm, k == ldig [f,g,l,p,q], r<-hm, l == ldig [f,g,h,k,m,p,q,r], s<-hm, m == ldig [g,h,i,l,n,q,r,s], t<-hm, n == ldig [h,i,j,m,o,r,s,t], o == ldig [i,j,n,s,t], u<-hm,v<-hm, p == ldig [k,l,q,u,v], w<-hm, q == ldig [k,l,m,p,r,u,v,w], x<-hm, r == ldig [l,m,n,q,s,v,w,x], y<-hm, s == ldig [m,n,o,r,t,w,x,y], t == ldig [n,o,s,x,y], u == ldig [p,q,v], v == ldig [p,q,r,u,w], w == ldig [q,r,s,v,x], x == ldig [r,s,t,w,y], y == ldig [s,t,x]] ``` After get all result and find the fact that middle cell is always 0, and many other facts, we still can optimize the code above.
45,562,577
I'm composing a web script with Oracle OpenScript. I recorded the actions to be performed * open link * select drop-down menu * select field from drop-down menu * save and I'm trying to now substitute the link to be opened with a variable from a .csv I created in the assets but I get a "Error reading file" message. [**SCREENSHOT**](https://i.stack.imgur.com/pAgyQ.png) Here's the full code: ``` import oracle.oats.scripting.modules.basic.api.*; import oracle.oats.scripting.modules.browser.api.*; import oracle.oats.scripting.modules.functionalTest.api.*; import oracle.oats.scripting.modules.utilities.api.*; import oracle.oats.scripting.modules.utilities.api.sql.*; import oracle.oats.scripting.modules.utilities.api.xml.*; import oracle.oats.scripting.modules.utilities.api.file.*; import oracle.oats.scripting.modules.webdom.api.*; public class script extends IteratingVUserScript { @ScriptService oracle.oats.scripting.modules.utilities.api.UtilitiesService utilities; @ScriptService oracle.oats.scripting.modules.browser.api.BrowserService browser; @ScriptService oracle.oats.scripting.modules.functionalTest.api.FunctionalTestService ft; @ScriptService oracle.oats.scripting.modules.webdom.api.WebDomService web; public void initialize() throws Exception { browser.launch(); } /** * Add code to be executed each iteration for this virtual user. */ public void run() throws Exception { beginStep("[1] No Title (/hotelconfig.html)", 0); { web.window(2, "/web:window[@index='0' or @title='about:blank']") .navigate( "URL"); { think(0.093); } } endStep(); beginStep("[2] Working... (/wia)", 0); { web.window(4, "/web:window[@index='0' or @title='about:blank']") .navigate( "URL"); web.window( 5, "/web:window[@index='0']") .waitForPage(null); { think(6.198); } web.selectBox( 6, "/web:window[@index='0']/web:document[@index='0']/web:form[@index='0']/web:select[(@id='office_id' or @name='office_id' or @index='10') and multiple mod 'False']") .selectOptionByText( "Office"); { think(2.636); } web.button( 7, "/web:window[@index='0']/web:document[@index='0']/web:form[@index='0']/web:input_submit[@name='save' or @value='Save' or @index='0']") .click(); } endStep(); beginStep( "[3] Intranet - Property info - *Hotel Settings - *Hotel configuration (/hotelconfig.html)", 0); { web.window( 8, "/web:window[@index='0']") .waitForPage(null); } endStep(); } public void finish() throws Exception { } } ``` I looked online and on Oracle's community but I couldn't find a fix. I also tried to run the OpenScript Diagnosis Tool but no luck. Anyone has any idea?
2017/08/08
[ "https://Stackoverflow.com/questions/45562577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8308159/" ]
Oracle Application Testing Suite (OATS) best supports csv data sheet reading. Code you pasted is just recording you performed and not seen any issue there. and Screenshot shows error message, something might have gone wrong while creating csv. I can suggest external excel reader , which is inbuilt in OATS itself <http://www.testinghive.com/category/oracle-application-testing-suite-tips/> ``` //Define Sheet name to be read, and provide comma seperated to read multiple sheets String sheetName = "Sheet1"; //Mention excel sheet path String strFile= "C:\\Demo\\test.xls"; //Defined array list to add Sheets to read List sheetList = new ArrayList(); sheetList.add(sheetName); // Iports Sheet1 datatable.importSheets(strFile, sheetList, true, true); //get rowcount info("Total rows :"+datatable.getRowCount()); int rowcount=datatable.getRowCount(); //Loop to read all rows for (int i=0;i<rowcount;i++) { //Set current row fromw here you need to start reading, in this case start from first row datatable.setCurrentRow(sheetName, i); String strCompany=(String) datatable.getValue(sheetName,i,"Company"); String strEmpFName=(String) datatable.getValue(sheetName,i,"FirstName"); String strEmpLName=(String) datatable.getValue(sheetName,i,"LastName"); String strEmpID=(String) datatable.getValue(sheetName,i,"EmpID"); String strLocation=(String) datatable.getValue(sheetName,i,"Location"); //prints first name and last name System.out.println("First Name : "+strEmpFName+", Last Name : "+strEmpLName); //Sets ACTIVE column in excel sheet to Y String strActive="Y"; datatable.setValue(sheetName, i, datatable.getColumn(sheetName, datatable.getColumnIndex("Active")), strActive); } //Updates sheet with updated values ie ACTIVE column sets to Y datatable.exportToExcel("C:\\Demo\\test1.xlsx"); } public void finish() throws Exception { } } ```
I find it easier to use a databank as data provider. By adding a CSV file with the necessary variable, you will be able to do the following substitution: ``` public void run() throws Exception { getDatabank("databank").getNextDatabankRecord(); String v_dataFilename = "{{db.databank.filename}}"; } ```
28,893,736
I need to load an external webpage into a div. I don't want to use an iFrame. And I want this done with plain Javascript or Jquery. I'm not sure how to go about it.
2015/03/06
[ "https://Stackoverflow.com/questions/28893736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4074117/" ]
As pointed out in <https://testdriven-ios.com> a very good approach is to override the NSDate.date in the test case forcing it to return a known date ``` @implementation NSDate (custom) + (instancetype)date{ NSDateFormatter* formatter = NSDateFormatter.new; [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ssZZZ"]; return [formatter dateFromString:@"2017-12-28 13:00:10+0000"]; } @end ``` Then everywhere where NSDate.date is called, the `2017-12-28 13:00:10+0000` will be returned ``` @implementation NSDate (custom) + (instancetype)date{ NSDateFormatter* formatter = NSDateFormatter.new; [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ssZZZ"]; return [formatter dateFromString:theDate]; } @end ``` you can even customize it further by using a static `date` variable and then modify it in the test ``` -(void) test_something_out { theDate = @"2017-12-28 13:00:10+0000"; //Test any function that uses nsdate.date } ```
One simple workaround can be to use following approach: 1. Create a mock class that derives from the class under test. 2. Add a method like "getDate()->NSDate", in the class under test, that returns "NSDate()"- or whatever value is expected. 3. Override the getDate() in the mockClass. You can also create a variable in mock class, that is returned from getDate(). With this, you will be able to supply whatever date you want to from the test. 4. Lastly, instead of creating instance of class that you wish to test, create the instance of mock class in your test.
28,893,736
I need to load an external webpage into a div. I don't want to use an iFrame. And I want this done with plain Javascript or Jquery. I'm not sure how to go about it.
2015/03/06
[ "https://Stackoverflow.com/questions/28893736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4074117/" ]
A good way to test methods that use Date() (or CLLocationManager, ReachabilityManager, or anything else static), is to set up an environment for your entire app which can be mocked in tests. To do this, create an Environment class like so: ``` struct Environment { var date: () -> Date = Date.init } var Env = Environment() ``` Throughout the rest of your app, access the current date via `Env.date()` instead of calling `Date()`. In your tests, create a mock environment like this: ``` extension Environment { static let mock = Environment( date: { return Date(year: 2019, month: 11, day: 12, hour: 2, minute: 45, second: 0, millisecond: 0, timeZone: TimeZone.init(abbreviation: "CST")) } ) } ``` And in the setup for your tests, replace the app environment with the mock env like this: ``` override func setUp() { super.setUp() Env = .mock } ``` I'd recommend putting that in a base class that all your test classes will inherit from so every test will use the mock environment. Now when you run your app you will see the current date, but in tests the date will always come back as Nov. 12, 2019 02:45, so you can verify whatever you want from that known date. For a working example of this setup, I've created a little demo project [here](https://github.com/BevTheDev/Paradigms). Environment.swift, MockEnvironment.swift, DateExamplesViewController.swift, and DateTests.swift are the relevant files.
One simple workaround can be to use following approach: 1. Create a mock class that derives from the class under test. 2. Add a method like "getDate()->NSDate", in the class under test, that returns "NSDate()"- or whatever value is expected. 3. Override the getDate() in the mockClass. You can also create a variable in mock class, that is returned from getDate(). With this, you will be able to supply whatever date you want to from the test. 4. Lastly, instead of creating instance of class that you wish to test, create the instance of mock class in your test.
28,893,736
I need to load an external webpage into a div. I don't want to use an iFrame. And I want this done with plain Javascript or Jquery. I'm not sure how to go about it.
2015/03/06
[ "https://Stackoverflow.com/questions/28893736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4074117/" ]
If you can use `Date.now()` like this, it will be very easy and clean to implement ``` extension Date { static var now: (()->Date) = { return Date() } } print(Date.now()) Date.now = { Date().addingTimeInterval(43534543) } print(Date.now()) ```
One simple workaround can be to use following approach: 1. Create a mock class that derives from the class under test. 2. Add a method like "getDate()->NSDate", in the class under test, that returns "NSDate()"- or whatever value is expected. 3. Override the getDate() in the mockClass. You can also create a variable in mock class, that is returned from getDate(). With this, you will be able to supply whatever date you want to from the test. 4. Lastly, instead of creating instance of class that you wish to test, create the instance of mock class in your test.
28,893,736
I need to load an external webpage into a div. I don't want to use an iFrame. And I want this done with plain Javascript or Jquery. I'm not sure how to go about it.
2015/03/06
[ "https://Stackoverflow.com/questions/28893736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4074117/" ]
As pointed out in <https://testdriven-ios.com> a very good approach is to override the NSDate.date in the test case forcing it to return a known date ``` @implementation NSDate (custom) + (instancetype)date{ NSDateFormatter* formatter = NSDateFormatter.new; [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ssZZZ"]; return [formatter dateFromString:@"2017-12-28 13:00:10+0000"]; } @end ``` Then everywhere where NSDate.date is called, the `2017-12-28 13:00:10+0000` will be returned ``` @implementation NSDate (custom) + (instancetype)date{ NSDateFormatter* formatter = NSDateFormatter.new; [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ssZZZ"]; return [formatter dateFromString:theDate]; } @end ``` you can even customize it further by using a static `date` variable and then modify it in the test ``` -(void) test_something_out { theDate = @"2017-12-28 13:00:10+0000"; //Test any function that uses nsdate.date } ```
NSDate.date (Objective C), Date() (Swift), Date.now() in other languages, are all problematic to mock, because they are *supposed* to give different results on different calls. So if I add an object to a database with the current date, and check that when I read it from the database it has the current date, that's not going to work. Not because there's anything wrong with the database, or with the Date.now() function, but with the way you use it. Mocking Date.now() to always return the same date to make your test work is fundamentally flawed, because the mocked Date.now() doesn't work the way it is supposed to work! Two calls in a row are supposed to return different dates, not the same one! The correct way: Create a date object D, any way you like. Add an object with the date D, write it to the database, read it from the database, check that the date of the object is D. Then check what the database documentation says about precision: If it stores the date as seconds, and you store a date with milliseconds, then either you change the definition of the object ("This object rounds all dates to whole seconds"), or you accept that writing + reading returns an object with a slightly different date, and change the unit test accordingly. So what you do is document what behaviour you expect, make the unit test test the expected behaviour, and on failure you decide if the unit test was wrong, or your code was wrong, or the expected behaviour should have been different. (Unit tests can have bugs as well, and specs for expected behaviour can have bugs).
28,893,736
I need to load an external webpage into a div. I don't want to use an iFrame. And I want this done with plain Javascript or Jquery. I'm not sure how to go about it.
2015/03/06
[ "https://Stackoverflow.com/questions/28893736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4074117/" ]
A good way to test methods that use Date() (or CLLocationManager, ReachabilityManager, or anything else static), is to set up an environment for your entire app which can be mocked in tests. To do this, create an Environment class like so: ``` struct Environment { var date: () -> Date = Date.init } var Env = Environment() ``` Throughout the rest of your app, access the current date via `Env.date()` instead of calling `Date()`. In your tests, create a mock environment like this: ``` extension Environment { static let mock = Environment( date: { return Date(year: 2019, month: 11, day: 12, hour: 2, minute: 45, second: 0, millisecond: 0, timeZone: TimeZone.init(abbreviation: "CST")) } ) } ``` And in the setup for your tests, replace the app environment with the mock env like this: ``` override func setUp() { super.setUp() Env = .mock } ``` I'd recommend putting that in a base class that all your test classes will inherit from so every test will use the mock environment. Now when you run your app you will see the current date, but in tests the date will always come back as Nov. 12, 2019 02:45, so you can verify whatever you want from that known date. For a working example of this setup, I've created a little demo project [here](https://github.com/BevTheDev/Paradigms). Environment.swift, MockEnvironment.swift, DateExamplesViewController.swift, and DateTests.swift are the relevant files.
NSDate.date (Objective C), Date() (Swift), Date.now() in other languages, are all problematic to mock, because they are *supposed* to give different results on different calls. So if I add an object to a database with the current date, and check that when I read it from the database it has the current date, that's not going to work. Not because there's anything wrong with the database, or with the Date.now() function, but with the way you use it. Mocking Date.now() to always return the same date to make your test work is fundamentally flawed, because the mocked Date.now() doesn't work the way it is supposed to work! Two calls in a row are supposed to return different dates, not the same one! The correct way: Create a date object D, any way you like. Add an object with the date D, write it to the database, read it from the database, check that the date of the object is D. Then check what the database documentation says about precision: If it stores the date as seconds, and you store a date with milliseconds, then either you change the definition of the object ("This object rounds all dates to whole seconds"), or you accept that writing + reading returns an object with a slightly different date, and change the unit test accordingly. So what you do is document what behaviour you expect, make the unit test test the expected behaviour, and on failure you decide if the unit test was wrong, or your code was wrong, or the expected behaviour should have been different. (Unit tests can have bugs as well, and specs for expected behaviour can have bugs).
28,893,736
I need to load an external webpage into a div. I don't want to use an iFrame. And I want this done with plain Javascript or Jquery. I'm not sure how to go about it.
2015/03/06
[ "https://Stackoverflow.com/questions/28893736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4074117/" ]
If you can use `Date.now()` like this, it will be very easy and clean to implement ``` extension Date { static var now: (()->Date) = { return Date() } } print(Date.now()) Date.now = { Date().addingTimeInterval(43534543) } print(Date.now()) ```
NSDate.date (Objective C), Date() (Swift), Date.now() in other languages, are all problematic to mock, because they are *supposed* to give different results on different calls. So if I add an object to a database with the current date, and check that when I read it from the database it has the current date, that's not going to work. Not because there's anything wrong with the database, or with the Date.now() function, but with the way you use it. Mocking Date.now() to always return the same date to make your test work is fundamentally flawed, because the mocked Date.now() doesn't work the way it is supposed to work! Two calls in a row are supposed to return different dates, not the same one! The correct way: Create a date object D, any way you like. Add an object with the date D, write it to the database, read it from the database, check that the date of the object is D. Then check what the database documentation says about precision: If it stores the date as seconds, and you store a date with milliseconds, then either you change the definition of the object ("This object rounds all dates to whole seconds"), or you accept that writing + reading returns an object with a slightly different date, and change the unit test accordingly. So what you do is document what behaviour you expect, make the unit test test the expected behaviour, and on failure you decide if the unit test was wrong, or your code was wrong, or the expected behaviour should have been different. (Unit tests can have bugs as well, and specs for expected behaviour can have bugs).
24,577,792
What do I have? * Google Account. * Simple API Key access. * I have created a Custom Search Engine, I've set **Search the entire web but emphasize included sites** in it, and I have removed all the links from **Sites to search** section (so that it searched the entire web, and it's not restricted to a certain website). * From the Custom Search Engine I got **CX** (search engine ID). If I try this command: ``` https://www.googleapis.com/customsearch/v1?key=[MY_API_KEY]&cx=017576662512468239146:omuauf_lfve&q=intitle:%22crazy+stink%22 ``` (the CX is provided by google as an example here: <https://developers.google.com/custom-search/json-api/v1/using_rest>, but I get the same results if I set my own CX). Results: ``` { "kind": "customsearch#search", "url": { "type": "application/json", "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json" }, "queries": { "request": [ { "title": "Google Custom Search - intitle:\"crazy stink\"", "totalResults": "0", "searchTerms": "intitle:\"crazy stink\"", "count": 10, "inputEncoding": "utf8", "outputEncoding": "utf8", "safe": "off", "cx": "017576662512468239146:omuauf_lfve" } ] }, "searchInformation": { "searchTime": 0.35068, "formattedSearchTime": "0.35", "totalResults": "0", "formattedTotalResults": "0" } } ``` If you test this out, you can see that this will give you 0 results, however if you perform a Google search for the same query, you'll get approx. 35 results: <https://www.google.com/search?q=intitle%3A%22crazy+stink%22> This is the main reason why I'm asking for assistance. In my project I need all of these results, if normal Google search gives 35 results, I need to get these 35 results as well. I need this for my C# project, however I don't really care in which format do I get the results (JSON, XML, etc...) I plan on enabling billing feature, and exceeding the "Free" limitations of 100 queries/day I currently have. However before I do that I need to have fully functional facility (which I don't at the moment). --- An additional note: Even with the free AJAX Api: [http://ajax.googleapis.com/ajax/services/search/web?v=1.0&start=1&rsz=large&q=intitle:%22crazy+stink%22](http://ajax.googleapis.com/ajax/services/search/web?v=1.0&start=1&rsz=large&q=intitle%3a%22crazy+stink%22) I get 0 results (you can test this one out without the API key). Results: ``` {"responseData": {"results":[],"cursor":{"moreResultsUrl":"http://www.google.com/search?oe\u003dutf8\u0026ie\u003dutf8\u0026source\u003duds\u0026start\u003d1\u0026hl\u003den\u0026q\u003dintitle:%22crazy+stink%22","searchResultTime":"0.10"}}, "responseDetails": null, "responseStatus": 200} ``` Any ideas, suggestions are more than welcome.
2014/07/04
[ "https://Stackoverflow.com/questions/24577792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1163533/" ]
With this api <https://developers.google.com/custom-search/json-api/v1/using_rest>, You have to give some sites to search, If you didn't provide the sites to search here(<https://www.google.com/cse/all>), It will not show you the results. At least put one site to search, or many sites to search. Your wanted Google Web Search API has been officially deprecated as of November 1, 2010. <https://developers.google.com/web-search/docs/> It only search entire web
I also faced the same issue, after research i found that i didnt provide sites in search engine which i created so i provide www.google.com as a site in search engine page here is the link to add site in your search engine <https://www.google.com/cse/setup/basic?cx=>{your search engine id} after executing above link with your search engine id you will get your search engine page then go into "**Basics**" tab in which go into "**site to search**" section then **Add** site for me i used **www.google.com** and my issue get resolved :)
41,433,965
I have a query which gives me list of total counts of different items, as: ``` $data = DB::table($Table1) ->join($table2,$Table1.'.id','=',$Table2.'.device_key') ->where($Table1.'.created_at', '>', $value) ->select('item', DB::raw('count(*) as total')) ->groupBy('item') ->lists('total', 'item'); ``` now i want to fetch same data with extra condition as >where($Table1.'.status', '=', 'SUCCESS') . how do i do that ??
2017/01/02
[ "https://Stackoverflow.com/questions/41433965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3809745/" ]
I don't think you'll get away with anything nice than this. ``` $query = DB::table($Table1) ->join($table2,$Table1.'.id','=',$Table2.'.device_key') ->where($Table1.'.created_at', '>', $value) ->select('item', DB::raw('count(*) as total')) ->groupBy('item'); $data1 = $query->lists('total', 'rem'); $data2 = $query->where($Table1 . '.status', '=', 'SUCCESS')->lists('total, 'rem'); ```
Use clone to copy the query object for modifications. ``` $query = DB::table()->where(); $clonedQuery = clone $query; $clonedQuery->where(..); ```
35,994,640
To convert HTML to jade is use this [jade converter](http://html2jade.aaron-powell.com/). When I enter the following HTML, ``` <!doctype html> <html class="no-js"> <head> <meta charset="utf-8"> </head> <body> <div class="container"> <div class="header"> <ul class="nav nav-pills pull-right"> <li class="active"><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </div> </div> </body> </html> ``` the output is as follows: ``` doctype html.no-js head meta(charset='utf-8') | body .container .header ul.nav.nav-pills.pull-right li.active a(href='#') Home | li a(href='#') About | li a(href='#') Contact ``` What is the purpose of the vertical bars (`|`) ?
2016/03/14
[ "https://Stackoverflow.com/questions/35994640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4670075/" ]
It is just a better visualization of plain text in jade templates. see <https://pugjs.org/language/plain-text.html>
Quick update to @burnedikt's answer. Since Jade is now Pug due to a copyright issue with the word "Jade", the website has also changed. The current link is <https://pugjs.org/language/plain-text.html#piped-text>. FYI what it says is simply: > > Another way to add plain text to templates is to prefix a line with a pipe character (|). This method is useful for mixing plain text with inline tags, as we discuss later, in the Whitespace Control section. > > > If you are interested in doing multiline text without having to have a vertical slash (another name for the 'pipe' character) every time, check out this answer: [jade template engine (under node.js): multi-line block without pipe symbol](https://stackoverflow.com/q/4717703/1492590).
59,267,975
I wrote a SP which will call internally another parameterized SP and output will be store into a physical table.While I am executing Outer SP I am getting following error. > > Msg 207, Level 16, State 1, Procedure CBs\_LargeExposer, Line 88 [Batch > Start Line 12] Invalid column name 'SlNo'. > > > I observed, if I execute inner SP in separate window and very next to it if I execute the same outer SP is working fine, after certain time if I execute the same statement(Outer SP) I am getting same error. ```sql ALTER PROCEDURE [dbo].[CBS_GlMapping] @finYear nvarchar(30)='2019-2020', @quarter char(5)='Q2', @Oflag Varchar(6)='O4' AS BEGIN SET NOCOUNT ON; Declare @QtrStart date,@QtrSEnd date,@FyFrom int,@FyTo int,@BranchId int select @FyFrom=year(YearBeginDate),@FyTo=Year(YEarEndDate) from BranchTable where BranchCode in(select OrgBankCode from OrgDetails) IF(@FyFrom < left(@finYear,4) and @FyTo < Right(@finYear,4)) Begin print 'Sorry, Recods are not available for the financial year ' + @finYear return End If(@quarter='Q1') Begin select @QtrStart=YearBeginDate,@QtrSEnd=EOMONTH(DATEADD(MM,2,YearBeginDate)) from BranchTable where BranchCode in(select OrgBankCode from OrgDetails) End If(@quarter='Q2') Begin select @QtrStart=Dateadd(mm,3,YearBeginDate),@QtrSEnd=EOMONTH(DATEADD(MM,5,YearBeginDate)) from BranchTable where BranchCode in(select OrgBankCode from OrgDetails) End If(@quarter='Q3') Begin select @QtrStart=Dateadd(mm,6,YearBeginDate),@QtrSEnd=EOMONTH(DATEADD(MM,8,YearBeginDate)) from BranchTable where BranchCode in(select OrgBankCode from OrgDetails) End If(@quarter='Q4') Begin select @QtrStart=DATEADD(month, DATEDIFF(month, 0,Dateadd(mm,-2,YEarEndDate)), 0),@QtrSEnd=YEarEndDate from BranchTable where BranchCode in(select OrgBankCode from OrgDetails) End /* To handel the Financial year */ if(left(@finYear,4)<year(@QtrStart) and @quarter<>'Q4') begin set @QtrStart = cast(left(@finYear,4) as varchar(4))+'-'+cast(month(@QtrStart) as Varchar(2))+'-'+Cast(day(@QtrStart) as Varchar(2)) set @QtrSEnd = cast(left(@finYear,4) as varchar(4))+'-'+cast(month(@QtrSEnd) as Varchar(2))+'-'+Cast(day(@QtrSEnd) as Varchar(2)) end if(right(@finYear,4)<year(@QtrStart) and @quarter='Q4') begin set @QtrStart = cast(right(@finYear,4) as varchar(4))+'-'+cast(month(@QtrStart) as Varchar(2))+'-'+Cast(day(@QtrStart) as Varchar(2)) set @QtrSEnd = cast(right(@finYear,4) as varchar(4))+'-'+cast(month(@QtrSEnd) as Varchar(2))+'-'+Cast(day(@QtrSEnd) as Varchar(2)) end Create table #tempData ( Bal numeric(15,2) ) declare @sql varchar(500),@sql2 varchar(500),@day Varchar(10),@Month varchar(2),@Year varchar(4) select @day= Day(@QtrSEnd) select @Month= month(@QtrSEnd) select @Year= Year(@QtrSEnd) Create table #temp ( slno int, glcode Varchar(500), GlLen int, ColNO varchar(50), CellNo varchar(50), Amount Numeric(15,2) ) declare @tsql varchar(500) set @tsql=N' insert into #temp select ROW_NUMBER() over(order by glcode) slno,glcode,LEN(Glcode) GlLen,ColNo,CellNo,amount from BsGl'+@Oflag+' where glcode <>'''' ' exec(@tsql) declare @LoopStart int,@loopEnd Int,@glcode varchar(500),@amt numeric(15,0) select @LoopStart=Min(Slno) from #temp select @loopEnd=MAX(Slno) from #temp while (@LoopStart <= @loopEnd) begin select @glcode= Glcode from #temp where slno = @LoopStart set @sql='insert into #tempData select Sum(day'+@day+') from DayBal where AcYear='+@Year+' and acmonth='+@Month+'and GlCode in(SELECT glcode FROM dbo.splitstring(convert(varchar(500),'''+@glcode+''')))' EXEC(@sql) update #temp set Amount=(select Bal from #tempData) where slno =@LoopStart set @LoopStart=@LoopStart+1 Truncate table #tempData end set @tsql='' set @tsql='update BsGl'+@Oflag+' set Amount=0.00 where Glcode ='''' ' EXEC(@tsql) set @tsql='' set @tsql='update B set B.amount=isnull(round((Case when A.Amount<0 then A.Amount*(-1) else A.Amount end/1000),0),0) from #temp a inner join BsGl'+@Oflag+' B on a.CellNo=B.CellNo and B.ColNo=A.ColNo' EXEC(@tsql) IF(@Oflag='O4') BEGIN EXEC [DBO].[CBs_LargeExposer] @QtrSEnd END Drop table #temp End ```
2019/12/10
[ "https://Stackoverflow.com/questions/59267975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12510748/" ]
So I ended up fixing this problem by overriding how the anchor tag helper works and making sure it always passes in the culture from the route. This is the custom tag helper: ``` [HtmlTargetElement("a", Attributes = ActionAttributeName)] [HtmlTargetElement("a", Attributes = ControllerAttributeName)] [HtmlTargetElement("a", Attributes = AreaAttributeName)] [HtmlTargetElement("a", Attributes = PageAttributeName)] [HtmlTargetElement("a", Attributes = PageHandlerAttributeName)] [HtmlTargetElement("a", Attributes = FragmentAttributeName)] [HtmlTargetElement("a", Attributes = HostAttributeName)] [HtmlTargetElement("a", Attributes = ProtocolAttributeName)] [HtmlTargetElement("a", Attributes = RouteAttributeName)] [HtmlTargetElement("a", Attributes = RouteValuesDictionaryName)] [HtmlTargetElement("a", Attributes = RouteValuesPrefix + "*")] public class CultureAnchorTagHelper : AnchorTagHelper { private const string ActionAttributeName = "asp-action"; private const string ControllerAttributeName = "asp-controller"; private const string AreaAttributeName = "asp-area"; private const string PageAttributeName = "asp-page"; private const string PageHandlerAttributeName = "asp-page-handler"; private const string FragmentAttributeName = "asp-fragment"; private const string HostAttributeName = "asp-host"; private const string ProtocolAttributeName = "asp-protocol"; private const string RouteAttributeName = "asp-route"; private const string RouteValuesDictionaryName = "asp-all-route-data"; private const string RouteValuesPrefix = "asp-route-"; public CultureAnchorTagHelper(IHtmlGenerator generator, IHttpContextAccessor contextAccessor) : base(generator) { var culture = contextAccessor.HttpContext.Request.RouteValues["culture"]?.ToString() ?? "en"; RouteValues["culture"] = culture; } } ``` To use it you need to remove the default anchor tag helper and add your own in `_ViewImports.cshtml`: ``` @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @removeTagHelper Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Your.Assembly.Namespace //assembly name containing class above ``` Some useful links: * [anchor tag source code](https://github.com/aspnet/Mvc/blob/master/src/Microsoft.AspNetCore.Mvc.TagHelpers/AnchorTagHelper.cs) * [tag helpers](https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro?view=aspnetcore-3.1) * [extending tag helpers](http://rion.io/2017/04/27/extending-tag-helpers-in-asp-net-core-applications/)
@herostwist, your solution saved my day :) just a simplified version of it: ```cs //... public CultureAnchorTagHelper(IHtmlGenerator generator) : base(generator) { RouteValues["culture"] = CultureInfo.CurrentCulture.Name; } ```
11,629,444
So is it possible to do all the development of a Java daemon (Apache Daemon) on a Windows 7 machine, then install the service on Ubuntu server (still have to search how to do that) which has OpenJDK installed ? If yes, how can I identify the compatible versions of Java on both systems ? I mean if I'm using Java 1.6 on windows, what is the least compatible OpenJDK version I should have on Ubuntu server ?
2012/07/24
[ "https://Stackoverflow.com/questions/11629444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897041/" ]
Mostly yes, but for corner cases it depends and should be carefully tested on stage that match closely to production configuration. Here are examples of compiler crash and test failure that occurs on OpenJDK, while the same snapshot of sources are green when build by Oracle JDK: <http://travis-ci.org/#!/plokhotnyuk/actors/builds/1948184> <http://travis-ci.org/#!/plokhotnyuk/calculator/builds/1948194>
Java byte code is portable and can be executed using any JVM that has same or newer version.
11,629,444
So is it possible to do all the development of a Java daemon (Apache Daemon) on a Windows 7 machine, then install the service on Ubuntu server (still have to search how to do that) which has OpenJDK installed ? If yes, how can I identify the compatible versions of Java on both systems ? I mean if I'm using Java 1.6 on windows, what is the least compatible OpenJDK version I should have on Ubuntu server ?
2012/07/24
[ "https://Stackoverflow.com/questions/11629444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897041/" ]
Java byte code is portable and can be executed using any JVM that has same or newer version.
No, that's not but you have nothing to worry about this.Java is a standardized platform, you should be able to compile and run on any implementation of it. Just as long as you keep the version in mind. Java 7 software is not going to run on a Java 6 installation completely. Java 6 software does work on a Java 7 installation completely though.
11,629,444
So is it possible to do all the development of a Java daemon (Apache Daemon) on a Windows 7 machine, then install the service on Ubuntu server (still have to search how to do that) which has OpenJDK installed ? If yes, how can I identify the compatible versions of Java on both systems ? I mean if I'm using Java 1.6 on windows, what is the least compatible OpenJDK version I should have on Ubuntu server ?
2012/07/24
[ "https://Stackoverflow.com/questions/11629444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897041/" ]
Java byte code is portable and can be executed using any JVM that has same or newer version.
If you have compiled for Java 1.6, you need at least OpenJDK 1.6. There are rare cases where Hotspot and OpenJDK are different but since Hotspot is based on the OpenJDK you are more likely to see minor differences in build versions. Both JVMs comply with the JLS spec and IMHO are practically reference implementations. The OpenJDK is the open standard and a HotSpot is widely used as the commercial standard. The releases are almost exactly the same. You can install the same version of Hotspot on Ubuntu if this is a real concern.
11,629,444
So is it possible to do all the development of a Java daemon (Apache Daemon) on a Windows 7 machine, then install the service on Ubuntu server (still have to search how to do that) which has OpenJDK installed ? If yes, how can I identify the compatible versions of Java on both systems ? I mean if I'm using Java 1.6 on windows, what is the least compatible OpenJDK version I should have on Ubuntu server ?
2012/07/24
[ "https://Stackoverflow.com/questions/11629444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897041/" ]
Mostly yes, but for corner cases it depends and should be carefully tested on stage that match closely to production configuration. Here are examples of compiler crash and test failure that occurs on OpenJDK, while the same snapshot of sources are green when build by Oracle JDK: <http://travis-ci.org/#!/plokhotnyuk/actors/builds/1948184> <http://travis-ci.org/#!/plokhotnyuk/calculator/builds/1948194>
No, that's not but you have nothing to worry about this.Java is a standardized platform, you should be able to compile and run on any implementation of it. Just as long as you keep the version in mind. Java 7 software is not going to run on a Java 6 installation completely. Java 6 software does work on a Java 7 installation completely though.
11,629,444
So is it possible to do all the development of a Java daemon (Apache Daemon) on a Windows 7 machine, then install the service on Ubuntu server (still have to search how to do that) which has OpenJDK installed ? If yes, how can I identify the compatible versions of Java on both systems ? I mean if I'm using Java 1.6 on windows, what is the least compatible OpenJDK version I should have on Ubuntu server ?
2012/07/24
[ "https://Stackoverflow.com/questions/11629444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897041/" ]
Mostly yes, but for corner cases it depends and should be carefully tested on stage that match closely to production configuration. Here are examples of compiler crash and test failure that occurs on OpenJDK, while the same snapshot of sources are green when build by Oracle JDK: <http://travis-ci.org/#!/plokhotnyuk/actors/builds/1948184> <http://travis-ci.org/#!/plokhotnyuk/calculator/builds/1948194>
If you have compiled for Java 1.6, you need at least OpenJDK 1.6. There are rare cases where Hotspot and OpenJDK are different but since Hotspot is based on the OpenJDK you are more likely to see minor differences in build versions. Both JVMs comply with the JLS spec and IMHO are practically reference implementations. The OpenJDK is the open standard and a HotSpot is widely used as the commercial standard. The releases are almost exactly the same. You can install the same version of Hotspot on Ubuntu if this is a real concern.
11,629,444
So is it possible to do all the development of a Java daemon (Apache Daemon) on a Windows 7 machine, then install the service on Ubuntu server (still have to search how to do that) which has OpenJDK installed ? If yes, how can I identify the compatible versions of Java on both systems ? I mean if I'm using Java 1.6 on windows, what is the least compatible OpenJDK version I should have on Ubuntu server ?
2012/07/24
[ "https://Stackoverflow.com/questions/11629444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897041/" ]
If you have compiled for Java 1.6, you need at least OpenJDK 1.6. There are rare cases where Hotspot and OpenJDK are different but since Hotspot is based on the OpenJDK you are more likely to see minor differences in build versions. Both JVMs comply with the JLS spec and IMHO are practically reference implementations. The OpenJDK is the open standard and a HotSpot is widely used as the commercial standard. The releases are almost exactly the same. You can install the same version of Hotspot on Ubuntu if this is a real concern.
No, that's not but you have nothing to worry about this.Java is a standardized platform, you should be able to compile and run on any implementation of it. Just as long as you keep the version in mind. Java 7 software is not going to run on a Java 6 installation completely. Java 6 software does work on a Java 7 installation completely though.
79,984
I want to understand Prop 6 in the paper "[Convergence of the Q-curvarture flow on $S^4$](http://dx.doi.org/10.1016/j.aim.2005.07.002)" by Simon Brendle. I understand that for every $p\in B^4$, where $B^4=\{x\in\mathbb{R}^5: |x|\leq 1\}$, $$\phi(x)=p+\frac{1-|p|^2}{1+2\langle p,x\rangle+|p|^2}(x+p) $$defines a conformal diffeomorphism from $S^4$ to $S^4$, where $S^4=\{x\in\mathbb{R}^5: |x|=1\}$ is the sphere (This fact was proved in the paper in P.11). My questions are: (i) How is the formula derived? I want to understand how can we know the conformal map is related to some $p\in B^4$ and why the formula is in this particular form. Of course, if I already know the formula I can just check by definition it is a conformal map. (ii) Is every conformal diffeomorphism from $S^4$ to $S^4$ in this form? I think this is related to Liouville's Theorem.
2011/11/03
[ "https://mathoverflow.net/questions/79984", "https://mathoverflow.net", "https://mathoverflow.net/users/14579/" ]
Conformal diffeomorphisms of $S^n$ correspond to hyperbolic isometries of hyperbolic space $\mathbb H^{n+1}$ -- the idea is to think of $S^n$ as the visual sphere for hyperbolic space, all conformal diffeos extend uniquely to a hyperbolic isometry. For (ii), no. Hyperbolic isometries have various forms. Your $\phi$ does not give you any elliptic or parabolic elements. You can work out similar formula for a general conformal map. What you do is you write-out your hyperbolic isometry in your favourite model of hyperbolic geometry, and then restrict it to the sphere. Ratcliffe's book is maybe one of the better sources for these types of formula, but they're available in many places.
Another approach to conformal maps is to use stereographic projection and work on $R^n$. There, you basically want to show that the only conformal maps are higher dimensional analogues of Mobius transformations. I'm not sure, but i think the survey article by Lee and Parker on the Yamabe problem in the Bulletin of the AMS goes through the details. It's also a really nice exercise to try to work this all out yourself.
79,984
I want to understand Prop 6 in the paper "[Convergence of the Q-curvarture flow on $S^4$](http://dx.doi.org/10.1016/j.aim.2005.07.002)" by Simon Brendle. I understand that for every $p\in B^4$, where $B^4=\{x\in\mathbb{R}^5: |x|\leq 1\}$, $$\phi(x)=p+\frac{1-|p|^2}{1+2\langle p,x\rangle+|p|^2}(x+p) $$defines a conformal diffeomorphism from $S^4$ to $S^4$, where $S^4=\{x\in\mathbb{R}^5: |x|=1\}$ is the sphere (This fact was proved in the paper in P.11). My questions are: (i) How is the formula derived? I want to understand how can we know the conformal map is related to some $p\in B^4$ and why the formula is in this particular form. Of course, if I already know the formula I can just check by definition it is a conformal map. (ii) Is every conformal diffeomorphism from $S^4$ to $S^4$ in this form? I think this is related to Liouville's Theorem.
2011/11/03
[ "https://mathoverflow.net/questions/79984", "https://mathoverflow.net", "https://mathoverflow.net/users/14579/" ]
Conformal diffeomorphisms of $S^n$ correspond to hyperbolic isometries of hyperbolic space $\mathbb H^{n+1}$ -- the idea is to think of $S^n$ as the visual sphere for hyperbolic space, all conformal diffeos extend uniquely to a hyperbolic isometry. For (ii), no. Hyperbolic isometries have various forms. Your $\phi$ does not give you any elliptic or parabolic elements. You can work out similar formula for a general conformal map. What you do is you write-out your hyperbolic isometry in your favourite model of hyperbolic geometry, and then restrict it to the sphere. Ratcliffe's book is maybe one of the better sources for these types of formula, but they're available in many places.
See my [answer](https://mathoverflow.net/questions/60687/the-conformal-group-of-sn/60731#60731) to a question about conformal diffeomorphims of a sphere.
79,984
I want to understand Prop 6 in the paper "[Convergence of the Q-curvarture flow on $S^4$](http://dx.doi.org/10.1016/j.aim.2005.07.002)" by Simon Brendle. I understand that for every $p\in B^4$, where $B^4=\{x\in\mathbb{R}^5: |x|\leq 1\}$, $$\phi(x)=p+\frac{1-|p|^2}{1+2\langle p,x\rangle+|p|^2}(x+p) $$defines a conformal diffeomorphism from $S^4$ to $S^4$, where $S^4=\{x\in\mathbb{R}^5: |x|=1\}$ is the sphere (This fact was proved in the paper in P.11). My questions are: (i) How is the formula derived? I want to understand how can we know the conformal map is related to some $p\in B^4$ and why the formula is in this particular form. Of course, if I already know the formula I can just check by definition it is a conformal map. (ii) Is every conformal diffeomorphism from $S^4$ to $S^4$ in this form? I think this is related to Liouville's Theorem.
2011/11/03
[ "https://mathoverflow.net/questions/79984", "https://mathoverflow.net", "https://mathoverflow.net/users/14579/" ]
Conformal diffeomorphisms of $S^n$ correspond to hyperbolic isometries of hyperbolic space $\mathbb H^{n+1}$ -- the idea is to think of $S^n$ as the visual sphere for hyperbolic space, all conformal diffeos extend uniquely to a hyperbolic isometry. For (ii), no. Hyperbolic isometries have various forms. Your $\phi$ does not give you any elliptic or parabolic elements. You can work out similar formula for a general conformal map. What you do is you write-out your hyperbolic isometry in your favourite model of hyperbolic geometry, and then restrict it to the sphere. Ratcliffe's book is maybe one of the better sources for these types of formula, but they're available in many places.
Here is a geometric illustration for the conformal map $\phi$ on $S^1$. On $S^n$ this is the same. [The conformal map $\phi$ on $S^1$](https://i.stack.imgur.com/M4MCJ.png) I hope this is enough to realize the formule given by Brendle in his paper.
79,984
I want to understand Prop 6 in the paper "[Convergence of the Q-curvarture flow on $S^4$](http://dx.doi.org/10.1016/j.aim.2005.07.002)" by Simon Brendle. I understand that for every $p\in B^4$, where $B^4=\{x\in\mathbb{R}^5: |x|\leq 1\}$, $$\phi(x)=p+\frac{1-|p|^2}{1+2\langle p,x\rangle+|p|^2}(x+p) $$defines a conformal diffeomorphism from $S^4$ to $S^4$, where $S^4=\{x\in\mathbb{R}^5: |x|=1\}$ is the sphere (This fact was proved in the paper in P.11). My questions are: (i) How is the formula derived? I want to understand how can we know the conformal map is related to some $p\in B^4$ and why the formula is in this particular form. Of course, if I already know the formula I can just check by definition it is a conformal map. (ii) Is every conformal diffeomorphism from $S^4$ to $S^4$ in this form? I think this is related to Liouville's Theorem.
2011/11/03
[ "https://mathoverflow.net/questions/79984", "https://mathoverflow.net", "https://mathoverflow.net/users/14579/" ]
Conformal diffeomorphisms of $S^n$ correspond to hyperbolic isometries of hyperbolic space $\mathbb H^{n+1}$ -- the idea is to think of $S^n$ as the visual sphere for hyperbolic space, all conformal diffeos extend uniquely to a hyperbolic isometry. For (ii), no. Hyperbolic isometries have various forms. Your $\phi$ does not give you any elliptic or parabolic elements. You can work out similar formula for a general conformal map. What you do is you write-out your hyperbolic isometry in your favourite model of hyperbolic geometry, and then restrict it to the sphere. Ratcliffe's book is maybe one of the better sources for these types of formula, but they're available in many places.
When I first saw this equation, I think it was just the inversion of unit sphere with respect to some sphere with center $-p$ and radius $r$, then I tried to write it in a form that look likes inversion: $$\varphi=\frac{1-|p|^2}{|x+p|}\cdot\frac{x+p}{|x+p|}+p$$ So actually you fix point $p$ first, then draw a sphere $T$ with origin at $-p$ and radius $r=\sqrt{1-|p|^2}.$ Then above map is just the inversion of unit sphere with respect to this sphere $T$. This map actually looks similar to the conformal maps constructed by Yau "Lectures on Differential geometry" and Nadirashvili "A differential invariant related to the first steklov eigenvalue", but I think they built such sphere $T$ with origin outside of unit sphere. In this way I guess you can construct infinitely many different transformations.
79,984
I want to understand Prop 6 in the paper "[Convergence of the Q-curvarture flow on $S^4$](http://dx.doi.org/10.1016/j.aim.2005.07.002)" by Simon Brendle. I understand that for every $p\in B^4$, where $B^4=\{x\in\mathbb{R}^5: |x|\leq 1\}$, $$\phi(x)=p+\frac{1-|p|^2}{1+2\langle p,x\rangle+|p|^2}(x+p) $$defines a conformal diffeomorphism from $S^4$ to $S^4$, where $S^4=\{x\in\mathbb{R}^5: |x|=1\}$ is the sphere (This fact was proved in the paper in P.11). My questions are: (i) How is the formula derived? I want to understand how can we know the conformal map is related to some $p\in B^4$ and why the formula is in this particular form. Of course, if I already know the formula I can just check by definition it is a conformal map. (ii) Is every conformal diffeomorphism from $S^4$ to $S^4$ in this form? I think this is related to Liouville's Theorem.
2011/11/03
[ "https://mathoverflow.net/questions/79984", "https://mathoverflow.net", "https://mathoverflow.net/users/14579/" ]
Another approach to conformal maps is to use stereographic projection and work on $R^n$. There, you basically want to show that the only conformal maps are higher dimensional analogues of Mobius transformations. I'm not sure, but i think the survey article by Lee and Parker on the Yamabe problem in the Bulletin of the AMS goes through the details. It's also a really nice exercise to try to work this all out yourself.
See my [answer](https://mathoverflow.net/questions/60687/the-conformal-group-of-sn/60731#60731) to a question about conformal diffeomorphims of a sphere.
79,984
I want to understand Prop 6 in the paper "[Convergence of the Q-curvarture flow on $S^4$](http://dx.doi.org/10.1016/j.aim.2005.07.002)" by Simon Brendle. I understand that for every $p\in B^4$, where $B^4=\{x\in\mathbb{R}^5: |x|\leq 1\}$, $$\phi(x)=p+\frac{1-|p|^2}{1+2\langle p,x\rangle+|p|^2}(x+p) $$defines a conformal diffeomorphism from $S^4$ to $S^4$, where $S^4=\{x\in\mathbb{R}^5: |x|=1\}$ is the sphere (This fact was proved in the paper in P.11). My questions are: (i) How is the formula derived? I want to understand how can we know the conformal map is related to some $p\in B^4$ and why the formula is in this particular form. Of course, if I already know the formula I can just check by definition it is a conformal map. (ii) Is every conformal diffeomorphism from $S^4$ to $S^4$ in this form? I think this is related to Liouville's Theorem.
2011/11/03
[ "https://mathoverflow.net/questions/79984", "https://mathoverflow.net", "https://mathoverflow.net/users/14579/" ]
Another approach to conformal maps is to use stereographic projection and work on $R^n$. There, you basically want to show that the only conformal maps are higher dimensional analogues of Mobius transformations. I'm not sure, but i think the survey article by Lee and Parker on the Yamabe problem in the Bulletin of the AMS goes through the details. It's also a really nice exercise to try to work this all out yourself.
Here is a geometric illustration for the conformal map $\phi$ on $S^1$. On $S^n$ this is the same. [The conformal map $\phi$ on $S^1$](https://i.stack.imgur.com/M4MCJ.png) I hope this is enough to realize the formule given by Brendle in his paper.
79,984
I want to understand Prop 6 in the paper "[Convergence of the Q-curvarture flow on $S^4$](http://dx.doi.org/10.1016/j.aim.2005.07.002)" by Simon Brendle. I understand that for every $p\in B^4$, where $B^4=\{x\in\mathbb{R}^5: |x|\leq 1\}$, $$\phi(x)=p+\frac{1-|p|^2}{1+2\langle p,x\rangle+|p|^2}(x+p) $$defines a conformal diffeomorphism from $S^4$ to $S^4$, where $S^4=\{x\in\mathbb{R}^5: |x|=1\}$ is the sphere (This fact was proved in the paper in P.11). My questions are: (i) How is the formula derived? I want to understand how can we know the conformal map is related to some $p\in B^4$ and why the formula is in this particular form. Of course, if I already know the formula I can just check by definition it is a conformal map. (ii) Is every conformal diffeomorphism from $S^4$ to $S^4$ in this form? I think this is related to Liouville's Theorem.
2011/11/03
[ "https://mathoverflow.net/questions/79984", "https://mathoverflow.net", "https://mathoverflow.net/users/14579/" ]
Another approach to conformal maps is to use stereographic projection and work on $R^n$. There, you basically want to show that the only conformal maps are higher dimensional analogues of Mobius transformations. I'm not sure, but i think the survey article by Lee and Parker on the Yamabe problem in the Bulletin of the AMS goes through the details. It's also a really nice exercise to try to work this all out yourself.
When I first saw this equation, I think it was just the inversion of unit sphere with respect to some sphere with center $-p$ and radius $r$, then I tried to write it in a form that look likes inversion: $$\varphi=\frac{1-|p|^2}{|x+p|}\cdot\frac{x+p}{|x+p|}+p$$ So actually you fix point $p$ first, then draw a sphere $T$ with origin at $-p$ and radius $r=\sqrt{1-|p|^2}.$ Then above map is just the inversion of unit sphere with respect to this sphere $T$. This map actually looks similar to the conformal maps constructed by Yau "Lectures on Differential geometry" and Nadirashvili "A differential invariant related to the first steklov eigenvalue", but I think they built such sphere $T$ with origin outside of unit sphere. In this way I guess you can construct infinitely many different transformations.
3,565,988
If i have a button pressed method like this: ``` $('#next').click(function () { }); ``` How can i stop this method being initiated whilst its running. Say the method takes 5 seconds to run and someone clicks it 3 seconds in it breaks so i want to make the div thats being clicked unclickable while the methods running.
2010/08/25
[ "https://Stackoverflow.com/questions/3565988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/378022/" ]
Replace the clicked link with `<p>loading...</p>`
``` $('#next').click(function () { $(this).attr("disabled", "disabled"); stuffff $(this).attr("disabled", ""); }); ```
3,565,988
If i have a button pressed method like this: ``` $('#next').click(function () { }); ``` How can i stop this method being initiated whilst its running. Say the method takes 5 seconds to run and someone clicks it 3 seconds in it breaks so i want to make the div thats being clicked unclickable while the methods running.
2010/08/25
[ "https://Stackoverflow.com/questions/3565988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/378022/" ]
``` $('#next').click(function () { $(this).attr("disabled", "disabled"); stuffff $(this).attr("disabled", ""); }); ```
You can use "disabled" to disable the button while your execution, as like byron said
3,565,988
If i have a button pressed method like this: ``` $('#next').click(function () { }); ``` How can i stop this method being initiated whilst its running. Say the method takes 5 seconds to run and someone clicks it 3 seconds in it breaks so i want to make the div thats being clicked unclickable while the methods running.
2010/08/25
[ "https://Stackoverflow.com/questions/3565988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/378022/" ]
Replace the clicked link with `<p>loading...</p>`
You can use "disabled" to disable the button while your execution, as like byron said
57,612,712
I'm trying to setup a parent > child relationship, in which the parent is scrollable but the child does not scroll and stays fixed at top 50%. I have tried using multiple positions and means of separating the child from the parent but it is important that this relationship stays the same. This is for a mega-menu in which the main list is very long and should scroll on the left-side, but the secondary-level, as it is shorter, when shown should stay top centred and not scroll with the parent so that it is always in view ```css * { box-sizing: border-box; } .nothing { position: relative; } .container { position: relative; border: solid 1px red; height: 256px; width: 256px; overflow: scroll; float: left; margin-right: 16px; } .inner { position: relative; height: auto; overflow: hidden; } .full-height { position: absolute; top: 50%; transform: translateY(-50%); left: 0; right: 128px; bottom: 0; height: 50px; background: blue; } ``` ```html <div class="container"> <div class="full-height"> </div> </div> <div class="nothing"> <div class="container"> <div class="inner"> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur mollitia maxime facere quae cumque perferendis cum atque quia repellendus rerum eaque quod quibusdam incidunt blanditiis possimus temporibus reiciendis deserunt sequi eveniet necessitatibus maiores quas assumenda voluptate qui odio laboriosam totam repudiandae? Doloremque dignissimos voluptatibus eveniet rem quasi minus ex cumque esse culpa cupiditate cum architecto! Facilis deleniti unde suscipit minima obcaecati vero ea soluta odio cupiditate placeat vitae nesciunt quis alias dolorum nemo sint facere. Deleniti itaque incidunt eligendi qui nemo corporis ducimus beatae consequatur est iusto dolorum consequuntur vero debitis saepe voluptatem impedit sint ea numquam quia voluptate quidem. <div class="full-height"></div> </div> </div> </div> ``` In the example, I'd like to know how to get the text to be scrollable but the blue box to stay centred within the initial viewport.
2019/08/22
[ "https://Stackoverflow.com/questions/57612712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11963448/" ]
The problem is that Keras for R creates its own virtual environment, called `r-reticulate`, and pillow is missing in there. You also have to find out whether it used conda or virtualenv to create such environment. Then, activate it and install pillow and scipy. Finally, restart the R session. In my case it was conda: ``` $ conda env list # conda environments: # base * C:\Users\black\Anaconda3 py2 C:\Users\black\Anaconda3\envs\py2 r-reticulate C:\Users\black\Anaconda3\envs\r-reticulate $ conda activate r-reticulate $ conda install pillow scipy ```
It's an old question, but this is what worked for me just now: use `reticulate::py_install("pillow")` to install any missing packages into the reticulate environment directly.
47,472,689
I have the following T-SQL query which I'm trying to convert into C# code: ```sql SELECT *, DATEFROMPARTS(Jaar, Maand, 1) FROM EAN_Budget_Meetdata_Factuur WHERE EID = 1 AND Bron = 'B' AND DATEFROMPARTS(Jaar, Maand, 1) BETWEEN '20161101' AND '20170101' ``` The table contains a column Year and Month, and I'm querying the table based on two known DateTimes (a period). The query is meant to retrieve the table rows that apply to this period based on the years and months between the two DateTimes. What is the best way to convert this query into C#? I've so far come up with the following, without success: ``` var query = from b in CT2.EAN_Budget_Meetdata_Factuur let JaarTest = b.Jaar + "-" + b.Maand + "-01" where b.EID == 1 && b.Bron == "B" && JaarTest == "something" select new { JaarTest = b.Jaar + "-" + b.Maand + "-01" }; ```
2017/11/24
[ "https://Stackoverflow.com/questions/47472689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453213/" ]
You can use cursor option available with aggregate query pipeline. ``` {cursor: { batchSize: batch_size }} ``` <https://docs.mongodb.com/manual/reference/method/db.collection.aggregate/> `Aggregation.newAggregation(AggregationOperation... operations).withOptions(new AggregationOptions(false,false,new Document().append("batchSize" , batch_size)))` may help in this case
Your command no longer works due to a change in mongodb driver change in version `3.6`. You need to invoke it from `dbCollection.aggregate(...)` method instead.
47,472,689
I have the following T-SQL query which I'm trying to convert into C# code: ```sql SELECT *, DATEFROMPARTS(Jaar, Maand, 1) FROM EAN_Budget_Meetdata_Factuur WHERE EID = 1 AND Bron = 'B' AND DATEFROMPARTS(Jaar, Maand, 1) BETWEEN '20161101' AND '20170101' ``` The table contains a column Year and Month, and I'm querying the table based on two known DateTimes (a period). The query is meant to retrieve the table rows that apply to this period based on the years and months between the two DateTimes. What is the best way to convert this query into C#? I've so far come up with the following, without success: ``` var query = from b in CT2.EAN_Budget_Meetdata_Factuur let JaarTest = b.Jaar + "-" + b.Maand + "-01" where b.EID == 1 && b.Bron == "B" && JaarTest == "something" select new { JaarTest = b.Jaar + "-" + b.Maand + "-01" }; ```
2017/11/24
[ "https://Stackoverflow.com/questions/47472689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453213/" ]
It seems Pull Request mentionned by @mp911de has been release in version 1.10.10 of Spring Data MongoDB. So you can either * upgrade your Spring Data MongoDB dependency to 1.10.10.RELEASE * upgrade your spring-boot-starter-data-mongodb dependency to 1.5.10.RELEASE
I have also faced this type of error when using org.springframework.data version 1.10.3.RELEASE. And then i have changed version to 2.0.5.RELEASE and my problem was solved.
47,472,689
I have the following T-SQL query which I'm trying to convert into C# code: ```sql SELECT *, DATEFROMPARTS(Jaar, Maand, 1) FROM EAN_Budget_Meetdata_Factuur WHERE EID = 1 AND Bron = 'B' AND DATEFROMPARTS(Jaar, Maand, 1) BETWEEN '20161101' AND '20170101' ``` The table contains a column Year and Month, and I'm querying the table based on two known DateTimes (a period). The query is meant to retrieve the table rows that apply to this period based on the years and months between the two DateTimes. What is the best way to convert this query into C#? I've so far come up with the following, without success: ``` var query = from b in CT2.EAN_Budget_Meetdata_Factuur let JaarTest = b.Jaar + "-" + b.Maand + "-01" where b.EID == 1 && b.Bron == "B" && JaarTest == "something" select new { JaarTest = b.Jaar + "-" + b.Maand + "-01" }; ```
2017/11/24
[ "https://Stackoverflow.com/questions/47472689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453213/" ]
I have also faced this type of error when using Mongodb version 3.6.2. Check your version of ***org.springframework.data*** in pom.xml For me, i have changed **org.springframework.data** version to 2.0.3.RELEASE and my problem was solved.
1. Use Spring Boot 2.0.0 or later. 2. Add `AggregationOptions` with cursor to your `Aggregation`: ```java AggregationOptions aggregationOptions = AggregationOptions.builder() .allowDiskUse(true) .cursor(new Document()) .build(); Aggregation aggregation = Aggregation.newAggregation(aggregationOperations) .withOptions(aggregationOptions); ``` 3. Call `aggregateStream()` (not `aggregate()`) method of `MongoOperations`. This method utilizes the cursor responded by MongoDB: ```java mongoOps.aggregateStream(aggregation, "collection", MyEntity.class) ```
47,472,689
I have the following T-SQL query which I'm trying to convert into C# code: ```sql SELECT *, DATEFROMPARTS(Jaar, Maand, 1) FROM EAN_Budget_Meetdata_Factuur WHERE EID = 1 AND Bron = 'B' AND DATEFROMPARTS(Jaar, Maand, 1) BETWEEN '20161101' AND '20170101' ``` The table contains a column Year and Month, and I'm querying the table based on two known DateTimes (a period). The query is meant to retrieve the table rows that apply to this period based on the years and months between the two DateTimes. What is the best way to convert this query into C#? I've so far come up with the following, without success: ``` var query = from b in CT2.EAN_Budget_Meetdata_Factuur let JaarTest = b.Jaar + "-" + b.Maand + "-01" where b.EID == 1 && b.Bron == "B" && JaarTest == "something" select new { JaarTest = b.Jaar + "-" + b.Maand + "-01" }; ```
2017/11/24
[ "https://Stackoverflow.com/questions/47472689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453213/" ]
``` Just updating the spring boot version works for me. This is the version that I have used and worked.... <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.10.RELEASE</version> </parent> ```
I've tried all above (short of changing the code to using a cursor) to no avail. In the end, I had to upgrage ``` 'mongo-java-driver' : '3.6.2' ``` Then it worked.
47,472,689
I have the following T-SQL query which I'm trying to convert into C# code: ```sql SELECT *, DATEFROMPARTS(Jaar, Maand, 1) FROM EAN_Budget_Meetdata_Factuur WHERE EID = 1 AND Bron = 'B' AND DATEFROMPARTS(Jaar, Maand, 1) BETWEEN '20161101' AND '20170101' ``` The table contains a column Year and Month, and I'm querying the table based on two known DateTimes (a period). The query is meant to retrieve the table rows that apply to this period based on the years and months between the two DateTimes. What is the best way to convert this query into C#? I've so far come up with the following, without success: ``` var query = from b in CT2.EAN_Budget_Meetdata_Factuur let JaarTest = b.Jaar + "-" + b.Maand + "-01" where b.EID == 1 && b.Bron == "B" && JaarTest == "something" select new { JaarTest = b.Jaar + "-" + b.Maand + "-01" }; ```
2017/11/24
[ "https://Stackoverflow.com/questions/47472689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453213/" ]
It seems Pull Request mentionned by @mp911de has been release in version 1.10.10 of Spring Data MongoDB. So you can either * upgrade your Spring Data MongoDB dependency to 1.10.10.RELEASE * upgrade your spring-boot-starter-data-mongodb dependency to 1.5.10.RELEASE
1. Use Spring Boot 2.0.0 or later. 2. Add `AggregationOptions` with cursor to your `Aggregation`: ```java AggregationOptions aggregationOptions = AggregationOptions.builder() .allowDiskUse(true) .cursor(new Document()) .build(); Aggregation aggregation = Aggregation.newAggregation(aggregationOperations) .withOptions(aggregationOptions); ``` 3. Call `aggregateStream()` (not `aggregate()`) method of `MongoOperations`. This method utilizes the cursor responded by MongoDB: ```java mongoOps.aggregateStream(aggregation, "collection", MyEntity.class) ```
47,472,689
I have the following T-SQL query which I'm trying to convert into C# code: ```sql SELECT *, DATEFROMPARTS(Jaar, Maand, 1) FROM EAN_Budget_Meetdata_Factuur WHERE EID = 1 AND Bron = 'B' AND DATEFROMPARTS(Jaar, Maand, 1) BETWEEN '20161101' AND '20170101' ``` The table contains a column Year and Month, and I'm querying the table based on two known DateTimes (a period). The query is meant to retrieve the table rows that apply to this period based on the years and months between the two DateTimes. What is the best way to convert this query into C#? I've so far come up with the following, without success: ``` var query = from b in CT2.EAN_Budget_Meetdata_Factuur let JaarTest = b.Jaar + "-" + b.Maand + "-01" where b.EID == 1 && b.Bron == "B" && JaarTest == "something" select new { JaarTest = b.Jaar + "-" + b.Maand + "-01" }; ```
2017/11/24
[ "https://Stackoverflow.com/questions/47472689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453213/" ]
MongoDB changed in 3.6 how the aggregation command works. Aggregations require now a cursor. We [adapted Spring Data MongoDB 2.1](https://github.com/spring-projects/spring-data-mongodb/pull/515) but not previous versions. Aggregations must be invoked through the collection's `aggregate(…)` method instead of calling the command directly. This is also the reason why we didn't backport the change. `executeCommand(…)` is no longer called and we don't want to break compatibility in a bugfix release. The easiest approach for you can be to override the `aggregate(…)` method and call the appropriate method, `DBCollection.aggregate(…)` with the mapped aggregation pipeline.
Your command no longer works due to a change in mongodb driver change in version `3.6`. You need to invoke it from `dbCollection.aggregate(...)` method instead.
47,472,689
I have the following T-SQL query which I'm trying to convert into C# code: ```sql SELECT *, DATEFROMPARTS(Jaar, Maand, 1) FROM EAN_Budget_Meetdata_Factuur WHERE EID = 1 AND Bron = 'B' AND DATEFROMPARTS(Jaar, Maand, 1) BETWEEN '20161101' AND '20170101' ``` The table contains a column Year and Month, and I'm querying the table based on two known DateTimes (a period). The query is meant to retrieve the table rows that apply to this period based on the years and months between the two DateTimes. What is the best way to convert this query into C#? I've so far come up with the following, without success: ``` var query = from b in CT2.EAN_Budget_Meetdata_Factuur let JaarTest = b.Jaar + "-" + b.Maand + "-01" where b.EID == 1 && b.Bron == "B" && JaarTest == "something" select new { JaarTest = b.Jaar + "-" + b.Maand + "-01" }; ```
2017/11/24
[ "https://Stackoverflow.com/questions/47472689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453213/" ]
MongoDB changed in 3.6 how the aggregation command works. Aggregations require now a cursor. We [adapted Spring Data MongoDB 2.1](https://github.com/spring-projects/spring-data-mongodb/pull/515) but not previous versions. Aggregations must be invoked through the collection's `aggregate(…)` method instead of calling the command directly. This is also the reason why we didn't backport the change. `executeCommand(…)` is no longer called and we don't want to break compatibility in a bugfix release. The easiest approach for you can be to override the `aggregate(…)` method and call the appropriate method, `DBCollection.aggregate(…)` with the mapped aggregation pipeline.
1. Use Spring Boot 2.0.0 or later. 2. Add `AggregationOptions` with cursor to your `Aggregation`: ```java AggregationOptions aggregationOptions = AggregationOptions.builder() .allowDiskUse(true) .cursor(new Document()) .build(); Aggregation aggregation = Aggregation.newAggregation(aggregationOperations) .withOptions(aggregationOptions); ``` 3. Call `aggregateStream()` (not `aggregate()`) method of `MongoOperations`. This method utilizes the cursor responded by MongoDB: ```java mongoOps.aggregateStream(aggregation, "collection", MyEntity.class) ```
47,472,689
I have the following T-SQL query which I'm trying to convert into C# code: ```sql SELECT *, DATEFROMPARTS(Jaar, Maand, 1) FROM EAN_Budget_Meetdata_Factuur WHERE EID = 1 AND Bron = 'B' AND DATEFROMPARTS(Jaar, Maand, 1) BETWEEN '20161101' AND '20170101' ``` The table contains a column Year and Month, and I'm querying the table based on two known DateTimes (a period). The query is meant to retrieve the table rows that apply to this period based on the years and months between the two DateTimes. What is the best way to convert this query into C#? I've so far come up with the following, without success: ``` var query = from b in CT2.EAN_Budget_Meetdata_Factuur let JaarTest = b.Jaar + "-" + b.Maand + "-01" where b.EID == 1 && b.Bron == "B" && JaarTest == "something" select new { JaarTest = b.Jaar + "-" + b.Maand + "-01" }; ```
2017/11/24
[ "https://Stackoverflow.com/questions/47472689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453213/" ]
I was using: ``` <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.8.RELEASE</version> <relativePath></relativePath> </parent> ``` Then after upgraded my dependency to a higher version, the issue was resolved: ``` <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.10.RELEASE</version> <relativePath></relativePath> </parent> ```
I have also faced this type of error when using org.springframework.data version 1.10.3.RELEASE. And then i have changed version to 2.0.5.RELEASE and my problem was solved.
47,472,689
I have the following T-SQL query which I'm trying to convert into C# code: ```sql SELECT *, DATEFROMPARTS(Jaar, Maand, 1) FROM EAN_Budget_Meetdata_Factuur WHERE EID = 1 AND Bron = 'B' AND DATEFROMPARTS(Jaar, Maand, 1) BETWEEN '20161101' AND '20170101' ``` The table contains a column Year and Month, and I'm querying the table based on two known DateTimes (a period). The query is meant to retrieve the table rows that apply to this period based on the years and months between the two DateTimes. What is the best way to convert this query into C#? I've so far come up with the following, without success: ``` var query = from b in CT2.EAN_Budget_Meetdata_Factuur let JaarTest = b.Jaar + "-" + b.Maand + "-01" where b.EID == 1 && b.Bron == "B" && JaarTest == "something" select new { JaarTest = b.Jaar + "-" + b.Maand + "-01" }; ```
2017/11/24
[ "https://Stackoverflow.com/questions/47472689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453213/" ]
``` Just updating the spring boot version works for me. This is the version that I have used and worked.... <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.10.RELEASE</version> </parent> ```
I have also faced this type of error when using org.springframework.data version 1.10.3.RELEASE. And then i have changed version to 2.0.5.RELEASE and my problem was solved.
47,472,689
I have the following T-SQL query which I'm trying to convert into C# code: ```sql SELECT *, DATEFROMPARTS(Jaar, Maand, 1) FROM EAN_Budget_Meetdata_Factuur WHERE EID = 1 AND Bron = 'B' AND DATEFROMPARTS(Jaar, Maand, 1) BETWEEN '20161101' AND '20170101' ``` The table contains a column Year and Month, and I'm querying the table based on two known DateTimes (a period). The query is meant to retrieve the table rows that apply to this period based on the years and months between the two DateTimes. What is the best way to convert this query into C#? I've so far come up with the following, without success: ``` var query = from b in CT2.EAN_Budget_Meetdata_Factuur let JaarTest = b.Jaar + "-" + b.Maand + "-01" where b.EID == 1 && b.Bron == "B" && JaarTest == "something" select new { JaarTest = b.Jaar + "-" + b.Maand + "-01" }; ```
2017/11/24
[ "https://Stackoverflow.com/questions/47472689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453213/" ]
MongoDB changed in 3.6 how the aggregation command works. Aggregations require now a cursor. We [adapted Spring Data MongoDB 2.1](https://github.com/spring-projects/spring-data-mongodb/pull/515) but not previous versions. Aggregations must be invoked through the collection's `aggregate(…)` method instead of calling the command directly. This is also the reason why we didn't backport the change. `executeCommand(…)` is no longer called and we don't want to break compatibility in a bugfix release. The easiest approach for you can be to override the `aggregate(…)` method and call the appropriate method, `DBCollection.aggregate(…)` with the mapped aggregation pipeline.
I've tried all above (short of changing the code to using a cursor) to no avail. In the end, I had to upgrage ``` 'mongo-java-driver' : '3.6.2' ``` Then it worked.
36,028,646
I want to increase the size of hyper-link in both direction(left and right), when text inside changes. When text inside selected.name changes, it should be expand in both direction. Currently it is expanding in only right direction. I want to expand in both direction when text changes... HTML ``` <a ng-model="link_text" class="tag">{{selected.name}}</a> ``` CSS ``` .tag { padding: 6px 12px; border: 1px solid #GGGGF0; font: 14px/27px'OpenSansLight'; font-size: 12px; text-decoration: none; position: relative; float: left; cursor: pointer; } ```
2016/03/16
[ "https://Stackoverflow.com/questions/36028646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5910006/" ]
you need to remove `float: left` to expand the link in both direction and add following `min-width:200px; /*optional*/ display:block; margin:auto;` Thanks
You can try by giving a specific `width` maybe a `min-width` and have `text-align: center;` that should help you with your requirement.
53,498,662
I need to display rows within a table using php variables and a while loop and I can't figure out what I am doing wrong. I have tried all kinds of different combinations of single quotes and double quotes, but I still can't use the correct syntax needed to make these rows get outputted within the table without generating any errors. I am using Dreamweaver 2019 to code it with. I used Netbeans 8.2 but I still can't figure out the correct syntax for this code. Here's also what I found on stackoverflow so far but I am still not finding exactly what I need. And I can't find exactly how to use the correct syntax using google either within this context: [php - for loop inside a while loop, correct syntax?](https://stackoverflow.com/questions/9676726/php-for-loop-inside-a-while-loop-correct-syntax) [Inline Styling in PHP](https://stackoverflow.com/questions/43049108/inline-styling-in-php?newreg=909487112fd447669439443d39e1dc0a) <https://stackoverflow.com/search?q=use+inline+styling+with+php+html+table> [html tables & inline styles](https://stackoverflow.com/questions/19646928/html-tables-inline-styles) [HTML Table with inline PHP](https://stackoverflow.com/questions/30262506/html-table-with-inline-php) ``` <?php include 'connection.php'; // includes the connection.php file to connect to the database // query to database and prepares and executes $query = "SELECT id, first_name, last_name FROM customers ORDER BY last_name asc"; $stmt = $db->prepare($query); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($id, $first_name, $last_name); // count the number of customers $total_customers = $stmt->num_rows; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Granger Customers</title> <link href="assets/bootstrap.min.css" rel="stylesheet" type="text/css"> </head> <body> <!--start container to center design in browser--> <div class="container"> <div class="row" style="margin-bottom:30px"> <div class="col-xs-12"> <ul class="nav nav-pills"> <li class="nav-item"> <a class="nav-link" href="index.php">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="customers.php">Customers</a> </li> <li class="nav-item"> <a class="nav-link" href="">Search</a> </li> <li class="nav-item"> <a class="nav-link" href="">Add New</a> </li> </ul> </div> </div> <div class="row"> <div class="col-xs-12"> <table class="table table-bordered table-striped table-hover"> <p><strong>There are a total of <?PHP echo $total_customers; ?> customers.</strong></p> <!-- output total number of customers --> <thead> <tr class="success"> <th class="text-center">#</th> <th>Customer ID</th> <th>Last Name</th> <th>First name</th> <th class="text-center">Details</th> </tr> </thead> <tbody> <tr> <?php while($result = $stmt->fetch()) { echo '<th class="text-center">'#'</th>' echo <th>"$result"</th> echo <th>"$result"</th> echo <th>"$result"</th> echo <th class="text-center">"Details"</th> } ?> </tr> </tbody> </table> </div> </div> </div> <!--end container to center design in browser--> </body> </html> ```
2018/11/27
[ "https://Stackoverflow.com/questions/53498662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10711172/" ]
Better approach would be a step closer to a template-like solution. ``` <tbody> <?php while($result = $stmt->fetch()): ?> <tr> <td clas="text-center">#</td> <td><?php echo $id; ?> </td> <td><?php echo $first_name; ?> </td> <td><?php echo $last_name; ?> </td> <td class="text-center">Details</td> </tr> <?php endwhile; ?> ```
try using below code write this way `'$id, $last_name, $firs_name` ``` <?php while($result = $stmt->fetch()) { echo '<th class="text-center">#</th>'; echo '<th>'.$id.'</th>'; echo '<th>'.$lastt_name.'</th>'; echo '<th>'.$first_name.'</th>'; echo '<th class="text-center">Details/th>'; } ?> ```
53,498,662
I need to display rows within a table using php variables and a while loop and I can't figure out what I am doing wrong. I have tried all kinds of different combinations of single quotes and double quotes, but I still can't use the correct syntax needed to make these rows get outputted within the table without generating any errors. I am using Dreamweaver 2019 to code it with. I used Netbeans 8.2 but I still can't figure out the correct syntax for this code. Here's also what I found on stackoverflow so far but I am still not finding exactly what I need. And I can't find exactly how to use the correct syntax using google either within this context: [php - for loop inside a while loop, correct syntax?](https://stackoverflow.com/questions/9676726/php-for-loop-inside-a-while-loop-correct-syntax) [Inline Styling in PHP](https://stackoverflow.com/questions/43049108/inline-styling-in-php?newreg=909487112fd447669439443d39e1dc0a) <https://stackoverflow.com/search?q=use+inline+styling+with+php+html+table> [html tables & inline styles](https://stackoverflow.com/questions/19646928/html-tables-inline-styles) [HTML Table with inline PHP](https://stackoverflow.com/questions/30262506/html-table-with-inline-php) ``` <?php include 'connection.php'; // includes the connection.php file to connect to the database // query to database and prepares and executes $query = "SELECT id, first_name, last_name FROM customers ORDER BY last_name asc"; $stmt = $db->prepare($query); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($id, $first_name, $last_name); // count the number of customers $total_customers = $stmt->num_rows; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Granger Customers</title> <link href="assets/bootstrap.min.css" rel="stylesheet" type="text/css"> </head> <body> <!--start container to center design in browser--> <div class="container"> <div class="row" style="margin-bottom:30px"> <div class="col-xs-12"> <ul class="nav nav-pills"> <li class="nav-item"> <a class="nav-link" href="index.php">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="customers.php">Customers</a> </li> <li class="nav-item"> <a class="nav-link" href="">Search</a> </li> <li class="nav-item"> <a class="nav-link" href="">Add New</a> </li> </ul> </div> </div> <div class="row"> <div class="col-xs-12"> <table class="table table-bordered table-striped table-hover"> <p><strong>There are a total of <?PHP echo $total_customers; ?> customers.</strong></p> <!-- output total number of customers --> <thead> <tr class="success"> <th class="text-center">#</th> <th>Customer ID</th> <th>Last Name</th> <th>First name</th> <th class="text-center">Details</th> </tr> </thead> <tbody> <tr> <?php while($result = $stmt->fetch()) { echo '<th class="text-center">'#'</th>' echo <th>"$result"</th> echo <th>"$result"</th> echo <th>"$result"</th> echo <th class="text-center">"Details"</th> } ?> </tr> </tbody> </table> </div> </div> </div> <!--end container to center design in browser--> </body> </html> ```
2018/11/27
[ "https://Stackoverflow.com/questions/53498662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10711172/" ]
Because you have used `$stmt->bind_result($id, $first_name, $last_name);` then the columns you select will be returned by `$stmt->fetch()` into variables called `$id`, `$first_name`, `$last_name` Also remember each `echo` is a distinct statement and should end with a `;` Also note that when using double quoted string literals your variables will get expanded automatically. Also inside a double quoted literal you can use single quotes without it causing you issues with early termination of the literal. That also applies to using double quotes inside a single quoted literal. ``` while($stmt->fetch()) { echo "<th class='text-center'>'#'</th>"; echo "<th>$id</th>"; echo "<th>$first_name</th>"; echo "<th>$last_name</th>"; echo "<th class='text-center'>Details</th>"; } ```
try using below code write this way `'$id, $last_name, $firs_name` ``` <?php while($result = $stmt->fetch()) { echo '<th class="text-center">#</th>'; echo '<th>'.$id.'</th>'; echo '<th>'.$lastt_name.'</th>'; echo '<th>'.$first_name.'</th>'; echo '<th class="text-center">Details/th>'; } ?> ```
53,498,662
I need to display rows within a table using php variables and a while loop and I can't figure out what I am doing wrong. I have tried all kinds of different combinations of single quotes and double quotes, but I still can't use the correct syntax needed to make these rows get outputted within the table without generating any errors. I am using Dreamweaver 2019 to code it with. I used Netbeans 8.2 but I still can't figure out the correct syntax for this code. Here's also what I found on stackoverflow so far but I am still not finding exactly what I need. And I can't find exactly how to use the correct syntax using google either within this context: [php - for loop inside a while loop, correct syntax?](https://stackoverflow.com/questions/9676726/php-for-loop-inside-a-while-loop-correct-syntax) [Inline Styling in PHP](https://stackoverflow.com/questions/43049108/inline-styling-in-php?newreg=909487112fd447669439443d39e1dc0a) <https://stackoverflow.com/search?q=use+inline+styling+with+php+html+table> [html tables & inline styles](https://stackoverflow.com/questions/19646928/html-tables-inline-styles) [HTML Table with inline PHP](https://stackoverflow.com/questions/30262506/html-table-with-inline-php) ``` <?php include 'connection.php'; // includes the connection.php file to connect to the database // query to database and prepares and executes $query = "SELECT id, first_name, last_name FROM customers ORDER BY last_name asc"; $stmt = $db->prepare($query); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($id, $first_name, $last_name); // count the number of customers $total_customers = $stmt->num_rows; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Granger Customers</title> <link href="assets/bootstrap.min.css" rel="stylesheet" type="text/css"> </head> <body> <!--start container to center design in browser--> <div class="container"> <div class="row" style="margin-bottom:30px"> <div class="col-xs-12"> <ul class="nav nav-pills"> <li class="nav-item"> <a class="nav-link" href="index.php">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="customers.php">Customers</a> </li> <li class="nav-item"> <a class="nav-link" href="">Search</a> </li> <li class="nav-item"> <a class="nav-link" href="">Add New</a> </li> </ul> </div> </div> <div class="row"> <div class="col-xs-12"> <table class="table table-bordered table-striped table-hover"> <p><strong>There are a total of <?PHP echo $total_customers; ?> customers.</strong></p> <!-- output total number of customers --> <thead> <tr class="success"> <th class="text-center">#</th> <th>Customer ID</th> <th>Last Name</th> <th>First name</th> <th class="text-center">Details</th> </tr> </thead> <tbody> <tr> <?php while($result = $stmt->fetch()) { echo '<th class="text-center">'#'</th>' echo <th>"$result"</th> echo <th>"$result"</th> echo <th>"$result"</th> echo <th class="text-center">"Details"</th> } ?> </tr> </tbody> </table> </div> </div> </div> <!--end container to center design in browser--> </body> </html> ```
2018/11/27
[ "https://Stackoverflow.com/questions/53498662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10711172/" ]
Better approach would be a step closer to a template-like solution. ``` <tbody> <?php while($result = $stmt->fetch()): ?> <tr> <td clas="text-center">#</td> <td><?php echo $id; ?> </td> <td><?php echo $first_name; ?> </td> <td><?php echo $last_name; ?> </td> <td class="text-center">Details</td> </tr> <?php endwhile; ?> ```
First you need to understand how to use the loop. Your code within the loop is not correct. There are many quotes issues. Moreover, as per your code I believe you are fetching the table and not using the columns in the loop, something like `$result['id']` or `$result->id` You also may need to understand how PHP Concatenation works. PHP allows single quote `'` and double quotes `"` for string. If you use the same code to wrap the variable than you will have to escape it by using backslash `\`. Try below code, that may resolve your issue. ``` <?php while($result = $stmt->fetch()) { echo '<th class="text-center">#</th>'; echo '<th>' . $id . '</th>'; echo '<th>' . $first_name . '</th>'; echo '<th>' . $last_name . '</th>'; echo '<th class="text-center">Details</th>'; } ?> ``` > > **Additionally,** you should check [this](http://php.net/manual/en/language.operators.string.php) to understand PHP string and concatenation > > >
53,498,662
I need to display rows within a table using php variables and a while loop and I can't figure out what I am doing wrong. I have tried all kinds of different combinations of single quotes and double quotes, but I still can't use the correct syntax needed to make these rows get outputted within the table without generating any errors. I am using Dreamweaver 2019 to code it with. I used Netbeans 8.2 but I still can't figure out the correct syntax for this code. Here's also what I found on stackoverflow so far but I am still not finding exactly what I need. And I can't find exactly how to use the correct syntax using google either within this context: [php - for loop inside a while loop, correct syntax?](https://stackoverflow.com/questions/9676726/php-for-loop-inside-a-while-loop-correct-syntax) [Inline Styling in PHP](https://stackoverflow.com/questions/43049108/inline-styling-in-php?newreg=909487112fd447669439443d39e1dc0a) <https://stackoverflow.com/search?q=use+inline+styling+with+php+html+table> [html tables & inline styles](https://stackoverflow.com/questions/19646928/html-tables-inline-styles) [HTML Table with inline PHP](https://stackoverflow.com/questions/30262506/html-table-with-inline-php) ``` <?php include 'connection.php'; // includes the connection.php file to connect to the database // query to database and prepares and executes $query = "SELECT id, first_name, last_name FROM customers ORDER BY last_name asc"; $stmt = $db->prepare($query); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($id, $first_name, $last_name); // count the number of customers $total_customers = $stmt->num_rows; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Granger Customers</title> <link href="assets/bootstrap.min.css" rel="stylesheet" type="text/css"> </head> <body> <!--start container to center design in browser--> <div class="container"> <div class="row" style="margin-bottom:30px"> <div class="col-xs-12"> <ul class="nav nav-pills"> <li class="nav-item"> <a class="nav-link" href="index.php">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="customers.php">Customers</a> </li> <li class="nav-item"> <a class="nav-link" href="">Search</a> </li> <li class="nav-item"> <a class="nav-link" href="">Add New</a> </li> </ul> </div> </div> <div class="row"> <div class="col-xs-12"> <table class="table table-bordered table-striped table-hover"> <p><strong>There are a total of <?PHP echo $total_customers; ?> customers.</strong></p> <!-- output total number of customers --> <thead> <tr class="success"> <th class="text-center">#</th> <th>Customer ID</th> <th>Last Name</th> <th>First name</th> <th class="text-center">Details</th> </tr> </thead> <tbody> <tr> <?php while($result = $stmt->fetch()) { echo '<th class="text-center">'#'</th>' echo <th>"$result"</th> echo <th>"$result"</th> echo <th>"$result"</th> echo <th class="text-center">"Details"</th> } ?> </tr> </tbody> </table> </div> </div> </div> <!--end container to center design in browser--> </body> </html> ```
2018/11/27
[ "https://Stackoverflow.com/questions/53498662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10711172/" ]
Better approach would be a step closer to a template-like solution. ``` <tbody> <?php while($result = $stmt->fetch()): ?> <tr> <td clas="text-center">#</td> <td><?php echo $id; ?> </td> <td><?php echo $first_name; ?> </td> <td><?php echo $last_name; ?> </td> <td class="text-center">Details</td> </tr> <?php endwhile; ?> ```
Try using `<?=$string; ?>`, like this: ``` <?php while($result = $stmt->fetch()): ?> <tr> <td clas="text-center">#</td> <td><?=$id; ?> </td> <td><?=$first_name; ?> </td> <td><?=$last_name; ?> </td> <td class="text-center">Details</td> </tr> <?php endwhile; ?> ``` Using less php in your html keeps it clean.
53,498,662
I need to display rows within a table using php variables and a while loop and I can't figure out what I am doing wrong. I have tried all kinds of different combinations of single quotes and double quotes, but I still can't use the correct syntax needed to make these rows get outputted within the table without generating any errors. I am using Dreamweaver 2019 to code it with. I used Netbeans 8.2 but I still can't figure out the correct syntax for this code. Here's also what I found on stackoverflow so far but I am still not finding exactly what I need. And I can't find exactly how to use the correct syntax using google either within this context: [php - for loop inside a while loop, correct syntax?](https://stackoverflow.com/questions/9676726/php-for-loop-inside-a-while-loop-correct-syntax) [Inline Styling in PHP](https://stackoverflow.com/questions/43049108/inline-styling-in-php?newreg=909487112fd447669439443d39e1dc0a) <https://stackoverflow.com/search?q=use+inline+styling+with+php+html+table> [html tables & inline styles](https://stackoverflow.com/questions/19646928/html-tables-inline-styles) [HTML Table with inline PHP](https://stackoverflow.com/questions/30262506/html-table-with-inline-php) ``` <?php include 'connection.php'; // includes the connection.php file to connect to the database // query to database and prepares and executes $query = "SELECT id, first_name, last_name FROM customers ORDER BY last_name asc"; $stmt = $db->prepare($query); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($id, $first_name, $last_name); // count the number of customers $total_customers = $stmt->num_rows; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Granger Customers</title> <link href="assets/bootstrap.min.css" rel="stylesheet" type="text/css"> </head> <body> <!--start container to center design in browser--> <div class="container"> <div class="row" style="margin-bottom:30px"> <div class="col-xs-12"> <ul class="nav nav-pills"> <li class="nav-item"> <a class="nav-link" href="index.php">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="customers.php">Customers</a> </li> <li class="nav-item"> <a class="nav-link" href="">Search</a> </li> <li class="nav-item"> <a class="nav-link" href="">Add New</a> </li> </ul> </div> </div> <div class="row"> <div class="col-xs-12"> <table class="table table-bordered table-striped table-hover"> <p><strong>There are a total of <?PHP echo $total_customers; ?> customers.</strong></p> <!-- output total number of customers --> <thead> <tr class="success"> <th class="text-center">#</th> <th>Customer ID</th> <th>Last Name</th> <th>First name</th> <th class="text-center">Details</th> </tr> </thead> <tbody> <tr> <?php while($result = $stmt->fetch()) { echo '<th class="text-center">'#'</th>' echo <th>"$result"</th> echo <th>"$result"</th> echo <th>"$result"</th> echo <th class="text-center">"Details"</th> } ?> </tr> </tbody> </table> </div> </div> </div> <!--end container to center design in browser--> </body> </html> ```
2018/11/27
[ "https://Stackoverflow.com/questions/53498662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10711172/" ]
Because you have used `$stmt->bind_result($id, $first_name, $last_name);` then the columns you select will be returned by `$stmt->fetch()` into variables called `$id`, `$first_name`, `$last_name` Also remember each `echo` is a distinct statement and should end with a `;` Also note that when using double quoted string literals your variables will get expanded automatically. Also inside a double quoted literal you can use single quotes without it causing you issues with early termination of the literal. That also applies to using double quotes inside a single quoted literal. ``` while($stmt->fetch()) { echo "<th class='text-center'>'#'</th>"; echo "<th>$id</th>"; echo "<th>$first_name</th>"; echo "<th>$last_name</th>"; echo "<th class='text-center'>Details</th>"; } ```
First you need to understand how to use the loop. Your code within the loop is not correct. There are many quotes issues. Moreover, as per your code I believe you are fetching the table and not using the columns in the loop, something like `$result['id']` or `$result->id` You also may need to understand how PHP Concatenation works. PHP allows single quote `'` and double quotes `"` for string. If you use the same code to wrap the variable than you will have to escape it by using backslash `\`. Try below code, that may resolve your issue. ``` <?php while($result = $stmt->fetch()) { echo '<th class="text-center">#</th>'; echo '<th>' . $id . '</th>'; echo '<th>' . $first_name . '</th>'; echo '<th>' . $last_name . '</th>'; echo '<th class="text-center">Details</th>'; } ?> ``` > > **Additionally,** you should check [this](http://php.net/manual/en/language.operators.string.php) to understand PHP string and concatenation > > >
53,498,662
I need to display rows within a table using php variables and a while loop and I can't figure out what I am doing wrong. I have tried all kinds of different combinations of single quotes and double quotes, but I still can't use the correct syntax needed to make these rows get outputted within the table without generating any errors. I am using Dreamweaver 2019 to code it with. I used Netbeans 8.2 but I still can't figure out the correct syntax for this code. Here's also what I found on stackoverflow so far but I am still not finding exactly what I need. And I can't find exactly how to use the correct syntax using google either within this context: [php - for loop inside a while loop, correct syntax?](https://stackoverflow.com/questions/9676726/php-for-loop-inside-a-while-loop-correct-syntax) [Inline Styling in PHP](https://stackoverflow.com/questions/43049108/inline-styling-in-php?newreg=909487112fd447669439443d39e1dc0a) <https://stackoverflow.com/search?q=use+inline+styling+with+php+html+table> [html tables & inline styles](https://stackoverflow.com/questions/19646928/html-tables-inline-styles) [HTML Table with inline PHP](https://stackoverflow.com/questions/30262506/html-table-with-inline-php) ``` <?php include 'connection.php'; // includes the connection.php file to connect to the database // query to database and prepares and executes $query = "SELECT id, first_name, last_name FROM customers ORDER BY last_name asc"; $stmt = $db->prepare($query); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($id, $first_name, $last_name); // count the number of customers $total_customers = $stmt->num_rows; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Granger Customers</title> <link href="assets/bootstrap.min.css" rel="stylesheet" type="text/css"> </head> <body> <!--start container to center design in browser--> <div class="container"> <div class="row" style="margin-bottom:30px"> <div class="col-xs-12"> <ul class="nav nav-pills"> <li class="nav-item"> <a class="nav-link" href="index.php">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="customers.php">Customers</a> </li> <li class="nav-item"> <a class="nav-link" href="">Search</a> </li> <li class="nav-item"> <a class="nav-link" href="">Add New</a> </li> </ul> </div> </div> <div class="row"> <div class="col-xs-12"> <table class="table table-bordered table-striped table-hover"> <p><strong>There are a total of <?PHP echo $total_customers; ?> customers.</strong></p> <!-- output total number of customers --> <thead> <tr class="success"> <th class="text-center">#</th> <th>Customer ID</th> <th>Last Name</th> <th>First name</th> <th class="text-center">Details</th> </tr> </thead> <tbody> <tr> <?php while($result = $stmt->fetch()) { echo '<th class="text-center">'#'</th>' echo <th>"$result"</th> echo <th>"$result"</th> echo <th>"$result"</th> echo <th class="text-center">"Details"</th> } ?> </tr> </tbody> </table> </div> </div> </div> <!--end container to center design in browser--> </body> </html> ```
2018/11/27
[ "https://Stackoverflow.com/questions/53498662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10711172/" ]
Because you have used `$stmt->bind_result($id, $first_name, $last_name);` then the columns you select will be returned by `$stmt->fetch()` into variables called `$id`, `$first_name`, `$last_name` Also remember each `echo` is a distinct statement and should end with a `;` Also note that when using double quoted string literals your variables will get expanded automatically. Also inside a double quoted literal you can use single quotes without it causing you issues with early termination of the literal. That also applies to using double quotes inside a single quoted literal. ``` while($stmt->fetch()) { echo "<th class='text-center'>'#'</th>"; echo "<th>$id</th>"; echo "<th>$first_name</th>"; echo "<th>$last_name</th>"; echo "<th class='text-center'>Details</th>"; } ```
Try using `<?=$string; ?>`, like this: ``` <?php while($result = $stmt->fetch()): ?> <tr> <td clas="text-center">#</td> <td><?=$id; ?> </td> <td><?=$first_name; ?> </td> <td><?=$last_name; ?> </td> <td class="text-center">Details</td> </tr> <?php endwhile; ?> ``` Using less php in your html keeps it clean.
7,083,568
Trying to use SQL Server with a jQuery autocomplete. I can get the following to work when just checking the term entered with a matching domain, but I would also like the autocomplete to check if a match is found for the contact name (first name and last name). Is there a way (like in mySQL) to concat the fname and lname? Domain only: ($term = data entered in autocomplete box) ``` SELECT distinct comp_companyid, comp_name, comp_emailaddress, comp_website, pers_firstname, pers_lastname, addr_address1, addr_address2, addr_city, addr_state, addr_postcode FROM company, person, address, address_link WHERE pers_companyid = comp_companyid AND addr_addressid = adli_addressid AND adli_companyid = comp_companyid AND comp_website LIKE '%".$term."%'; ``` My attempt at matching name as well: ``` SELECT distinct comp_companyid, comp_name, comp_emailaddress, comp_website, pers_firstname, pers_lastname, addr_address1, addr_address2, addr_city, addr_state, addr_postcode FROM company, person, address, address_link WHERE pers_companyid = comp_companyid AND addr_addressid = adli_addressid AND adli_companyid = comp_companyid AND comp_website LIKE '%".$term."%' OR pers_firstname + ' ' + pers_lastname LIKE '%".$term."%'; ```
2011/08/16
[ "https://Stackoverflow.com/questions/7083568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/708831/" ]
1. Yes, some pages will need different combinations of style sheets. Each combination must be cached individually. Unfortunately, the browser won't know that there isn't a difference between `?stylesheets=a.css,b.css` and `?stylesheets=b.css,a.css` so both will need to be cached. 2. That's used to make sure the browser doesn't accidentally cache the dynamically generated stylesheet. It's unnecessary if you are using a decent minifier. Usually, the GUID is found by hashing the `last-modified` times of each file in the list. Like I said, most minifiers will automatically check for new versions of files and discard the old cached version. I would suggest [PHP Minify](http://code.google.com/p/minify/). Installation is as easy as copying the folder into your doc root. It also supports JavaScript compression with the Google Closure Compiler.
[Assetic](https://github.com/kriswallsmith/assetic) seems to be good at making assets of JS/CSS and minify them while putting them in cache.