qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
36,808,260
I recently had to solve a problem in a real data system with a nested dict/list combination. I worked on this for quite a while and came up with a solution, but I am very unsatisfied. I had to resort to using `globals()` and a named temporary global parameter. I do not like to use globals. That's just asking for an i...
2016/04/23
[ "https://Stackoverflow.com/questions/36808260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2892074/" ]
This is a slightly modified version without using globals. Set `h` to `None` as default and create a new list for the first call to `_get_recursive_results()`. Later provide `h` as an argument in the recursive calls to `_get_recursive_results()`: ``` def _get_recursive_results(d, iter_key, get_keys, h=None): if h ...
Take a look at <https://github.com/akesterson/dpath-python/blob/master/README.rst> It a nice way of searching over a dict
36,808,260
I recently had to solve a problem in a real data system with a nested dict/list combination. I worked on this for quite a while and came up with a solution, but I am very unsatisfied. I had to resort to using `globals()` and a named temporary global parameter. I do not like to use globals. That's just asking for an i...
2016/04/23
[ "https://Stackoverflow.com/questions/36808260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2892074/" ]
This is a slightly modified version without using globals. Set `h` to `None` as default and create a new list for the first call to `_get_recursive_results()`. Later provide `h` as an argument in the recursive calls to `_get_recursive_results()`: ``` def _get_recursive_results(d, iter_key, get_keys, h=None): if h ...
Use generator ============= With following generator: ``` def get_stuff(dct, iter_keys, get_keys): k, stuff = get_keys l, m = iter_keys if k in dct: yield {k: dct[k], stuff: dct[stuff]} if dct.get(l): for subdct in dct[l][m]: for res in get_stuff(subdct, iter_ke...
46,749,999
I have the right function, just not finding the right regex pattern to remove (ID:999999) from the string. This ID value varies but is all numeric. I like to remove everything including the brackets. ``` $string = "This is the value I would like removed. (ID:17937)"; $string = preg_replace('#(ID:['0-9']?)#si', "", $st...
2017/10/14
[ "https://Stackoverflow.com/questions/46749999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4888754/" ]
Try this: ``` $string = preg_replace('# \(ID:[0-9]+\)#si', "", $string); ``` You need to escape the parenthesis using backslashes `\`. You shouldn't use quotes around the number range. You should use `+` (one or more) instead of `?` (zero or one). You can add a space at the start, to avoid having a space at...
In PHP regex is in `/` and not `#`, after that, parentheses are for capture group so you must escape them to match them. Also to use `preg_replace` replacement you will need to use capture group so in your case `/(\(ID:[0-9]+\))/si` will be the a nice regular expression.
46,749,999
I have the right function, just not finding the right regex pattern to remove (ID:999999) from the string. This ID value varies but is all numeric. I like to remove everything including the brackets. ``` $string = "This is the value I would like removed. (ID:17937)"; $string = preg_replace('#(ID:['0-9']?)#si', "", $st...
2017/10/14
[ "https://Stackoverflow.com/questions/46749999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4888754/" ]
Try this: ``` $string = preg_replace('# \(ID:[0-9]+\)#si', "", $string); ``` You need to escape the parenthesis using backslashes `\`. You shouldn't use quotes around the number range. You should use `+` (one or more) instead of `?` (zero or one). You can add a space at the start, to avoid having a space at...
Here are two options: Code: ([Demo](http://sandbox.onlinephpfunctions.com/code/e0550232b7934e46b380434d7e9efb60075923c8)) ``` $string = "This is the value I would like removed. (ID:17937)"; var_export(preg_replace('/ \(ID:\d+\)/',"",$string)); echo "\n\n"; var_export(strstr($string,' (ID:',true)); ``` Output: (I ...
40,184,145
I am trying to get the length of characters that the user enters. If the user enters a string with length less than 5 or greater than 5 then it should say "Enter a valid 5 digit number". If the length is 5 then I want it to go on the next question, but for some reason it's not working. Thanks! ``` package Hw; import j...
2016/10/21
[ "https://Stackoverflow.com/questions/40184145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The main concept should be working with String instead of Integer, by that approach it is much easier and quicker to check the user's input length. I would recommend to change the code as follows: Change that line: ``` int length = length(Integer.toString(cardnumber)); ``` to: ``` String length = Integer.toString(...
The crux of your question as asked would be, how to implement this method: ``` private static int length(String string) { // TODO Auto-generated method stub return 0; } ``` What you want is to look at the length() method built into the Java string object. In the interest of being helpful - it seems like the...
40,184,145
I am trying to get the length of characters that the user enters. If the user enters a string with length less than 5 or greater than 5 then it should say "Enter a valid 5 digit number". If the length is 5 then I want it to go on the next question, but for some reason it's not working. Thanks! ``` package Hw; import j...
2016/10/21
[ "https://Stackoverflow.com/questions/40184145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The main concept should be working with String instead of Integer, by that approach it is much easier and quicker to check the user's input length. I would recommend to change the code as follows: Change that line: ``` int length = length(Integer.toString(cardnumber)); ``` to: ``` String length = Integer.toString(...
You can use simple maths to do this: ``` private static int getLength(int num) { int count = 1; while (num >= 10) { num = num / 10; count++; } return count; } ```
40,184,145
I am trying to get the length of characters that the user enters. If the user enters a string with length less than 5 or greater than 5 then it should say "Enter a valid 5 digit number". If the length is 5 then I want it to go on the next question, but for some reason it's not working. Thanks! ``` package Hw; import j...
2016/10/21
[ "https://Stackoverflow.com/questions/40184145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The main concept should be working with String instead of Integer, by that approach it is much easier and quicker to check the user's input length. I would recommend to change the code as follows: Change that line: ``` int length = length(Integer.toString(cardnumber)); ``` to: ``` String length = Integer.toString(...
**Java:** A simple Java code like the below will also works fine..! ``` int num = sc.nextInt(); int b=Integer.toString(num).length(); ``` **C++** ``` to_string(num).length() ``` **C** ``` count = 0 while (num != 0) { num /= 10; count++; } ```
72,006,715
I'm working on a card number check code, for now I created a function that asks for the card number and checks if it is 8 digits or not (it has to be 8) and then calls another function that will do the math and check if the card is valid. For this function: 1. Starting from the rightmost digit, form the sum of every o...
2022/04/25
[ "https://Stackoverflow.com/questions/72006715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17344001/" ]
So, the *ugly* way of doing is, you can write a for loop and use indexing for access specific elements ``` for i in range(len(CardInput)): # it will iterate from 0 to 7 print(CardInput[i]) # here you get ith element if i % 2 == 1: print("I am other!") # you can sum your things here into another var...
Since you need to iterate over the digits, it's actually easier IMO if you leave it as a string, rather than converting the input to an `int`; that way you can just iterate over the digits and convert them to `int` individuall to do math on them. Given an 8-digit long string `card`, it might look like this, broken int...
72,006,715
I'm working on a card number check code, for now I created a function that asks for the card number and checks if it is 8 digits or not (it has to be 8) and then calls another function that will do the math and check if the card is valid. For this function: 1. Starting from the rightmost digit, form the sum of every o...
2022/04/25
[ "https://Stackoverflow.com/questions/72006715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17344001/" ]
So, the *ugly* way of doing is, you can write a for loop and use indexing for access specific elements ``` for i in range(len(CardInput)): # it will iterate from 0 to 7 print(CardInput[i]) # here you get ith element if i % 2 == 1: print("I am other!") # you can sum your things here into another var...
``` prompt = "Enter the eight-digit number: " while True: number = input(prompt) if len(number) == 8 and number.isdigit(): break prompt = "Oops, try again: " first_digits = number[1::2] # If the user entered '12345678', this will be the substring '2468' first_sum = sum(map(int, first_digits)) # Ta...
72,006,715
I'm working on a card number check code, for now I created a function that asks for the card number and checks if it is 8 digits or not (it has to be 8) and then calls another function that will do the math and check if the card is valid. For this function: 1. Starting from the rightmost digit, form the sum of every o...
2022/04/25
[ "https://Stackoverflow.com/questions/72006715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17344001/" ]
So, the *ugly* way of doing is, you can write a for loop and use indexing for access specific elements ``` for i in range(len(CardInput)): # it will iterate from 0 to 7 print(CardInput[i]) # here you get ith element if i % 2 == 1: print("I am other!") # you can sum your things here into another var...
``` def getCard(): CardInput = input("Enter your 8 digit credit card number: ") if len(CardInput) == 8: CardCheck(CardInput) else: print("Invalid Input: Should be exactly 8 digits!") getCard() def CardCheck(CardNumber): list_CardNumber = [x for x in "25424334"] Sum = sum(int(x) for x i...
72,006,715
I'm working on a card number check code, for now I created a function that asks for the card number and checks if it is 8 digits or not (it has to be 8) and then calls another function that will do the math and check if the card is valid. For this function: 1. Starting from the rightmost digit, form the sum of every o...
2022/04/25
[ "https://Stackoverflow.com/questions/72006715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17344001/" ]
So, the *ugly* way of doing is, you can write a for loop and use indexing for access specific elements ``` for i in range(len(CardInput)): # it will iterate from 0 to 7 print(CardInput[i]) # here you get ith element if i % 2 == 1: print("I am other!") # you can sum your things here into another var...
You can use: ``` # lets say CardNumber = '12345678' # as mentioned by kosciej16 # get every other digit starting from the second one # convert them to integers and sum part1 = sum(map(int, CardNumber[1::2])) # get every other digit starting from the first one # convert them to integers and double them # join all th...
72,006,715
I'm working on a card number check code, for now I created a function that asks for the card number and checks if it is 8 digits or not (it has to be 8) and then calls another function that will do the math and check if the card is valid. For this function: 1. Starting from the rightmost digit, form the sum of every o...
2022/04/25
[ "https://Stackoverflow.com/questions/72006715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17344001/" ]
So, the *ugly* way of doing is, you can write a for loop and use indexing for access specific elements ``` for i in range(len(CardInput)): # it will iterate from 0 to 7 print(CardInput[i]) # here you get ith element if i % 2 == 1: print("I am other!") # you can sum your things here into another var...
To get you started, you should check out `enumerate()`, it'll simplify things if you're just going to use loops by giving you easy access to both the index and value every loop. ``` step1 = 0 for i, x in enumerate(number): if i % 2: print('index: '+ str(i), 'value: '+ x) step1 += int(x) print('ste...
30,649,609
I am just learning Java and decided that I would create a Pi calculator, I wrote it in Python and got it working to about 14 d.p. The formula I'm using works by calculating the decimal part in an infinite loop and adding 3 onto it. However now that I've brought it into Java, it doesn't see to change the the 'total' ...
2015/06/04
[ "https://Stackoverflow.com/questions/30649609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4974589/" ]
You have to use floating point division, otherwise `Changer` will always be `0`. Python3 does this by default, but Java doesn't. Also, you mistyped `+=` as `=+`, so that `No1` through `No3` are always set to `+2` in each turn, instead of *incrementing* them by `2`. ``` No1 += 2; // ...
**Your code has error** ``` if (PosOrNeg == True) { } ``` **it should be** ``` if (PosOrNeg == true) { } ```
30,649,609
I am just learning Java and decided that I would create a Pi calculator, I wrote it in Python and got it working to about 14 d.p. The formula I'm using works by calculating the decimal part in an infinite loop and adding 3 onto it. However now that I've brought it into Java, it doesn't see to change the the 'total' ...
2015/06/04
[ "https://Stackoverflow.com/questions/30649609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4974589/" ]
Assign variable ``` double sum = 4; ``` change ``` No1 = +2; to No1 +=2; or No1 = No1+2; No2 = +2; to No2 +=2; or No2 = No2+2; No3 = +2; to No3 +=2; or No3 = No3+2; ``` change ``` Changer = (4/ (No1 * No2 * No3)); to Changer = (sum/ (No1 * No2 * No3)); ``` it will work.
You have to use floating point division, otherwise `Changer` will always be `0`. Python3 does this by default, but Java doesn't. Also, you mistyped `+=` as `=+`, so that `No1` through `No3` are always set to `+2` in each turn, instead of *incrementing* them by `2`. ``` No1 += 2; // ...
30,649,609
I am just learning Java and decided that I would create a Pi calculator, I wrote it in Python and got it working to about 14 d.p. The formula I'm using works by calculating the decimal part in an infinite loop and adding 3 onto it. However now that I've brought it into Java, it doesn't see to change the the 'total' ...
2015/06/04
[ "https://Stackoverflow.com/questions/30649609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4974589/" ]
Assign variable ``` double sum = 4; ``` change ``` No1 = +2; to No1 +=2; or No1 = No1+2; No2 = +2; to No2 +=2; or No2 = No2+2; No3 = +2; to No3 +=2; or No3 = No3+2; ``` change ``` Changer = (4/ (No1 * No2 * No3)); to Changer = (sum/ (No1 * No2 * No3)); ``` it will work.
**Your code has error** ``` if (PosOrNeg == True) { } ``` **it should be** ``` if (PosOrNeg == true) { } ```
19,234,134
tlndr: how to tell in a function if it's called from an `except` block (directly/indirectly). python2.7/cpython. I use python 2.7 and try to provide something similar to py3's `__context__` for my custom exception class: ``` class MyErr(Exception): def __init__(self, *args): Exception.__init__(self, *args...
2013/10/07
[ "https://Stackoverflow.com/questions/19234134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989121/" ]
This is tested with CPython 2.7.3: ``` $ python myerr.py MyErr('bang!',) from ZeroDivisionError('integer division or modulo by zero',) MyErr('nobang!',) ``` It works as long as the magic exception is directly created within the scope of an except clause. A little additional code can lift that restriction, though. ...
One solution would be to call [`sys.exc_clear()`](http://docs.python.org/2/library/sys.html#sys.exc_info) after an exception has been handled: ``` import sys class MyErr(Exception): def __init__(self, *args): Exception.__init__(self, *args) self.context = sys.exc_info()[1] def __str__(self): ...
19,234,134
tlndr: how to tell in a function if it's called from an `except` block (directly/indirectly). python2.7/cpython. I use python 2.7 and try to provide something similar to py3's `__context__` for my custom exception class: ``` class MyErr(Exception): def __init__(self, *args): Exception.__init__(self, *args...
2013/10/07
[ "https://Stackoverflow.com/questions/19234134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989121/" ]
The following approach might work, although it's a bit long-winded. * Get the code of the current frame from `import inspect; inspect.currentframe().f_code` * Inspect the bytecode (`f_code.co_code`), perhaps using `dis.dis`, to figure out whether the frame is being executed in an `except` block. * Depending on what yo...
One solution would be to call [`sys.exc_clear()`](http://docs.python.org/2/library/sys.html#sys.exc_info) after an exception has been handled: ``` import sys class MyErr(Exception): def __init__(self, *args): Exception.__init__(self, *args) self.context = sys.exc_info()[1] def __str__(self): ...
19,234,134
tlndr: how to tell in a function if it's called from an `except` block (directly/indirectly). python2.7/cpython. I use python 2.7 and try to provide something similar to py3's `__context__` for my custom exception class: ``` class MyErr(Exception): def __init__(self, *args): Exception.__init__(self, *args...
2013/10/07
[ "https://Stackoverflow.com/questions/19234134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989121/" ]
This is tested with CPython 2.7.3: ``` $ python myerr.py MyErr('bang!',) from ZeroDivisionError('integer division or modulo by zero',) MyErr('nobang!',) ``` It works as long as the magic exception is directly created within the scope of an except clause. A little additional code can lift that restriction, though. ...
The following approach might work, although it's a bit long-winded. * Get the code of the current frame from `import inspect; inspect.currentframe().f_code` * Inspect the bytecode (`f_code.co_code`), perhaps using `dis.dis`, to figure out whether the frame is being executed in an `except` block. * Depending on what yo...
19,234,134
tlndr: how to tell in a function if it's called from an `except` block (directly/indirectly). python2.7/cpython. I use python 2.7 and try to provide something similar to py3's `__context__` for my custom exception class: ``` class MyErr(Exception): def __init__(self, *args): Exception.__init__(self, *args...
2013/10/07
[ "https://Stackoverflow.com/questions/19234134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989121/" ]
This is tested with CPython 2.7.3: ``` $ python myerr.py MyErr('bang!',) from ZeroDivisionError('integer division or modulo by zero',) MyErr('nobang!',) ``` It works as long as the magic exception is directly created within the scope of an except clause. A little additional code can lift that restriction, though. ...
I searched through the Python source to see if there was some indicator that was being set when the entering an `except` block that could be queried by going through the frame sequence from the custom exception's constructor. I found this [`fblocktype`](https://github.com/python/cpython/blob/237284d0a73e472f836adc72f0...
19,234,134
tlndr: how to tell in a function if it's called from an `except` block (directly/indirectly). python2.7/cpython. I use python 2.7 and try to provide something similar to py3's `__context__` for my custom exception class: ``` class MyErr(Exception): def __init__(self, *args): Exception.__init__(self, *args...
2013/10/07
[ "https://Stackoverflow.com/questions/19234134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989121/" ]
The following approach might work, although it's a bit long-winded. * Get the code of the current frame from `import inspect; inspect.currentframe().f_code` * Inspect the bytecode (`f_code.co_code`), perhaps using `dis.dis`, to figure out whether the frame is being executed in an `except` block. * Depending on what yo...
I searched through the Python source to see if there was some indicator that was being set when the entering an `except` block that could be queried by going through the frame sequence from the custom exception's constructor. I found this [`fblocktype`](https://github.com/python/cpython/blob/237284d0a73e472f836adc72f0...
8,684,777
after i execute .exe and .bat files and close them, system does not let the handle go for about a minute. it forces me wait to build/save the file. this pisses me off so much when i m editing bat files or building executable. here are 2 screenshot to show what i mean 1st is the all active processes, (maybe there is s...
2011/12/30
[ "https://Stackoverflow.com/questions/8684777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1055536/" ]
I found the solution. To have a Service receive SMS messages: 1. Update the manifest to give your app the permissions to receive SMS (WRITE\_SMS, READ\_SMS, RECEIVE\_SMS) 2. DO NOT update the manifest with the receiver intent filter ! (which every sample code online seems to do) 3. In your Service, create a nested Bro...
You can make the SmsReceiver separately from the Sevice using context from the onReceive method to star service. That lets you not to run service all the time. Or even not starting activity to register receiver. Though I can mistake. Something like this: ``` @Override public void onReceive(Context context, Intent...
8,684,777
after i execute .exe and .bat files and close them, system does not let the handle go for about a minute. it forces me wait to build/save the file. this pisses me off so much when i m editing bat files or building executable. here are 2 screenshot to show what i mean 1st is the all active processes, (maybe there is s...
2011/12/30
[ "https://Stackoverflow.com/questions/8684777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1055536/" ]
I found the solution. To have a Service receive SMS messages: 1. Update the manifest to give your app the permissions to receive SMS (WRITE\_SMS, READ\_SMS, RECEIVE\_SMS) 2. DO NOT update the manifest with the receiver intent filter ! (which every sample code online seems to do) 3. In your Service, create a nested Bro...
I have this solution worked for me perfectly by adding BROADCAST\_SMS permission: ``` <receiver android:name="com.mohamedtest.sendandreceivesms_m.SMSReceiver" android:enabled="true" android:exported="true" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> ...
8,684,777
after i execute .exe and .bat files and close them, system does not let the handle go for about a minute. it forces me wait to build/save the file. this pisses me off so much when i m editing bat files or building executable. here are 2 screenshot to show what i mean 1st is the all active processes, (maybe there is s...
2011/12/30
[ "https://Stackoverflow.com/questions/8684777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1055536/" ]
I found the solution. To have a Service receive SMS messages: 1. Update the manifest to give your app the permissions to receive SMS (WRITE\_SMS, READ\_SMS, RECEIVE\_SMS) 2. DO NOT update the manifest with the receiver intent filter ! (which every sample code online seems to do) 3. In your Service, create a nested Bro...
``` manifest file <application android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supports...
8,684,777
after i execute .exe and .bat files and close them, system does not let the handle go for about a minute. it forces me wait to build/save the file. this pisses me off so much when i m editing bat files or building executable. here are 2 screenshot to show what i mean 1st is the all active processes, (maybe there is s...
2011/12/30
[ "https://Stackoverflow.com/questions/8684777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1055536/" ]
I have this solution worked for me perfectly by adding BROADCAST\_SMS permission: ``` <receiver android:name="com.mohamedtest.sendandreceivesms_m.SMSReceiver" android:enabled="true" android:exported="true" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> ...
You can make the SmsReceiver separately from the Sevice using context from the onReceive method to star service. That lets you not to run service all the time. Or even not starting activity to register receiver. Though I can mistake. Something like this: ``` @Override public void onReceive(Context context, Intent...
8,684,777
after i execute .exe and .bat files and close them, system does not let the handle go for about a minute. it forces me wait to build/save the file. this pisses me off so much when i m editing bat files or building executable. here are 2 screenshot to show what i mean 1st is the all active processes, (maybe there is s...
2011/12/30
[ "https://Stackoverflow.com/questions/8684777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1055536/" ]
I have this solution worked for me perfectly by adding BROADCAST\_SMS permission: ``` <receiver android:name="com.mohamedtest.sendandreceivesms_m.SMSReceiver" android:enabled="true" android:exported="true" android:permission="android.permission.BROADCAST_SMS"> <intent-filter> ...
``` manifest file <application android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supports...
320,571
Let's say I have a compound quantum system (CQS) in an (unknown to me) pure state $\left|\Psi\right>$. If an operator $\mathbf{A}$ acts only on variables of a subsystem (S) of CQS, then I can calculate expectation value of the corresponding observable as $$ \bar{A} = \textrm{Tr} (\mathbf{\rho}\_S \mathbf{A}) $$ wher...
2017/03/22
[ "https://physics.stackexchange.com/questions/320571", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/24157/" ]
Waves can interfere constructively or destructively only when they oscillate in the same medium. Sound waves oscillate in matter (solid, liquid, gas); these sounds waves oscillate in air. On the other hand, light waves oscillate in the background electromagnetic fields. Light may travel through air, but it is not air t...
Sound waves are called as Pressure waves which require medium to travel. refer this link. <http://www.physicsclassroom.com/Class/sound/u11l1c.html> Light waves are EM waves which doesnt need medium to travel. refer this link <http://bestanimations.com/Science/Physics/Physics3.html> because they are heterogeneous wa...
70,189,950
Let's say that with a bash script I want to create a file, so to the command to create the file will be something like this: ``` myscript hostgroup_one 2 ``` `hostgroup_one` and the number `2` are parameters. How can I insert the parameters in the lines below and output all the lines as a file? ``` { "bool": { ...
2021/12/01
[ "https://Stackoverflow.com/questions/70189950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16751910/" ]
I'd use [jq](/questions/tagged/jq "show questions tagged 'jq'") to build the JSON: ```sh jq -n \ --arg hostgroup "$1" \ --argjson minimum "$2" \ '{bool: {should: [{match_phrase: {"hostgroup.keyword": $hostgroup}}], minimum_should_match: $minimum}}' ``` will produce your desired output.
While `jq` is a great tool for manipulating json, as glenn jackman recommends, if you don't have it and your sysadmin won't install it (?!?)... You can use a "[*here document*](https://tldp.org/LDP/abs/html/here-docs.html)" Your `myscript` could look something like this: ``` #!/bin/bash echo "dollar-1 is '${1}' do...
1,511,875
Note: $5379 = 3 \times 11 \times 163$. I tried Chinese Remainder Theorem and Fermat's Little Theorem, got as far as: $$ 1234^{1234} = 1 \pmod{3} \\ 1234^{1234} = 5 \pmod{11} $$ With a bit more work: $$1234^{1234} = 93^{100} \pmod{163}$$ But $93^{100}$ doesn't really help? WolframAlpha tells me that $\phi(5379)=3240>...
2015/11/03
[ "https://math.stackexchange.com/questions/1511875", "https://math.stackexchange.com", "https://math.stackexchange.com/users/255891/" ]
Well this is far from perfect,but it works if you have enough time or a calculator. $$93\equiv -70\pmod{163}$$ $$\begin{align} 93^{100}&\equiv(-70)^{100}\\ &= 490^{50}\cdot10^{50}\\ &\equiv 10^{50}\\ &= 2^{50}\cdot 5^{50}\\ &= 1024^5\cdot 3125^{10}\\ &\equiv 46^5\cdot 28^{10}\\ &=2^{25}\cdot 23^5\cdot 7^{10}\\ &= 2^{2...
$93^{100}$ can be computed with the *Fast Exponentiation algorithm*. First note $93^2\equiv 10\mod163$. Hence all we have to compute is $10^{50}\mod 163$ It can be done with a hand-held calculator. First note the exponent in base $2$ is written as $110010$, and we use these digits (from right to left) in the algorithm...
1,511,875
Note: $5379 = 3 \times 11 \times 163$. I tried Chinese Remainder Theorem and Fermat's Little Theorem, got as far as: $$ 1234^{1234} = 1 \pmod{3} \\ 1234^{1234} = 5 \pmod{11} $$ With a bit more work: $$1234^{1234} = 93^{100} \pmod{163}$$ But $93^{100}$ doesn't really help? WolframAlpha tells me that $\phi(5379)=3240>...
2015/11/03
[ "https://math.stackexchange.com/questions/1511875", "https://math.stackexchange.com", "https://math.stackexchange.com/users/255891/" ]
A little noodling produced the following, where all congruences are mod $163$: $$93\equiv256=2^8\implies2^{10}\cdot93^{100}\equiv2^{810}=2^{162\cdot5}\equiv1$$ Noting that $2^{10}=1024\equiv46$, it remains to compute $46^{-1}$ mod $163$. This could be done by a straightforward Euclidean algorithm, but I found it easy...
$93^{100}$ can be computed with the *Fast Exponentiation algorithm*. First note $93^2\equiv 10\mod163$. Hence all we have to compute is $10^{50}\mod 163$ It can be done with a hand-held calculator. First note the exponent in base $2$ is written as $110010$, and we use these digits (from right to left) in the algorithm...
8,261,134
Ok, I created custom Total class for adding the special discount, and everything seems to work fine except, for some reason I can't find, my total is calculated twice! That results in double amount of discount, and incorrect grand total. Now, this happens on cart page and on checkout pages...BUT...when I complete the o...
2011/11/24
[ "https://Stackoverflow.com/questions/8261134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/596981/" ]
Could the problem be that a total object belongs to an address object and Magento orders typically have TWO addresses - one for shipping and one for billing? Your total will therefore be called to run *twice* - once with the billing address and once with the shipping address and the amount is totalled per-address. You...
Is it possible that you are adding in your own layout xml code for a shopping cart block? If you are, there is a solid chance that block is being called twice (one from the base code, and again for your code -- even if you are just extending it), thus duplicating the price total. If that is the case, you will need to r...
8,261,134
Ok, I created custom Total class for adding the special discount, and everything seems to work fine except, for some reason I can't find, my total is calculated twice! That results in double amount of discount, and incorrect grand total. Now, this happens on cart page and on checkout pages...BUT...when I complete the o...
2011/11/24
[ "https://Stackoverflow.com/questions/8261134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/596981/" ]
After searching around, here is another solution ``` public function collect(Mage_Sales_Model_Quote_Address $address) { parent::collect($address); //Pay attention to this code $items = $this->_getAddressItems($address); if (!count($items)) { return $this; //this makes only address type shippin...
Is it possible that you are adding in your own layout xml code for a shopping cart block? If you are, there is a solid chance that block is being called twice (one from the base code, and again for your code -- even if you are just extending it), thus duplicating the price total. If that is the case, you will need to r...
8,261,134
Ok, I created custom Total class for adding the special discount, and everything seems to work fine except, for some reason I can't find, my total is calculated twice! That results in double amount of discount, and incorrect grand total. Now, this happens on cart page and on checkout pages...BUT...when I complete the o...
2011/11/24
[ "https://Stackoverflow.com/questions/8261134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/596981/" ]
Could the problem be that a total object belongs to an address object and Magento orders typically have TWO addresses - one for shipping and one for billing? Your total will therefore be called to run *twice* - once with the billing address and once with the shipping address and the amount is totalled per-address. You...
After searching around, here is another solution ``` public function collect(Mage_Sales_Model_Quote_Address $address) { parent::collect($address); //Pay attention to this code $items = $this->_getAddressItems($address); if (!count($items)) { return $this; //this makes only address type shippin...
30,391,747
I'm working on an intranet website. All users should get desktop popups from the webserver whenever something new is posted on the website. I was looking to make my own windows service that would subscribe to the server ( Making use of something like SignalR ) and then this service would show a simple popup notifying...
2015/05/22
[ "https://Stackoverflow.com/questions/30391747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412074/" ]
For building a Windows Service try Top Shelf: <http://docs.topshelf-project.com/en/latest/> In general it is easy as one, two, three... ``` public class TownCrier { readonly Timer _timer; public TownCrier() { _timer = new Timer(1000) {AutoReset = true}; _timer.Elapsed += (sender, eventArgs)...
for the signalr Server side, I would suggest you use a C# winform. for the client side, you can use JavaScript inside any html file to 'receive' the message from the signalr Server, then you can popup an alert message or whatever you want, however, in this case you have to make sure the users are browsing that html fi...
30,391,747
I'm working on an intranet website. All users should get desktop popups from the webserver whenever something new is posted on the website. I was looking to make my own windows service that would subscribe to the server ( Making use of something like SignalR ) and then this service would show a simple popup notifying...
2015/05/22
[ "https://Stackoverflow.com/questions/30391747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412074/" ]
> > I'm working on an intranet website. All users should get desktop > popups from the webserver whenever something new is posted on the > website. > > > using **timer** is not a good technique over here as updates are not guaranteed in particular interval or session .but you can take that as an option based on ...
for the signalr Server side, I would suggest you use a C# winform. for the client side, you can use JavaScript inside any html file to 'receive' the message from the signalr Server, then you can popup an alert message or whatever you want, however, in this case you have to make sure the users are browsing that html fi...
30,391,747
I'm working on an intranet website. All users should get desktop popups from the webserver whenever something new is posted on the website. I was looking to make my own windows service that would subscribe to the server ( Making use of something like SignalR ) and then this service would show a simple popup notifying...
2015/05/22
[ "https://Stackoverflow.com/questions/30391747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412074/" ]
For building a Windows Service try Top Shelf: <http://docs.topshelf-project.com/en/latest/> In general it is easy as one, two, three... ``` public class TownCrier { readonly Timer _timer; public TownCrier() { _timer = new Timer(1000) {AutoReset = true}; _timer.Elapsed += (sender, eventArgs)...
This question: [SignalR Chat App in WinForm With Remote Clients](https://stackoverflow.com/questions/20476404/signalr-chat-app-in-winform-with-remote-clients) looks like it might point you inthe right direction. Specifically this article: <https://damienbod.wordpress.com/2013/11/01/signalr-messaging-with-console-serve...
30,391,747
I'm working on an intranet website. All users should get desktop popups from the webserver whenever something new is posted on the website. I was looking to make my own windows service that would subscribe to the server ( Making use of something like SignalR ) and then this service would show a simple popup notifying...
2015/05/22
[ "https://Stackoverflow.com/questions/30391747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412074/" ]
For building a Windows Service try Top Shelf: <http://docs.topshelf-project.com/en/latest/> In general it is easy as one, two, three... ``` public class TownCrier { readonly Timer _timer; public TownCrier() { _timer = new Timer(1000) {AutoReset = true}; _timer.Elapsed += (sender, eventArgs)...
you could probably use DesktopToast: <https://github.com/emoacht/DesktopToast> or Growl: <http://www.growlforwindows.com/>
30,391,747
I'm working on an intranet website. All users should get desktop popups from the webserver whenever something new is posted on the website. I was looking to make my own windows service that would subscribe to the server ( Making use of something like SignalR ) and then this service would show a simple popup notifying...
2015/05/22
[ "https://Stackoverflow.com/questions/30391747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412074/" ]
> > I'm working on an intranet website. All users should get desktop > popups from the webserver whenever something new is posted on the > website. > > > using **timer** is not a good technique over here as updates are not guaranteed in particular interval or session .but you can take that as an option based on ...
This question: [SignalR Chat App in WinForm With Remote Clients](https://stackoverflow.com/questions/20476404/signalr-chat-app-in-winform-with-remote-clients) looks like it might point you inthe right direction. Specifically this article: <https://damienbod.wordpress.com/2013/11/01/signalr-messaging-with-console-serve...
30,391,747
I'm working on an intranet website. All users should get desktop popups from the webserver whenever something new is posted on the website. I was looking to make my own windows service that would subscribe to the server ( Making use of something like SignalR ) and then this service would show a simple popup notifying...
2015/05/22
[ "https://Stackoverflow.com/questions/30391747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4412074/" ]
> > I'm working on an intranet website. All users should get desktop > popups from the webserver whenever something new is posted on the > website. > > > using **timer** is not a good technique over here as updates are not guaranteed in particular interval or session .but you can take that as an option based on ...
you could probably use DesktopToast: <https://github.com/emoacht/DesktopToast> or Growl: <http://www.growlforwindows.com/>
33,433,242
I have a route: /register I wanna show user an error page which is like: 404 Page not found or redirect. How to do it in Laravel 4.2 route?
2015/10/30
[ "https://Stackoverflow.com/questions/33433242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4679012/" ]
If you want to do that, you must set it as readonly, that way no user will be able to set it as True.
Just make this changes to field.boolean("string",default=False,readonly=False, ,required=False) It will works, Thanks
23,289,130
I have multiple divs with same id , i need to get the content of child's div when the parent div is clicked, the divs are dynamically created. The following code explains that : i have php file that generate the multiple divs with the same id as follows : ``` <div id="display" style="display: block;"> <div class="di...
2014/04/25
[ "https://Stackoverflow.com/questions/23289130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3572213/" ]
Try this (see fiddle console) ``` $(document).on('click','#display',function(){ $(this).find('.display_box').each(function(){ console.log($(this).html()) // returns overall content }); }); ``` [DEMO](http://jsfiddle.net/6aBEf/5/) OR ``` $(document).on('click','.display_box',function(){ console.l...
``` $(document).on('click','.display_box',function(){ alert($(this).html()) }); ```
6,078,542
Say I have this code: ``` unsigned int func1(); unsigned int func2(); unsigned int func3(); unsigned int x = func1() | func2() | func3(); ``` Does C++ guarantee that func1() will be called first, then func2(), and then func3()? Or is the compiler allowed to call the functions in any order it feels like? Also, is ...
2011/05/20
[ "https://Stackoverflow.com/questions/6078542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131930/" ]
No, there is no guarantee which order the functions will be called in. Unlike `||`, `|` does not imply a sequence point. All functions in the expression must be called unless the implementation can determine that they have no side-effects and it can determine the result of the expression without actually calling one o...
It will not short circuit. It may execute out of order. "The direction of evaluation does not affect the results of expressions that include more than one multiplication (\*), addition (+), or binary-bitwise (& | ^) operator at the same level."
22,024,585
I've been trying to perform the simple task written in the title. I could only think of using timer, thread sleep or background worker, but I'm going to do this task only once.. so I would like to avoid making a lot of functions or such just for one time. I tried thread sleep but it doesn't show the mainform before the...
2014/02/25
[ "https://Stackoverflow.com/questions/22024585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1243819/" ]
The easiest option is to use `await Task.Delay`: ``` private async void Form_Load(object sender, EventArgs e) { await Task.Delay(timespan); label1.Text = "Hello world"; } ``` If you don't have access to `await` using the version of .NET that you're using, then your best bet would be to use a `Timer`. Yes it'...
Use a System.Timer instance * make an eventhandler with Timer.Elapsed * set timer interval * start timer as application fires up -after the timer elapses set your label -stop timer
22,024,585
I've been trying to perform the simple task written in the title. I could only think of using timer, thread sleep or background worker, but I'm going to do this task only once.. so I would like to avoid making a lot of functions or such just for one time. I tried thread sleep but it doesn't show the mainform before the...
2014/02/25
[ "https://Stackoverflow.com/questions/22024585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1243819/" ]
The easiest option is to use `await Task.Delay`: ``` private async void Form_Load(object sender, EventArgs e) { await Task.Delay(timespan); label1.Text = "Hello world"; } ``` If you don't have access to `await` using the version of .NET that you're using, then your best bet would be to use a `Timer`. Yes it'...
Use a `System.Threading.Timer` in the `Form.Load` event: ``` private const int DelayMilliseconds = 500; private void Form1_Load(object sender, EventArgs e) { new System.Threading.Timer(_ => Invoke(new Action(() => _myLabel.Text = "bla")), null, DelayMi...
22,024,585
I've been trying to perform the simple task written in the title. I could only think of using timer, thread sleep or background worker, but I'm going to do this task only once.. so I would like to avoid making a lot of functions or such just for one time. I tried thread sleep but it doesn't show the mainform before the...
2014/02/25
[ "https://Stackoverflow.com/questions/22024585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1243819/" ]
Use a `System.Threading.Timer` in the `Form.Load` event: ``` private const int DelayMilliseconds = 500; private void Form1_Load(object sender, EventArgs e) { new System.Threading.Timer(_ => Invoke(new Action(() => _myLabel.Text = "bla")), null, DelayMi...
Use a System.Timer instance * make an eventhandler with Timer.Elapsed * set timer interval * start timer as application fires up -after the timer elapses set your label -stop timer
37,952,418
i have a list of tuples that i loop through in a simple for loop to identify tuples that contain some conditions. ``` mytuplist = [(1, 'ABC', 'Today is a great day'), (2, 'ABC', 'The sky is blue'), (3, 'DEF', 'The sea is green'), (4, 'ABC', 'There are clouds in the sky')] ``` I want it to be efficient...
2016/06/21
[ "https://Stackoverflow.com/questions/37952418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2800939/" ]
You should use the built-in [`any()`](https://docs.python.org/2/library/functions.html#any) function: ``` mytuplist = [ (1, 'ABC', 'Today is a great day'), (2, 'ABC', 'The sky is blue'), (3, 'DEF', 'The sea is green'), (4, 'ABC', 'There are clouds in the sky') ] keywords = ['Today is', 'The sky'] for ...
You don't, because `in` with a sequence only matches the whole element. ``` if tup[1] =='ABC' and any(el in tup[2] for el in ('Today is', 'The sky')): ```
37,952,418
i have a list of tuples that i loop through in a simple for loop to identify tuples that contain some conditions. ``` mytuplist = [(1, 'ABC', 'Today is a great day'), (2, 'ABC', 'The sky is blue'), (3, 'DEF', 'The sea is green'), (4, 'ABC', 'There are clouds in the sky')] ``` I want it to be efficient...
2016/06/21
[ "https://Stackoverflow.com/questions/37952418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2800939/" ]
You don't, because `in` with a sequence only matches the whole element. ``` if tup[1] =='ABC' and any(el in tup[2] for el in ('Today is', 'The sky')): ```
Your second approach (which, however, needs to be parenthesized as `x and (y or z)` to be correct) is necessary `tup[2]` *contains* one of your key phrases, rather than being an element of your set of key phrases. You could use regular-expression matching at the cost of some performance: ``` if tup[1] == 'ABC' and re....
37,952,418
i have a list of tuples that i loop through in a simple for loop to identify tuples that contain some conditions. ``` mytuplist = [(1, 'ABC', 'Today is a great day'), (2, 'ABC', 'The sky is blue'), (3, 'DEF', 'The sea is green'), (4, 'ABC', 'There are clouds in the sky')] ``` I want it to be efficient...
2016/06/21
[ "https://Stackoverflow.com/questions/37952418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2800939/" ]
You should use the built-in [`any()`](https://docs.python.org/2/library/functions.html#any) function: ``` mytuplist = [ (1, 'ABC', 'Today is a great day'), (2, 'ABC', 'The sky is blue'), (3, 'DEF', 'The sea is green'), (4, 'ABC', 'There are clouds in the sky') ] keywords = ['Today is', 'The sky'] for ...
Your second approach (which, however, needs to be parenthesized as `x and (y or z)` to be correct) is necessary `tup[2]` *contains* one of your key phrases, rather than being an element of your set of key phrases. You could use regular-expression matching at the cost of some performance: ``` if tup[1] == 'ABC' and re....
43,047,832
I am trying to remove a minimum element from a Java LinkedList. In order to find the minimum, I have to traverse through the LinkedList once. I would like to save the Node or Iterator of that element to remove it in O(1). The normal ``` list.remove(Object o) ``` takes O(n) steps. ``` void removeMin(LinkedList<Int...
2017/03/27
[ "https://Stackoverflow.com/questions/43047832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3265570/" ]
you can copy the iterator at current `.next` index in this way : ``` ListIterator<Integer> minItList = List.listIterator(itList.nextIndex()); ``` the solution will be like: ``` ListIterator<Integer> itList = list.listIterator(); ListIterator<Integer> minItList = list.listIterator(); Integer min = itList.next(); w...
I dont know if its faster but you can use `Collections.min(...)` ``` void removeMin(LinkedList<Integer> list) { list.remove(Collections.min(list)); } ```
43,047,832
I am trying to remove a minimum element from a Java LinkedList. In order to find the minimum, I have to traverse through the LinkedList once. I would like to save the Node or Iterator of that element to remove it in O(1). The normal ``` list.remove(Object o) ``` takes O(n) steps. ``` void removeMin(LinkedList<Int...
2017/03/27
[ "https://Stackoverflow.com/questions/43047832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3265570/" ]
you can copy the iterator at current `.next` index in this way : ``` ListIterator<Integer> minItList = List.listIterator(itList.nextIndex()); ``` the solution will be like: ``` ListIterator<Integer> itList = list.listIterator(); ListIterator<Integer> minItList = list.listIterator(); Integer min = itList.next(); w...
in any way, if you use sequential search symbol table(unordered linked list) in worst case find of minimum element will be O(N) + O(M) for removeOperation where M "position" of Min Node. May be you should use binary search symbol table(ordered) where at the head store the minimum value and you with O(1) time can delete...
58,337,471
I have this list ``` mylist = ['SHIMLA', 'TIKKAR', 'GSSS PUJARLI-4', 'GHS SERI', '31.19041597', '77.62639507', '2197', '20', 'f', 'Level1', 'Yes', 'Yes', 'Level2', 'Yes', 'Good', 'Good', 'Good', '1', 'http://ab0db3c8f0b1:8080/view/binaryData?blobKey=BRCC_V1%5B%40version%3Dnull+and+%40uiVersion%3Dnull%5D%2FBRCCs_QM_Qu...
2019/10/11
[ "https://Stackoverflow.com/questions/58337471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6049429/" ]
1. It seems your list is a string not array. eg- "['SHIMLA', 'TIKKAR'.......]" you may convert that back to an array: ``` var mylistArr = mylist.replace('[', '').replace(']', '').split(", ") ``` 2. Why your loop starts from 1st index? (x=1) it should be 0 if the data would be a correct array.
I changed the code to: ```js mylist = ['SHIMLA', 'TIKKAR', 'GSSS PUJARLI-4', 'GHS SERI', '31.19041597', '77.62639507', '2197', '20', 'f', 'Level1', 'Yes', 'Yes', 'Level2', 'Yes', 'Good', 'Good', 'Good', '1', 'http://ab0db3c8f0b1:8080/view/binaryData?blobKey=BRCC_V1%5B%40version%3Dnull+and+%40uiVersion%3Dnull%5D%2FBRCC...
6,750,273
I want it to look something like the image below ![Should look like this](https://i.stack.imgur.com/U8PcH.png)
2011/07/19
[ "https://Stackoverflow.com/questions/6750273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/747536/" ]
Something like this?: <http://jsfiddle.net/JA7vh/>
JSFiddle: <http://jsfiddle.net/Tq8Ff/4/> Code: ``` <div class="wrapper"> <span class="inner">new message form heaquarter</div> </div> .inner { text-align:center; background-color: white; } .wrapper { text-align:center; background-color: purple; padding: 10px; } ```
6,750,273
I want it to look something like the image below ![Should look like this](https://i.stack.imgur.com/U8PcH.png)
2011/07/19
[ "https://Stackoverflow.com/questions/6750273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/747536/" ]
Something like this?: <http://jsfiddle.net/JA7vh/>
Here you go: <http://jsfiddle.net/a3U5a/>
6,750,273
I want it to look something like the image below ![Should look like this](https://i.stack.imgur.com/U8PcH.png)
2011/07/19
[ "https://Stackoverflow.com/questions/6750273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/747536/" ]
JSFiddle: <http://jsfiddle.net/Tq8Ff/4/> Code: ``` <div class="wrapper"> <span class="inner">new message form heaquarter</div> </div> .inner { text-align:center; background-color: white; } .wrapper { text-align:center; background-color: purple; padding: 10px; } ```
Here you go: <http://jsfiddle.net/a3U5a/>
135,913
I am running code that shows child categories, and all posts in the child categories. But if there are more than 5 posts in a category, only the 5 newest are shown. How can I show all, or at least set a number like 9 posts etc.? My code: ``` <?php $args = array( 'child_of' => 1 ); $categories = get_categories( $...
2014/02/25
[ "https://wordpress.stackexchange.com/questions/135913", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14416/" ]
I think you could use the `posts_per_page` argument in your `get_posts` query: ``` $args = array( 'child_of' => 1 ); $categories = get_categories( $args ); foreach ($categories as $category) { echo '<li><a>'.$category->name.'</a>'; echo '<ul>'; $posts_args = array( 'posts_per_page' => 9, ...
You've to make use of the `post_per_page` or `numberposts` parameter of [`get_posts()`](http://codex.wordpress.org/Function_Reference/get_posts). The parameter defaults to `5`, see [source](https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/post.php#L1678), just chose the value you actually want it to h...
135,913
I am running code that shows child categories, and all posts in the child categories. But if there are more than 5 posts in a category, only the 5 newest are shown. How can I show all, or at least set a number like 9 posts etc.? My code: ``` <?php $args = array( 'child_of' => 1 ); $categories = get_categories( $...
2014/02/25
[ "https://wordpress.stackexchange.com/questions/135913", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/14416/" ]
I think you could use the `posts_per_page` argument in your `get_posts` query: ``` $args = array( 'child_of' => 1 ); $categories = get_categories( $args ); foreach ($categories as $category) { echo '<li><a>'.$category->name.'</a>'; echo '<ul>'; $posts_args = array( 'posts_per_page' => 9, ...
The number of posts is set to 5 by default, so you have to set it to your liking. If you want to show all posts, then it's `-1`, and the number you want otherwise. You should also put functions out of loops (as in your second `foreach`), so here is your code, optimized: ``` <?php $args = array( 'child_of' => 1,...
99,373
I lost the device with my Android Bitcoin Wallet late 2013. At the time, I had stored a 'wallet backup' file. It has no extension, is 240 bytes, and begins with 'U'. With only that file, is it possible to recover the value of the Bitcoin? Please explain what the 240-byte string is, and what else would be necessary to...
2020/10/07
[ "https://bitcoin.stackexchange.com/questions/99373", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/110216/" ]
That is very likely to be the ["Bitcoin Wallet for Android" by "Bitcoin Wallet Developers"](https://play.google.com/store/apps/details?id=de.schildbach.wallet) also sometimes known as the Schildbach wallet. Other people on Reddit discuss having a file of that size created by this wallet. Apparently the backup format ...
Did you get it unencrypted yet ? Its possible to brute-force the schildbach backup file, using just a btc python script, if the password is not too long, how long do you think the password is ? Its very possible, just say if you need more info ?
40,213
Ich las soeben diesen Satz: > > Die Veranstaltung ist ein Beispiel dafür, wie man die Darbietung dreier Musiker mit Texten siebener Autoren verbindet. > > > Es geht dabei um die Deklination der Zahlwörter. Folgende Beispiele sind ja durchaus gängig: > > der Text **eines** Autors > > die Texte **zweier** Au...
2017/11/16
[ "https://german.stackexchange.com/questions/40213", "https://german.stackexchange.com", "https://german.stackexchange.com/users/1487/" ]
Beides ist richtig. Ja, die Bildung solcher Formen mit Zahlwörtern über "drei" ist ungebräuchlich. Aber auch: Ja, in Textgattungen (oder Text-Orten), wo kreative Sprache erlaubt ist (oder wo man sich leisten kann, kreativ zu sein), spricht wenig gegen die Ausdehnung des Prinzips auf höhere Zahlen. Übrigens meine ...
Wenn man *will*, *kann* man dieses Schema natürlich weiterführen; mein Sprachgefühl gerät bei dem Satz mit **siebener** jedoch eindeutig ins Stocken. Möglicherweise liegt der Grund für das Stocken darin, dass meine Sprachautomatik ein spezifischeres Schema bildet. Ausgehend von: > > **eines** Autors <-- korrekt, da ...
19,813
This is a problem that has bothered me for a couple of weeks now, and I can't seem to wrap my head around it and understand it. Let's say we have a planet with a mass of $m$. We also have an object of relatively small mass (so small that its gravitational field would not affect the planet), and we know that at time 0 ...
2012/01/22
[ "https://physics.stackexchange.com/questions/19813", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/7246/" ]
You are correct that the "normal" formula $y = h - gt^2/2$ doesn't work when the gravitational acceleration changes, so you need a different formula. The mathematical expressions are a little ugly, though. Steven laid the groundwork for this, but I'm going to point you to an earlier [answer of mine where I did the calc...
I think that your paradox results from the first equation assuming *constant acceleration*, which won't be the case if you calculate gravity using the inverse-square law of Universal Gravitation as opposed to just assuming a constant *g*. As for what formula you *could* use to calculate the position of your object whe...
19,813
This is a problem that has bothered me for a couple of weeks now, and I can't seem to wrap my head around it and understand it. Let's say we have a planet with a mass of $m$. We also have an object of relatively small mass (so small that its gravitational field would not affect the planet), and we know that at time 0 ...
2012/01/22
[ "https://physics.stackexchange.com/questions/19813", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/7246/" ]
I think that your paradox results from the first equation assuming *constant acceleration*, which won't be the case if you calculate gravity using the inverse-square law of Universal Gravitation as opposed to just assuming a constant *g*. As for what formula you *could* use to calculate the position of your object whe...
Wikipedia has a formula for the distance fallen by an object in a certain amount of time, or the inverse (time taken to fall a specified distance): <https://en.wikipedia.org/wiki/Free_fall#Inverse-square_law_gravitational_field>
19,813
This is a problem that has bothered me for a couple of weeks now, and I can't seem to wrap my head around it and understand it. Let's say we have a planet with a mass of $m$. We also have an object of relatively small mass (so small that its gravitational field would not affect the planet), and we know that at time 0 ...
2012/01/22
[ "https://physics.stackexchange.com/questions/19813", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/7246/" ]
You are correct that the "normal" formula $y = h - gt^2/2$ doesn't work when the gravitational acceleration changes, so you need a different formula. The mathematical expressions are a little ugly, though. Steven laid the groundwork for this, but I'm going to point you to an earlier [answer of mine where I did the calc...
Wikipedia has a formula for the distance fallen by an object in a certain amount of time, or the inverse (time taken to fall a specified distance): <https://en.wikipedia.org/wiki/Free_fall#Inverse-square_law_gravitational_field>
51,609,392
I have a table like this : ``` ---------------------------------------------------------- | Actions | ---------------------------------------------------------- | action_id | user_id | action_active | action_cancelled | ----------------------------------------------------...
2018/07/31
[ "https://Stackoverflow.com/questions/51609392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4787829/" ]
I encountered the same prblem, and found a solution. You need to set an JavaScript code injection to the `WkWebView` configuration. The scale number needs to be set in the JavaScript code. The full code is shown below: ``` NSString *jScript = @"document.body.style.zoom = 0.8"; WKUserScript *wkUScript = [[WKUserScrip...
As an alternative to injecting javascript, as described in the accepted answer of @elsonpeng, you can also adjust the zoom level at any time like this (Swift): ``` webView.evaluateJavaScript("document.body.style.zoom = 1.5", completionHandler: nil) ``` This can of course also be used in combination with `WKNavigatio...
22,772,477
I have the following code which tracks user location and detect if the user was in one of the specified events in the JSON File by matching the long and the lat of current user location with the long and lat of the today event + when the event starting time is equal to the current iPhone time then perform the following...
2014/03/31
[ "https://Stackoverflow.com/questions/22772477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3066516/" ]
In your handler definition you are closing over the loop variable `i`, not the current value of `i`, so when you reach the end of the loop, `i = 20` in all the registered handlers. You can fix it by copying `i` to another loop variable: ``` for (int i = 0; i < 20; i++) { int temp = i; MyEvent += a => { ...
``` for (int i = 0; i < 20; i++) MyEvent += a => { int temp = i; if (a != temp) throw new NotSupportedException(); return a * 2; }; ``` > > I'd like someone to explain to me why temp is always equal to 20 and not *the value that was set to temp in the lo...
22,772,477
I have the following code which tracks user location and detect if the user was in one of the specified events in the JSON File by matching the long and the lat of current user location with the long and lat of the today event + when the event starting time is equal to the current iPhone time then perform the following...
2014/03/31
[ "https://Stackoverflow.com/questions/22772477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3066516/" ]
In your handler definition you are closing over the loop variable `i`, not the current value of `i`, so when you reach the end of the loop, `i = 20` in all the registered handlers. You can fix it by copying `i` to another loop variable: ``` for (int i = 0; i < 20; i++) { int temp = i; MyEvent += a => { ...
Simply move `temp` outside of the closure. ``` for (int i = 0; i < 20; i++) { int temp = i; MyEvent += a => { if (a != temp) throw new NotSupportedException(); return a * 2; }; } ```
22,772,477
I have the following code which tracks user location and detect if the user was in one of the specified events in the JSON File by matching the long and the lat of current user location with the long and lat of the today event + when the event starting time is equal to the current iPhone time then perform the following...
2014/03/31
[ "https://Stackoverflow.com/questions/22772477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3066516/" ]
`i` is being used in a closure. You have this loop: ``` for (int i = 0; i < 20; i++) MyEvent += a => { int temp = i; if (a != temp) throw new NotSupportedException(); return a * 2; }; ``` The lambda uses `i`, not *the value of i*. In...
``` for (int i = 0; i < 20; i++) MyEvent += a => { int temp = i; if (a != temp) throw new NotSupportedException(); return a * 2; }; ``` > > I'd like someone to explain to me why temp is always equal to 20 and not *the value that was set to temp in the lo...
22,772,477
I have the following code which tracks user location and detect if the user was in one of the specified events in the JSON File by matching the long and the lat of current user location with the long and lat of the today event + when the event starting time is equal to the current iPhone time then perform the following...
2014/03/31
[ "https://Stackoverflow.com/questions/22772477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3066516/" ]
`i` is being used in a closure. You have this loop: ``` for (int i = 0; i < 20; i++) MyEvent += a => { int temp = i; if (a != temp) throw new NotSupportedException(); return a * 2; }; ``` The lambda uses `i`, not *the value of i*. In...
Simply move `temp` outside of the closure. ``` for (int i = 0; i < 20; i++) { int temp = i; MyEvent += a => { if (a != temp) throw new NotSupportedException(); return a * 2; }; } ```
36,638,763
I want to listen to a tweet in real-time, which means when someone tweets I want to see that tweet. However I was able to get tweets from my news feed using twitter4j library. Here's the code. ``` package twitteroperation; import java.util.List; import twitter4j.Status; import twitter4j.TwitterException; import tw...
2016/04/15
[ "https://Stackoverflow.com/questions/36638763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5068770/" ]
Twitter4j provides examples, and one of them is [exactly what you are looking for](https://github.com/yusuke/twitter4j/blob/master/twitter4j-examples/src/main/java/twitter4j/examples/stream/PrintSampleStream.java), however you need to change the line ``` TwitterStream twitterStream = new TwitterStreamFactory().getInst...
I would recommend you to try out the [Twitter HBC project](https://github.com/twitter/hbc). It has some good examples on the front-page for how you can set up a BlockingQueue for consuming events.
11,105,812
I am developing an Eclipse plug-in that requires a third-party plug-in such as the AJDT (AspectJ Development Tools) plug-in. When a user wants to install my plug-in from the update site and does not have AJDT installed or enabled in his list of available update sites the installation will fail. I created a file asso...
2012/06/19
[ "https://Stackoverflow.com/questions/11105812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1002670/" ]
Using associateSitesURL seems to be deprecated. This can help: [Include an external update site in my update site in Eclipse](https://stackoverflow.com/questions/57398070/include-an-external-update-site-in-my-update-site-in-eclipse) together with [Feature Export Wizard](https://help.eclipse.org/2020-06/index.jsp?to...
Try making the associateSitesURL an absolute URL (eg, `http://www.yourdomain.com/updates/associateSites.xml`)
52,287,613
I need to write a program in Python that prints the alphabet in lowercase and without the newline. Other requirements: ``` * only use one print function with string format * only use one loop in your code * you are not allowed to store characters in a variable * you are not allowed to import any module ``` Here's wh...
2018/09/12
[ "https://Stackoverflow.com/questions/52287613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9281901/" ]
You're mixing character code with character value. `range` yields codes, you're testing value. You'd need `if alpha_letters == ord('e'):` instead (ot `if alpha_letters in [ord('e'),ord('q')]:` to test for 2 letters. So regardless of some ludicrious constraints, I'd do the following (without importing any magical modul...
I didn't know you could get the alphabet to print like that, this code will definitely come in handy for puzzles in the future. **Here's a one-liner that covers all criteria** (I think): ``` print(*["%c" % a for a in range(ord('a'),ord('z')+1) if "%c" % a not in 'qe'],sep='',end='') ``` I used list comprehension, J...
52,287,613
I need to write a program in Python that prints the alphabet in lowercase and without the newline. Other requirements: ``` * only use one print function with string format * only use one loop in your code * you are not allowed to store characters in a variable * you are not allowed to import any module ``` Here's wh...
2018/09/12
[ "https://Stackoverflow.com/questions/52287613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9281901/" ]
You're mixing character code with character value. `range` yields codes, you're testing value. You'd need `if alpha_letters == ord('e'):` instead (ot `if alpha_letters in [ord('e'),ord('q')]:` to test for 2 letters. So regardless of some ludicrious constraints, I'd do the following (without importing any magical modul...
Well i am guessing that you are using the concept of ASCII and direct character comparison both at once: 1. You can prefer ASCII completely : ``` for alpha_letters in range(ord('a'), ord('z')+1): if ord(alpha_letters) ==101 or ord(alpha_letters) == 113: continue print("{:c}".format(alpha_lette...
52,287,613
I need to write a program in Python that prints the alphabet in lowercase and without the newline. Other requirements: ``` * only use one print function with string format * only use one loop in your code * you are not allowed to store characters in a variable * you are not allowed to import any module ``` Here's wh...
2018/09/12
[ "https://Stackoverflow.com/questions/52287613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9281901/" ]
If you want to use the same code, change the if condition like this.. ``` if alpha_letters in [101,113]: ```
I didn't know you could get the alphabet to print like that, this code will definitely come in handy for puzzles in the future. **Here's a one-liner that covers all criteria** (I think): ``` print(*["%c" % a for a in range(ord('a'),ord('z')+1) if "%c" % a not in 'qe'],sep='',end='') ``` I used list comprehension, J...
52,287,613
I need to write a program in Python that prints the alphabet in lowercase and without the newline. Other requirements: ``` * only use one print function with string format * only use one loop in your code * you are not allowed to store characters in a variable * you are not allowed to import any module ``` Here's wh...
2018/09/12
[ "https://Stackoverflow.com/questions/52287613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9281901/" ]
If you want to use the same code, change the if condition like this.. ``` if alpha_letters in [101,113]: ```
Well i am guessing that you are using the concept of ASCII and direct character comparison both at once: 1. You can prefer ASCII completely : ``` for alpha_letters in range(ord('a'), ord('z')+1): if ord(alpha_letters) ==101 or ord(alpha_letters) == 113: continue print("{:c}".format(alpha_lette...
52,287,613
I need to write a program in Python that prints the alphabet in lowercase and without the newline. Other requirements: ``` * only use one print function with string format * only use one loop in your code * you are not allowed to store characters in a variable * you are not allowed to import any module ``` Here's wh...
2018/09/12
[ "https://Stackoverflow.com/questions/52287613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9281901/" ]
I didn't know you could get the alphabet to print like that, this code will definitely come in handy for puzzles in the future. **Here's a one-liner that covers all criteria** (I think): ``` print(*["%c" % a for a in range(ord('a'),ord('z')+1) if "%c" % a not in 'qe'],sep='',end='') ``` I used list comprehension, J...
Well i am guessing that you are using the concept of ASCII and direct character comparison both at once: 1. You can prefer ASCII completely : ``` for alpha_letters in range(ord('a'), ord('z')+1): if ord(alpha_letters) ==101 or ord(alpha_letters) == 113: continue print("{:c}".format(alpha_lette...
72,111,794
i want to export an excel sheet and using xlsx this is my code : ``` import XLSX from 'xlsx'; ``` and ``` const downloadExcel = () => { console.log(XLSX); const worksheet = XLSX.utils.json_to_sheet(excelExport); const workbook = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(workbook, workshee...
2022/05/04
[ "https://Stackoverflow.com/questions/72111794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18017544/" ]
I had the same error, **changed this:** import XLSX from 'xlsx' **to this:** import \* as XLSX from 'xlsx' **based on:** <https://github.com/SheetJS/sheetjs/issues/393>
I had the same error with a Vuejs project. My workaround was to go back to version 0.18.0 of xlsx (latest version right now is 0.18.5) ``` "xlsx": "^0.18.0" ```
17,943
Can you suggest some ways of saying "I admire that guy"? First of all, is the sentence below correct? > > I admire someone > > > Secondly, how can I change it to avoid always using the same sentence?
2014/02/23
[ "https://ell.stackexchange.com/questions/17943", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/4457/" ]
First of all, yes, that sentence is perfectly sound. In order to rephrase it, it would depend on the type of admiration, since the word "admire" has more than one definition, just as "relationship", "respect", or "love" can mean several different kinds of relationships, different kinds of respect, different kinds of lo...
Yes, "I admire someone" is a correct sentence and it would be fine to use it. Another expression for this that is very common is to say "I [look up to](https://www.bing.com/search?pc=cosp&ptag=AD6C08C471A&form=CONBDF&conlogo=CT3210127&q=define%20look%20up%20to) someone." **Examples:** * "I really look up to Simone B...
17,943
Can you suggest some ways of saying "I admire that guy"? First of all, is the sentence below correct? > > I admire someone > > > Secondly, how can I change it to avoid always using the same sentence?
2014/02/23
[ "https://ell.stackexchange.com/questions/17943", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/4457/" ]
I'd have to know more about the kind of feelings you're trying to convey, but one slang term gaining traction in the U.S. is *man crush*. The [Urban Dictionary](http://www.urbandictionary.com/define.php?term=man%20crush) has several meanings listed at their site; I'll share this one: > > **man crush** - for a man to ...
Yes, "I admire someone" is a correct sentence and it would be fine to use it. Another expression for this that is very common is to say "I [look up to](https://www.bing.com/search?pc=cosp&ptag=AD6C08C471A&form=CONBDF&conlogo=CT3210127&q=define%20look%20up%20to) someone." **Examples:** * "I really look up to Simone B...
71,194,541
I'm working on a data set that shows mortality rate for certain diseases and other info in hospitals in various states, and here it is. <https://drive.google.com/open?id=1FTZJQLdw0PKw2bQ7XvxWnOITU7-yOCXC> I'm trying to write a function called rankall() that takes TWO (2) arguments: (a) the disease (output) which might...
2022/02/20
[ "https://Stackoverflow.com/questions/71194541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17074045/" ]
If you using **iTextSharp** Why don't do it all the way in **iTextSharp**? ``` GeneratedPdf generatedPDF = new GeneratedPdf(); Document document = new Document(); string path = @"C:\Temp\"; string originalFileName = "qr.pdf"; PdfWriter pdfWriter = PdfWriter.GetInstance(documen...
**SOLUTION** We open a MemoryStream and put into them our QR / picture. In our function behind them we want to read a "Stream qrstream". It must be "MemoryStream qrstream". **We use now "Spire Barcode" instead of "IronBarcode" or "QRCoder"** **wrong** ``` public void AddImage(Stream qrstream) { ...
71,194,541
I'm working on a data set that shows mortality rate for certain diseases and other info in hospitals in various states, and here it is. <https://drive.google.com/open?id=1FTZJQLdw0PKw2bQ7XvxWnOITU7-yOCXC> I'm trying to write a function called rankall() that takes TWO (2) arguments: (a) the disease (output) which might...
2022/02/20
[ "https://Stackoverflow.com/questions/71194541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17074045/" ]
If you using **iTextSharp** Why don't do it all the way in **iTextSharp**? ``` GeneratedPdf generatedPDF = new GeneratedPdf(); Document document = new Document(); string path = @"C:\Temp\"; string originalFileName = "qr.pdf"; PdfWriter pdfWriter = PdfWriter.GetInstance(documen...
IronBarcode don't have any function with this name GetInstance() you can use qrcode.Image property that return System.Drawing.Image object and there is also lot of functions that return different types like qrcode.ToBitmap() , qrcode.ToImage() , qrcode.ToStream and a lot others you can find them all in [IronSoftware We...
71,194,541
I'm working on a data set that shows mortality rate for certain diseases and other info in hospitals in various states, and here it is. <https://drive.google.com/open?id=1FTZJQLdw0PKw2bQ7XvxWnOITU7-yOCXC> I'm trying to write a function called rankall() that takes TWO (2) arguments: (a) the disease (output) which might...
2022/02/20
[ "https://Stackoverflow.com/questions/71194541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17074045/" ]
**SOLUTION** We open a MemoryStream and put into them our QR / picture. In our function behind them we want to read a "Stream qrstream". It must be "MemoryStream qrstream". **We use now "Spire Barcode" instead of "IronBarcode" or "QRCoder"** **wrong** ``` public void AddImage(Stream qrstream) { ...
IronBarcode don't have any function with this name GetInstance() you can use qrcode.Image property that return System.Drawing.Image object and there is also lot of functions that return different types like qrcode.ToBitmap() , qrcode.ToImage() , qrcode.ToStream and a lot others you can find them all in [IronSoftware We...
16,056,941
> > 8:46:12,814 ERROR > [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ecmfi].[action]] > (http--192.168.192.38-8080-4) Servlet.service() for servlet action > threw exception: java.lang.IllegalStateException: Parameters > processing failed. at > org.apache.tomcat.util.http.Parameters.process...
2013/04/17
[ "https://Stackoverflow.com/questions/16056941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1639975/" ]
I had this same problem today and discovered that it was due to an bad URL parameter. One of my parameters had no name and no value: <https://www.someurl.com?param1=A&param2=B&=&param3=c> Once I fixed the URL this error went away.
I guess its a known issue for JBOSS AS-7.1.1. Follow these threads <https://community.jboss.org/message/747210> [AS7-5143](https://issues.jboss.org/browse/AS7-5143) As of now, the only solution seems to be to downgrade to JBoss AS 7.1.0.
16,056,941
> > 8:46:12,814 ERROR > [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ecmfi].[action]] > (http--192.168.192.38-8080-4) Servlet.service() for servlet action > threw exception: java.lang.IllegalStateException: Parameters > processing failed. at > org.apache.tomcat.util.http.Parameters.process...
2013/04/17
[ "https://Stackoverflow.com/questions/16056941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1639975/" ]
I also got this exception with a JBoss / Spring application server. It was due to one parameter appearing twice in the form (2 times the same path). I would advise to make sure that all fields in the form and corresponding parameters in the submitted URL are valid.
I guess its a known issue for JBOSS AS-7.1.1. Follow these threads <https://community.jboss.org/message/747210> [AS7-5143](https://issues.jboss.org/browse/AS7-5143) As of now, the only solution seems to be to downgrade to JBoss AS 7.1.0.
16,056,941
> > 8:46:12,814 ERROR > [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ecmfi].[action]] > (http--192.168.192.38-8080-4) Servlet.service() for servlet action > threw exception: java.lang.IllegalStateException: Parameters > processing failed. at > org.apache.tomcat.util.http.Parameters.process...
2013/04/17
[ "https://Stackoverflow.com/questions/16056941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1639975/" ]
I also got this exception with a JBoss / Spring application server. It was due to one parameter appearing twice in the form (2 times the same path). I would advise to make sure that all fields in the form and corresponding parameters in the submitted URL are valid.
I had this same problem today and discovered that it was due to an bad URL parameter. One of my parameters had no name and no value: <https://www.someurl.com?param1=A&param2=B&=&param3=c> Once I fixed the URL this error went away.
35,722
> > **Possible Duplicate:** > > [Increase captcha threshold for post editing](https://meta.stackexchange.com/questions/2167/increase-captcha-threshold-for-post-editing) > > > Make human verification appear less often in frequent editions for users with a certain rep. Human verification appears every time I ma...
2010/01/15
[ "https://meta.stackexchange.com/questions/35722", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/147655/" ]
I agree wholeheartedly. I am getting quite annoyed, since I ask myself how often I will have to prove my humanity again. What the system currently does is saying "Bad boy, don't edit so often" and "Bad boy, you took too long to edit".
[It's already in place](https://meta.stackexchange.com/questions/2167/increase-captcha-threshold-for-post-editing), just get to 10,000 reputation.
68,015,159
I'm using "microsoft bot builder" library to build a bot in c#. I have a card that contains an AdaptiveSubmitAction button which will present a new card on click. I want to **disable** the submit button once its activated.. how would that be possible? This is a part of my code: ``` ////// Submit and Finish ...
2021/06/17
[ "https://Stackoverflow.com/questions/68015159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9576638/" ]
This happens because you are iterating through the dictionary created by your JSON at a level too high. You can go inside the dictionary at key = 'data' by using jsonObject["data"], then iterate like you did. ``` for key in jsonObject["data"][0]: value = jsonObject["data"][0][key] print("The key and value are ...
Assuming that `data` (which is a list in your case) inside your JSON could contain more than one element : ```py import json jsonString = '{ "data": [ {"key1":"value1","key2":"value2","key3":"value3"} ] }' jsonObject = json.loads(jsonString) print("The keys and values are:") for item in jsonObject["data"]: for k...
59,215,711
I have an app which is based on single activity and multiple fragments and some fragments needs to show into fullscreen when enters fragment and exit from fullscreen when exit. I am currently using flags to show fullscreen in `Android Kitkat` but its not optimal way i think. I also read `ImmersiveMode` but it's not wor...
2019/12/06
[ "https://Stackoverflow.com/questions/59215711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6527410/" ]
How to handle the toolbar from fragment? ---------------------------------------- Where to put the toolbar is highly opinionated. But I recommend you to put the toolbar in each fragment xml file rather than keeping one toolbar for the whole application in the Activity xml file. [See this](https://github.com/android/su...
1- in style xml file change AppTheme parent to NoActionBar: ``` <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> ``` 2- use this method in your activity for transparent statusBar ``` private void hideStatusBar() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow()...
59,215,711
I have an app which is based on single activity and multiple fragments and some fragments needs to show into fullscreen when enters fragment and exit from fullscreen when exit. I am currently using flags to show fullscreen in `Android Kitkat` but its not optimal way i think. I also read `ImmersiveMode` but it's not wor...
2019/12/06
[ "https://Stackoverflow.com/questions/59215711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6527410/" ]
I solved this issue by creating a method which clears desired flags at `onStop` and add flags at `onResume` ``` @Override public void onResume() { super.onResume(); App_Functions.transparentStatusBar(getActivity(),true,false); } @Override public void onStop() { super.onStop(...
How to handle the toolbar from fragment? ---------------------------------------- Where to put the toolbar is highly opinionated. But I recommend you to put the toolbar in each fragment xml file rather than keeping one toolbar for the whole application in the Activity xml file. [See this](https://github.com/android/su...
59,215,711
I have an app which is based on single activity and multiple fragments and some fragments needs to show into fullscreen when enters fragment and exit from fullscreen when exit. I am currently using flags to show fullscreen in `Android Kitkat` but its not optimal way i think. I also read `ImmersiveMode` but it's not wor...
2019/12/06
[ "https://Stackoverflow.com/questions/59215711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6527410/" ]
I solved this issue by creating a method which clears desired flags at `onStop` and add flags at `onResume` ``` @Override public void onResume() { super.onResume(); App_Functions.transparentStatusBar(getActivity(),true,false); } @Override public void onStop() { super.onStop(...
1- in style xml file change AppTheme parent to NoActionBar: ``` <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> ``` 2- use this method in your activity for transparent statusBar ``` private void hideStatusBar() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow()...
41,139,643
I want to change value dynamically at some event Event: ``` BackgroundGeolocation.on('location', (location) => { currentDistance = distance(previousLatitude,previousLongitude,latitude,longitude); this.setState({ text: currentDistance }); ...
2016/12/14
[ "https://Stackoverflow.com/questions/41139643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7290536/" ]
Below is the example where it uses states for dynamic changing of text value while clicking on it. You can set on any event you want. ``` import React, { Component } from 'react' import { Text, View } from 'react-native' export default class reactApp extends Component { constructor() { super() th...
Use: ``` <TextInput editable={false} ref={component=> this._MyComponent=component}/> ``` instead of: ``` <Text></Text> ``` Then you can change the text this way: ``` onPress= {()=> { this._MyComponent.setNativeProps({text:'my new text'}); } ```
25,299,929
I'm trying to change the name of multiple files that all have identical names but various extensions, I get the impression there there is a simple streamlined method of doing this but I can't figure out how. At present my code looks like this; ``` import os def rename_test(): os.rename ('cheddar.tasty.coor', 'ne...
2014/08/14
[ "https://Stackoverflow.com/questions/25299929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3764754/" ]
``` import os def rename(dirpath): whitelist = set('txt csv coor'.split()) for fname in os.listdir(dirpath): name, cat, ext = os.path.basename(os.path.join(dirpath, fname)).rsplit(os.path.extsep,2) if ext not in whitelist: continue name = 'new' + name cat = 'vintage' ...
You might use the `glob` module. It really depends on what you want to improve. ``` for ext in ('*.coor', '*.txt', '*.csv'): for filename in glob.glob(ext): newname = filename.replace("cheddar.", "newcheddar.").replace(".tasty.", ".vintage.") os.rename(filename, newnew) ```
25,299,929
I'm trying to change the name of multiple files that all have identical names but various extensions, I get the impression there there is a simple streamlined method of doing this but I can't figure out how. At present my code looks like this; ``` import os def rename_test(): os.rename ('cheddar.tasty.coor', 'ne...
2014/08/14
[ "https://Stackoverflow.com/questions/25299929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3764754/" ]
``` import os def rename(dirpath): whitelist = set('txt csv coor'.split()) for fname in os.listdir(dirpath): name, cat, ext = os.path.basename(os.path.join(dirpath, fname)).rsplit(os.path.extsep,2) if ext not in whitelist: continue name = 'new' + name cat = 'vintage' ...
``` def rename_test(): for ext in "coor txt csv".split(): os.rename('cheddar.tasty.'+ext, 'newcheddar.vintage.'+ext) ```
25,299,929
I'm trying to change the name of multiple files that all have identical names but various extensions, I get the impression there there is a simple streamlined method of doing this but I can't figure out how. At present my code looks like this; ``` import os def rename_test(): os.rename ('cheddar.tasty.coor', 'ne...
2014/08/14
[ "https://Stackoverflow.com/questions/25299929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3764754/" ]
``` import os def rename(dirpath): whitelist = set('txt csv coor'.split()) for fname in os.listdir(dirpath): name, cat, ext = os.path.basename(os.path.join(dirpath, fname)).rsplit(os.path.extsep,2) if ext not in whitelist: continue name = 'new' + name cat = 'vintage' ...
I would use `listdir` and `replace` - no regular expressions, no having to parse the filename twice. Just one replace and an equality test: ``` import os for old_filename in os.listdir('.'): new_filename = old_filename.replace('cheddar.tasty', 'newcheddar.vintage') if new_filename != old_filename: os.rename(o...
10,207,354
I have a file containing many vowels with diacritics. I need to make these replacements: * Replace ā, á, ǎ, and à with a. * Replace ē, é, ě, and è with e. * Replace ī, í, ǐ, and ì with i. * Replace ō, ó, ǒ, and ò with o. * Replace ū, ú, ǔ, and ù with u. * Replace ǖ, ǘ, ǚ, and ǜ with ü. * Replace Ā, Á, Ǎ, and À with A....
2012/04/18
[ "https://Stackoverflow.com/questions/10207354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834616/" ]
``` #!/bin/bash INPUT="$1" declare -a acc declare -a noa acc=('$' 'è' 'ê' 'é' 'À' 'Á' 'Â' 'Ã' 'Ä' 'Å' 'Æ' 'Ç' 'È' 'É' 'Ê' 'Ë' 'Ì' 'Í' 'Î' 'Ï' 'Ð' 'Ñ' 'Ò' 'Ó' 'Ô' 'Õ' 'Ö' 'Ø' 'Ù' 'Ú' 'Û' 'Ü' 'Ý' 'ß' 'à' 'á' 'â' 'ã' 'ä' 'å' 'æ' 'ç' 'è' 'é' 'ê' 'ë' 'ì' 'í' 'î' 'ï' 'ñ' 'ò' 'ó' 'ô' 'õ' 'ö' 'ø' 'ù' 'ú' 'û' 'ü' 'ý' 'ÿ' 'Ā'...
This may not work. Just because your locale must be set! use locale to set LC\_ALL, for example: ``` export LC_ALL=en_US.iso88591 ``` Note that the full list of locales is available through: ``` locale -a ```
10,207,354
I have a file containing many vowels with diacritics. I need to make these replacements: * Replace ā, á, ǎ, and à with a. * Replace ē, é, ě, and è with e. * Replace ī, í, ǐ, and ì with i. * Replace ō, ó, ǒ, and ò with o. * Replace ū, ú, ǔ, and ù with u. * Replace ǖ, ǘ, ǚ, and ǜ with ü. * Replace Ā, Á, Ǎ, and À with A....
2012/04/18
[ "https://Stackoverflow.com/questions/10207354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834616/" ]
For this the *tr(1)* command is for. For example: ``` tr 'āáǎàēéěèīíǐì...' 'aaaaeeeeiii...' <infile >outfile ``` You may have to check/change your `LANG` environment variable to match the character set being used.
You can use `man iso_8859_1` (or your char set) or `od -bc` to identify the the octal representation of the diacritic. Then use `gawk` to do the replacing. ``` { gsub(/\344/,"a"; print $0 } ``` This replaces `ä` with `a`.
10,207,354
I have a file containing many vowels with diacritics. I need to make these replacements: * Replace ā, á, ǎ, and à with a. * Replace ē, é, ě, and è with e. * Replace ī, í, ǐ, and ì with i. * Replace ō, ó, ǒ, and ò with o. * Replace ū, ú, ǔ, and ù with u. * Replace ǖ, ǘ, ǚ, and ǜ with ü. * Replace Ā, Á, Ǎ, and À with A....
2012/04/18
[ "https://Stackoverflow.com/questions/10207354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834616/" ]
This might work for you: ``` sed -i 'y/āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜĀÁǍÀĒÉĚÈĪÍǏÌŌÓǑÒŪÚǓÙǕǗǙǛ/aaaaeeeeiiiioooouuuuüüüüAAAAEEEEIIIIOOOOUUUUÜÜÜÜ/' file ```
You can use something like this: ``` sed -e 's/[àâ]/a/g;s/[ọõ]/o/g;s/[í,ì]/i/g;s/[ê,ệ]/e/g' ``` just add more characters to [..] for your need.
10,207,354
I have a file containing many vowels with diacritics. I need to make these replacements: * Replace ā, á, ǎ, and à with a. * Replace ē, é, ě, and è with e. * Replace ī, í, ǐ, and ì with i. * Replace ō, ó, ǒ, and ò with o. * Replace ū, ú, ǔ, and ù with u. * Replace ǖ, ǘ, ǚ, and ǜ with ü. * Replace Ā, Á, Ǎ, and À with A....
2012/04/18
[ "https://Stackoverflow.com/questions/10207354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834616/" ]
``` #!/bin/bash INPUT="$1" declare -a acc declare -a noa acc=('$' 'è' 'ê' 'é' 'À' 'Á' 'Â' 'Ã' 'Ä' 'Å' 'Æ' 'Ç' 'È' 'É' 'Ê' 'Ë' 'Ì' 'Í' 'Î' 'Ï' 'Ð' 'Ñ' 'Ò' 'Ó' 'Ô' 'Õ' 'Ö' 'Ø' 'Ù' 'Ú' 'Û' 'Ü' 'Ý' 'ß' 'à' 'á' 'â' 'ã' 'ä' 'å' 'æ' 'ç' 'è' 'é' 'ê' 'ë' 'ì' 'í' 'î' 'ï' 'ñ' 'ò' 'ó' 'ô' 'õ' 'ö' 'ø' 'ù' 'ú' 'û' 'ü' 'ý' 'ÿ' 'Ā'...
You can use something like this: ``` sed -e 's/[àâ]/a/g;s/[ọõ]/o/g;s/[í,ì]/i/g;s/[ê,ệ]/e/g' ``` just add more characters to [..] for your need.
10,207,354
I have a file containing many vowels with diacritics. I need to make these replacements: * Replace ā, á, ǎ, and à with a. * Replace ē, é, ě, and è with e. * Replace ī, í, ǐ, and ì with i. * Replace ō, ó, ǒ, and ò with o. * Replace ū, ú, ǔ, and ù with u. * Replace ǖ, ǘ, ǚ, and ǜ with ü. * Replace Ā, Á, Ǎ, and À with A....
2012/04/18
[ "https://Stackoverflow.com/questions/10207354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834616/" ]
This might work for you: ``` sed -i 'y/āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜĀÁǍÀĒÉĚÈĪÍǏÌŌÓǑÒŪÚǓÙǕǗǙǛ/aaaaeeeeiiiioooouuuuüüüüAAAAEEEEIIIIOOOOUUUUÜÜÜÜ/' file ```
For this the *tr(1)* command is for. For example: ``` tr 'āáǎàēéěèīíǐì...' 'aaaaeeeeiii...' <infile >outfile ``` You may have to check/change your `LANG` environment variable to match the character set being used.
10,207,354
I have a file containing many vowels with diacritics. I need to make these replacements: * Replace ā, á, ǎ, and à with a. * Replace ē, é, ě, and è with e. * Replace ī, í, ǐ, and ì with i. * Replace ō, ó, ǒ, and ò with o. * Replace ū, ú, ǔ, and ù with u. * Replace ǖ, ǘ, ǚ, and ǜ with ü. * Replace Ā, Á, Ǎ, and À with A....
2012/04/18
[ "https://Stackoverflow.com/questions/10207354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834616/" ]
This might work for you: ``` sed -i 'y/āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜĀÁǍÀĒÉĚÈĪÍǏÌŌÓǑÒŪÚǓÙǕǗǙǛ/aaaaeeeeiiiioooouuuuüüüüAAAAEEEEIIIIOOOOUUUUÜÜÜÜ/' file ```
This may not work. Just because your locale must be set! use locale to set LC\_ALL, for example: ``` export LC_ALL=en_US.iso88591 ``` Note that the full list of locales is available through: ``` locale -a ```
10,207,354
I have a file containing many vowels with diacritics. I need to make these replacements: * Replace ā, á, ǎ, and à with a. * Replace ē, é, ě, and è with e. * Replace ī, í, ǐ, and ì with i. * Replace ō, ó, ǒ, and ò with o. * Replace ū, ú, ǔ, and ù with u. * Replace ǖ, ǘ, ǚ, and ǜ with ü. * Replace Ā, Á, Ǎ, and À with A....
2012/04/18
[ "https://Stackoverflow.com/questions/10207354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834616/" ]
If you check the man page of the tool `iconv`: > > //TRANSLIT > > When the string "//TRANSLIT" is appended to --to-code, transliteration is activated. This means that when a character cannot be represented in the > target character set, it can be approximated through one or several similarly looking characters. > ...
If you want to know which solution is the fastest: Text Transliteration: using `tr` : 5.3 MB/s Text Transliteration: using `sed`: 70.3 MB/s Text Transliteration: using `iconv`: 35.2 MB/s So the `sed 'y/[diacritics]/[transliterated]/'` command is the fastest by far! (code on [github.com/pforret/bash\_benchmarks](ht...
10,207,354
I have a file containing many vowels with diacritics. I need to make these replacements: * Replace ā, á, ǎ, and à with a. * Replace ē, é, ě, and è with e. * Replace ī, í, ǐ, and ì with i. * Replace ō, ó, ǒ, and ò with o. * Replace ū, ú, ǔ, and ù with u. * Replace ǖ, ǘ, ǚ, and ǜ with ü. * Replace Ā, Á, Ǎ, and À with A....
2012/04/18
[ "https://Stackoverflow.com/questions/10207354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834616/" ]
``` #!/bin/bash INPUT="$1" declare -a acc declare -a noa acc=('$' 'è' 'ê' 'é' 'À' 'Á' 'Â' 'Ã' 'Ä' 'Å' 'Æ' 'Ç' 'È' 'É' 'Ê' 'Ë' 'Ì' 'Í' 'Î' 'Ï' 'Ð' 'Ñ' 'Ò' 'Ó' 'Ô' 'Õ' 'Ö' 'Ø' 'Ù' 'Ú' 'Û' 'Ü' 'Ý' 'ß' 'à' 'á' 'â' 'ã' 'ä' 'å' 'æ' 'ç' 'è' 'é' 'ê' 'ë' 'ì' 'í' 'î' 'ï' 'ñ' 'ò' 'ó' 'ô' 'õ' 'ö' 'ø' 'ù' 'ú' 'û' 'ü' 'ý' 'ÿ' 'Ā'...
If you want to know which solution is the fastest: Text Transliteration: using `tr` : 5.3 MB/s Text Transliteration: using `sed`: 70.3 MB/s Text Transliteration: using `iconv`: 35.2 MB/s So the `sed 'y/[diacritics]/[transliterated]/'` command is the fastest by far! (code on [github.com/pforret/bash\_benchmarks](ht...
10,207,354
I have a file containing many vowels with diacritics. I need to make these replacements: * Replace ā, á, ǎ, and à with a. * Replace ē, é, ě, and è with e. * Replace ī, í, ǐ, and ì with i. * Replace ō, ó, ǒ, and ò with o. * Replace ū, ú, ǔ, and ù with u. * Replace ǖ, ǘ, ǚ, and ǜ with ü. * Replace Ā, Á, Ǎ, and À with A....
2012/04/18
[ "https://Stackoverflow.com/questions/10207354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834616/" ]
For this the *tr(1)* command is for. For example: ``` tr 'āáǎàēéěèīíǐì...' 'aaaaeeeeiii...' <infile >outfile ``` You may have to check/change your `LANG` environment variable to match the character set being used.
You can use something like this: ``` sed -e 's/[àâ]/a/g;s/[ọõ]/o/g;s/[í,ì]/i/g;s/[ê,ệ]/e/g' ``` just add more characters to [..] for your need.
10,207,354
I have a file containing many vowels with diacritics. I need to make these replacements: * Replace ā, á, ǎ, and à with a. * Replace ē, é, ě, and è with e. * Replace ī, í, ǐ, and ì with i. * Replace ō, ó, ǒ, and ò with o. * Replace ū, ú, ǔ, and ù with u. * Replace ǖ, ǘ, ǚ, and ǜ with ü. * Replace Ā, Á, Ǎ, and À with A....
2012/04/18
[ "https://Stackoverflow.com/questions/10207354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/834616/" ]
``` #!/bin/bash INPUT="$1" declare -a acc declare -a noa acc=('$' 'è' 'ê' 'é' 'À' 'Á' 'Â' 'Ã' 'Ä' 'Å' 'Æ' 'Ç' 'È' 'É' 'Ê' 'Ë' 'Ì' 'Í' 'Î' 'Ï' 'Ð' 'Ñ' 'Ò' 'Ó' 'Ô' 'Õ' 'Ö' 'Ø' 'Ù' 'Ú' 'Û' 'Ü' 'Ý' 'ß' 'à' 'á' 'â' 'ã' 'ä' 'å' 'æ' 'ç' 'è' 'é' 'ê' 'ë' 'ì' 'í' 'î' 'ï' 'ñ' 'ò' 'ó' 'ô' 'õ' 'ö' 'ø' 'ù' 'ú' 'û' 'ü' 'ý' 'ÿ' 'Ā'...
If you, like me, need to replace the accents just in some special places of your file text, you can do that using this kind of regex ``` echo '{"doNotReplaceKey":"bábögêjírù","replaceValueKey":"bábögêjírù","anotherNotReplaceKey":"bábögêjírù"}' \ | sed -e ':a;s/replaceValueKey":"\([a-zA-Z0-9 -_]*\)[áâàãä]/replaceVa...