qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
313,975 | I have this mail notification for new post.
All the new post contain arround 100 words and no pictures, so I would like to include in the notification the post content and if is possible, the number of words in the post.
Anybody could help me?
Thanks for all
```
/* avisar al admin*/
function submit_send_email ... | 2018/09/12 | [
"https://wordpress.stackexchange.com/questions/313975",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/150466/"
] | This question had me scratching my head. Yeah, how come WordPress doesn't support this natively? And then I found out.
You asked how to upload SVG in WordPress 4.9.8 (the current version at the time of writing). You mention that you "tried uploading after installing different plugins". You don't say which plugins, no... | After adding **upload\_mimes** action still anyone facing issue then add this in your wp-config.php file
```
define( 'ALLOW_UNFILTERED_UPLOADS', true );
``` |
313,975 | I have this mail notification for new post.
All the new post contain arround 100 words and no pictures, so I would like to include in the notification the post content and if is possible, the number of words in the post.
Anybody could help me?
Thanks for all
```
/* avisar al admin*/
function submit_send_email ... | 2018/09/12 | [
"https://wordpress.stackexchange.com/questions/313975",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/150466/"
] | This question had me scratching my head. Yeah, how come WordPress doesn't support this natively? And then I found out.
You asked how to upload SVG in WordPress 4.9.8 (the current version at the time of writing). You mention that you "tried uploading after installing different plugins". You don't say which plugins, no... | The first function is to check the WordPress and add support on WP version lower than 4.8. The second function is to register the mime file type(SVG) and the last one is to fix the thumbnails on media library.
```
/**
* Add svg support
*
*/
add_filter( 'wp_check_filetype_and_ext', function( $data, $file, $filename... |
313,975 | I have this mail notification for new post.
All the new post contain arround 100 words and no pictures, so I would like to include in the notification the post content and if is possible, the number of words in the post.
Anybody could help me?
Thanks for all
```
/* avisar al admin*/
function submit_send_email ... | 2018/09/12 | [
"https://wordpress.stackexchange.com/questions/313975",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/150466/"
] | The first function is to check the WordPress and add support on WP version lower than 4.8. The second function is to register the mime file type(SVG) and the last one is to fix the thumbnails on media library.
```
/**
* Add svg support
*
*/
add_filter( 'wp_check_filetype_and_ext', function( $data, $file, $filename... | Add this hooks , i tested on wp 5.3 it works :
```php
// Allow SVG
add_filter('wp_check_filetype_and_ext', function ($data, $file, $filename, $mimes) {
if (!$data['type']) {
$wp_filetype = wp_check_filetype($filename, $mimes);
$ext = $wp_filetype['ext'];
$type = $wp_filetype['type'];
... |
313,975 | I have this mail notification for new post.
All the new post contain arround 100 words and no pictures, so I would like to include in the notification the post content and if is possible, the number of words in the post.
Anybody could help me?
Thanks for all
```
/* avisar al admin*/
function submit_send_email ... | 2018/09/12 | [
"https://wordpress.stackexchange.com/questions/313975",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/150466/"
] | ```
//add SVG to allowed file uploads
function add_file_types_to_uploads($file_types){
$new_filetypes = array();
$new_filetypes['svg'] = 'image/svg+xml';
$file_types = array_merge($file_types, $new_filetypes );
return $file_types;
}
add_action('upload_mimes', 'add_file_types_to_uploads');
``` | The first function is to check the WordPress and add support on WP version lower than 4.8. The second function is to register the mime file type(SVG) and the last one is to fix the thumbnails on media library.
```
/**
* Add svg support
*
*/
add_filter( 'wp_check_filetype_and_ext', function( $data, $file, $filename... |
246,157 | We recently had issues with people messing around inside our system. To prevent code injections within my python code, I implemented the following `if` block:
```
#! /usr/bin/python3
#-*- coding:utf-8 -*-
def main():
print("Your interactive Python shell!")
text = input('>>> ')
for keyword in ['eval', 'exec... | 2021/03/15 | [
"https://security.stackexchange.com/questions/246157",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/252790/"
] | Simple blacklists are about the worst way to patch a vulnerability. They'll create a lot of false positives and any determined attacker will usually find a way around them.
Web Application Firewalls are a good example. The detection rules they employ are way more complicated than your simplistic blacklist, yet they do... | The problem I see with your blacklist is that in Python, one could write Python code that generates additional Python code, and then run the additional code. So one could generate the word 'eval' from inside of a program that itself doesn't contain the word. Part of the problem is the dynamism of Python itself, whereas... |
246,157 | We recently had issues with people messing around inside our system. To prevent code injections within my python code, I implemented the following `if` block:
```
#! /usr/bin/python3
#-*- coding:utf-8 -*-
def main():
print("Your interactive Python shell!")
text = input('>>> ')
for keyword in ['eval', 'exec... | 2021/03/15 | [
"https://security.stackexchange.com/questions/246157",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/252790/"
] | Simple blacklists are about the worst way to patch a vulnerability. They'll create a lot of false positives and any determined attacker will usually find a way around them.
Web Application Firewalls are a good example. The detection rules they employ are way more complicated than your simplistic blacklist, yet they do... | I wanted to suggest the approach to set `__builtins__` to `{}` but **even this is not safe**
```
def myfunc(a, b):
return a + b
global_namespace = {"__builtins__": {}, "myfunc": myfunc}
exec(yourstring, global_namespace, {})
```
This disables all builtin keywords, allows only the explicitly passed globals (in ... |
246,157 | We recently had issues with people messing around inside our system. To prevent code injections within my python code, I implemented the following `if` block:
```
#! /usr/bin/python3
#-*- coding:utf-8 -*-
def main():
print("Your interactive Python shell!")
text = input('>>> ')
for keyword in ['eval', 'exec... | 2021/03/15 | [
"https://security.stackexchange.com/questions/246157",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/252790/"
] | The problem I see with your blacklist is that in Python, one could write Python code that generates additional Python code, and then run the additional code. So one could generate the word 'eval' from inside of a program that itself doesn't contain the word. Part of the problem is the dynamism of Python itself, whereas... | I wanted to suggest the approach to set `__builtins__` to `{}` but **even this is not safe**
```
def myfunc(a, b):
return a + b
global_namespace = {"__builtins__": {}, "myfunc": myfunc}
exec(yourstring, global_namespace, {})
```
This disables all builtin keywords, allows only the explicitly passed globals (in ... |
42,787,779 | I am running a `docker login` command as a part of the Bamboo build job. The command text is obtained by `aws ecr get-login` call and executed in a subshell.
This command fails with `Error saving credentials: error storing credentials - err: exit status 1, out: write permissions error` when ran as a part of the Bamboo... | 2017/03/14 | [
"https://Stackoverflow.com/questions/42787779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715716/"
] | I had to remove my existing config.json file. It would not overwrite or modify the one that I had. | For me the simplest solution was to create config.json file under .docker directory inside the user home directory:
~/home/.docker/config.json
Then I copied the content of this file from the server from where i was able to login to the docker hub.
```
{
"auths": {
"https://index.docker.io/v1/... |
42,787,779 | I am running a `docker login` command as a part of the Bamboo build job. The command text is obtained by `aws ecr get-login` call and executed in a subshell.
This command fails with `Error saving credentials: error storing credentials - err: exit status 1, out: write permissions error` when ran as a part of the Bamboo... | 2017/03/14 | [
"https://Stackoverflow.com/questions/42787779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715716/"
] | I found this question while trying to use ECR to get a Docker container **running** within a Jenkins pipeline on an AWS EC2 instance with an IAM Instance Profile. I found lots of information about creating, pushing, and pulling instances from ECR, but not running.
The goal is a Docker container with the specific Ruby... | If you have installed Docker Desktop, you should sign-in inside the desktop app. In the title bar, click on the sign-in button and follow de instructions to initialize your credentials store. You don't need to `docker login` from terminal. |
42,787,779 | I am running a `docker login` command as a part of the Bamboo build job. The command text is obtained by `aws ecr get-login` call and executed in a subshell.
This command fails with `Error saving credentials: error storing credentials - err: exit status 1, out: write permissions error` when ran as a part of the Bamboo... | 2017/03/14 | [
"https://Stackoverflow.com/questions/42787779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715716/"
] | Try running the `docker login` command as sudo. It worked for me.
Run this command : `sudo docker login`.
This will prompt you to enter your sudo password. After providing the password, the login command will run and you will be able to login successfully. | Install the following packages to solve this issue.
`sudo apt install gnupg2 pass` |
42,787,779 | I am running a `docker login` command as a part of the Bamboo build job. The command text is obtained by `aws ecr get-login` call and executed in a subshell.
This command fails with `Error saving credentials: error storing credentials - err: exit status 1, out: write permissions error` when ran as a part of the Bamboo... | 2017/03/14 | [
"https://Stackoverflow.com/questions/42787779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715716/"
] | **The Problem**: you try to login into docker registry and unable to authenticate due to storing credentials error.
```
Error saving credentials: error storing credentials - err: exit status 1,
out: `Post "http://ipc/registry/credstore-updated":
dial unix /var/root/Library/Containers/com.docker.docker/Data/backend.s... | For me the simplest solution was to create config.json file under .docker directory inside the user home directory:
~/home/.docker/config.json
Then I copied the content of this file from the server from where i was able to login to the docker hub.
```
{
"auths": {
"https://index.docker.io/v1/... |
42,787,779 | I am running a `docker login` command as a part of the Bamboo build job. The command text is obtained by `aws ecr get-login` call and executed in a subshell.
This command fails with `Error saving credentials: error storing credentials - err: exit status 1, out: write permissions error` when ran as a part of the Bamboo... | 2017/03/14 | [
"https://Stackoverflow.com/questions/42787779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715716/"
] | Try running the `docker login` command as sudo. It worked for me.
Run this command : `sudo docker login`.
This will prompt you to enter your sudo password. After providing the password, the login command will run and you will be able to login successfully. | For me the simplest solution was to create config.json file under .docker directory inside the user home directory:
~/home/.docker/config.json
Then I copied the content of this file from the server from where i was able to login to the docker hub.
```
{
"auths": {
"https://index.docker.io/v1/... |
42,787,779 | I am running a `docker login` command as a part of the Bamboo build job. The command text is obtained by `aws ecr get-login` call and executed in a subshell.
This command fails with `Error saving credentials: error storing credentials - err: exit status 1, out: write permissions error` when ran as a part of the Bamboo... | 2017/03/14 | [
"https://Stackoverflow.com/questions/42787779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715716/"
] | You can remove the file `docker-credential-osxkeychain`:
```
$ sudo rm /usr/local/bin/docker-credential-osxkeychain
``` | For me the simplest solution was to create config.json file under .docker directory inside the user home directory:
~/home/.docker/config.json
Then I copied the content of this file from the server from where i was able to login to the docker hub.
```
{
"auths": {
"https://index.docker.io/v1/... |
42,787,779 | I am running a `docker login` command as a part of the Bamboo build job. The command text is obtained by `aws ecr get-login` call and executed in a subshell.
This command fails with `Error saving credentials: error storing credentials - err: exit status 1, out: write permissions error` when ran as a part of the Bamboo... | 2017/03/14 | [
"https://Stackoverflow.com/questions/42787779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715716/"
] | Install the following package then try docker login again
`sudo apt install install gnupg2 pass`
If it still doesn't work, run the command with root privileges
`sudo docker login` | For me the simplest solution was to create config.json file under .docker directory inside the user home directory:
~/home/.docker/config.json
Then I copied the content of this file from the server from where i was able to login to the docker hub.
```
{
"auths": {
"https://index.docker.io/v1/... |
42,787,779 | I am running a `docker login` command as a part of the Bamboo build job. The command text is obtained by `aws ecr get-login` call and executed in a subshell.
This command fails with `Error saving credentials: error storing credentials - err: exit status 1, out: write permissions error` when ran as a part of the Bamboo... | 2017/03/14 | [
"https://Stackoverflow.com/questions/42787779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715716/"
] | I had to remove my existing config.json file. It would not overwrite or modify the one that I had. | If you have installed Docker Desktop, you should sign-in inside the desktop app. In the title bar, click on the sign-in button and follow de instructions to initialize your credentials store. You don't need to `docker login` from terminal. |
42,787,779 | I am running a `docker login` command as a part of the Bamboo build job. The command text is obtained by `aws ecr get-login` call and executed in a subshell.
This command fails with `Error saving credentials: error storing credentials - err: exit status 1, out: write permissions error` when ran as a part of the Bamboo... | 2017/03/14 | [
"https://Stackoverflow.com/questions/42787779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715716/"
] | I had to remove my existing config.json file. It would not overwrite or modify the one that I had. | Install the following package then try docker login again
`sudo apt install install gnupg2 pass`
If it still doesn't work, run the command with root privileges
`sudo docker login` |
42,787,779 | I am running a `docker login` command as a part of the Bamboo build job. The command text is obtained by `aws ecr get-login` call and executed in a subshell.
This command fails with `Error saving credentials: error storing credentials - err: exit status 1, out: write permissions error` when ran as a part of the Bamboo... | 2017/03/14 | [
"https://Stackoverflow.com/questions/42787779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2715716/"
] | Try running the `docker login` command as sudo. It worked for me.
Run this command : `sudo docker login`.
This will prompt you to enter your sudo password. After providing the password, the login command will run and you will be able to login successfully. | If you have installed Docker Desktop, you should sign-in inside the desktop app. In the title bar, click on the sign-in button and follow de instructions to initialize your credentials store. You don't need to `docker login` from terminal. |
208 | Just like the title says. Myself and a few other users have used Wikipedia as a reference while others use IMDb/articles/etc.
We should establish here and now if this is a valid way to reference points/answers or not.
My personal beliefs is that Wikipedia is not as bad as everyone says with referencing items and sh... | 2012/01/10 | [
"https://movies.meta.stackexchange.com/questions/208",
"https://movies.meta.stackexchange.com",
"https://movies.meta.stackexchange.com/users/130/"
] | Wikipedia varies in the quality of its content, and each movie page will vary in the number of supporting references. However a reference to Wikipedia is better than no reference at all, and compliments the factual detail of IMDB. This is particularly true when wanting to give someone an outline of a plot, which is oft... | Wikipedia may have weaknesses, but I support having it as a valid reference because, on top of having own content, it also lists other (likely more authoritative) references. One other pro is that it is far cleaner than the UI mess that is IMDb. |
1,252,398 | OS: Ubuntu 18.04 LTS, with Linux 4.15.0-1087-oem.
Notebook model: DELL LATITUDE 7400. No discrete video card.
The problem appeared suddenly and recently, probably after a system update. First, the loader window appears, I press Enter on the Ubuntu item - the download does not go, but sometimes it loaded without probl... | 2020/06/21 | [
"https://askubuntu.com/questions/1252398",
"https://askubuntu.com",
"https://askubuntu.com/users/1097451/"
] | I recently experienced this with Ubuntu 20.04 LTS as well. After lengthy troubleshooting, I was able to resolve this by running:
```
python3 -m pip install --upgrade setuptools
``` | I received this error as well, the only thing that worked was the following after troubleshooting and seeing python3 installed at 3.8.2 but pip or pip3 command not found:
`sudo apt install python3-pip`
After this, everything worked fine. It looks like it installs python dev related packages including pip that was mis... |
42,501,617 | I have been searching on how to draw a border line that has shorter length that it container for few days. Basically I want to achieve below results i.e borders that do not have reach its edge.
[](https://i.stack.imgur.com/dDhgR.png)
So far this is w... | 2017/02/28 | [
"https://Stackoverflow.com/questions/42501617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5541721/"
] | ```
$(window).scroll(function(){
var scrolltop = $(this).scrollTop();
if(scrolltop >=100){
$('#pre-header,#id-of-your-logo').css('display','none');
}
else{
$('#pre-header,#id-of-your-logo').css('display','block');
}
```
Hope this... | Are you looking for this?
I just added JavaScript to it, so if you scrolling down, the `headermenu` gets a new class `shrink` which have a css-rule to `display: none` the `preheader` and `LogoSchool`.
```js
$(document).on("scroll", function() {
if ($(document).scrollTop() > 100) {
$(".headermenu").addClass("s... |
42,501,617 | I have been searching on how to draw a border line that has shorter length that it container for few days. Basically I want to achieve below results i.e borders that do not have reach its edge.
[](https://i.stack.imgur.com/dDhgR.png)
So far this is w... | 2017/02/28 | [
"https://Stackoverflow.com/questions/42501617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5541721/"
] | ```
$(window).scroll(function(){
var scrolltop = $(this).scrollTop();
if(scrolltop >=100){
$('#pre-header,#id-of-your-logo').css('display','none');
}
else{
$('#pre-header,#id-of-your-logo').css('display','block');
}
```
Hope this... | Bootstrap navbar animation on scroll: <http://codepen.io/davidtmiller/pen/yepJoX>
and when you scroll nav bar change it's class to .affix and you can hide preheader like this.
```
.navbar-default.affix #preheader{
display: none;
}
``` |
9,999,963 | Whats the best/easiest way to test for administrative rights in a PowerShell script?
I need to write a script that requires administrative rights and want to know the best way to achieve it. | 2012/04/03 | [
"https://Stackoverflow.com/questions/9999963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019687/"
] | This is the little function I have in a security module:
```
function Test-IsAdmin {
try {
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal -ArgumentList $identity
return $principal.IsInRole( [Security.Principal.Windo... | Check out this url: <http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/11/check-for-admin-credentials-in-a-powershell-script.aspx>
I didn't test it but the summary seems to state what you are looking for: "Learn how to check for administrative credentials when you run a Windows PowerShell script or command." |
9,999,963 | Whats the best/easiest way to test for administrative rights in a PowerShell script?
I need to write a script that requires administrative rights and want to know the best way to achieve it. | 2012/04/03 | [
"https://Stackoverflow.com/questions/9999963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019687/"
] | FYI, for those folks that have the [PowerShell Community Extensions](http://pscx.codeplex.com) installed:
```
PS> Test-UserGroupMembership -GroupName Administrators
True
```
This cmdlet is a bit more generic in that you can test for group membership in any group. | Check out this url: <http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/11/check-for-admin-credentials-in-a-powershell-script.aspx>
I didn't test it but the summary seems to state what you are looking for: "Learn how to check for administrative credentials when you run a Windows PowerShell script or command." |
9,999,963 | Whats the best/easiest way to test for administrative rights in a PowerShell script?
I need to write a script that requires administrative rights and want to know the best way to achieve it. | 2012/04/03 | [
"https://Stackoverflow.com/questions/9999963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019687/"
] | Here it is directly:
```
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator")
``` | Check out this url: <http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/11/check-for-admin-credentials-in-a-powershell-script.aspx>
I didn't test it but the summary seems to state what you are looking for: "Learn how to check for administrative credentials when you run a Windows PowerShell script or command." |
9,999,963 | Whats the best/easiest way to test for administrative rights in a PowerShell script?
I need to write a script that requires administrative rights and want to know the best way to achieve it. | 2012/04/03 | [
"https://Stackoverflow.com/questions/9999963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019687/"
] | In Powershell 4.0 you can use [requires](https://technet.microsoft.com/en-us/library/hh847765(v=wps.630).aspx) at the top of your script:
```
#Requires -RunAsAdministrator
```
Outputs:
>
> The script 'MyScript.ps1' cannot be run because it contains a "#requires" statement for
> running as Administrator. The curre... | Check out this url: <http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/11/check-for-admin-credentials-in-a-powershell-script.aspx>
I didn't test it but the summary seems to state what you are looking for: "Learn how to check for administrative credentials when you run a Windows PowerShell script or command." |
9,999,963 | Whats the best/easiest way to test for administrative rights in a PowerShell script?
I need to write a script that requires administrative rights and want to know the best way to achieve it. | 2012/04/03 | [
"https://Stackoverflow.com/questions/9999963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019687/"
] | This is the little function I have in a security module:
```
function Test-IsAdmin {
try {
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal -ArgumentList $identity
return $principal.IsInRole( [Security.Principal.Windo... | FYI, for those folks that have the [PowerShell Community Extensions](http://pscx.codeplex.com) installed:
```
PS> Test-UserGroupMembership -GroupName Administrators
True
```
This cmdlet is a bit more generic in that you can test for group membership in any group. |
9,999,963 | Whats the best/easiest way to test for administrative rights in a PowerShell script?
I need to write a script that requires administrative rights and want to know the best way to achieve it. | 2012/04/03 | [
"https://Stackoverflow.com/questions/9999963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019687/"
] | This is the little function I have in a security module:
```
function Test-IsAdmin {
try {
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal -ArgumentList $identity
return $principal.IsInRole( [Security.Principal.Windo... | Here it is directly:
```
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator")
``` |
9,999,963 | Whats the best/easiest way to test for administrative rights in a PowerShell script?
I need to write a script that requires administrative rights and want to know the best way to achieve it. | 2012/04/03 | [
"https://Stackoverflow.com/questions/9999963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019687/"
] | This is the little function I have in a security module:
```
function Test-IsAdmin {
try {
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal -ArgumentList $identity
return $principal.IsInRole( [Security.Principal.Windo... | In Powershell 4.0 you can use [requires](https://technet.microsoft.com/en-us/library/hh847765(v=wps.630).aspx) at the top of your script:
```
#Requires -RunAsAdministrator
```
Outputs:
>
> The script 'MyScript.ps1' cannot be run because it contains a "#requires" statement for
> running as Administrator. The curre... |
9,999,963 | Whats the best/easiest way to test for administrative rights in a PowerShell script?
I need to write a script that requires administrative rights and want to know the best way to achieve it. | 2012/04/03 | [
"https://Stackoverflow.com/questions/9999963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019687/"
] | In Powershell 4.0 you can use [requires](https://technet.microsoft.com/en-us/library/hh847765(v=wps.630).aspx) at the top of your script:
```
#Requires -RunAsAdministrator
```
Outputs:
>
> The script 'MyScript.ps1' cannot be run because it contains a "#requires" statement for
> running as Administrator. The curre... | FYI, for those folks that have the [PowerShell Community Extensions](http://pscx.codeplex.com) installed:
```
PS> Test-UserGroupMembership -GroupName Administrators
True
```
This cmdlet is a bit more generic in that you can test for group membership in any group. |
9,999,963 | Whats the best/easiest way to test for administrative rights in a PowerShell script?
I need to write a script that requires administrative rights and want to know the best way to achieve it. | 2012/04/03 | [
"https://Stackoverflow.com/questions/9999963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019687/"
] | In Powershell 4.0 you can use [requires](https://technet.microsoft.com/en-us/library/hh847765(v=wps.630).aspx) at the top of your script:
```
#Requires -RunAsAdministrator
```
Outputs:
>
> The script 'MyScript.ps1' cannot be run because it contains a "#requires" statement for
> running as Administrator. The curre... | Here it is directly:
```
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator")
``` |
158,298 | I was looking into HMACs and was wondering if a HMAC can verify the existence of a message.
I need to verify another host is (still) holding a large piece of data. I plan to send the host a key and expect a computed hash back. I am considering one of the below methods for the host to generate a unique key confirming t... | 2017/04/27 | [
"https://security.stackexchange.com/questions/158298",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/146874/"
] | What you need here is properly called **randomized hashing**: conceptually, a *family* of secure hash functions, out of which you pick members at random and use those to hash the message. Typically these are implemented as *two-arguement* functions that take a "key" or "salt" as first argument, but it's important to un... | So if I understand you correctly, hosts A and B have a piece of information and A wants to know whether B still possesses it. Why not just ask B to send the data to A?
If the data is large, you might want to hash it and have B send the hash to A. Without the data, B can never make the correct hash.
However, B could g... |
158,298 | I was looking into HMACs and was wondering if a HMAC can verify the existence of a message.
I need to verify another host is (still) holding a large piece of data. I plan to send the host a key and expect a computed hash back. I am considering one of the below methods for the host to generate a unique key confirming t... | 2017/04/27 | [
"https://security.stackexchange.com/questions/158298",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/146874/"
] | What you need here is properly called **randomized hashing**: conceptually, a *family* of secure hash functions, out of which you pick members at random and use those to hash the message. Typically these are implemented as *two-arguement* functions that take a "key" or "salt" as first argument, but it's important to un... | I think the simplest solution is for you to pre-compute a set of hashes of offset+length and then send a request with one of these offset,length pairs every so often.
Whatever you do, you must perform the same operations ahead of time if you expect to delete the data you're uploading, and this method imposes the lowes... |
54,496,672 | If I have a route like the following.
```php
Route::post('/user/{id}', 'UserController@my_function');
```
How do I set up the controller function to be like this so I can use the URL parameter and POST request body data? I'd expect it to be similar to the below code, but is this correct?
```php
public function my_f... | 2019/02/02 | [
"https://Stackoverflow.com/questions/54496672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9693461/"
] | The way you doing is correct according to the laravel docs.
>
> If your controller method is also expecting input from a route parameter, list your route arguments after your other dependencies. For example, if your route is defined like so:
>
>
>
```
Route::put('user/{id}', 'UserController@update');
```
>
>... | its ok but i love passing the id like this when i am returning a view
```
public function my_function(Request $request){
return view('myfile',['id'=>$id]);
}
``` |
54,496,672 | If I have a route like the following.
```php
Route::post('/user/{id}', 'UserController@my_function');
```
How do I set up the controller function to be like this so I can use the URL parameter and POST request body data? I'd expect it to be similar to the below code, but is this correct?
```php
public function my_f... | 2019/02/02 | [
"https://Stackoverflow.com/questions/54496672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9693461/"
] | The way you doing is correct according to the laravel docs.
>
> If your controller method is also expecting input from a route parameter, list your route arguments after your other dependencies. For example, if your route is defined like so:
>
>
>
```
Route::put('user/{id}', 'UserController@update');
```
>
>... | When ever you expose your url arguments like that you have to use a get request parameter to pass it through e.g localhost:3000/user/1
`Route::get('/user/{id}', 'UserController@my_function');`
`public function my_function($id){
//do something
}`
But if you pass an id under the hold i.e hidden through post.
`Route... |
6,801 | I have a brocade icx 6450 with the following config. The pc's are connected directly to the phones.
I have port 1/1/48 going into another switch which is has the dhcp server for the data network and port 1/2/1 going to another switch which has the dhcp server for the voip network.
Now the pc's get the dhcp requests ... | 2014/03/13 | [
"https://networkengineering.stackexchange.com/questions/6801",
"https://networkengineering.stackexchange.com",
"https://networkengineering.stackexchange.com/users/864/"
] | Add IP addresses (gateway) to the `ve` interfaces. That way it has a source address to route the DHCP requests from.
i.e.
```
interface ve 100
ip address 192.168.16.x 255.255.255.x
ip helper-address 1 192.168.16.205
!
interface ve 150
ip address 10.50.1.x 255.255.255.x
ip helper-address 1 10.50.1.1
!
```
or wha... | I don't know Brocade's device specifically, but the config seems pretty straightfoward.
Are you using Trunking (802.1Q) to have multiple VLANs between your switches? You seem to have more than one VLAN on the swich (150 + default) but only the default VLAN on your uplink port.
If that's the case and the Brocade autom... |
4,061,869 | Is $((\frac{1}{a})^{\frac{1}{b}})^{\frac{1}{c}}=\frac{1}{\sqrt[bc]{a}}$?
I believe it is since $((\frac{1}{a})^{\frac{1}{b}})^{\frac{1}{c}}=\frac{1}{\sqrt[b]{a}}^\frac{1}{c}=\frac{1}{\sqrt[bc]{a}}$.
Can someone please confirm my suspicions as I just came across a question that states in the answer that $((\frac{1}{a}... | 2021/03/14 | [
"https://math.stackexchange.com/questions/4061869",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/854466/"
] | For $a, b, c > 0$, yes, you are correct. This is easy to check: choose $a = 729 = 3^6$, $b = 1/2$, $c = 1/3$. We must obviously have $((1/a)^{1/b})^{1/c} < 1$, but $\sqrt[6]{729} > 1$. | ${ \left( {\frac{1}{a}}^{\frac{1}{b}} \right)}^{\frac{1}{c}}= { \frac{1}{a}}^{ \frac{1}{b} \cdot \frac{1}{c}} = { \frac{1}{a} }^{ \frac{1}{bc}} = \frac{1}{a^{\frac{1}{bc}}} = \frac{1}{\sqrt[bc]{a}}$
Thus, yes (assuming $a,b,c$ are all positive reals). |
4,061,869 | Is $((\frac{1}{a})^{\frac{1}{b}})^{\frac{1}{c}}=\frac{1}{\sqrt[bc]{a}}$?
I believe it is since $((\frac{1}{a})^{\frac{1}{b}})^{\frac{1}{c}}=\frac{1}{\sqrt[b]{a}}^\frac{1}{c}=\frac{1}{\sqrt[bc]{a}}$.
Can someone please confirm my suspicions as I just came across a question that states in the answer that $((\frac{1}{a}... | 2021/03/14 | [
"https://math.stackexchange.com/questions/4061869",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/854466/"
] | For $a, b, c > 0$, yes, you are correct. This is easy to check: choose $a = 729 = 3^6$, $b = 1/2$, $c = 1/3$. We must obviously have $((1/a)^{1/b})^{1/c} < 1$, but $\sqrt[6]{729} > 1$. | *assuming* you are working with positive real numbers and *assuming* you are using the definition that if $m \ne 1$ and $m > 0$ and $k \in \mathbb N$ the $m^{\frac 1k}$ is defined to be (and you have proven there *is* such) the unique one and only positive number $w$ so that $w^k = m$ then
$((\frac 1a)^{\frac 1b})^{\f... |
4,061,869 | Is $((\frac{1}{a})^{\frac{1}{b}})^{\frac{1}{c}}=\frac{1}{\sqrt[bc]{a}}$?
I believe it is since $((\frac{1}{a})^{\frac{1}{b}})^{\frac{1}{c}}=\frac{1}{\sqrt[b]{a}}^\frac{1}{c}=\frac{1}{\sqrt[bc]{a}}$.
Can someone please confirm my suspicions as I just came across a question that states in the answer that $((\frac{1}{a}... | 2021/03/14 | [
"https://math.stackexchange.com/questions/4061869",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/854466/"
] | ${ \left( {\frac{1}{a}}^{\frac{1}{b}} \right)}^{\frac{1}{c}}= { \frac{1}{a}}^{ \frac{1}{b} \cdot \frac{1}{c}} = { \frac{1}{a} }^{ \frac{1}{bc}} = \frac{1}{a^{\frac{1}{bc}}} = \frac{1}{\sqrt[bc]{a}}$
Thus, yes (assuming $a,b,c$ are all positive reals). | *assuming* you are working with positive real numbers and *assuming* you are using the definition that if $m \ne 1$ and $m > 0$ and $k \in \mathbb N$ the $m^{\frac 1k}$ is defined to be (and you have proven there *is* such) the unique one and only positive number $w$ so that $w^k = m$ then
$((\frac 1a)^{\frac 1b})^{\f... |
1,643,073 | This is a general question on how to unit-test a Java Class using mock objects.
I can summarize my problem with this example.
Let's say I've an Interface called MyInterface.java and a "TwoString" Object that doesn't override equals()
**"TwoString.java"**
```
private String string1;
private String string... | 2009/10/29 | [
"https://Stackoverflow.com/questions/1643073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109970/"
] | First up - you probably mean "override equals" rather than implement, since all classes have *some* implementation of equals (the one they inherit from Object if they don't override anything else).
The answer in this case is simple - all value objects really really ought to implements equals and hashcode. Whether it's... | You can achieve this with argument captors in Mockito 1.8.
<http://mockito.googlecode.com/svn/branches/1.8.0/javadoc/org/mockito/Mockito.html#15>
I know you are using EasyMock but changing to Mockito is easy and it's much better! |
1,643,073 | This is a general question on how to unit-test a Java Class using mock objects.
I can summarize my problem with this example.
Let's say I've an Interface called MyInterface.java and a "TwoString" Object that doesn't override equals()
**"TwoString.java"**
```
private String string1;
private String string... | 2009/10/29 | [
"https://Stackoverflow.com/questions/1643073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109970/"
] | First up - you probably mean "override equals" rather than implement, since all classes have *some* implementation of equals (the one they inherit from Object if they don't override anything else).
The answer in this case is simple - all value objects really really ought to implements equals and hashcode. Whether it's... | >
> In this case the TwoString object is very simple and it will be easy to override the equals method - but what if I need to check a more complex object.
>
>
>
Once your objects start becoming so complex that you can't trivially check if they're equal from elsewhere, you should probably refactor and inject them ... |
1,643,073 | This is a general question on how to unit-test a Java Class using mock objects.
I can summarize my problem with this example.
Let's say I've an Interface called MyInterface.java and a "TwoString" Object that doesn't override equals()
**"TwoString.java"**
```
private String string1;
private String string... | 2009/10/29 | [
"https://Stackoverflow.com/questions/1643073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109970/"
] | It is possible to use a custom equals matching method using `org.easymock.IArgumentMatcher`.
It should look something like:
```
private static <T extends TwoString> T eqTwoString(final TwoString twoString) {
reportMatcher(new IArgumentMatcher() {
/** Required to get nice output */
public void appe... | First up - you probably mean "override equals" rather than implement, since all classes have *some* implementation of equals (the one they inherit from Object if they don't override anything else).
The answer in this case is simple - all value objects really really ought to implements equals and hashcode. Whether it's... |
1,643,073 | This is a general question on how to unit-test a Java Class using mock objects.
I can summarize my problem with this example.
Let's say I've an Interface called MyInterface.java and a "TwoString" Object that doesn't override equals()
**"TwoString.java"**
```
private String string1;
private String string... | 2009/10/29 | [
"https://Stackoverflow.com/questions/1643073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109970/"
] | Take a look at Jakarta Commons Lang: [EqualsBuilder.reflectionEquals()](http://commons.apache.org/lang/api/org/apache/commons/lang/builder/EqualsBuilder.html#reflectionEquals(java.lang.Object,%20java.lang.Object))
While I agree with *dtsazza* that all value objects should have an `equals()` (and `hashCode()`) method, ... | You can achieve this with argument captors in Mockito 1.8.
<http://mockito.googlecode.com/svn/branches/1.8.0/javadoc/org/mockito/Mockito.html#15>
I know you are using EasyMock but changing to Mockito is easy and it's much better! |
1,643,073 | This is a general question on how to unit-test a Java Class using mock objects.
I can summarize my problem with this example.
Let's say I've an Interface called MyInterface.java and a "TwoString" Object that doesn't override equals()
**"TwoString.java"**
```
private String string1;
private String string... | 2009/10/29 | [
"https://Stackoverflow.com/questions/1643073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109970/"
] | >
> In this case the TwoString object is very simple and it will be easy to override the equals method - but what if I need to check a more complex object.
>
>
>
Once your objects start becoming so complex that you can't trivially check if they're equal from elsewhere, you should probably refactor and inject them ... | You can achieve this with argument captors in Mockito 1.8.
<http://mockito.googlecode.com/svn/branches/1.8.0/javadoc/org/mockito/Mockito.html#15>
I know you are using EasyMock but changing to Mockito is easy and it's much better! |
1,643,073 | This is a general question on how to unit-test a Java Class using mock objects.
I can summarize my problem with this example.
Let's say I've an Interface called MyInterface.java and a "TwoString" Object that doesn't override equals()
**"TwoString.java"**
```
private String string1;
private String string... | 2009/10/29 | [
"https://Stackoverflow.com/questions/1643073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109970/"
] | It is possible to use a custom equals matching method using `org.easymock.IArgumentMatcher`.
It should look something like:
```
private static <T extends TwoString> T eqTwoString(final TwoString twoString) {
reportMatcher(new IArgumentMatcher() {
/** Required to get nice output */
public void appe... | You can achieve this with argument captors in Mockito 1.8.
<http://mockito.googlecode.com/svn/branches/1.8.0/javadoc/org/mockito/Mockito.html#15>
I know you are using EasyMock but changing to Mockito is easy and it's much better! |
1,643,073 | This is a general question on how to unit-test a Java Class using mock objects.
I can summarize my problem with this example.
Let's say I've an Interface called MyInterface.java and a "TwoString" Object that doesn't override equals()
**"TwoString.java"**
```
private String string1;
private String string... | 2009/10/29 | [
"https://Stackoverflow.com/questions/1643073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109970/"
] | Take a look at Jakarta Commons Lang: [EqualsBuilder.reflectionEquals()](http://commons.apache.org/lang/api/org/apache/commons/lang/builder/EqualsBuilder.html#reflectionEquals(java.lang.Object,%20java.lang.Object))
While I agree with *dtsazza* that all value objects should have an `equals()` (and `hashCode()`) method, ... | >
> In this case the TwoString object is very simple and it will be easy to override the equals method - but what if I need to check a more complex object.
>
>
>
Once your objects start becoming so complex that you can't trivially check if they're equal from elsewhere, you should probably refactor and inject them ... |
1,643,073 | This is a general question on how to unit-test a Java Class using mock objects.
I can summarize my problem with this example.
Let's say I've an Interface called MyInterface.java and a "TwoString" Object that doesn't override equals()
**"TwoString.java"**
```
private String string1;
private String string... | 2009/10/29 | [
"https://Stackoverflow.com/questions/1643073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109970/"
] | It is possible to use a custom equals matching method using `org.easymock.IArgumentMatcher`.
It should look something like:
```
private static <T extends TwoString> T eqTwoString(final TwoString twoString) {
reportMatcher(new IArgumentMatcher() {
/** Required to get nice output */
public void appe... | Take a look at Jakarta Commons Lang: [EqualsBuilder.reflectionEquals()](http://commons.apache.org/lang/api/org/apache/commons/lang/builder/EqualsBuilder.html#reflectionEquals(java.lang.Object,%20java.lang.Object))
While I agree with *dtsazza* that all value objects should have an `equals()` (and `hashCode()`) method, ... |
1,643,073 | This is a general question on how to unit-test a Java Class using mock objects.
I can summarize my problem with this example.
Let's say I've an Interface called MyInterface.java and a "TwoString" Object that doesn't override equals()
**"TwoString.java"**
```
private String string1;
private String string... | 2009/10/29 | [
"https://Stackoverflow.com/questions/1643073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109970/"
] | It is possible to use a custom equals matching method using `org.easymock.IArgumentMatcher`.
It should look something like:
```
private static <T extends TwoString> T eqTwoString(final TwoString twoString) {
reportMatcher(new IArgumentMatcher() {
/** Required to get nice output */
public void appe... | >
> In this case the TwoString object is very simple and it will be easy to override the equals method - but what if I need to check a more complex object.
>
>
>
Once your objects start becoming so complex that you can't trivially check if they're equal from elsewhere, you should probably refactor and inject them ... |
47,166,294 | Is there any built-in way to round a number down no matter the decimals?
For example
```
<div>{{var / 3 | number:0}}</div>
```
if the result of the division is 9.99 I would like to show just 9, not 10
Thanks | 2017/11/07 | [
"https://Stackoverflow.com/questions/47166294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/555340/"
] | Use a custom filter, here's a great answer from: <http://tianes.logdown.com/posts/2015/12/08/rounding-a-number-to-the-nearest-neighbour-up-and-down>
```
/*********************************************************
- Author: Sebastian Cubillos
- Github: @tianes
- More Gists: https://gist.github.com/tianes/
... | You could use javascripts Floor() which will round a number downward to the nearest integer
```
var numb = Math.floor(9.99) // numb = 9
``` |
463,091 | I have a global rsnapshot config file for all machines that we backup. The global file has
```
ssh_args -p 123
```
The machine specific files include the global config file and tries to override the port:
```
include_conf /etc/rsnapshot-common.conf
ssh_args -p 456
```
This does not work, I get the error:
>... | 2013/01/04 | [
"https://serverfault.com/questions/463091",
"https://serverfault.com",
"https://serverfault.com/users/15623/"
] | The [rsnapshot](http://linux.die.net/man/1/rsnapshot) man page seems to imply that you add the `per-backup-point` arguments as a comma separated list after the destination, the example they give is
```
backup /var/ localhost/ one_fs=1
```
>
> This is the same as the other examples, but notice the fourth column. Thi... | You can also set the port globally for that user inside the corresponding `~/.ssh/config`:
```
Host example.com
Port 1234
```
That way it'd get picked up everywhere SSH-related and you won't have to manually specify it each time.
Not saying it's a better solution, just an alternative. |
463,091 | I have a global rsnapshot config file for all machines that we backup. The global file has
```
ssh_args -p 123
```
The machine specific files include the global config file and tries to override the port:
```
include_conf /etc/rsnapshot-common.conf
ssh_args -p 456
```
This does not work, I get the error:
>... | 2013/01/04 | [
"https://serverfault.com/questions/463091",
"https://serverfault.com",
"https://serverfault.com/users/15623/"
] | The [rsnapshot](http://linux.die.net/man/1/rsnapshot) man page seems to imply that you add the `per-backup-point` arguments as a comma separated list after the destination, the example they give is
```
backup /var/ localhost/ one_fs=1
```
>
> This is the same as the other examples, but notice the fourth column. Thi... | rsnapshot.conf is a TAB-separated file, so the ssh\_args can even contain spaces. Mine looks like this:
```
backup root@HOSTNAME:/ HOSTNAME/ ssh_args=-p 2220 -i /ssh-id -o StrictHostKeychecking=no
``` |
463,091 | I have a global rsnapshot config file for all machines that we backup. The global file has
```
ssh_args -p 123
```
The machine specific files include the global config file and tries to override the port:
```
include_conf /etc/rsnapshot-common.conf
ssh_args -p 456
```
This does not work, I get the error:
>... | 2013/01/04 | [
"https://serverfault.com/questions/463091",
"https://serverfault.com",
"https://serverfault.com/users/15623/"
] | You can also set the port globally for that user inside the corresponding `~/.ssh/config`:
```
Host example.com
Port 1234
```
That way it'd get picked up everywhere SSH-related and you won't have to manually specify it each time.
Not saying it's a better solution, just an alternative. | rsnapshot.conf is a TAB-separated file, so the ssh\_args can even contain spaces. Mine looks like this:
```
backup root@HOSTNAME:/ HOSTNAME/ ssh_args=-p 2220 -i /ssh-id -o StrictHostKeychecking=no
``` |
250,799 | I setup Magento, however, my admin page is not accessible on the website. Every time I go to the admin page it pops up with 'This site can’t be reached'
Current URL: 77.68.94.254
Any help with this? I think it's due to SSL as I have to take out the s out of the Https when I access the site, however, I can't get a SSL... | 2018/11/21 | [
"https://magento.stackexchange.com/questions/250799",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/73827/"
] | You can change the format of the date. Add this line to your code
```
<item name="dateFormat" xsi:type="string">Y-MM-dd HH:mm:ss</item>
```
modify the date format according to you . For more reference check this link
[UI component - display the time to 'Y-m-d H:i:s' format(ISO time format)](https://magento.stackexch... | You need to add custom file to add customization :
```
<column name="date" class="VendorName\ModuleName\Ui\Component\Listing\Column\TestingFile">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">dateRange</item>
<ite... |
222,007 | Every time I boot my system I get software update notifications for Java, Adobe Reader and my Creative Soundblaster card.
I then install the updates, but every time I reboot, it says that there are updates for them again. This has been happening for a couple months. It's annoying.
Anyone know any way to resolve this... | 2010/12/14 | [
"https://superuser.com/questions/222007",
"https://superuser.com",
"https://superuser.com/users/59161/"
] | Perhaps try running the updaters with explicit Administrator permission (right-click the app and select 'Run As Administrator')?
Another option is to uninstall and reinstall the applications themselves. | Yes, disable the updaters or download the latest version of this software directly from the website and install it. I'd suggest the second option for security.
Java updater can be disabled in **Control Panel -> Java**.
Adobe Updater can be disabled by opening Reader and going to **Edit -> Preferences -> Updater**.
C... |
222,007 | Every time I boot my system I get software update notifications for Java, Adobe Reader and my Creative Soundblaster card.
I then install the updates, but every time I reboot, it says that there are updates for them again. This has been happening for a couple months. It's annoying.
Anyone know any way to resolve this... | 2010/12/14 | [
"https://superuser.com/questions/222007",
"https://superuser.com",
"https://superuser.com/users/59161/"
] | Perhaps try running the updaters with explicit Administrator permission (right-click the app and select 'Run As Administrator')?
Another option is to uninstall and reinstall the applications themselves. | Look into the [Task Scheduler](http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614%28v=vs.85%29.aspx) as well as the options of the updaters, you can change the event that decides when to check for updates to something on a weekly basis rather than on boot. |
22,900,921 | I have my nav working almost exactly how I want it. The only issue left I can't seem to figure out is this little arrow image I use on a subnav which indicates it contains another level subnav.
```
ul#css3menu ul span {
background-image: url("images/arrowsub.png");
padding-right: 28px;
}
ul#css3menu ul span:... | 2014/04/06 | [
"https://Stackoverflow.com/questions/22900921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2588953/"
] | I'd recommend Google [protobuf](https://code.google.com/p/protobuf/): it is binary, stable, proven, and has bindings for all languages you've mentioned. Moreover, it also handles structured data nicely. | There is a binary json format called [bson](http://bsonspec.org/).
>
> I would also like to point out that a lot of these calculations will be taking place, so a text-based format (such as JSON) **may** produce far larger operation times.
>
>
>
---
>
> Do not optimize before you measured.
> Premature optimiza... |
22,900,921 | I have my nav working almost exactly how I want it. The only issue left I can't seem to figure out is this little arrow image I use on a subnav which indicates it contains another level subnav.
```
ul#css3menu ul span {
background-image: url("images/arrowsub.png");
padding-right: 28px;
}
ul#css3menu ul span:... | 2014/04/06 | [
"https://Stackoverflow.com/questions/22900921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2588953/"
] | There is a binary json format called [bson](http://bsonspec.org/).
>
> I would also like to point out that a lot of these calculations will be taking place, so a text-based format (such as JSON) **may** produce far larger operation times.
>
>
>
---
>
> Do not optimize before you measured.
> Premature optimiza... | Thrift,Protobuf,JSON,MessagePack
complexity of installation Thrift >> Protobuf > BSON > MessagePack > JSON
serialization data size JSON > MessagePack > Binary Thrift > Compact Thrift > Protobuf
time cost Compact Thrift > Binary Thrift > Protobuf > JSON > MessagePack |
22,900,921 | I have my nav working almost exactly how I want it. The only issue left I can't seem to figure out is this little arrow image I use on a subnav which indicates it contains another level subnav.
```
ul#css3menu ul span {
background-image: url("images/arrowsub.png");
padding-right: 28px;
}
ul#css3menu ul span:... | 2014/04/06 | [
"https://Stackoverflow.com/questions/22900921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2588953/"
] | I'd recommend Google [protobuf](https://code.google.com/p/protobuf/): it is binary, stable, proven, and has bindings for all languages you've mentioned. Moreover, it also handles structured data nicely. | Thrift,Protobuf,JSON,MessagePack
complexity of installation Thrift >> Protobuf > BSON > MessagePack > JSON
serialization data size JSON > MessagePack > Binary Thrift > Compact Thrift > Protobuf
time cost Compact Thrift > Binary Thrift > Protobuf > JSON > MessagePack |
10,133,309 | I am new to using `ArrayList`'s in java. I have several lists and want to write a method for removing a list with its elements. Here is what I have so far:
```
public void delete(double value){
list.remove(value);
}
```
After that I want get the output:
```
public ArrayList<Double> getlist(){
return list;
}... | 2012/04/12 | [
"https://Stackoverflow.com/questions/10133309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1324522/"
] | How long does the loading of images take? If it's negligible then why not load each image in right before you display it, discarding the old one? That way you only have 1 image in memory at any one stage.
Alternatively do something akin to using a back buffer, have two spaces in memory, one for the image being displa... | Despite what people say, you actually can have a lot of images in your Live Wallpaper. The only tricky thing is the memory limit. I had as much as 40 .pngs loaded in my application and i reloaded them once in a minute.
But when you handling that many images in your application, you have to load them in a smart way:
... |
36,154,014 | I am looking for a trick or solution on my problem. Maybe one of you may advice me some way ?
**STRUCTURE**
So I have my combobox with the code as below:
```
<GridViewColumn Header="{lex:LocText CurrentWordCode}" controls:CustomColumnInfo.Name="CurrentWordCode">
<GridViewColumn.CellTemplate>
... | 2016/03/22 | [
"https://Stackoverflow.com/questions/36154014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4906746/"
] | First, You can loose the third item in your tuple, this is purely for display puposes and should not be there, since we already have all info we need in the other two items.
Second, you will need to use a controltemplate to tell your combobox how to display it's contents. You will need two, actually. One for the selec... | Looks like you need to set the following properties of ComboBox:
```
<ComboBox x:Name="ToolsComboBox" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0" SelectedItem="{Binding SelectedCurrentWord}" ItemsSource="{Binding AvailbleWords}" SelectedValuePath="Item1" SelectionBoxItemTemplate="{Path_to your ... |
61,887,505 | I observe that subsequent runs of the same program deliver different labels for the k-means clusters, although the original features are the same. The program applies a set of transformations to an original dataframe, and then to a new dataframe, the pipeline consisting of -- in this order -- StandardScaler--> PCA --> ... | 2020/05/19 | [
"https://Stackoverflow.com/questions/61887505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9332343/"
] | Your program could use several optimizations, but let's focus on the main issue. The least frequent characters input string `"We were here"` are actually `'W'`, `'w'` and `'h'`, all of them with a single occurrence.
Your mistake is considering `'W'` and `'w'` as the same character. They're not, as the first is upper c... | Sorry to say that, but your code is way too complicated for the given simple problem of computing a character histogram. You just need one loop over the string to compute the histogram, plus another loop for determining the minimum afterwards (or keep the minimum count and associated letters while computing the histogr... |
61,887,505 | I observe that subsequent runs of the same program deliver different labels for the k-means clusters, although the original features are the same. The program applies a set of transformations to an original dataframe, and then to a new dataframe, the pipeline consisting of -- in this order -- StandardScaler--> PCA --> ... | 2020/05/19 | [
"https://Stackoverflow.com/questions/61887505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9332343/"
] | Your program could use several optimizations, but let's focus on the main issue. The least frequent characters input string `"We were here"` are actually `'W'`, `'w'` and `'h'`, all of them with a single occurrence.
Your mistake is considering `'W'` and `'w'` as the same character. They're not, as the first is upper c... | In C, you can make use of the fact that `char` is in fact stored as an `int`. The `ascii` array below is used to store the frequency of each ASCII character in the input string. If a `B` character, `ascii[66]` is incremented (ASCII code of `B` is 66).
I implemented a simple `smallest` function that returns the index o... |
20,407,046 | Dear fellow programmers,
I am very new to programming and i am following the tutorial on using app engine backend tutorial. However i face some problem along the way.
I have Setup App Engine Backend Application Project, created a CheckIn entity class.
After which, i follow the instruction to create a new class with t... | 2013/12/05 | [
"https://Stackoverflow.com/questions/20407046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3054711/"
] | The instructions as provided by Google are confusing. What the instructions intended to say is after creating CheckIn.java, right-click on the CheckIn.java file and select Google->Generate Cloud Endpoint Class. This will then automatically create the CheckInEndpoint.java file.
Read through the entire "Entity Design Cl... | Try adding this annotation to your CheckIn class:
```
import javax.jdo.annotations.PersistenceCapable;
@PersistenceCapable
public class CheckIn ...
```
This way it will find it as a JDO entity class and it will generate your CheckInEndPoint class. |
20,407,046 | Dear fellow programmers,
I am very new to programming and i am following the tutorial on using app engine backend tutorial. However i face some problem along the way.
I have Setup App Engine Backend Application Project, created a CheckIn entity class.
After which, i follow the instruction to create a new class with t... | 2013/12/05 | [
"https://Stackoverflow.com/questions/20407046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3054711/"
] | Try adding this annotation to your CheckIn class:
```
import javax.jdo.annotations.PersistenceCapable;
@PersistenceCapable
public class CheckIn ...
```
This way it will find it as a JDO entity class and it will generate your CheckInEndPoint class. | I had the same error, I have first renamed the class CheckInEndPoint I've created manually to avoid any kind of conflicts. After that I have right clicked on
```
CheckIn class -> Google ->Generate Cloud Endpoint Class.
```
If you get some dependencies errors, please try check whether all the classes like ApiKeysAnd... |
20,407,046 | Dear fellow programmers,
I am very new to programming and i am following the tutorial on using app engine backend tutorial. However i face some problem along the way.
I have Setup App Engine Backend Application Project, created a CheckIn entity class.
After which, i follow the instruction to create a new class with t... | 2013/12/05 | [
"https://Stackoverflow.com/questions/20407046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3054711/"
] | The instructions as provided by Google are confusing. What the instructions intended to say is after creating CheckIn.java, right-click on the CheckIn.java file and select Google->Generate Cloud Endpoint Class. This will then automatically create the CheckInEndpoint.java file.
Read through the entire "Entity Design Cl... | I had the same error, I have first renamed the class CheckInEndPoint I've created manually to avoid any kind of conflicts. After that I have right clicked on
```
CheckIn class -> Google ->Generate Cloud Endpoint Class.
```
If you get some dependencies errors, please try check whether all the classes like ApiKeysAnd... |
55,088 | I've just remove my mudguards from my Ti frame and as usual I have put the bolts back into the frame where the thread goes into a tube - for example in the chain-stay bridge and brake bridge.
I used anti-seize on the threads and did not do them up tight.
Should I be doing this?
I do it because it looks a bit neater a... | 2018/06/05 | [
"https://bicycles.stackexchange.com/questions/55088",
"https://bicycles.stackexchange.com",
"https://bicycles.stackexchange.com/users/10367/"
] | I usually plug the hole with appropriate size hardware. I add a dab of anti-seize compound. My reasoning (other than appearance) is that while the frame is aluminum or carbon the threaded insert is typically steel and there fore subject to rust. | I leave mudguard, waterbottle mount etc. bolts in the frame, with appropriate grease, anti-seize applied. I do this mostly so I can find them when I need to mount the component again. |
55,088 | I've just remove my mudguards from my Ti frame and as usual I have put the bolts back into the frame where the thread goes into a tube - for example in the chain-stay bridge and brake bridge.
I used anti-seize on the threads and did not do them up tight.
Should I be doing this?
I do it because it looks a bit neater a... | 2018/06/05 | [
"https://bicycles.stackexchange.com/questions/55088",
"https://bicycles.stackexchange.com",
"https://bicycles.stackexchange.com/users/10367/"
] | I usually plug the hole with appropriate size hardware. I add a dab of anti-seize compound. My reasoning (other than appearance) is that while the frame is aluminum or carbon the threaded insert is typically steel and there fore subject to rust. | You should plug the with something for two reasons:
1) to prevent water ingress into the frame
2) the brazing or frame threads are usually bare metal so they will rust easily
It’s easy to put a bolt into them or a plastic or rubber plug (if you’re a weight weenie) |
37,789,636 | I want to get a `NSArray` with all the `UIImage` from a Live Photo to create a GIF of that. I tried to make screenshots while animating the live photo but it doesn't work.
Can anyone help me?
Thanks! | 2016/06/13 | [
"https://Stackoverflow.com/questions/37789636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6030212/"
] | Replace
```
Intent imageEditorIntent = new AdobeImageIntent().Builder(this)
^^^^^
```
with:
```
Intent imageEditorIntent = new AdobeImageIntent.Builder(this)
^^^^^
``` | Possible issues with the code above
===================================
Try removing the `cdsIntent` and see if your code runs.
Without more information, it's hard to know, but it could be that both your `cdsIntent` and your `imageView` assignments are coming too late in `onCreate()`.
Taking a photo from your app
=... |
1,791,656 | How to solve this equation?
Find all polynomials $P$ such that
$P(x)^2+P(\frac1x)^2=
P(x^2)P(\frac1{x^2})$
Please step by step | 2016/05/19 | [
"https://math.stackexchange.com/questions/1791656",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/296138/"
] | Notation: A box $X$ has $x$ balls inside.
First of all, note that no box can contain less than $1$ and more than $t$ balls. Also, the sum of two boxes mustn't be lower than $t + 1$.
Let's say box $A$ has $1 \leq a \leq t$ balls. Box $B$ must have then at least $t - a + 1 \leq b \leq t$ balls. This gives you $a$ ways ... | There must be at least $1$ ball in the first box; why? On the other hand, there cannot be more than $t$ balls in the first box; why?
Say there are $n$ balls in the first box, where $1\le n\le t$. If there are $m$ balls in the second box, what are the possible values for $m$? We have to be sure that
$$m+n>(2t+1)-(m+... |
223,586 | 1. I would like to login to root via ssh directly while at home (192.168.1.0/24).
2. But while outside (e.g. at work), I can still login via ssh by using one of the custom accounts I created.
I jus tried:
```
Match Address 192.168.1.0/24
PermitRootLogin yes
```
and now I'm completely locked out of the box. ... | 2015/08/17 | [
"https://unix.stackexchange.com/questions/223586",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/79941/"
] | Check out the [AUTHORIZED\_KEYS FILE FORMAT](http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man8/sshd.8#x415554484f52495a45445f4b4559532046494c4520464f524d4154) section of the sshd man page. Then add something like the following to `~root/.ssh/authorized_keys` (where the `ssh-ed25519 ...` part is replaced by yo... | The configuration change you made means "allow root from 192.168.1.0/24, deny everything else". In other words, only the conditions that match are allowed access.
You could try this instead:
```
AllowUsers root@192.168.1.? anotheruser1 anotheruser2
```
That means root from 192.168.1.0/24, and the other two users fr... |
14,596,861 | I am trying to write some message to text file. The text file is in the server path. I am able to read content from that file. But i am unable to write content to that file. I am getting FileNotFoundException: \wastServer\apps\LogPath\message.txt (Access Denied).
Note: File has a read and write permissions.
But where... | 2013/01/30 | [
"https://Stackoverflow.com/questions/14596861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2023982/"
] | Please check whether you can access the `apps` and `LogPath` directory.
Type these on Run (Windows Key + R)
```
\\\\wastServer\\apps\\
\\\\wastServer\\apps\\LogPath\\
```
And see whether you can access those directories from the machine and user you are executing the above code. | After this line
```
File fo = new File(FilePath);
```
try to print the absolute path
```
System.out.println( fo.getAbsolutePath() );
```
And then check whether the file exists in that location, instead of directly checking at
```
\\\\wastServer\\apps\\LogPath\\message.txt
```
So , you will know, where the com... |
14,596,861 | I am trying to write some message to text file. The text file is in the server path. I am able to read content from that file. But i am unable to write content to that file. I am getting FileNotFoundException: \wastServer\apps\LogPath\message.txt (Access Denied).
Note: File has a read and write permissions.
But where... | 2013/01/30 | [
"https://Stackoverflow.com/questions/14596861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2023982/"
] | Please check whether you can access the `apps` and `LogPath` directory.
Type these on Run (Windows Key + R)
```
\\\\wastServer\\apps\\
\\\\wastServer\\apps\\LogPath\\
```
And see whether you can access those directories from the machine and user you are executing the above code. | You don't have write access to the share, one of the directories, or the file itself. Possibly the file is already open. |
14,596,861 | I am trying to write some message to text file. The text file is in the server path. I am able to read content from that file. But i am unable to write content to that file. I am getting FileNotFoundException: \wastServer\apps\LogPath\message.txt (Access Denied).
Note: File has a read and write permissions.
But where... | 2013/01/30 | [
"https://Stackoverflow.com/questions/14596861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2023982/"
] | You don't have write access to the share, one of the directories, or the file itself. Possibly the file is already open. | After this line
```
File fo = new File(FilePath);
```
try to print the absolute path
```
System.out.println( fo.getAbsolutePath() );
```
And then check whether the file exists in that location, instead of directly checking at
```
\\\\wastServer\\apps\\LogPath\\message.txt
```
So , you will know, where the com... |
8,979,434 | is it possible to redirect a visitor on my php page as soon as I received a Postback/Callback? If yes can someone provide me some pointers where to start. Searched in Google for it but found nothing...
Thanks! | 2012/01/23 | [
"https://Stackoverflow.com/questions/8979434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165907/"
] | I believe you mean [include?](http://www.ruby-doc.org/core-1.9.2/String.html#method-i-include-3F) | include?
<http://ruby-doc.org/core-1.9.3/String.html#method-i-include-3F> |
8,979,434 | is it possible to redirect a visitor on my php page as soon as I received a Postback/Callback? If yes can someone provide me some pointers where to start. Searched in Google for it but found nothing...
Thanks! | 2012/01/23 | [
"https://Stackoverflow.com/questions/8979434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165907/"
] | I believe you mean [include?](http://www.ruby-doc.org/core-1.9.2/String.html#method-i-include-3F) | I believe you are looking for include?
```
"ab123de".include?("123")
``` |
8,979,434 | is it possible to redirect a visitor on my php page as soon as I received a Postback/Callback? If yes can someone provide me some pointers where to start. Searched in Google for it but found nothing...
Thanks! | 2012/01/23 | [
"https://Stackoverflow.com/questions/8979434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165907/"
] | I believe you mean [include?](http://www.ruby-doc.org/core-1.9.2/String.html#method-i-include-3F) | Sorry, found what i was looking for (because of the use of **regexp**):
>
> index(regexp [, offset]) → fixnum or nil
>
>
> Returns the index of the
> first occurrence of the given substring or pattern (regexp) in str.
> Returns nil if not found.
>
>
>
```
"hello".index('lo') #=> 3
"hello".index('a') ... |
8,979,434 | is it possible to redirect a visitor on my php page as soon as I received a Postback/Callback? If yes can someone provide me some pointers where to start. Searched in Google for it but found nothing...
Thanks! | 2012/01/23 | [
"https://Stackoverflow.com/questions/8979434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165907/"
] | I believe you are looking for include?
```
"ab123de".include?("123")
``` | include?
<http://ruby-doc.org/core-1.9.3/String.html#method-i-include-3F> |
8,979,434 | is it possible to redirect a visitor on my php page as soon as I received a Postback/Callback? If yes can someone provide me some pointers where to start. Searched in Google for it but found nothing...
Thanks! | 2012/01/23 | [
"https://Stackoverflow.com/questions/8979434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165907/"
] | Sorry, found what i was looking for (because of the use of **regexp**):
>
> index(regexp [, offset]) → fixnum or nil
>
>
> Returns the index of the
> first occurrence of the given substring or pattern (regexp) in str.
> Returns nil if not found.
>
>
>
```
"hello".index('lo') #=> 3
"hello".index('a') ... | include?
<http://ruby-doc.org/core-1.9.3/String.html#method-i-include-3F> |
16,176,291 | ive just tried running my python script and getting invalid syntax error i've double checked the problem and still cant see the problem can any see the problem? Below is the code if anyone can help see the problem.
thanks.
```
import random
import Tkinter
class life (Tkinter.Frame):
def __init__(self,x,y):
... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16176291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1957509/"
] | If you use an opening `"`, you have to use a closing `"` as well, not `'`:
```
File "synt2.py", line 63
if __name__ =="__main__':
^
SyntaxError: EOL while scanning string literal
``` | here is your code, working.
```
import random
import Tkinter
class Life (Tkinter.Frame):
def __init__(self,x,y):
Tkinter.Frame.__init__(self)
self.master.title("The Game Of Life")
self.grid = [[False for j in range (y)] for i in range (x)]
universe = Tkinter.Frame(self)
de... |
16,176,291 | ive just tried running my python script and getting invalid syntax error i've double checked the problem and still cant see the problem can any see the problem? Below is the code if anyone can help see the problem.
thanks.
```
import random
import Tkinter
class life (Tkinter.Frame):
def __init__(self,x,y):
... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16176291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1957509/"
] | If you use an opening `"`, you have to use a closing `"` as well, not `'`:
```
File "synt2.py", line 63
if __name__ =="__main__':
^
SyntaxError: EOL while scanning string literal
``` | You declared a class named `life`, while you are calling `Life`. Python is case-sensitive. Either change line 4 to to `class Life (Tkinter.Frame):` or change line 64 to `game=life(8,10)`. |
2,664,513 | I write LaTeX docs in French, and babel package puts extra spaces before colons (**:**). It is useful, but I don’t want it in URLs:
>
> http ://docbook.org/ns/docbook
>
>
>
Any thoughts how to solve problem?
Thanks! | 2010/04/19 | [
"https://Stackoverflow.com/questions/2664513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319918/"
] | My suggestion would be using the package [`hyperref`](http://mirrors.dotsrc.org/ctan/macros/latex/contrib/hyperref/doc/manual.html), and then using the command `\url{http://example.org/url/here}` for your URLs.
With some luck, this hopefully won't be affected by babel. | In french typography colons are special as they should be preceded by a space. The babel package enforces this rule if used with the [french] option.
You can override colons as an active character using the following babel command.
```
\shorthandoff{:}
```
Use the following command to switch back colons as an activ... |
18,145,673 | I need to make my email and telephone validated for the contact form.. theres code in there for email but its incorrect and not the proper way any help!
i know it needs to were it says:
```
if(email.length == 0 || email.indexOf('@') == '-1')
```
but im now sure how to do this im very new to php, so go easy on me :) ... | 2013/08/09 | [
"https://Stackoverflow.com/questions/18145673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2173963/"
] | email regex: <http://www.regexlib.com/Search.aspx?k=email>
telephone regex: <http://www.regexlib.com/Search.aspx?k=telephone>
using regex and jquery to validate fields: <https://stackoverflow.com/a/709358/2646455>
so you could do something like this:
```
$.validator.addMethod(
"regex",
function(valu... | ```
var atposition = email.indexOf("@"); //email = $('#email').val();
var dotposition = email.lastIndexOf(".");
if (atposition<1 || dotposition<atposition+2 || dotposition+2>=email.length)
{
//Invalid Email Code
}
``` |
2,875,820 | I'm trying to find the Convergence radios for the function $f(z)=\frac{1}{1+e^z}$ using taylor series around $z=0$. this is what I've got so far:
$\frac{1}{1+z} = \sum\_{n=0}^{\infty}z^n$ thus I get:
$\frac{1}{1+e^z}=\sum\_{n=0}^{\infty}(\sum\_{m=0}^{\infty}\frac{n^mz^m}{m!})$
also I'm having a problem because $z$ s... | 2018/08/08 | [
"https://math.stackexchange.com/questions/2875820",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/582516/"
] | The radius of convergence is $\pi$. It is the radius of the largest disc around $0$ in which the function is analytic. By solving $e^{z}+1=0$ you can see that the radius is $\pi$. | The isolated singularities of $f$ are:
$$ z\_k:=(2k+1) i \pi, \quad k \in \mathbb Z.$$
hence the radius in question is given by
$$ min \{|z\_k|:k \in \mathbb Z\}= \pi.$$ |
2,875,820 | I'm trying to find the Convergence radios for the function $f(z)=\frac{1}{1+e^z}$ using taylor series around $z=0$. this is what I've got so far:
$\frac{1}{1+z} = \sum\_{n=0}^{\infty}z^n$ thus I get:
$\frac{1}{1+e^z}=\sum\_{n=0}^{\infty}(\sum\_{m=0}^{\infty}\frac{n^mz^m}{m!})$
also I'm having a problem because $z$ s... | 2018/08/08 | [
"https://math.stackexchange.com/questions/2875820",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/582516/"
] | The radius of convergence is $\pi$. It is the radius of the largest disc around $0$ in which the function is analytic. By solving $e^{z}+1=0$ you can see that the radius is $\pi$. | The theorem that analytic functions are equal to their own Taylor series tells you that the Taylor series around a point $a$ converges on every open disk around $a$ where the function is analytic. Here, $f(z)=\frac1{e^z+1}$ is analytic when $e^z\neq -1$, i.e. when $z\neq i\pi +2\pi k i$, $k\in\mathbb{Z}$.
You can fin... |
2,875,820 | I'm trying to find the Convergence radios for the function $f(z)=\frac{1}{1+e^z}$ using taylor series around $z=0$. this is what I've got so far:
$\frac{1}{1+z} = \sum\_{n=0}^{\infty}z^n$ thus I get:
$\frac{1}{1+e^z}=\sum\_{n=0}^{\infty}(\sum\_{m=0}^{\infty}\frac{n^mz^m}{m!})$
also I'm having a problem because $z$ s... | 2018/08/08 | [
"https://math.stackexchange.com/questions/2875820",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/582516/"
] | The radius of convergence is $\pi$. It is the radius of the largest disc around $0$ in which the function is analytic. By solving $e^{z}+1=0$ you can see that the radius is $\pi$. | The radius is $\pi$. In fact, for every analytic function $g$ and every $z\_0\in D\_g$, if $r>0$ is such that $D(z\_0,r)\subset D\_g$, then the radius of convergence of the Taylor series of $g$ centered at $z\_0$ is at least $r$.
In your case, the largest domain that $f$ can have is $\mathbb{C}\setminus\{\pi i+2\pi i ... |
26,649,755 | I've developed a few phonegap apps for ios and now I want to create android versions for one of them. The thing with android is, of course, that it is used on so many different devices. I understand that the safest way is to test the app on every single device that I'm targeting, but is there a smart and easy solution ... | 2014/10/30 | [
"https://Stackoverflow.com/questions/26649755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009453/"
] | Updated 2021/11/17
------------------
When using PIL/Pillow, Jupyter Notebooks now have a `display` built-in that will show the image directly, with no extra fuss.
```
display(pil_im)
```
Jupyter will also show the image if it is simply the last line in a cell (this has changed since the original post). Thanks to a... | If you are using the pylab extension, you could convert the image to a numpy array and use matplotlib's imshow.
```
%pylab # only if not started with the --pylab option
imshow(array(pil_im))
```
EDIT:
As mentioned in the comments, the pylab module is deprecated, so use the matplotlib magic instead and import the fun... |
26,649,755 | I've developed a few phonegap apps for ios and now I want to create android versions for one of them. The thing with android is, of course, that it is used on so many different devices. I understand that the safest way is to test the app on every single device that I'm targeting, but is there a smart and easy solution ... | 2014/10/30 | [
"https://Stackoverflow.com/questions/26649755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009453/"
] | Use IPython display to render PIL images in a notebook.
```
from PIL import Image # to load images
from IPython.display import display # to display images
pil_im = Image.open('path/to/image.jpg')
display(pil_im)
``` | A cleaner Python3 version that use standard numpy, matplotlib and PIL. Merging the answer for opening from URL.
```
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
pil_im = Image.open('image.jpg')
## Uncomment to open from URL
#import requests
#r = requests.get('https://www.vegvesen.no/public... |
26,649,755 | I've developed a few phonegap apps for ios and now I want to create android versions for one of them. The thing with android is, of course, that it is used on so many different devices. I understand that the safest way is to test the app on every single device that I'm targeting, but is there a smart and easy solution ... | 2014/10/30 | [
"https://Stackoverflow.com/questions/26649755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009453/"
] | Use IPython display to render PIL images in a notebook.
```
from PIL import Image # to load images
from IPython.display import display # to display images
pil_im = Image.open('path/to/image.jpg')
display(pil_im)
``` | I suggest following installation by no image show img.show()
(from PIL import Image)
$ sudo apt-get install imagemagick |
26,649,755 | I've developed a few phonegap apps for ios and now I want to create android versions for one of them. The thing with android is, of course, that it is used on so many different devices. I understand that the safest way is to test the app on every single device that I'm targeting, but is there a smart and easy solution ... | 2014/10/30 | [
"https://Stackoverflow.com/questions/26649755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009453/"
] | If you are using the pylab extension, you could convert the image to a numpy array and use matplotlib's imshow.
```
%pylab # only if not started with the --pylab option
imshow(array(pil_im))
```
EDIT:
As mentioned in the comments, the pylab module is deprecated, so use the matplotlib magic instead and import the fun... | Just use
```
from IPython.display import Image
Image('image.png')
``` |
26,649,755 | I've developed a few phonegap apps for ios and now I want to create android versions for one of them. The thing with android is, of course, that it is used on so many different devices. I understand that the safest way is to test the app on every single device that I'm targeting, but is there a smart and easy solution ... | 2014/10/30 | [
"https://Stackoverflow.com/questions/26649755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009453/"
] | Updated 2021/11/17
------------------
When using PIL/Pillow, Jupyter Notebooks now have a `display` built-in that will show the image directly, with no extra fuss.
```
display(pil_im)
```
Jupyter will also show the image if it is simply the last line in a cell (this has changed since the original post). Thanks to a... | case python3
```
from PIL import Image
from IPython.display import HTML
from io import BytesIO
from base64 import b64encode
pil_im = Image.open('data/empire.jpg')
b = BytesIO()
pil_im.save(b, format='png')
HTML("<img src='data:image/png;base64,{0}'/>".format(b64encode(b.getvalue()).decode('utf-8')))
``` |
26,649,755 | I've developed a few phonegap apps for ios and now I want to create android versions for one of them. The thing with android is, of course, that it is used on so many different devices. I understand that the safest way is to test the app on every single device that I'm targeting, but is there a smart and easy solution ... | 2014/10/30 | [
"https://Stackoverflow.com/questions/26649755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009453/"
] | In order to simply visualize the image in a notebook you can use display()
```
%matplotlib inline
from PIL import Image
im = Image.open(im_path)
display(im)
``` | If you are using the pylab extension, you could convert the image to a numpy array and use matplotlib's imshow.
```
%pylab # only if not started with the --pylab option
imshow(array(pil_im))
```
EDIT:
As mentioned in the comments, the pylab module is deprecated, so use the matplotlib magic instead and import the fun... |
26,649,755 | I've developed a few phonegap apps for ios and now I want to create android versions for one of them. The thing with android is, of course, that it is used on so many different devices. I understand that the safest way is to test the app on every single device that I'm targeting, but is there a smart and easy solution ... | 2014/10/30 | [
"https://Stackoverflow.com/questions/26649755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009453/"
] | Use IPython display to render PIL images in a notebook.
```
from PIL import Image # to load images
from IPython.display import display # to display images
pil_im = Image.open('path/to/image.jpg')
display(pil_im)
``` | Just use
```
from IPython.display import Image
Image('image.png')
``` |
26,649,755 | I've developed a few phonegap apps for ios and now I want to create android versions for one of them. The thing with android is, of course, that it is used on so many different devices. I understand that the safest way is to test the app on every single device that I'm targeting, but is there a smart and easy solution ... | 2014/10/30 | [
"https://Stackoverflow.com/questions/26649755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009453/"
] | Use IPython display to render PIL images in a notebook.
```
from PIL import Image # to load images
from IPython.display import display # to display images
pil_im = Image.open('path/to/image.jpg')
display(pil_im)
``` | Based on other answers and my tries, best experience would be first installing, *pillow* and scipy, then using the following starting code on your jupyter notebook:
```
%matplotlib inline
from matplotlib.pyplot import imshow
from scipy.misc import imread
imshow(imread('image.jpg', 1))
``` |
26,649,755 | I've developed a few phonegap apps for ios and now I want to create android versions for one of them. The thing with android is, of course, that it is used on so many different devices. I understand that the safest way is to test the app on every single device that I'm targeting, but is there a smart and easy solution ... | 2014/10/30 | [
"https://Stackoverflow.com/questions/26649755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009453/"
] | much simpler in jupyter using pillow.
```
from PIL import Image
image0=Image.open('image.png')
image0
``` | In order to simply visualize the image in a notebook you can use display()
```
%matplotlib inline
from PIL import Image
im = Image.open(im_path)
display(im)
``` |
26,649,755 | I've developed a few phonegap apps for ios and now I want to create android versions for one of them. The thing with android is, of course, that it is used on so many different devices. I understand that the safest way is to test the app on every single device that I'm targeting, but is there a smart and easy solution ... | 2014/10/30 | [
"https://Stackoverflow.com/questions/26649755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1009453/"
] | much simpler in jupyter using pillow.
```
from PIL import Image
image0=Image.open('image.png')
image0
``` | Based on other answers and my tries, best experience would be first installing, *pillow* and scipy, then using the following starting code on your jupyter notebook:
```
%matplotlib inline
from matplotlib.pyplot import imshow
from scipy.misc import imread
imshow(imread('image.jpg', 1))
``` |
26,529,366 | I have an array of about 60 audio files, (~3min each). I loop through this array - for each item I create an OfflineAudioContext and then do some filtering and processing like so:
```
var request = new XMLHttpRequest();
request.open('GET', audioFile.source, true);
request.responseType = "arraybuffer";
request.onload ... | 2014/10/23 | [
"https://Stackoverflow.com/questions/26529366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2993473/"
] | Without seeing all the surrounding code, I can't tell. Can you remove the decodeAudioData calls and just create 30+ OfflineAudioContexts of the given lengths and see if it has the same issues? (i.e. don't load the buffers). | `OfflineAudioContext` was crashing my page when I accidentally created one that was 24 times too long.
I think if you create too many, or create one that is too long, it will immediately crash because it doesn't have enough memory.
Try garbage collecting, or perhaps doing them one at a time in sequence. |
3,207,894 | Without using integration show that $$\lim\_{n\rightarrow \infty} \frac{[(n+1)(n+2)...(2n)]^{\frac{1}{n}}}{n}=\frac{4}{e}$$. It could have been easier with integration, but I cannot proceed with this one. Can anyone please give me any hint or the solution... I will be very grateful. Please. | 2019/04/30 | [
"https://math.stackexchange.com/questions/3207894",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | By Stirling,
$$\frac1n\sqrt[n]{\frac{(2n)!}{n!}}\sim\frac1n\frac{\sqrt[2n]{4\pi n}\left(\dfrac{2n}e\right)^2}{\sqrt[n]{4\pi n}\dfrac ne}\to\frac 4e.$$ | If we let $a\_n=\frac{[(n+1)(n+2)...(2n)]}{n^n}=\frac{(2n)!}{n!n^n}$, then $\frac{[(n+1)(n+2)...(2n)]^{\frac{1}{n}}}{n}=(a\_n)^{\frac{1}{n}}$. Then $\frac{a\_{n+1}}{a\_n}=\frac{(2n+2)!}{(2n)!}×\frac{n!}{(n+1)!}×\frac{n^n}{(n+1)^{n+1}}=\frac{(2n+1)(2n+2)}{(n+1)}×\frac{n^n}{(n+1)^{n+1}}=\frac{2(2n+1)}{(n+1)}×\frac{n^n}{(... |
3,207,894 | Without using integration show that $$\lim\_{n\rightarrow \infty} \frac{[(n+1)(n+2)...(2n)]^{\frac{1}{n}}}{n}=\frac{4}{e}$$. It could have been easier with integration, but I cannot proceed with this one. Can anyone please give me any hint or the solution... I will be very grateful. Please. | 2019/04/30 | [
"https://math.stackexchange.com/questions/3207894",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | If we let $a\_n=\frac{[(n+1)(n+2)...(2n)]}{n^n}=\frac{(2n)!}{n!n^n}$, then $\frac{[(n+1)(n+2)...(2n)]^{\frac{1}{n}}}{n}=(a\_n)^{\frac{1}{n}}$. Then $\frac{a\_{n+1}}{a\_n}=\frac{(2n+2)!}{(2n)!}×\frac{n!}{(n+1)!}×\frac{n^n}{(n+1)^{n+1}}=\frac{(2n+1)(2n+2)}{(n+1)}×\frac{n^n}{(n+1)^{n+1}}=\frac{2(2n+1)}{(n+1)}×\frac{n^n}{(... | By taking logs of both sides we can get:
$$L=\lim\_{n\to\infty}\frac{\left[(n+1)(n+2)(n+3)...(2n)\right]^{1/n}}{n}$$
$$\ln(L)=\lim\_{n\to\infty}\frac1n\ln\left[(n+1)(n+2)(n+3)...(2n)\right]-\ln(n)$$
$$\ln(L)=\lim\_{n\to\infty}\frac1n\sum\_{i=1}^n\ln(n+i)-\ln(n)$$
And I am sure there is a formula for the summation of lo... |
3,207,894 | Without using integration show that $$\lim\_{n\rightarrow \infty} \frac{[(n+1)(n+2)...(2n)]^{\frac{1}{n}}}{n}=\frac{4}{e}$$. It could have been easier with integration, but I cannot proceed with this one. Can anyone please give me any hint or the solution... I will be very grateful. Please. | 2019/04/30 | [
"https://math.stackexchange.com/questions/3207894",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | By Stirling,
$$\frac1n\sqrt[n]{\frac{(2n)!}{n!}}\sim\frac1n\frac{\sqrt[2n]{4\pi n}\left(\dfrac{2n}e\right)^2}{\sqrt[n]{4\pi n}\dfrac ne}\to\frac 4e.$$ | By taking logs of both sides we can get:
$$L=\lim\_{n\to\infty}\frac{\left[(n+1)(n+2)(n+3)...(2n)\right]^{1/n}}{n}$$
$$\ln(L)=\lim\_{n\to\infty}\frac1n\ln\left[(n+1)(n+2)(n+3)...(2n)\right]-\ln(n)$$
$$\ln(L)=\lim\_{n\to\infty}\frac1n\sum\_{i=1}^n\ln(n+i)-\ln(n)$$
And I am sure there is a formula for the summation of lo... |
24,921,682 | I have Win 7 with Cygwin installed. The cygwin has its own Python 2.7 interpreter. I have installed Miniconda separately for Win 7 (not for Cygwin, not sure if i have to).
So, the thing is I am able to create a new env from cygwin, and able to activate it. However, the activation doesn't seem to do anything??
```
amb... | 2014/07/23 | [
"https://Stackoverflow.com/questions/24921682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/558397/"
] | This will be fixed with the Conda 4.1 release. Keep an eye out - coming soon. | Cygwin will probably work with the Unix [activate](https://github.com/conda/conda/blob/master/bin/activate) and [deactivate](https://github.com/conda/conda/blob/master/bin/deactivate) scripts. Try putting them in Anaconda\Scripts and use `source activate envname` and `source deactivate`. |
24,921,682 | I have Win 7 with Cygwin installed. The cygwin has its own Python 2.7 interpreter. I have installed Miniconda separately for Win 7 (not for Cygwin, not sure if i have to).
So, the thing is I am able to create a new env from cygwin, and able to activate it. However, the activation doesn't seem to do anything??
```
amb... | 2014/07/23 | [
"https://Stackoverflow.com/questions/24921682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/558397/"
] | This will be fixed with the Conda 4.1 release. Keep an eye out - coming soon. | Another option is to use the cmd shell, where `activate` does work. You'll need to make sure to add cygwin to your PATH, though. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.