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
596,929
I'm curious to see how popular the alternatives to C are in the embedded developer world e.g. Ada... I've only ever used C (with a little bit of assembler), but then my targets have very limited resources. Is there a move else where in this space to something else? What is winning the ware in set top boxes? If !C wha...
2009/02/27
[ "https://Stackoverflow.com/questions/596929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/67494/" ]
[Forth](http://Forth.Org/) is quite popular for embedded development. Also, while [Smalltalk](http://Smalltalk.Org/) is probably not popular in the embedded community, [embedded development](http://Smalltalk.Org/versions/OOVM.html) is definitely popular in the Smalltalk community.
Considering how many times I've had a Java out-of-memory exception on my phone(most of the time I do anything remotely interesting), I'd run away from Java like a bat out of a hot place. I've heard that Erlang was designed for use for cell phones. I think Lisp is a good architecture for remote device support- if the d...
596,929
I'm curious to see how popular the alternatives to C are in the embedded developer world e.g. Ada... I've only ever used C (with a little bit of assembler), but then my targets have very limited resources. Is there a move else where in this space to something else? What is winning the ware in set top boxes? If !C wha...
2009/02/27
[ "https://Stackoverflow.com/questions/596929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/67494/" ]
[Forth](http://Forth.Org/) is quite popular for embedded development. Also, while [Smalltalk](http://Smalltalk.Org/) is probably not popular in the embedded community, [embedded development](http://Smalltalk.Org/versions/OOVM.html) is definitely popular in the Smalltalk community.
Depends on the microcontroller, many of them have C but the compilers are horribly, assembler is usually easy and the best performing, most efficient, etc. Ones like the msp, avr, and arm are good for C compilers and for those I would and do use C (depending on the problem). I would stick to C or assembler, you are wa...
596,929
I'm curious to see how popular the alternatives to C are in the embedded developer world e.g. Ada... I've only ever used C (with a little bit of assembler), but then my targets have very limited resources. Is there a move else where in this space to something else? What is winning the ware in set top boxes? If !C wha...
2009/02/27
[ "https://Stackoverflow.com/questions/596929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/67494/" ]
Yes. Java is becoming more popular - many processors have added instructions that pertain primarily to Java and similar languages (.net). Also, uclinux runs on microcontrollers, so you can use practically any language for some of the larger micros. Basic is still common, as is assembly. You'll see Ada in certain gov'...
There is a [Pascal](http://turbo51.com/) compiler for 8051
55,021,980
I'm pretty new to WPF so I've been struggling with some basic concepts. My application consists out of a main window containing various tabs. The first tab is used to add files, activating the other tabs which operate on the given files. For simplicity, let's call the latter "DataTabs". I'm not sure about how to corr...
2019/03/06
[ "https://Stackoverflow.com/questions/55021980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1719355/" ]
I used the following DAX based on the link recommended by Ryan.B ``` IF ( ISFILTERED ( AgentTable[EmployeeID] ), CALCULATE([STDEVP.1_Duration],ALL(AgentTable[EmployeeID])) - SUM(Duration), IF ( ISFILTERED ( AgentTable[TeamID] ), CALCULATE([STDEVP.1_Duration],ALL(AgentTable[TeamID]))- SUM(Dur...
Yes basically we use ISFILTERED for such requirements. However, sometimes your total line might be wrong or empty, in that case you can add HASONEFILTER to detect total line and calucte it differently Also you might need to have different number formats for each level, in that case you can add FORMAT function. Yet b...
12,403
What is the range of possible results of a chess game? I am asking this question, because I am developing an XML schema for recording chess games; sort of like an XML version of PGN, and I need a way to classify and record the game result. The list of possible results that I came up with: 1. Win for white, by virtue...
2015/09/22
[ "https://chess.stackexchange.com/questions/12403", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/8324/" ]
First thing that comes to mind is Draw by mutual insufficient mating material As far as I'm aware, that doesn't fall under any of your categories. I'll add more if I think of them. Edit: White wins because black runs out of time, and the converse Draw because black ran out of time and white has insufficient ma...
15. White wins on time 16. Black wins on time 17. In progress (often seen in PGN)
12,403
What is the range of possible results of a chess game? I am asking this question, because I am developing an XML schema for recording chess games; sort of like an XML version of PGN, and I need a way to classify and record the game result. The list of possible results that I came up with: 1. Win for white, by virtue...
2015/09/22
[ "https://chess.stackexchange.com/questions/12403", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/8324/" ]
In addition to the things mentioned, at least two categories are missing in my opinion. The first one is "A oversteps time when B does not have enough mating material" and the second one is "A didn't arrive at the chessboard in time and B won". Let's structure it a bit better so we make sure we don't miss anything. I ...
First thing that comes to mind is Draw by mutual insufficient mating material As far as I'm aware, that doesn't fall under any of your categories. I'll add more if I think of them. Edit: White wins because black runs out of time, and the converse Draw because black ran out of time and white has insufficient ma...
12,403
What is the range of possible results of a chess game? I am asking this question, because I am developing an XML schema for recording chess games; sort of like an XML version of PGN, and I need a way to classify and record the game result. The list of possible results that I came up with: 1. Win for white, by virtue...
2015/09/22
[ "https://chess.stackexchange.com/questions/12403", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/8324/" ]
In addition to the things mentioned, at least two categories are missing in my opinion. The first one is "A oversteps time when B does not have enough mating material" and the second one is "A didn't arrive at the chessboard in time and B won". Let's structure it a bit better so we make sure we don't miss anything. I ...
15. White wins on time 16. Black wins on time 17. In progress (often seen in PGN)
1,950
For illustrating the effects of shot noise (more precisely, emitter failure in fluorescence imaging) I am looking for a good example image. The image should ideally be easily misinterpreted, especially by non-aided human analysts, when a fair amount of shot noise is applied to it. Does anyone know of such an image?
2011/11/10
[ "https://dsp.stackexchange.com/questions/1950", "https://dsp.stackexchange.com", "https://dsp.stackexchange.com/users/3792/" ]
Would something like Figure 4 in this paper by Dumitriu, Rodriguez, and Morrison (2011) work? They imaged the spines on a neuron using six different gain settings, which produce different amounts of shot noise. One can see how the putative shape of the spine changes based on the amount of noise present. This example mi...
You can expect small-size type printed in color with low intensity contrast (say, orange letters on blue background of similar brightness) to become illegible with a lot of shot noise. Something like <http://img.ctrlv.in/4f5641aede8eb.jpg> but with much more noise.
1,950
For illustrating the effects of shot noise (more precisely, emitter failure in fluorescence imaging) I am looking for a good example image. The image should ideally be easily misinterpreted, especially by non-aided human analysts, when a fair amount of shot noise is applied to it. Does anyone know of such an image?
2011/11/10
[ "https://dsp.stackexchange.com/questions/1950", "https://dsp.stackexchange.com", "https://dsp.stackexchange.com/users/3792/" ]
Would something like Figure 4 in this paper by Dumitriu, Rodriguez, and Morrison (2011) work? They imaged the spines on a neuron using six different gain settings, which produce different amounts of shot noise. One can see how the putative shape of the spine changes based on the amount of noise present. This example mi...
Many [captcha](http://en.wikipedia.org/wiki/CAPTCHA)s, especially those mixing text and lines, are difficult to read and would become worse with added noise.
295,199
Using mathematical induction I would like to prove the following. $S\_0=1$ $S\_1=1+a,...,S\_n=\sum\_{i=0}^n a^i$ Prove that $S\_{n+1}=1+aS\_n$ where $n \ge 0$.
2013/02/05
[ "https://math.stackexchange.com/questions/295199", "https://math.stackexchange.com", "https://math.stackexchange.com/users/15283/" ]
Check that it holds for $n=1$. Fix an $n\geq 1$ and assume that $S\_n=\sum\_{i=0}^n a^i$. $$ aS\_n=a\sum\_{i=0}^n a^i=\sum\_{i=0}^n a^{i+1}=\sum\_{i=1}^{n+1}a^i. $$ Now add $1$ and conclude that $S\_{n+1}$ has the right form.
**Hint** $\ $ Below is an overview of the induction step. $$\begin{eqnarray} \rm S\_n =\, \sum\_{i\, =\, 0}^n\,a^i\ \ \Rightarrow\ \ S\_{n+1} &=&\rm\ \ S\_n\ +\ a^n \\ \\ \rm Hence\ \quad S\_{n+2} - a\, S\_{n+1} &=&\rm\ (S\_{n+1} +\color{#C00}{a^{n+2}}) - \color{#C00}a\,(S\_{n}+\color{#C00}{a^{n+1}})\\ \\ &=&\rm\ \ S...
2,727,441
I installed VS2010 pro using the web installer, but now need to install it on another machine. As this new install will require the same features as my current install, is it possible to reuse the files already downloaded? And if so, how is this achieved?
2010/04/28
[ "https://Stackoverflow.com/questions/2727441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19570/" ]
In general, installing Python (or anything directly from the source) when it is already available on your system or when there are package managers that will install it for you, is not a very good idea. I strongly advise you against installing Python manually... Mac OS X 10.6 Snow Leopard comes with Python 2.6 out of t...
Have you checked the parameters or variables make expects? There probably is a make variable you can use to override that behavior. In any case, have you tried [MacPorts](http://www.macports.org/)? It may be a better solution to what you are trying to accomplish.
2,727,441
I installed VS2010 pro using the web installer, but now need to install it on another machine. As this new install will require the same features as my current install, is it possible to reuse the files already downloaded? And if so, how is this achieved?
2010/04/28
[ "https://Stackoverflow.com/questions/2727441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19570/" ]
Doh. I've answered my own question. Recently I created a ~/.pydistutils.cfg file, for some stupid reason. I forgot to delete that file. It's contents were: [install] install\_lib = ~/Library/Python/$py\_version\_short/site-packages install\_scripts = ~/bin `make install` calls `setup.py`, and this file was over...
Have you checked the parameters or variables make expects? There probably is a make variable you can use to override that behavior. In any case, have you tried [MacPorts](http://www.macports.org/)? It may be a better solution to what you are trying to accomplish.
2,727,441
I installed VS2010 pro using the web installer, but now need to install it on another machine. As this new install will require the same features as my current install, is it possible to reuse the files already downloaded? And if so, how is this achieved?
2010/04/28
[ "https://Stackoverflow.com/questions/2727441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19570/" ]
Doh. I've answered my own question. Recently I created a ~/.pydistutils.cfg file, for some stupid reason. I forgot to delete that file. It's contents were: [install] install\_lib = ~/Library/Python/$py\_version\_short/site-packages install\_scripts = ~/bin `make install` calls `setup.py`, and this file was over...
In general, installing Python (or anything directly from the source) when it is already available on your system or when there are package managers that will install it for you, is not a very good idea. I strongly advise you against installing Python manually... Mac OS X 10.6 Snow Leopard comes with Python 2.6 out of t...
40,429,079
This bug is very recent and seemed to appear out of nowhere. The console displays the following error: VM737:1 GET <http://s3.eu-central-1.amazonaws.com/forton/http_headers_1.js> It also seems to sprout in every Wordpress admin page. I have tried to search the entire wordpress code base for the amazonaws, forton, et...
2016/11/04
[ "https://Stackoverflow.com/questions/40429079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6077185/" ]
It's Malware effect. Try to check the extentions installed in your browser. Ex. "HTTP Headers" had become malware recently.
Yes I also removed the chrome HTTP Headers extention and it went away. thank you
40,429,079
This bug is very recent and seemed to appear out of nowhere. The console displays the following error: VM737:1 GET <http://s3.eu-central-1.amazonaws.com/forton/http_headers_1.js> It also seems to sprout in every Wordpress admin page. I have tried to search the entire wordpress code base for the amazonaws, forton, et...
2016/11/04
[ "https://Stackoverflow.com/questions/40429079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6077185/" ]
It's Malware effect. Try to check the extentions installed in your browser. Ex. "HTTP Headers" had become malware recently.
I experienced the same issue. The sponsored by popup occurred twice this morning, once on a Wordpress site (on my imac) and once on a basic HTML site (on my macbook pro). In both instances I was using the Chrome browser and both computers had the HTTP Headers extension installed. I right-clicked on the popup and sele...
40,429,079
This bug is very recent and seemed to appear out of nowhere. The console displays the following error: VM737:1 GET <http://s3.eu-central-1.amazonaws.com/forton/http_headers_1.js> It also seems to sprout in every Wordpress admin page. I have tried to search the entire wordpress code base for the amazonaws, forton, et...
2016/11/04
[ "https://Stackoverflow.com/questions/40429079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6077185/" ]
Yes I also removed the chrome HTTP Headers extention and it went away. thank you
I experienced the same issue. The sponsored by popup occurred twice this morning, once on a Wordpress site (on my imac) and once on a basic HTML site (on my macbook pro). In both instances I was using the Chrome browser and both computers had the HTTP Headers extension installed. I right-clicked on the popup and sele...
67,958,197
css is not my strong point. I am trying to create two Boxes or two divs, but one of them has to be fixed in the center of the page, and the other one has to adapt, being just next to the first one. It is just to build a textField in the middle of the page (the first div), and a loading spinner (as the second div) next ...
2021/06/13
[ "https://Stackoverflow.com/questions/67958197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11148124/" ]
This seems like the simplest way to do what you need to: ``` ranges = [[1, 10],[11, 20],[21,30]] n = 17 for i, r in enumerate(ranges): if n in range(r[0], r[1]+1): print(i) break ``` Btw, for the kind of ranges you have, you can go for a more mathematical approach: ``` index = (n-1) // 10 ```
You can use `filter` combined with `next`: ``` ranges = [[1, 10],[11, 20],[21,30]] target = 17 target_range = next(filter(lambda range: range[0] < target < range[1], ranges)) ``` `target_range` will be `[11, 20]` in this case. `filter` here is responsible for excluding ranges that do not have `target` within them....
67,958,197
css is not my strong point. I am trying to create two Boxes or two divs, but one of them has to be fixed in the center of the page, and the other one has to adapt, being just next to the first one. It is just to build a textField in the middle of the page (the first div), and a loading spinner (as the second div) next ...
2021/06/13
[ "https://Stackoverflow.com/questions/67958197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11148124/" ]
This seems like the simplest way to do what you need to: ``` ranges = [[1, 10],[11, 20],[21,30]] n = 17 for i, r in enumerate(ranges): if n in range(r[0], r[1]+1): print(i) break ``` Btw, for the kind of ranges you have, you can go for a more mathematical approach: ``` index = (n-1) // 10 ```
You could use generator expression. ``` >>> def find_index_by_range(*, collection, target): ... return next( ... (index for index, value in enumerate(collection) if target in range(*value)), ... None, ... ) ... >>> ranges = [[1, 10],[11, 20],[21,30]] >>> find_index_by_range(collection=ranges, ...
14,586,744
I am searching how to align left the text in a `AutoCompleteBox` So I details, the result is too long for the textbox associated to autocomplete box, so, there is a missing part. if the result is : "result of my autocomplete box", when I click and choose it, it's display on the textbox. But the part display is : "f...
2013/01/29
[ "https://Stackoverflow.com/questions/14586744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1439453/" ]
you should try This ``` <my:AutoCompleteBox Name="acbNames" ValueMemberBinding="{Binding FullName}"> <my:AutoCompleteBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding FullName}" TextAlignment="Left"/> </DataTemplate> </my:AutoCompleteBox.ItemTemplate> </my:AutoCompleteB...
Take a look at the following url <http://social.msdn.microsoft.com/Forums/en-US/silverlightarchieve/thread/d41d201d-834f-4f8a-8b78-122ff08dd830/> this might help.
14,586,744
I am searching how to align left the text in a `AutoCompleteBox` So I details, the result is too long for the textbox associated to autocomplete box, so, there is a missing part. if the result is : "result of my autocomplete box", when I click and choose it, it's display on the textbox. But the part display is : "f...
2013/01/29
[ "https://Stackoverflow.com/questions/14586744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1439453/" ]
Please use setter property of AutoCompleteBox to set text alignment like follow: ``` <toolkit:AutoCompleteBox.TextBoxStyle> <Style TargetType="TextBox"> <Setter Property="TextAlignment" Value="Center"></Setter> </Style> </toolkit:AutoCompleteBox.TextBoxStyle> ``` Thanks...
Take a look at the following url <http://social.msdn.microsoft.com/Forums/en-US/silverlightarchieve/thread/d41d201d-834f-4f8a-8b78-122ff08dd830/> this might help.
14,586,744
I am searching how to align left the text in a `AutoCompleteBox` So I details, the result is too long for the textbox associated to autocomplete box, so, there is a missing part. if the result is : "result of my autocomplete box", when I click and choose it, it's display on the textbox. But the part display is : "f...
2013/01/29
[ "https://Stackoverflow.com/questions/14586744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1439453/" ]
you should try This ``` <my:AutoCompleteBox Name="acbNames" ValueMemberBinding="{Binding FullName}"> <my:AutoCompleteBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding FullName}" TextAlignment="Left"/> </DataTemplate> </my:AutoCompleteBox.ItemTemplate> </my:AutoCompleteB...
Please use setter property of AutoCompleteBox to set text alignment like follow: ``` <toolkit:AutoCompleteBox.TextBoxStyle> <Style TargetType="TextBox"> <Setter Property="TextAlignment" Value="Center"></Setter> </Style> </toolkit:AutoCompleteBox.TextBoxStyle> ``` Thanks...
10,346,252
I am trying to override home key and full screen the acitiy using below code. locking of home key is working fine but it unable to hide notification bar (unable to full screen the activity). ``` public class ScreenLockDemo extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO ...
2012/04/27
[ "https://Stackoverflow.com/questions/10346252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/868713/" ]
The easiest solution to set the activity as full screen is to set it in the manifest. As an example add the following to your activity section within the manifest: ``` android:theme="@android:style/Theme.NoTitleBar.Fullscreen" ``` Therefore it should look something like: ``` <application android:icon="@drawable...
Try this code before setContentView(xml) ``` getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().requestFeature(Window.FEATURE_NO_TITLE); ``` Hope, this will work for you.
10,346,252
I am trying to override home key and full screen the acitiy using below code. locking of home key is working fine but it unable to hide notification bar (unable to full screen the activity). ``` public class ScreenLockDemo extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO ...
2012/04/27
[ "https://Stackoverflow.com/questions/10346252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/868713/" ]
Solve Problem using below code ``` @Override public void onAttachedToWindow() { // TODO Auto-generated method stub super.onAttachedToWindow(); handler.postDelayed(mUpdateUiMsg, 100); //this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); } public boolean onKeyDown(int keyCod...
Try this code before setContentView(xml) ``` getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().requestFeature(Window.FEATURE_NO_TITLE); ``` Hope, this will work for you.
10,346,252
I am trying to override home key and full screen the acitiy using below code. locking of home key is working fine but it unable to hide notification bar (unable to full screen the activity). ``` public class ScreenLockDemo extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO ...
2012/04/27
[ "https://Stackoverflow.com/questions/10346252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/868713/" ]
Solve Problem using below code ``` @Override public void onAttachedToWindow() { // TODO Auto-generated method stub super.onAttachedToWindow(); handler.postDelayed(mUpdateUiMsg, 100); //this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); } public boolean onKeyDown(int keyCod...
Try this code before setContentView(xml) ``` getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().requestFeature(Window.FEATURE_NO_TITLE); ``` Hope, this will work for you.
54,211,420
I'm trying to see if I can get wagtail running locally on my Android phone (aarch64) with Termux. But it uses Pillow which has a dependency for zlib. I can't seem to find zlib on package depos like apt or pkg. Do I need to compile it from source? (Still a novice with Unix, sorry.)
2019/01/16
[ "https://Stackoverflow.com/questions/54211420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1612399/" ]
zlib is [already there](https://developer.android.com/ndk/guides/stable_apis#zlib) in the NDK.
i was having the same problem. i have a note 8(samsung). just go to GitHub and install zlib from there, after that you will be avaible to install pillow.
54,211,420
I'm trying to see if I can get wagtail running locally on my Android phone (aarch64) with Termux. But it uses Pillow which has a dependency for zlib. I can't seem to find zlib on package depos like apt or pkg. Do I need to compile it from source? (Still a novice with Unix, sorry.)
2019/01/16
[ "https://Stackoverflow.com/questions/54211420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1612399/" ]
zlib is [already there](https://developer.android.com/ndk/guides/stable_apis#zlib) in the NDK.
You can fix this issue by running `termux-chroot` before running `buildozer` buildozer expecte zlib to be `/usr/include/zlib.h` but in termux it is in `$PREFIX/include/zlib.h` By running `termux-chroot`, $PREFIX will be `/usr`
54,211,420
I'm trying to see if I can get wagtail running locally on my Android phone (aarch64) with Termux. But it uses Pillow which has a dependency for zlib. I can't seem to find zlib on package depos like apt or pkg. Do I need to compile it from source? (Still a novice with Unix, sorry.)
2019/01/16
[ "https://Stackoverflow.com/questions/54211420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1612399/" ]
i was having the same problem. i have a note 8(samsung). just go to GitHub and install zlib from there, after that you will be avaible to install pillow.
You can fix this issue by running `termux-chroot` before running `buildozer` buildozer expecte zlib to be `/usr/include/zlib.h` but in termux it is in `$PREFIX/include/zlib.h` By running `termux-chroot`, $PREFIX will be `/usr`
52,842,591
I have a c#/WPF application that on some clients sites runs over RPD i.e. the application resides on the clients server and users access through terminal services sessions. The problem I'm having is that I can't prevent multiple instances of the application opening accidently. When the application is running locally o...
2018/10/16
[ "https://Stackoverflow.com/questions/52842591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6166147/" ]
In the past I've accomplished this using a [Mutex](https://learn.microsoft.com/en-us/dotnet/standard/threading/mutexes). When creating the mutex you would use the naming convention **Global\\MutexName** to handle terminal services scenarios. ``` // declare in your program private static Mutex mutex = null; bool creat...
I guess every remote connection will be from another user. You may use the following to determine who's the owner of the process: [How do I determine the owner of a process in C#?](https://stackoverflow.com/questions/777548/how-do-i-determine-the-owner-of-a-process-in-c)
2,121,473
I can not figure out why I am getting this session error... > > Warning: session\_start() > [function.session-start]: Cannot send > session cache limiter - headers > already sent (output started at > C:\webserver\htdocs\project2\labs\form-submits\index.php:2) > in > C:\webserver\htdocs\project2\labs\form-submi...
2010/01/23
[ "https://Stackoverflow.com/questions/2121473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143030/" ]
I ran into this error once when the file had a BOM (byte order marker) at the beginning. Apparently that also caused headers to be sent. However, this may have been a php bug that has been since fixed. Worth taking a look at though.. EDIT: At this point, I am thinking that session\_start() is throwing an error before ...
you probably have some whitespace at the top of index.php.. right before the <? tag, could be a space... that would cause it.. php is very finicky about that... session\_start has to be called before any output is emitted...
23,159,869
What is the ZF2 equivalent of the Request::getPathInfo() method from ZF1?
2014/04/18
[ "https://Stackoverflow.com/questions/23159869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1623579/" ]
You can get path info from the **Uri** instance easily which accesible via **Request** instance. In any controller action; ``` $path = $this->getRequest()->getUri()->getPath(); ``` For more details, look over the [Zend\Uri](https://github.com/zendframework/zf2/blob/master/library/Zend/Uri/Uri.php) and [Zend\Http\R...
``` $request = new \Zend\Http\PhpEnvironment\Request(); var_dump($request->getUri()); object(Zend\Uri\Http)[5] protected 'validHostTypes' => int 19 protected 'user' => null protected 'password' => null protected 'scheme' => string 'http' (length=4) protected 'userInfo' => null protected 'host' => string 'l...
369,507
I have a matrix $$\begin{bmatrix}1 &-1 &2\\2 &-2 &4\\0 &1 &1\end{bmatrix}$$ Its eigenvalues are $0$, $\sqrt{5}$ and $-\sqrt{5}$ (These are checked in MATLAB to be correct). I have found its eigenvectors for $0$, and also don't seem to have a problem in similar situations when the eigenvalues are not "root". But when ...
2013/04/22
[ "https://math.stackexchange.com/questions/369507", "https://math.stackexchange.com", "https://math.stackexchange.com/users/73829/" ]
The method to find an eigenvector is the same, regardless of what the eigenvalue is. The only difference between different eigenvalues is the appearance of the computation involved. For example, you will need to add, multiply, divide by real numbers like $(1-\sqrt{5})$. More details: To compute an eigenvector, you ne...
Calling your matrix $A$, the eigenvalue $\lambda$ and the eigenvector $y$, you use the fact that $(A-\lambda I)y=0$ So $$\begin{bmatrix}1-\sqrt 5 &-1 &2\\2 &-2-\sqrt 5 &4\\0 &1 &1-\sqrt 5\end{bmatrix}\begin{bmatrix}y\_1\\y\_2\\y\_3 \end{bmatrix}=\begin{bmatrix}0\\0\\0 \end{bmatrix}$$ and read off three equations in thr...
369,507
I have a matrix $$\begin{bmatrix}1 &-1 &2\\2 &-2 &4\\0 &1 &1\end{bmatrix}$$ Its eigenvalues are $0$, $\sqrt{5}$ and $-\sqrt{5}$ (These are checked in MATLAB to be correct). I have found its eigenvectors for $0$, and also don't seem to have a problem in similar situations when the eigenvalues are not "root". But when ...
2013/04/22
[ "https://math.stackexchange.com/questions/369507", "https://math.stackexchange.com", "https://math.stackexchange.com/users/73829/" ]
If you want results to compare against, you should get for $A = \begin{bmatrix}1 &-1 &2\\2 &-2 &4\\0 &1 &1\end{bmatrix}$, the following characteristic polynomial: $$5 \lambda - \lambda^3 = 0$$ This CP yields the following eigenvectors and eigenvalues: $\displaystyle \lambda\_1 = -\sqrt{5}, v\_1 = \left(\frac{1}{2} (...
Calling your matrix $A$, the eigenvalue $\lambda$ and the eigenvector $y$, you use the fact that $(A-\lambda I)y=0$ So $$\begin{bmatrix}1-\sqrt 5 &-1 &2\\2 &-2-\sqrt 5 &4\\0 &1 &1-\sqrt 5\end{bmatrix}\begin{bmatrix}y\_1\\y\_2\\y\_3 \end{bmatrix}=\begin{bmatrix}0\\0\\0 \end{bmatrix}$$ and read off three equations in thr...
65,796,892
I've been struggling to find the right regex (Python) to cover my requirement: I want to split a string according to the first place in which there are 6 digits. For example - ``` stringA = 'abcdf123456789' ``` Will ideally be cut into - ``` StringB='abcdf123456' StringC='789' ``` So far - This is the solution ...
2021/01/19
[ "https://Stackoverflow.com/questions/65796892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2568434/" ]
``` import re stringA = 'abcdf123456789' result = re.split("(?<=[0-9]{6})",stringA,maxsplit=1) print(result) # ['abcdf123456', '789'] ```
``` import re stringA = 'abcdf123456789' index = re.search(r'\d{6}', stringA).end() stringB = stringA[:index] stringC = stringA[index:] ```
65,796,892
I've been struggling to find the right regex (Python) to cover my requirement: I want to split a string according to the first place in which there are 6 digits. For example - ``` stringA = 'abcdf123456789' ``` Will ideally be cut into - ``` StringB='abcdf123456' StringC='789' ``` So far - This is the solution ...
2021/01/19
[ "https://Stackoverflow.com/questions/65796892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2568434/" ]
``` import re stringA = 'abcdf123456789' result = re.split("(?<=[0-9]{6})",stringA,maxsplit=1) print(result) # ['abcdf123456', '789'] ```
You can just use the `findall()` and `groups aka '()'` and simply finds the things you need! ``` import re stringA = 'abcdf123456789' pattern = r"([\D]*\d{6})(.*)" result = re.findall(pattern, stringA) print(result) #output [('abcdf123456', '789')] ```
65,796,892
I've been struggling to find the right regex (Python) to cover my requirement: I want to split a string according to the first place in which there are 6 digits. For example - ``` stringA = 'abcdf123456789' ``` Will ideally be cut into - ``` StringB='abcdf123456' StringC='789' ``` So far - This is the solution ...
2021/01/19
[ "https://Stackoverflow.com/questions/65796892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2568434/" ]
You may use this code with 2 capture groups: ```sh >>> import re >>> stringA = 'abcdf123456789' >>> [(stringB,stringC)] = re.findall(r'(.*?\d{6})(.*)', stringA) >>> print (stringB) abcdf123456 >>> print (stringC) 789 ```
``` import re stringA = 'abcdf123456789' index = re.search(r'\d{6}', stringA).end() stringB = stringA[:index] stringC = stringA[index:] ```
65,796,892
I've been struggling to find the right regex (Python) to cover my requirement: I want to split a string according to the first place in which there are 6 digits. For example - ``` stringA = 'abcdf123456789' ``` Will ideally be cut into - ``` StringB='abcdf123456' StringC='789' ``` So far - This is the solution ...
2021/01/19
[ "https://Stackoverflow.com/questions/65796892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2568434/" ]
You may use this code with 2 capture groups: ```sh >>> import re >>> stringA = 'abcdf123456789' >>> [(stringB,stringC)] = re.findall(r'(.*?\d{6})(.*)', stringA) >>> print (stringB) abcdf123456 >>> print (stringC) 789 ```
You can just use the `findall()` and `groups aka '()'` and simply finds the things you need! ``` import re stringA = 'abcdf123456789' pattern = r"([\D]*\d{6})(.*)" result = re.findall(pattern, stringA) print(result) #output [('abcdf123456', '789')] ```
65,796,892
I've been struggling to find the right regex (Python) to cover my requirement: I want to split a string according to the first place in which there are 6 digits. For example - ``` stringA = 'abcdf123456789' ``` Will ideally be cut into - ``` StringB='abcdf123456' StringC='789' ``` So far - This is the solution ...
2021/01/19
[ "https://Stackoverflow.com/questions/65796892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2568434/" ]
Using a lookbehind: ``` >>> stringA = 'abcdf123456789' >>> re.split(r'(?<=\d{6})', stringA, maxsplit=1) ['abcdf123456', '789'] ``` [Demo and explanation of the regex](https://regex101.com/r/qW3Wij/1)
You can just use the `findall()` and `groups aka '()'` and simply finds the things you need! ``` import re stringA = 'abcdf123456789' pattern = r"([\D]*\d{6})(.*)" result = re.findall(pattern, stringA) print(result) #output [('abcdf123456', '789')] ```
65,796,892
I've been struggling to find the right regex (Python) to cover my requirement: I want to split a string according to the first place in which there are 6 digits. For example - ``` stringA = 'abcdf123456789' ``` Will ideally be cut into - ``` StringB='abcdf123456' StringC='789' ``` So far - This is the solution ...
2021/01/19
[ "https://Stackoverflow.com/questions/65796892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2568434/" ]
You may use this code with 2 capture groups: ```sh >>> import re >>> stringA = 'abcdf123456789' >>> [(stringB,stringC)] = re.findall(r'(.*?\d{6})(.*)', stringA) >>> print (stringB) abcdf123456 >>> print (stringC) 789 ```
You can split on 6 digits with `maxsplit=1`, and capture the group you split on, then you can build your strings easily: ``` import re stringA = 'abcdf123456789' split = re.split(r'(\d{6})', stringA, maxsplit=1) # split is now ['abcdf', '123456', '789'] stringB = ''.join(split[:2]) stringC = split[2] print(stringB) ...
65,796,892
I've been struggling to find the right regex (Python) to cover my requirement: I want to split a string according to the first place in which there are 6 digits. For example - ``` stringA = 'abcdf123456789' ``` Will ideally be cut into - ``` StringB='abcdf123456' StringC='789' ``` So far - This is the solution ...
2021/01/19
[ "https://Stackoverflow.com/questions/65796892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2568434/" ]
``` import re stringA = 'abcdf123456789' result = re.split("(?<=[0-9]{6})",stringA,maxsplit=1) print(result) # ['abcdf123456', '789'] ```
You can split on 6 digits with `maxsplit=1`, and capture the group you split on, then you can build your strings easily: ``` import re stringA = 'abcdf123456789' split = re.split(r'(\d{6})', stringA, maxsplit=1) # split is now ['abcdf', '123456', '789'] stringB = ''.join(split[:2]) stringC = split[2] print(stringB) ...
65,796,892
I've been struggling to find the right regex (Python) to cover my requirement: I want to split a string according to the first place in which there are 6 digits. For example - ``` stringA = 'abcdf123456789' ``` Will ideally be cut into - ``` StringB='abcdf123456' StringC='789' ``` So far - This is the solution ...
2021/01/19
[ "https://Stackoverflow.com/questions/65796892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2568434/" ]
You can split on 6 digits with `maxsplit=1`, and capture the group you split on, then you can build your strings easily: ``` import re stringA = 'abcdf123456789' split = re.split(r'(\d{6})', stringA, maxsplit=1) # split is now ['abcdf', '123456', '789'] stringB = ''.join(split[:2]) stringC = split[2] print(stringB) ...
``` import re stringA = 'abcdf123456789' index = re.search(r'\d{6}', stringA).end() stringB = stringA[:index] stringC = stringA[index:] ```
65,796,892
I've been struggling to find the right regex (Python) to cover my requirement: I want to split a string according to the first place in which there are 6 digits. For example - ``` stringA = 'abcdf123456789' ``` Will ideally be cut into - ``` StringB='abcdf123456' StringC='789' ``` So far - This is the solution ...
2021/01/19
[ "https://Stackoverflow.com/questions/65796892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2568434/" ]
Using a lookbehind: ``` >>> stringA = 'abcdf123456789' >>> re.split(r'(?<=\d{6})', stringA, maxsplit=1) ['abcdf123456', '789'] ``` [Demo and explanation of the regex](https://regex101.com/r/qW3Wij/1)
``` import re stringA = 'abcdf123456789' index = re.search(r'\d{6}', stringA).end() stringB = stringA[:index] stringC = stringA[index:] ```
65,796,892
I've been struggling to find the right regex (Python) to cover my requirement: I want to split a string according to the first place in which there are 6 digits. For example - ``` stringA = 'abcdf123456789' ``` Will ideally be cut into - ``` StringB='abcdf123456' StringC='789' ``` So far - This is the solution ...
2021/01/19
[ "https://Stackoverflow.com/questions/65796892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2568434/" ]
You can split on 6 digits with `maxsplit=1`, and capture the group you split on, then you can build your strings easily: ``` import re stringA = 'abcdf123456789' split = re.split(r'(\d{6})', stringA, maxsplit=1) # split is now ['abcdf', '123456', '789'] stringB = ''.join(split[:2]) stringC = split[2] print(stringB) ...
You can just use the `findall()` and `groups aka '()'` and simply finds the things you need! ``` import re stringA = 'abcdf123456789' pattern = r"([\D]*\d{6})(.*)" result = re.findall(pattern, stringA) print(result) #output [('abcdf123456', '789')] ```
305,971
Can using a bare domain as server address (i.e. using *example.com* not *www.example.com*) make DNS based load balancing harder in some manner? Load balancing examples: * [Round robin DNS load balancing](http://www.zytrax.com/books/dns/ch9/rr.html#services). * [Split Horizon DNS Server](http://www.zytrax.com/books/d...
2011/08/29
[ "https://serverfault.com/questions/305971", "https://serverfault.com", "https://serverfault.com/users/44112/" ]
If you want (or need) to avoid backup/restore this is what I would recommend (these steps assuming you don't want to maintain the old schema NAME, just the structure) - Download [opendbdiff](https://github.com/OpenDBDiff/OpenDBDiff). Choose 'Compare' between source and (empty) destination. Choose sync. script tab and ...
If you use [SQL Data Compare](http://www.red-gate.com/products/sql-development/sql-data-compare/), your identity columns will be maintained. This really is the best way to keep DB's synced up perfectly and it comes highly recommended by the Stackoverflow founders. It is generally a losing battle to try to use the bu...
18,214
Can we have a product X which gets both a copyright & a patent? I'm particularly interested in the case of Software since its content overlaps with both Copyright & Patent. But someone told me that the same subject matter cannot be protected under different IPRs (Copyright & Patent). So, Pure Software is protected by...
2017/04/05
[ "https://law.stackexchange.com/questions/18214", "https://law.stackexchange.com", "https://law.stackexchange.com/users/322/" ]
There is no prohibition of overlapping coverage in IPRs in the TRIPS agreement. There is no direct mention of an overlap between patents and copyright in the TRIPS agreement. This is not surprising, since patent–copyright overlap is rather an edge case: outside of a very small subset of software patents, there is no p...
The same material can be the subject of different IP protection. Patents, copyright, trade marks and registered designs all have areas of overlap.
56,693,942
How to produce `hegellogo wogorld` from `hello world` with list comprehension? My attempt is not complete as follows. ``` ["g"+x for x in "hello world" if (x=="a" or x=="i" or x=="u" or x=="e" or x=="o")] ``` It produces `["ge","go","go"]` instead of `hegellogo wogorld` Note: I am only interested in list comprehe...
2019/06/20
[ "https://Stackoverflow.com/questions/56693942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397524/" ]
The if clause in the comprehension is filtering it. We instead want a ternary on whether each character is a vowel or not. We also need to join the resulting characters back together. ``` phrase = "hello world" vowels = "aeiou" ''.join(char + "g" + char if char in vowels else char for char in phrase) ```
For each character `ch`, you want your result to include either `ch + 'g' + ch` (if `ch` is a vowel) OTHERWISE just `ch`. You can express that as ``` (ch + 'g' + ch) if ch in "aeiou" else ch ``` So you need something like: ``` ''.join([(ch + 'g' + ch) if ch in "aeiou" else ch for ch in "hello world"]) ```
56,693,942
How to produce `hegellogo wogorld` from `hello world` with list comprehension? My attempt is not complete as follows. ``` ["g"+x for x in "hello world" if (x=="a" or x=="i" or x=="u" or x=="e" or x=="o")] ``` It produces `["ge","go","go"]` instead of `hegellogo wogorld` Note: I am only interested in list comprehe...
2019/06/20
[ "https://Stackoverflow.com/questions/56693942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397524/" ]
The if clause in the comprehension is filtering it. We instead want a ternary on whether each character is a vowel or not. We also need to join the resulting characters back together. ``` phrase = "hello world" vowels = "aeiou" ''.join(char + "g" + char if char in vowels else char for char in phrase) ```
Your code looks okay to me. An else part is missing and thats what results in unexpected stdout. ``` x = "hello world" y = "".join(["g"+a if a in ['a','e','i','o','u'] else a for a in x]) y --> 'hgellgo wgorld' ```
56,693,942
How to produce `hegellogo wogorld` from `hello world` with list comprehension? My attempt is not complete as follows. ``` ["g"+x for x in "hello world" if (x=="a" or x=="i" or x=="u" or x=="e" or x=="o")] ``` It produces `["ge","go","go"]` instead of `hegellogo wogorld` Note: I am only interested in list comprehe...
2019/06/20
[ "https://Stackoverflow.com/questions/56693942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397524/" ]
For each character `ch`, you want your result to include either `ch + 'g' + ch` (if `ch` is a vowel) OTHERWISE just `ch`. You can express that as ``` (ch + 'g' + ch) if ch in "aeiou" else ch ``` So you need something like: ``` ''.join([(ch + 'g' + ch) if ch in "aeiou" else ch for ch in "hello world"]) ```
Your code looks okay to me. An else part is missing and thats what results in unexpected stdout. ``` x = "hello world" y = "".join(["g"+a if a in ['a','e','i','o','u'] else a for a in x]) y --> 'hgellgo wgorld' ```
258,819
I know this is a very low level question, but I honestly can't remember how this is done. I want to solve for y with this: $$ x = 2.0 \cdot \arctan\left(\frac{\sqrt{y}}{\sqrt{1 - y}}\right) $$ And I thought I could do this: $$ \frac{\sqrt{y}}{\sqrt{1 - y}} = \tan\left(\frac{x}{2.0}\right) $$ But it seems like I've don...
2012/12/14
[ "https://math.stackexchange.com/questions/258819", "https://math.stackexchange.com", "https://math.stackexchange.com/users/53112/" ]
So, since Henry told me that I wasn't wrong, I continued and got a really simple answer. Thanks! ``` x = 2 * arctan(sqrt(y)/sqrt(1 - y)) sqrt(y)/sqrt(1 - y) = tan(x/2) 1/(sqrt(1 - y) * sqrt(1/y)) = tan(x/2) 1/tan(x/2) = sqrt(1/y - 1) 1/(tan(x/2))^2 + 1 = 1/y y = (tan(x/2))^2/((tan(x/2))^2 + 1) ``` Thanks again to He...
Two hints: * `sqrt(y)/sqrt(1 - y) = 1/sqrt(1/y - 1)` i.e. $\dfrac{\sqrt{y}}{\sqrt{1 - y}} = \dfrac{1}{\sqrt{1/y - 1}}$ if $y \not = 0$ * `(tan(x/2))^2 = (1-cos(x))/(1+cos(x))` i.e. $\tan^2\left(\dfrac{x}{2}\right) = \dfrac{1-\cos(x)}{1+\cos(x)}$ if $\cos(x) \not = -1$
44,450,178
I am new in python.I am doing addition of two numbers in cmd using input parameter .I am getting output on cmd but getting Error on python shell.I am using windows 7 and python shell 3.3.2 . so anyone can tell me why my code is not running on python shell ? code: ``` import sys n=int(sys.argv[1]) m=int(sys.argv[2]) p...
2017/06/09
[ "https://Stackoverflow.com/questions/44450178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
See the [jQuery documentation on `ajax`](https://api.jquery.com/jQuery.ajax/): > > > ``` > jqXHR.then( > function( data, textStatus, jqXHR ) {}, > function( jqXHR, textStatus, errorThrown ) {} > ); > > ``` > > Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) th...
You should change the signature of your fail function to be `function( jqXHR, textStatus, errorThrown )` Then check the values of those last 2 arguments.
12,370,633
I'm trying to pass a URL parameter from a JSP to a Sevlet. My URL is ``` /portal/faces/student.jsp?owner_id=1030303i ``` In my JSP i added this ``` <form action="steg" method="post" enctype="multipart/form-data"> <input type='text' value='<%=request.getParameter("owner_id")%>' id="owner"/> <input type="fi...
2012/09/11
[ "https://Stackoverflow.com/questions/12370633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1651129/" ]
There are 2 problems in your code: 1. You didn't give the input field a name. You expected that the `id` attribute of the input element is been used as request parameter name. But this is not true. It's the `name` attribute. ``` <input type="text" name="owner" value="${fn:escapeXml(param.owner_id)}" /> ``` *(note: ...
What version of servlets are you using? > > `multipart/form-data` encoded requests are indeed not by default supported by the Servlet API prior to version 3.0. The Servlet API parses the parameters by default using `application/x-www-form-urlencoded` encoding. When using a different encoding, the `request.getParamete...
12,370,633
I'm trying to pass a URL parameter from a JSP to a Sevlet. My URL is ``` /portal/faces/student.jsp?owner_id=1030303i ``` In my JSP i added this ``` <form action="steg" method="post" enctype="multipart/form-data"> <input type='text' value='<%=request.getParameter("owner_id")%>' id="owner"/> <input type="fi...
2012/09/11
[ "https://Stackoverflow.com/questions/12370633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1651129/" ]
There are 2 problems in your code: 1. You didn't give the input field a name. You expected that the `id` attribute of the input element is been used as request parameter name. But this is not true. It's the `name` attribute. ``` <input type="text" name="owner" value="${fn:escapeXml(param.owner_id)}" /> ``` *(note: ...
`sendRedirect()` method wont carry the request object forward. Instead use `RequestDispatcher rd = request.getRequestDispatcher("yourpage.jsp");rd.forward(req, res)` method which forwards the request object and so the request parameters.
41,877,789
Can someone tell me how can I slowdown the sprites appearance to create a more smooth animation? When I run the code it appears the last (27th) sprite in the JPanel. The animation processing is too fast! Someone told me about Swing Timer, but unfortunately I tried several times with that and I couldn't put the code to...
2017/01/26
[ "https://Stackoverflow.com/questions/41877789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7474585/" ]
1. First of all you have a lot of white spaces between each line, it makes it hard to read the code. 2. Yes, you could try using a Swing [`Timer`](https://docs.oracle.com/javase/8/docs/api/javax/swing/Timer.html), here is an [example](https://stackoverflow.com/questions/34746795/creating-an-animated-4x4-grid-in-java/34...
I have changed some sprite sheet coords because I could find a similar image, but it should give you the idea: ``` import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.Timer; import java.util.Timer...
8,626
I would like to trigger a GitlabCI pipeline that builds a Packer image, whenever there is a new version of a binary released in Github. How could I do that via the ci yaml configuration? Should I somehow use the API for [pipeline triggering](https://docs.gitlab.com/ee/ci/triggers/README.html)?
2019/07/16
[ "https://devops.stackexchange.com/questions/8626", "https://devops.stackexchange.com", "https://devops.stackexchange.com/users/9344/" ]
Checkout this solution with codepipeline. <https://aws.amazon.com/blogs/big-data/implement-continuous-integration-and-delivery-of-serverless-aws-glue-etl-applications-using-aws-developer-tools/>
If you are unit testing, you should be mocking external dependencies like Spark and AWS Glue. Look into Python mocking frameworks like [unittest.mock](https://docs.python.org/3/library/unittest.mock.html), [monkeypatch](https://docs.pytest.org/en/2.9.2/monkeypatch.html) and [pytest-mock](https://pypi.org/project/pytest...
55,277,524
I have a list containing several other lists. I would like to count how often one element occurs in all of these lists. For example: ``` my_list_of_lists=[[1,2,3,4],[1,2],[],[2,3,5]] ``` the output could be something like: ``` 1: 2 2: 3 3: 2 4: 1 5: 1 ``` A specific element only occurs ones per single list. Som...
2019/03/21
[ "https://Stackoverflow.com/questions/55277524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10720989/" ]
``` >>> from collections import Counter >>> ct = Counter([jtem for item in a for jtem in item]) >>> ct Counter({2: 3, 1: 2, 3: 2, 4: 1, 5: 1}) ``` OR ``` >>> from itertools import chain >>> from collections import Counter >>> >>> ct = Counter(chain.from_iterable(a)) >>> ct Counter({2: 3, 1: 2, 3: 2, 4: 1, 5: 1}) `...
``` d={} #l is the given list for l1 in l: #l1 is nested list for j in l1: #j is element if j in d.keys(): d[j]+=1 else: d[j]=1 ``` You have a dict d with elements as keys and value as count of elements.
55,277,524
I have a list containing several other lists. I would like to count how often one element occurs in all of these lists. For example: ``` my_list_of_lists=[[1,2,3,4],[1,2],[],[2,3,5]] ``` the output could be something like: ``` 1: 2 2: 3 3: 2 4: 1 5: 1 ``` A specific element only occurs ones per single list. Som...
2019/03/21
[ "https://Stackoverflow.com/questions/55277524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10720989/" ]
``` >>> from collections import Counter >>> ct = Counter([jtem for item in a for jtem in item]) >>> ct Counter({2: 3, 1: 2, 3: 2, 4: 1, 5: 1}) ``` OR ``` >>> from itertools import chain >>> from collections import Counter >>> >>> ct = Counter(chain.from_iterable(a)) >>> ct Counter({2: 3, 1: 2, 3: 2, 4: 1, 5: 1}) `...
For completeness you could use numpy for this as well: ``` import numpy as np my_list_of_lists=[[1,2,3,4],[1,2],[],[2,3,5]] np_array_of_arrays = np.concatenate([np.array(i) for i in my_list_of_lists]) d = dict(zip(*np.unique(np_array_of_arrays , return_counts=True))) print(d) {1.0: 2, 2.0: 3, 3.0: 2, 4.0: 1, 5.0: 1}...
55,277,524
I have a list containing several other lists. I would like to count how often one element occurs in all of these lists. For example: ``` my_list_of_lists=[[1,2,3,4],[1,2],[],[2,3,5]] ``` the output could be something like: ``` 1: 2 2: 3 3: 2 4: 1 5: 1 ``` A specific element only occurs ones per single list. Som...
2019/03/21
[ "https://Stackoverflow.com/questions/55277524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10720989/" ]
``` >>> from collections import Counter >>> ct = Counter([jtem for item in a for jtem in item]) >>> ct Counter({2: 3, 1: 2, 3: 2, 4: 1, 5: 1}) ``` OR ``` >>> from itertools import chain >>> from collections import Counter >>> >>> ct = Counter(chain.from_iterable(a)) >>> ct Counter({2: 3, 1: 2, 3: 2, 4: 1, 5: 1}) `...
using [Monoid](https://en.wikipedia.org/wiki/Monoid#Monoids_in_computer_science) ``` from collections import Counter Counter(sum(my_list_of_lists, [])) ```
55,277,524
I have a list containing several other lists. I would like to count how often one element occurs in all of these lists. For example: ``` my_list_of_lists=[[1,2,3,4],[1,2],[],[2,3,5]] ``` the output could be something like: ``` 1: 2 2: 3 3: 2 4: 1 5: 1 ``` A specific element only occurs ones per single list. Som...
2019/03/21
[ "https://Stackoverflow.com/questions/55277524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10720989/" ]
``` >>> from collections import Counter >>> ct = Counter([jtem for item in a for jtem in item]) >>> ct Counter({2: 3, 1: 2, 3: 2, 4: 1, 5: 1}) ``` OR ``` >>> from itertools import chain >>> from collections import Counter >>> >>> ct = Counter(chain.from_iterable(a)) >>> ct Counter({2: 3, 1: 2, 3: 2, 4: 1, 5: 1}) `...
Firstly you should flatten your `list` of `list`s so it would become, just `list`, you could do it following way: ``` data = [[1,2,3,4],[1,2],[],[2,3,5]] flat = sum(data,[]) ``` Now `flat` is `[1, 2, 3, 4, 1, 2, 2, 3, 5]`, now we can get unique elements: ``` uniq = list(set(flat)) ``` Finally we can get number of...
55,277,524
I have a list containing several other lists. I would like to count how often one element occurs in all of these lists. For example: ``` my_list_of_lists=[[1,2,3,4],[1,2],[],[2,3,5]] ``` the output could be something like: ``` 1: 2 2: 3 3: 2 4: 1 5: 1 ``` A specific element only occurs ones per single list. Som...
2019/03/21
[ "https://Stackoverflow.com/questions/55277524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10720989/" ]
using [Monoid](https://en.wikipedia.org/wiki/Monoid#Monoids_in_computer_science) ``` from collections import Counter Counter(sum(my_list_of_lists, [])) ```
``` d={} #l is the given list for l1 in l: #l1 is nested list for j in l1: #j is element if j in d.keys(): d[j]+=1 else: d[j]=1 ``` You have a dict d with elements as keys and value as count of elements.
55,277,524
I have a list containing several other lists. I would like to count how often one element occurs in all of these lists. For example: ``` my_list_of_lists=[[1,2,3,4],[1,2],[],[2,3,5]] ``` the output could be something like: ``` 1: 2 2: 3 3: 2 4: 1 5: 1 ``` A specific element only occurs ones per single list. Som...
2019/03/21
[ "https://Stackoverflow.com/questions/55277524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10720989/" ]
using [Monoid](https://en.wikipedia.org/wiki/Monoid#Monoids_in_computer_science) ``` from collections import Counter Counter(sum(my_list_of_lists, [])) ```
For completeness you could use numpy for this as well: ``` import numpy as np my_list_of_lists=[[1,2,3,4],[1,2],[],[2,3,5]] np_array_of_arrays = np.concatenate([np.array(i) for i in my_list_of_lists]) d = dict(zip(*np.unique(np_array_of_arrays , return_counts=True))) print(d) {1.0: 2, 2.0: 3, 3.0: 2, 4.0: 1, 5.0: 1}...
55,277,524
I have a list containing several other lists. I would like to count how often one element occurs in all of these lists. For example: ``` my_list_of_lists=[[1,2,3,4],[1,2],[],[2,3,5]] ``` the output could be something like: ``` 1: 2 2: 3 3: 2 4: 1 5: 1 ``` A specific element only occurs ones per single list. Som...
2019/03/21
[ "https://Stackoverflow.com/questions/55277524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10720989/" ]
using [Monoid](https://en.wikipedia.org/wiki/Monoid#Monoids_in_computer_science) ``` from collections import Counter Counter(sum(my_list_of_lists, [])) ```
Firstly you should flatten your `list` of `list`s so it would become, just `list`, you could do it following way: ``` data = [[1,2,3,4],[1,2],[],[2,3,5]] flat = sum(data,[]) ``` Now `flat` is `[1, 2, 3, 4, 1, 2, 2, 3, 5]`, now we can get unique elements: ``` uniq = list(set(flat)) ``` Finally we can get number of...
3,591,965
I am using Jquery to hide show a div. I want to show the div when '.microblogpostwrapper' is hovered and hidden when not hovered. Got the first bit done but can't get it to hide when not hovered. ``` $(".microblogpostwrapper").hover(function(){ $(this).find(".microblogpostactions").show(); ...
2010/08/28
[ "https://Stackoverflow.com/questions/3591965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342391/" ]
The [`.hover()`](http://api.jquery.com/hover/) handler will fire once for `mouseenter` and once for `mouseleave`. ``` $(".microblogpostwrapper").hover(function(){ $(this).find(".microblogpostactions").toggle(); // Toggle the show/hide }); ``` You can ensure the proper toggle is performed by passing a boolean va...
jQuery's `.hover()` [binds two handlers](http://api.jquery.com/hover/), one for 'in' and another for 'out.' The following should achieve what you want (although it might be worth assigning the element you're manipulating to a variable for a slight speed improvement): ``` $(".microblogpostwrapper").hover( function(...
3,591,965
I am using Jquery to hide show a div. I want to show the div when '.microblogpostwrapper' is hovered and hidden when not hovered. Got the first bit done but can't get it to hide when not hovered. ``` $(".microblogpostwrapper").hover(function(){ $(this).find(".microblogpostactions").show(); ...
2010/08/28
[ "https://Stackoverflow.com/questions/3591965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342391/" ]
The [`.hover()`](http://api.jquery.com/hover/) handler will fire once for `mouseenter` and once for `mouseleave`. ``` $(".microblogpostwrapper").hover(function(){ $(this).find(".microblogpostactions").toggle(); // Toggle the show/hide }); ``` You can ensure the proper toggle is performed by passing a boolean va...
u can use mouseenter/mouseleave to stop bubbling (re-calling hover while mouse moving)::: ``` $(".microblogpostwrapper").mouseenter(function() { $(this).find(".microblogpostactions").show(); }).mouseleave(function() { $(this).find(".microblogpostactions").hide(); });​ ```
54,247,360
I am trying to run my Protractor test on a remote server (selenium grid). I have Jenkin job to execute commands. When I run the exact test on my local server, the browser (both Firefox and Chrome works) get starts and load the URL and complete the tests. But when I execute via Jenkins it starts the browser but does not...
2019/01/18
[ "https://Stackoverflow.com/questions/54247360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8267843/" ]
I managed to solve this issue removing 'disable-infobars' in the chromeOptions. But not sure why `'chromeOptions': { 'args': ['disable-infobars'] }`
Check with the below code ``` capabilities: { browserName: 'chrome', directConnect: true //Hope by adding this your problem gets resolved } ``` Remove `seleniumAddress` from your config.
20,641,399
I'm using absolute positioning to have `100% height` of the screen. I also want to limit the `resizing` of my page so I add `min-width` in my header and content divs. The problem I'm facing is that once resizing reaches the min-width boundary, right side `margin disappears`. Any suggestions how to make it work? HTML: ...
2013/12/17
[ "https://Stackoverflow.com/questions/20641399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1289775/" ]
I found a solution my self. The problem is that if you apply `min-width` on the element which has `padding` or `margin`, that padding or margin collapses when you resize the window. So the solution was to wrap that element inside root element and **set min-width on the root element.** P.S. I also tried box-sizing appr...
You can use the [CSS box-sizing property](http://www.paulirish.com/2012/box-sizing-border-box-ftw/) to accomplish this in modern browsers (IE8+)
650,489
Case 1: 1. I start a connection to the DB 2. I BEGIN a TRANSACTION 3. I close the connection What happens to the transaction? Case 2: 1. I start a connection to the DB 2. I BEGIN a TRANSACTION 3. I start a concurrent connection to the same DB 4. With the second connection I modify the contents of a table 5. With th...
2009/03/16
[ "https://Stackoverflow.com/questions/650489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
Case 1: roll back Case 2: at step 4, you can't modify rows which are touched by the first connection so there's no effect: the second connection can't modify, it will wait (due to the locks).
Just to add: Transactions are session dependent - this explains your first question.
19,434,779
So I'm working on a Wordpress site with Bootstrap. I'm using Bootstrap's navbar for the menu integrated with WP. I have my homepage as a link in the navbar as "home". Instead of "Home" as a text I want a glyphicon to appear and not text. I think I could use CSS for that... something like this: ``` #menu-item-55 { ...
2013/10/17
[ "https://Stackoverflow.com/questions/19434779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077232/" ]
I figured that I can do it by adding a custom link and putting the inside the navigation label. I still would like another way to do it. :D Cheers
1. Navigate to Appearance > Menus 2. Find the menu item that you want to add an icon to 3. Expand the menu item 4. Inside the Navigation Item you will want to add your icon code either before or after or in place of your existing menu item label. For this example I’m going to use the home icon. Here’s what you would ty...
19,434,779
So I'm working on a Wordpress site with Bootstrap. I'm using Bootstrap's navbar for the menu integrated with WP. I have my homepage as a link in the navbar as "home". Instead of "Home" as a text I want a glyphicon to appear and not text. I think I could use CSS for that... something like this: ``` #menu-item-55 { ...
2013/10/17
[ "https://Stackoverflow.com/questions/19434779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077232/" ]
If you are using the wordpress 3+ wp\_nav\_menu with your theme adding this snippet to the `functions.php` will add a glyphicon-home link of bootstrap to your navigation. ``` function addHomeMenuLink($menuItems, $args) { if('header_menu' == $args->theme_location) // make sure to give the right theme location for t...
1. Navigate to Appearance > Menus 2. Find the menu item that you want to add an icon to 3. Expand the menu item 4. Inside the Navigation Item you will want to add your icon code either before or after or in place of your existing menu item label. For this example I’m going to use the home icon. Here’s what you would ty...
23,672
How can I make myself more productive with the SVN CLI? I need to complete repetitive tasks like these: * find modified files in directory * commit only SOME of them + selecting them somehow other then remembering their names * list unversioned files + add only some using some efective way other then remembering the...
2011/10/31
[ "https://unix.stackexchange.com/questions/23672", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/11974/" ]
This is an optional feature, that is not always desired - especially in scripts. Consider following drawbacks in case of scripts: * The fact that directory already exists is not reported: If a script is supposed to put some files in a newly created directory and that directory already exists and contains files, the sc...
I think, this is kinda philosophy. The bare *mkdir(1)* command (without options) represents the *mkdir(2)* system call, providing its functionality in shell, doing nothing more or less.
23,672
How can I make myself more productive with the SVN CLI? I need to complete repetitive tasks like these: * find modified files in directory * commit only SOME of them + selecting them somehow other then remembering their names * list unversioned files + add only some using some efective way other then remembering the...
2011/10/31
[ "https://unix.stackexchange.com/questions/23672", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/11974/" ]
This is an optional feature, that is not always desired - especially in scripts. Consider following drawbacks in case of scripts: * The fact that directory already exists is not reported: If a script is supposed to put some files in a newly created directory and that directory already exists and contains files, the sc...
In the [beginning](http://man.cat-v.org/unix-1st/1/mkdir), there was only the bare `mkdir` command. In accordance with Unix's design principles, this simple command performed one simple task: creating a directory. Later, `mkdir` acquired a `-p` option to handle a common use case where the caller wants to create zero, ...
23,672
How can I make myself more productive with the SVN CLI? I need to complete repetitive tasks like these: * find modified files in directory * commit only SOME of them + selecting them somehow other then remembering their names * list unversioned files + add only some using some efective way other then remembering the...
2011/10/31
[ "https://unix.stackexchange.com/questions/23672", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/11974/" ]
This is an optional feature, that is not always desired - especially in scripts. Consider following drawbacks in case of scripts: * The fact that directory already exists is not reported: If a script is supposed to put some files in a newly created directory and that directory already exists and contains files, the sc...
To me, the issue is that the behavior of the -p option if it were the default is essentially a side effect. It adds complexity to a command by doing something additional to what you asked it to do. It's one more invisible thing to have to remember. One of the basic rules of sound programming practice is to avoid side e...
23,672
How can I make myself more productive with the SVN CLI? I need to complete repetitive tasks like these: * find modified files in directory * commit only SOME of them + selecting them somehow other then remembering their names * list unversioned files + add only some using some efective way other then remembering the...
2011/10/31
[ "https://unix.stackexchange.com/questions/23672", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/11974/" ]
Of course one could argue that parent directory creation should be the default and some check option could be used to prevent the directory creation if the parent does not exist. But the reason why it is the other way around is just history. The basic version of *mkdir* did not create parent directories. This is why t...
I think, this is kinda philosophy. The bare *mkdir(1)* command (without options) represents the *mkdir(2)* system call, providing its functionality in shell, doing nothing more or less.
23,672
How can I make myself more productive with the SVN CLI? I need to complete repetitive tasks like these: * find modified files in directory * commit only SOME of them + selecting them somehow other then remembering their names * list unversioned files + add only some using some efective way other then remembering the...
2011/10/31
[ "https://unix.stackexchange.com/questions/23672", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/11974/" ]
Of course one could argue that parent directory creation should be the default and some check option could be used to prevent the directory creation if the parent does not exist. But the reason why it is the other way around is just history. The basic version of *mkdir* did not create parent directories. This is why t...
In the [beginning](http://man.cat-v.org/unix-1st/1/mkdir), there was only the bare `mkdir` command. In accordance with Unix's design principles, this simple command performed one simple task: creating a directory. Later, `mkdir` acquired a `-p` option to handle a common use case where the caller wants to create zero, ...
23,672
How can I make myself more productive with the SVN CLI? I need to complete repetitive tasks like these: * find modified files in directory * commit only SOME of them + selecting them somehow other then remembering their names * list unversioned files + add only some using some efective way other then remembering the...
2011/10/31
[ "https://unix.stackexchange.com/questions/23672", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/11974/" ]
Of course one could argue that parent directory creation should be the default and some check option could be used to prevent the directory creation if the parent does not exist. But the reason why it is the other way around is just history. The basic version of *mkdir* did not create parent directories. This is why t...
To me, the issue is that the behavior of the -p option if it were the default is essentially a side effect. It adds complexity to a command by doing something additional to what you asked it to do. It's one more invisible thing to have to remember. One of the basic rules of sound programming practice is to avoid side e...
8,914,172
Basically, I want to print out a string of values in a single line, in Python2 a statement like this one would suffice: ``` print x, ``` How to write the same simple statement in Python3 (i.e., without using any special formatting) ?
2012/01/18
[ "https://Stackoverflow.com/questions/8914172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/313127/" ]
``` >>> print(1, end=' '); print(2) 1 2 ``` For further enlightenment: ``` >>> help(print) ```
In Python 3.x you would say: ``` print(x, end='') ``` Not sure what you mean by 'special formatting'.
8,914,172
Basically, I want to print out a string of values in a single line, in Python2 a statement like this one would suffice: ``` print x, ``` How to write the same simple statement in Python3 (i.e., without using any special formatting) ?
2012/01/18
[ "https://Stackoverflow.com/questions/8914172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/313127/" ]
``` >>> print(1, end=' '); print(2) 1 2 ``` For further enlightenment: ``` >>> help(print) ```
Here is an explanation from the following site: <http://docs.python.org/release/3.0.1/whatsnew/3.0.html> See the section called "Print Is A Function." > > Old: print x, # Trailing comma suppresses newline > > > New: print(x, end=" ") # Appends a space instead of a newline > > >
8,914,172
Basically, I want to print out a string of values in a single line, in Python2 a statement like this one would suffice: ``` print x, ``` How to write the same simple statement in Python3 (i.e., without using any special formatting) ?
2012/01/18
[ "https://Stackoverflow.com/questions/8914172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/313127/" ]
Here is an explanation from the following site: <http://docs.python.org/release/3.0.1/whatsnew/3.0.html> See the section called "Print Is A Function." > > Old: print x, # Trailing comma suppresses newline > > > New: print(x, end=" ") # Appends a space instead of a newline > > >
In Python 3.x you would say: ``` print(x, end='') ``` Not sure what you mean by 'special formatting'.
16,221,030
I'm relatively a beginner in programming in C and am getting super confused with arrays and pointers. Basically what I'm trying to do is extend a string that contains binary to the designated length `len;` (i.e. len=8 for `num[]=101` would produce `"00000101"`). Can someone help me understand what's wrong with this?...
2013/04/25
[ "https://Stackoverflow.com/questions/16221030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1366929/" ]
Your problems start with your specification. If I understand you correctly, you want to have a function where you pass an array of characters and a length. The size of your array of input characters will be between 1 and `len`? However, your function has no way of knowing what the size of your array `num` is. If you wa...
this is wrong. ``` strcat("0", &number); ``` A weird way to fix you code would be this: ``` char temp[32] = {}; ... ... while(difference>0) { strncat(temp, "0", 31 - strlen(temp)); difference--; } strncat(temp, num, 31 - strlen(temp)); strncpy(num...
16,221,030
I'm relatively a beginner in programming in C and am getting super confused with arrays and pointers. Basically what I'm trying to do is extend a string that contains binary to the designated length `len;` (i.e. len=8 for `num[]=101` would produce `"00000101"`). Can someone help me understand what's wrong with this?...
2013/04/25
[ "https://Stackoverflow.com/questions/16221030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1366929/" ]
Your problems start with your specification. If I understand you correctly, you want to have a function where you pass an array of characters and a length. The size of your array of input characters will be between 1 and `len`? However, your function has no way of knowing what the size of your array `num` is. If you wa...
How do you set up num? If it's really an array of characters rather than a string, there's no requirement that it be null terminated, unless it's a global/static. If you set it up like so in a function: ``` char str[10]; str[0] = '1'; str[1] = '0'; str[2] = '1'; ``` than your strlen will get whatever, depending upon...
16,221,030
I'm relatively a beginner in programming in C and am getting super confused with arrays and pointers. Basically what I'm trying to do is extend a string that contains binary to the designated length `len;` (i.e. len=8 for `num[]=101` would produce `"00000101"`). Can someone help me understand what's wrong with this?...
2013/04/25
[ "https://Stackoverflow.com/questions/16221030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1366929/" ]
Your problems start with your specification. If I understand you correctly, you want to have a function where you pass an array of characters and a length. The size of your array of input characters will be between 1 and `len`? However, your function has no way of knowing what the size of your array `num` is. If you wa...
``` #include <stdio.h> #include <stdlib.h> #include <string.h> //case 1: for num[9]="101"; char *extendBinary1(char num[], int len) { int num_len = strlen(num); memmove(num + (len - num_len), num, num_len); memset(num, '0', (len - num_len)); return num; } //case 2: for "101";//pointer to const char ...
73,698,374
My intention is to format the name `key` in an existing Map value. Supposed the current `key` value is in `UpperCase` but I wanted to make it `LowerCase` From this ```dart Map<String, String> foo = { "A" : "valueOne", "B" : "valueTwo", }; print(foo); // output: {"A" : "valueOne", "B" : "valueTwo"} ``...
2022/09/13
[ "https://Stackoverflow.com/questions/73698374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10758321/" ]
First of all, you cannot *change* a key, you have to remove the old key and add a new key instead. You can then choose to either update the existing map, or build a new one. Creating a new one is simpler: ```dart var newMap = {for (var e in oldMap.entries) e.key.toLowerCase() : e.value}; ``` We ignore the risk of ...
I found the answer already. ```dart Map<String, String> foo = { "A": "valueOne", "B": "valueTwo", }; Map<String, dynamic> bar = {}; foo.keys.toList().forEach((key) { bar.addAll({key.toString().toLowerCase(): foo[key]}); }); print(bar); } ```
137,993
Where in the Panels "add content" list can I find the "add to cart" button? So far I can only add it via node / node content = ![enter image description here](https://i.stack.imgur.com/vE6lt.png) but this prints node title + body text + add to cart as opposed to just add to cart - here is the node content panel wi...
2014/11/25
[ "https://drupal.stackexchange.com/questions/137993", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/11375/" ]
The "Add to Cart Form" is not available directly from Panels. You need to create a view to load the Add to Cart Form and then display that view in the panel. When creating the view you have total control over what you want to display or not display. Panels is a way to put other Drupal content constructs together, firs...
I spent a lot of time figuring out how to create an ad to cart button in my custom panel node of product, but finally I have found a simple way. 1. I am not using teaser view of nodes, I use views and panels everywhere. So I configure the teaser view of node - so I hid everything except the price field. 2. In panels m...
137,993
Where in the Panels "add content" list can I find the "add to cart" button? So far I can only add it via node / node content = ![enter image description here](https://i.stack.imgur.com/vE6lt.png) but this prints node title + body text + add to cart as opposed to just add to cart - here is the node content panel wi...
2014/11/25
[ "https://drupal.stackexchange.com/questions/137993", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/11375/" ]
The "Add to Cart Form" is not available directly from Panels. You need to create a view to load the Add to Cart Form and then display that view in the panel. When creating the view you have total control over what you want to display or not display. Panels is a way to put other Drupal content constructs together, firs...
You need to show the Product reference field (in the "node" section) and use the formatter as "Add to cart" form.
137,993
Where in the Panels "add content" list can I find the "add to cart" button? So far I can only add it via node / node content = ![enter image description here](https://i.stack.imgur.com/vE6lt.png) but this prints node title + body text + add to cart as opposed to just add to cart - here is the node content panel wi...
2014/11/25
[ "https://drupal.stackexchange.com/questions/137993", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/11375/" ]
You need to show the Product reference field (in the "node" section) and use the formatter as "Add to cart" form.
I spent a lot of time figuring out how to create an ad to cart button in my custom panel node of product, but finally I have found a simple way. 1. I am not using teaser view of nodes, I use views and panels everywhere. So I configure the teaser view of node - so I hid everything except the price field. 2. In panels m...
28,399,335
I have an error on a script I have wrote since few months, it worked very good with a raspberry pi, but now with an orange pi I have this: ``` >>> import paramiko >>> transport = paramiko.Transport("192.168.2.2", 22) >>> transport.connect(username = "orangepi", password = "my_pass") Traceback (most recent call last): ...
2015/02/08
[ "https://Stackoverflow.com/questions/28399335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3314648/" ]
You should check if any of those MACs algorithms are available on your SSH server (sshd\_config, key: MACs) : * HMAC-SHA1 * HMAC-MD5 * HMAC-SHA1-96 * HMAC-MD5-96. They are **needed** in order for Paramiko to connect to your SSH server.
On your **remote** server, edit `/etc/ssh/sshd_config` and **add a `MACs` line or append to the existing one**, with one or more of `hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96` (values are comma-separated), for example: ``` MACs hmac-sha1 ``` Now **restart sshd**: `sudo systemctl restart ssh`.
28,399,335
I have an error on a script I have wrote since few months, it worked very good with a raspberry pi, but now with an orange pi I have this: ``` >>> import paramiko >>> transport = paramiko.Transport("192.168.2.2", 22) >>> transport.connect(username = "orangepi", password = "my_pass") Traceback (most recent call last): ...
2015/02/08
[ "https://Stackoverflow.com/questions/28399335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3314648/" ]
You should check if any of those MACs algorithms are available on your SSH server (sshd\_config, key: MACs) : * HMAC-SHA1 * HMAC-MD5 * HMAC-SHA1-96 * HMAC-MD5-96. They are **needed** in order for Paramiko to connect to your SSH server.
If the above solutions do not work, you need to upgrade Paramiko as found out by this [answer](https://stackoverflow.com/questions/36561792/paramiko-incompatible-ssh-server-no-acceptable-macs).
28,399,335
I have an error on a script I have wrote since few months, it worked very good with a raspberry pi, but now with an orange pi I have this: ``` >>> import paramiko >>> transport = paramiko.Transport("192.168.2.2", 22) >>> transport.connect(username = "orangepi", password = "my_pass") Traceback (most recent call last): ...
2015/02/08
[ "https://Stackoverflow.com/questions/28399335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3314648/" ]
On your **remote** server, edit `/etc/ssh/sshd_config` and **add a `MACs` line or append to the existing one**, with one or more of `hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96` (values are comma-separated), for example: ``` MACs hmac-sha1 ``` Now **restart sshd**: `sudo systemctl restart ssh`.
If the above solutions do not work, you need to upgrade Paramiko as found out by this [answer](https://stackoverflow.com/questions/36561792/paramiko-incompatible-ssh-server-no-acceptable-macs).
15,246,106
Please see below query: ``` Update Employee Set AccountManagerId = a.AM_ID FROM Employee e INNER JOIN AccountManager a on e.Id = a.Id WHERE ``` \*\*Struggling to construct below part (which needs to be added to the where clause)\*\* ``` If a.Department is not null then [FOLLOWING NEEDS TO BE ADDED TO WHERE CLAUSE] ...
2013/03/06
[ "https://Stackoverflow.com/questions/15246106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1426339/" ]
It means that your given host name `' '` is invalid (gai stands for `getaddrinfo()`). As NPE already states, maybe an empty string `''` would be more appropriate than a space `' '`.
The ``` HOST = ' ' ``` should read ``` HOST = '' ``` (i.e. no space between the quotes). The reason you're getting the error is that `' '` is not a valid hostname. In this context, `''` has a special meaning (it basically means "all local addresses").
39,304,610
I am working on large dataset, I need to optimize the query. I have a view abc\_view. Below query view is used 4 times. So every time view is executed, it contains complex logic. How can I build the query that view will execute only one time. ``` Select * from TableA a join abc_view v on(a.col1=v.line) whe...
2016/09/03
[ "https://Stackoverflow.com/questions/39304610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3715328/" ]
It is possible that a single reference to the view would improve performance, but not guaranteed. In standard SQL, you could do: ``` Select * from TableA a join abc_view v on (a.col1 = v.line and v.type = 'abc' ) or (a.col1 = v.group and v.type = 'bcd' ) or (a.col1 = v.cat and v.type = 'cde' ...
Try this hope it will perform well ``` SELECT * FROM TableA a JOIN abc_view v ON a.col1 IN (v.line, v.group, v.cat, v.test) AND v.type IN ('abc', 'bcd', 'cde', 'def') ``` and index on a.col1 and all four of view (v.line, v.group, v.cat, v.test)
20,276,598
I have an array ``` ar= [2, 3, 45 , 5556, 6, 'empty', 4] ``` I'd like to normalize this array in order to plot it later. ``` 0:2 1:3 2:45 3: 5556 4: 6 5: 0 # not "empty" anymore 6: 4 newAr = {if (ar[i] != 'empty') ar[i] : i for i in range(len(ar)) else: ar[i] = 0 } ``` I tried this way, How can I nor...
2013/11/29
[ "https://Stackoverflow.com/questions/20276598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3047512/" ]
This works: ``` ar = [2, 3, 45, 5556, 6, 'empty', 4] new_ar = [0 if x == 'empty' else x for x in ar] ``` yields: ``` [2, 3, 45, 5556, 6, 0, 4] ``` I used the Python [ternary operator](https://stackoverflow.com/questions/394809/ternary-conditional-operator-in-python) at the *front* of the list comprehension, inste...
``` In [91]: ar = [2, 3, 45, 5556, 6, 'empty', 4] In [92]: [i if not isinstance(i, str) else 0 for i in ar] Out[92]: [2, 3, 45, 5556, 6, 0, 4] ``` OR ``` In [93]: [i if i!='empty' else 0 for i in ar] Out[93]: [2, 3, 45, 5556, 6, 0, 4] ``` Based on your updated post, this should handle the appropriate removal of d...
68,062,752
I am attempting to modify Apple's code from the Landmarks tutorial to load JSON data from a remote URL. The url is a php script which returns plaintext JSON data. Apple's code: ``` func loadLocalJSON<T: Decodable>(_ filename: String) -> T { let data: Data guard let file = Bundle.main.url(forResource: filenam...
2021/06/21
[ "https://Stackoverflow.com/questions/68062752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15194351/" ]
You need a completion block instead of a return type. You are doing the async task. `URLSession.shared.dataTask` is async type. ``` func loadRemoteJSON<T: Decodable>(_ urlString: String, completion: @escaping ((T) -> Void)) { let data: Data guard let url = URL(string: urlString) else { fatalError("In...
``` func loadRemoteJSON<T: Decodable>(_ urlString: String,completion: @escaping (T)->Void) ``` Using the completion block is simple, just decode the JSON and pass it into your completion handler. ``` let decodedJSON = try decoder.decode(T.self, from: data) completion(decodedJSON) ``` Now, when you call `loadRemote...
64,227,040
let assume that we have a vector of points written as a flat sequence of integers. size of vector is precise and we want to convert it to vector of `Point` structs. So my conversion currently looks like this. ```rust #[derive(Debug)] struct Point { x: i32, y: i32, } impl Point { fn new(x: i32, y : i32) -> ...
2020/10/06
[ "https://Stackoverflow.com/questions/64227040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1856291/" ]
It is easy to do in std for slices using [chunks\_exact](https://doc.rust-lang.org/std/primitive.slice.html#method.chunks_exact). ```rust #[derive(Debug)] struct Point { x: i32, y: i32, z: i32, } impl Point { fn new(x: i32, y : i32, z: i32) -> Point { Point{x,y, z} } } fn main() { let ...
I don't think there is a pre-done method for it, but you can easily write code that can be adjusted pretty quickly to include a third `z` component, similar to this ([Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4848c770c35eaee2e88c6dbaa9b40c80)): ```rust #[derive(Debug, Default)...
40,350,515
How can a separate loop affect the performance of an independent earlier loop? My first loop reads some large text files and counts the lines/rows. After a malloc, the second loop populates the allocated matrix. If the second loop is commented out, the first loop takes 1.5 sec. However, compiling WITH the second l...
2016/10/31
[ "https://Stackoverflow.com/questions/40350515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7096852/" ]
My theory: Allocating and touching all that memory evicts the big files from disk cache, so the next run has to read them from disk. If you ran the version without loop2 a couple times to warm up the disk cache, then run a version *with* loop2, I predict it will be fast the first time, but slow for further runs witho...
From [THIS PAGE](http://www.gnu.org/software/libc/manual/html_node/Opening-and-Closing-Files.html): "The function close closes the file descriptor filedes. Closing a file has the following consequences: The file descriptor is deallocated. Any record locks owned by the process on the file are unlocked. When all file d...
7,549
In Yoshinkan aikido, the tegatana looks as follows. [![enter image description here](https://i.stack.imgur.com/phPJT.jpg)](https://i.stack.imgur.com/phPJT.jpg) The fingers are spread and we feel relaxed. But in Shodokan aikido, the teganta looks as follows. [![enter image description here](https://i.stack.imgur.com...
2017/06/02
[ "https://martialarts.stackexchange.com/questions/7549", "https://martialarts.stackexchange.com", "https://martialarts.stackexchange.com/users/7701/" ]
I apologize if I'm not exactly answering your question, as I can't speak directly to Yoshinkan or Shodokan: I am not a part of either organization. However, I am a Hapkido-in, and who practices the equivalent tegatana as Yoshinkan; and I am an Aikido-ka with Aikikai, whose practice of tegatana is similar in Shodokan a...
Yoshinkan ========= Gozo Shioda describes (in *Total Aikido*, page 31): > > Open up the fingers of the hand. […] The fingers of both hands should be pointing at the base of your partner's throat. Beginners tend to need strength in order to keep the fingers open, but keep practising until it becomes natural. > > >...
7,549
In Yoshinkan aikido, the tegatana looks as follows. [![enter image description here](https://i.stack.imgur.com/phPJT.jpg)](https://i.stack.imgur.com/phPJT.jpg) The fingers are spread and we feel relaxed. But in Shodokan aikido, the teganta looks as follows. [![enter image description here](https://i.stack.imgur.com...
2017/06/02
[ "https://martialarts.stackexchange.com/questions/7549", "https://martialarts.stackexchange.com", "https://martialarts.stackexchange.com/users/7701/" ]
I apologize if I'm not exactly answering your question, as I can't speak directly to Yoshinkan or Shodokan: I am not a part of either organization. However, I am a Hapkido-in, and who practices the equivalent tegatana as Yoshinkan; and I am an Aikido-ka with Aikikai, whose practice of tegatana is similar in Shodokan a...
Anatomically you have to think about what you are doing with that hand and arm. If you open the hand the wrist expands and is harder to hold onto (for someone grabbing the wrist) In Shorinji Kempo we call the principle of making your wrist hard to hold and bracing 'shuho' (kagite shuho, katate shuho and so on dependi...
7,549
In Yoshinkan aikido, the tegatana looks as follows. [![enter image description here](https://i.stack.imgur.com/phPJT.jpg)](https://i.stack.imgur.com/phPJT.jpg) The fingers are spread and we feel relaxed. But in Shodokan aikido, the teganta looks as follows. [![enter image description here](https://i.stack.imgur.com...
2017/06/02
[ "https://martialarts.stackexchange.com/questions/7549", "https://martialarts.stackexchange.com", "https://martialarts.stackexchange.com/users/7701/" ]
Yoshinkan ========= Gozo Shioda describes (in *Total Aikido*, page 31): > > Open up the fingers of the hand. […] The fingers of both hands should be pointing at the base of your partner's throat. Beginners tend to need strength in order to keep the fingers open, but keep practising until it becomes natural. > > >...
Anatomically you have to think about what you are doing with that hand and arm. If you open the hand the wrist expands and is harder to hold onto (for someone grabbing the wrist) In Shorinji Kempo we call the principle of making your wrist hard to hold and bracing 'shuho' (kagite shuho, katate shuho and so on dependi...
269,105
I am trying to implement a ***Left shift/ Right Shift on arrays***. I was able to accomplish this using double loops. Can the efficiency be improved? This is the working code for LeftShift/RightShift which is using 2 nested loops. ``` #include <iostream> #include <stdlib.h> #include <stdio.h> struct Array { in...
2021/10/18
[ "https://codereview.stackexchange.com/questions/269105", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/231559/" ]
The code doesn't check if `n` is within the expected boundaries of the array. Unintentional overwriting of memory is such an infamous concern in C/C++, even in toy code I would add the range check to build good habits, or at the very least document in a comment that the caller is assumed to be trusted.
The fastest way is to use `memmove()` and `memset()`, because as library routines they should be optimal. But if you can't do that for whatever reason, your best speed-up is from moving to using pointers. Looping over arrays with indexing is *never* optimal speed-wise (although it has obvious advantages for code readab...
269,105
I am trying to implement a ***Left shift/ Right Shift on arrays***. I was able to accomplish this using double loops. Can the efficiency be improved? This is the working code for LeftShift/RightShift which is using 2 nested loops. ``` #include <iostream> #include <stdlib.h> #include <stdio.h> struct Array { in...
2021/10/18
[ "https://codereview.stackexchange.com/questions/269105", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/231559/" ]
Why do you have the following line if you are not using `temp`? ```c int temp = arr->A[0]; ``` You do not need the nested loops. You are currently shifting the elements one position at a time when you can move them `n` positions. ```c void LeftShift1(struct Array* arr, unsigned int n) { for (unsigned int i = 0;...
> > > ``` > #include <iostream> > #include <stdlib.h> > #include <stdio.h> > > ``` > > If this is C, don't attempt to include `<iostream>`. If it's C++, use the C++ headers (`<cstdlib>` etc), and prefer `<iostream>` to `<stdio.h>`. There's almost never any need for an *implementation* file to be bilingual C and C...
269,105
I am trying to implement a ***Left shift/ Right Shift on arrays***. I was able to accomplish this using double loops. Can the efficiency be improved? This is the working code for LeftShift/RightShift which is using 2 nested loops. ``` #include <iostream> #include <stdlib.h> #include <stdio.h> struct Array { in...
2021/10/18
[ "https://codereview.stackexchange.com/questions/269105", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/231559/" ]
You can use `memmove()` function to move overlapping areas of memory and `memset()` to clear the moved items. LeftShift can be implemented like: ```c #include <string.h> void LeftShift(struct Array *arr, int n) //n is the number of shifts { memmove(&arr->A[0], &arr->A[n], (arr->size-n)*sizeof(arr->A[0])); ...
The code doesn't check if `n` is within the expected boundaries of the array. Unintentional overwriting of memory is such an infamous concern in C/C++, even in toy code I would add the range check to build good habits, or at the very least document in a comment that the caller is assumed to be trusted.
269,105
I am trying to implement a ***Left shift/ Right Shift on arrays***. I was able to accomplish this using double loops. Can the efficiency be improved? This is the working code for LeftShift/RightShift which is using 2 nested loops. ``` #include <iostream> #include <stdlib.h> #include <stdio.h> struct Array { in...
2021/10/18
[ "https://codereview.stackexchange.com/questions/269105", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/231559/" ]
Why do you have the following line if you are not using `temp`? ```c int temp = arr->A[0]; ``` You do not need the nested loops. You are currently shifting the elements one position at a time when you can move them `n` positions. ```c void LeftShift1(struct Array* arr, unsigned int n) { for (unsigned int i = 0;...
The fastest way is to use `memmove()` and `memset()`, because as library routines they should be optimal. But if you can't do that for whatever reason, your best speed-up is from moving to using pointers. Looping over arrays with indexing is *never* optimal speed-wise (although it has obvious advantages for code readab...
269,105
I am trying to implement a ***Left shift/ Right Shift on arrays***. I was able to accomplish this using double loops. Can the efficiency be improved? This is the working code for LeftShift/RightShift which is using 2 nested loops. ``` #include <iostream> #include <stdlib.h> #include <stdio.h> struct Array { in...
2021/10/18
[ "https://codereview.stackexchange.com/questions/269105", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/231559/" ]
Why do you have the following line if you are not using `temp`? ```c int temp = arr->A[0]; ``` You do not need the nested loops. You are currently shifting the elements one position at a time when you can move them `n` positions. ```c void LeftShift1(struct Array* arr, unsigned int n) { for (unsigned int i = 0;...
You know, C and C++ are different languages. You used both tags, and your code is confused as to which it wants to be. It appears to use C syntax, library calls, and ways of doing things; but it includes a C++ header. It doesn't seem to use that header though. Maybe this is the current state of the file after you have ...