qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
42,564,910
I have series of ~10 queries to be executed every hour automatically in Redshift (maybe report success/failure). Most queries are aggregation on my tables. I have tried using AWS Lambda with [CloudWatch Events](http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html), but Lambda functions only ...
2017/03/02
[ "https://Stackoverflow.com/questions/42564910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3713955/" ]
It's kind of strange that AWS doesn't provide a simple distributed cron style service. It would be useful for so many things. There is [SWF](https://aws.amazon.com/swf/), but the timing/scheduling aspect is left up to the user. You could use Lambda/Cloudwatch to trigger SWF events. That's a lot of overhead to get reaso...
use aws lambda to run your script. you can schedule it. see <https://docs.aws.amazon.com/lambda/latest/dg/with-scheduled-events.html> this uses CloudWatch events behind the scenes. If you do it from the console, it will set things up for you.
41,116,613
I have a popup model where user add the course name. I have added a form validation in my codeigniter controller and then if the validation is false, I am loading my view again with a form error showing above form input in the model, but due to page reload the model closes. What I want is if the form validation is fals...
2016/12/13
[ "https://Stackoverflow.com/questions/41116613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7289695/" ]
[The answer by Eran](https://stackoverflow.com/a/41117159/1421925) is definitely the straightforward way of performing the search. However, I would like to propose a slightly different approach: ``` private static final Map<String, Runnable> stringToRunnable = new HashMap<>(); { stringToRunnable.put("a", this::doSo...
You can use `anyMatch` to find the first element matching one of your conditions and terminate. Use side effects for calling the processing methods : ``` boolean found = names.stream() .anyMatch (name -> { if (name.equals(a)) { doSomething(); return tr...
6,431,281
I am developing a chrome extension. I open an image file in canvas, I apply some changes to it, then I am trying to save it to the HTML5 filesystem api. First I get the dataURL from the canvas: ``` var dataURL = canvas.toDataURL('image/png;base64'); ``` Then just the data: ``` var image64 = dataURL.repl...
2011/06/21
[ "https://Stackoverflow.com/questions/6431281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/809181/" ]
I've found a function that converts a data URL to a blob. Great for when you need to save a canvas image to the sandboxed FileSystem. Works in Chrome 13. ``` function dataURItoBlob(dataURI, callback) { // convert base64 to raw binary data held in a string // doesn't handle URLEncoded DataURIs var byteStri...
I had been wondering the same thing and had a look at finding an answer. From what I can tell you have to convert the raw string you get from an atob to an unit8array and then you can append it to a blob. Here's an example that converts an image to a canvas and then the data from the canvas to a blob and then the...
1,004,696
A perl script I'm writing needs to parse a file that has continuation lines like a Makefile. i.e. lines that begin with whitespace are part of the previous line. I wrote the code below but don't feel like it is very clean or perl-ish (heck, it doesn't even use "redo"!) There are many edge cases: EOF at odd places, si...
2009/06/17
[ "https://Stackoverflow.com/questions/1004696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/71978/" ]
How about slurping the whole file into memory and processing it using regular expressions. Much more 'perlish'. This passes your tests and is *much* smaller and neater: ``` #!/usr/bin/perl use strict; use warnings; $/ = undef; # we want no input record separator. my $file = <>; # slurp whole fil...
If you don't mind loading the entire file in memory, then the code below passes the tests. It stores the lines in an array, adding each line either to the previous one (continuation) or at the end of the array (other). ``` #!/usr/bin/perl use strict; use warnings; my @out; while( <>) { chomp; s{#.*}{}; ...
275,956
I have to find in a folder the files not having certain permissions (755). The sub-directory has other sub-directories containing in total millions of files, and the `find ./ -not -perm 755` command it just takes too long. Is there a more efficient / faster command to do this task ( like ls combined with grep or so )...
2016/04/12
[ "https://unix.stackexchange.com/questions/275956", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/137578/" ]
If your intent is to make all the files and directories have 755 permissions, you could simply perform a recursive chmod: ``` chmod -R 755 $directory ``` If you need files to be mode 644, you might be better with ``` chmod -R u=rwX,go=rw $directory ``` This will use a single process to find the necessary files an...
If you have mlocate installed it makes this easier, but only if you know part of the file name. Also, unless you make permission changes to the mlocate.db file it requires root. When installed a cron job should run periodically to update the mlocate database, or you can run updatedb to do it manually. Once there use t...
55,860
Is there a program available for Vista, that allows me to set up a folder as an SFTP connection to a remote server? The use case is to have a folder on my desktop, where I can drag/drop/edit files and have my remote location be updated automatically. I've googled this to no avail. Thanks!
2009/10/15
[ "https://superuser.com/questions/55860", "https://superuser.com", "https://superuser.com/users/7868/" ]
DirectNet Drive is free for home use. <http://directnet-drive.net/index.php>
I might be mistaking it for FTPS (I always confuse the two), but I believe this capability is built into windows explorer. Just open a folder window and type an ftp url (including secure items) into an address bar. Something like this: ``` sftp://user:pass@ftpsite.example.com/ ``` You should be able to make a normal...
39,775,686
I am currently working with Laravel 5.2, trying to display images on click which I have currently stored in the **Storage** folder. I am trying to display these images in my blade view but every time it loads the page, it gets to an undefined variable exception. **Controller**: ``` public function createemoji($action...
2016/09/29
[ "https://Stackoverflow.com/questions/39775686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6668408/" ]
Try to change this: ``` ->with('file'->$path); ``` To this: ``` ->with('file', $path); ``` <https://laravel.com/docs/5.3/views#passing-data-to-views>
With function takes two arguments key and value You can use this ``` return redirect()->returnemoji()->with('file',$path); ```
15,907,011
I wrote a Java project using Java SE. I want the program to start when Windows starts, how can I do that ?
2013/04/09
[ "https://Stackoverflow.com/questions/15907011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2192861/" ]
It's easier in the method syntax, as you aren't constrained to the order of the operations: ``` var query = authors.OrderBy(x => x.surname) .Select(x => new { x.id_author, fullName = String.Concat(x.name, " ", x.surname) }) .Where(x => x.fullName == "Jean Paul Olvera"); ```
use the `let` clause: ``` var name = (from x in db.authors let fullName = String.Concat(x.name," ", x.surname) where fullname = "Jean Paul Olvera" orderby x.surname select new { x.id_author, fullName }); ```
4,940,867
"“Excuse me, I hope this isn’t weird or anything," How can I fix the encoding on this?
2011/02/09
[ "https://Stackoverflow.com/questions/4940867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197606/" ]
What you're running into is the result of the data being written in one encoding, and interpreted as being another. You need to make sure that you're requesting input to be in the same format that you're expecting it to be in. I recommend just sticking with UTF-8 the whole way through unless you need to avoid multibyte...
The [`iconv`](http://us.php.net/manual/en/function.iconv.php) function is generally able to deal with this sort of encoding issue.
12,387,067
I'm trying to match the second dot in a number to replace it later with a white space in my 'find and replace' function in Aptana. I tried a lot of expressions, none of them worked for me. For example I take the number: 48.454.714 (I want to replace the dot between 454 and 714)
2012/09/12
[ "https://Stackoverflow.com/questions/12387067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1098122/" ]
Try this regex: ``` (\d{3})\.(\d{3}) ``` and replace the first and second capturing group `\1 \2` as mentioned by FiveO, you might want to match other numbers of digits too. E.g. one to 3 digits: `\d{1,3}` or any number of digits: `\d+`
Try with following regex: ``` \d+\.\d+(\.)\d+ ``` And replace it with white space.
52,182,643
I have created a setup with GetStream, where i have some flat-feeds that contains data and an aggregated-feed that follows the flat-feeds. I'm now uploading data to the flat-feeds from my database, with my own timestamp added to the activity. Which make my flat-feed ordered by time. **Here is my problem:** When i'm f...
2018/09/05
[ "https://Stackoverflow.com/questions/52182643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7924849/" ]
Stream aggregated feeds are sorted by the `updated_at` field of the aggregated activity. At the moment there is no way to change this behaviour. You can sort the activity groups on the client side before presenting the data to users. Default aggregation format for aggregated feeds is `{{ verb }}_{{ time.strftime('%Y-...
Thanks for responding. My solution on this problem was to sort the lists, before i uploaded them to GetStream. *But i still see a potential issue, if i have to upload "older" items later on...*
22,574,623
I'm creating a basic page that should look like Figure 1 in this link: <http://www.w3.org/wiki/HTML_structural_elements> The only thing is, instead of text for the heading, I want to place an image. I am trying to style the image in CSS to size and center it. Right under the heading I have an ul which is my navigati...
2014/03/22
[ "https://Stackoverflow.com/questions/22574623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3427030/" ]
```html <html> <head> <title>CSS image placement</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css" media="screen"> #headline1 { background-image: url(images/newsletter_headline1.gif); background-repeat: no-...
Just make a block-level image: ``` <div id="header"> <img src="mypic.png" /> <div id="nav"></div> </div> ``` CSS: ``` img { display: block; margin: 0 auto; } ```
42,794,141
I have an array called `vel` declared inside `global.h` and defined inside `global.cpp`. When I try to use it inside a function, `get_velocities()`, of another class called `Robot` (inside `Robot.cpp`), it says: > > undefined reference to `vel' > > > Here are the three files: 1) `global.h` ``` #ifndef GLOBAL_H_I...
2017/03/14
[ "https://Stackoverflow.com/questions/42794141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4834108/" ]
I'd recommend against renaming the development.services.yml file to services.yml because that would cause all of your development code/config/settings to apply and run on production environments. Instead, use the development files as designed. Here's our standard setup: `/sites/default/settings.php` (in version contr...
You need to set the `cache` option to **true** on your `development.services.yml` file. Something like this: ``` services: cache.backend.null: class: Drupal\Core\Cache\NullBackendFactory parameters: twig.config: debug: true auto_reload: true cache: true ``` After you clear your cache and open som...
963,822
I want to determine a branch of logarithm such that $f(z)=L(z^3-2)$ is analytic at $0$. I am not really sure how to find a branch but I will explain few things I tried. Since $z^3-2$ maps $0$ onto $-2$, what needs to be done is to find a branch of logarithm which is analytic at $-2$.So if L is a branch of logarithm, b...
2014/10/08
[ "https://math.stackexchange.com/questions/963822", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Here are the steps $$ f(x)=g(x) $$ $$ ax=\sqrt{x} $$ $$ (ax)^2=(\sqrt{x})^2 $$ $$ a^2x^2=|x| $$ Since $x\gt 0$ and $a\gt 0$, then $$ a^2x^2=x $$ $$ \frac{x^2}{x}=\frac{1}{a^2} $$ Thus, when $x\gt 0$ and $a\gt 0$, the functions $f(x)$ and $g(x)$ will intersect only when $$x=\frac{1}{a^2}$$
In this case an algebraic proof is possible; but taking it from a more general point of view, we can consider the function $$ F(x)=ax-\sqrt{x} $$ defined for $x\ge0$; it's continuous and $\lim\_{x\to\infty}F(x)=\infty$, because $$ \lim\_{x\to\infty}(ax-\sqrt{x})= \lim\_{x\to\infty}x(a-1/\sqrt{x}). $$ Moreover $F(0)=0$....
11,934,171
I'm using Rails 3. When a user submits a form with a text\_field and has & entered in it, the form gets validated. When it isn't valid, Rails returns an error, which I then show to the user. But now the & is translated to `&amp;` . How can I change this behaviour? Thanks.
2012/08/13
[ "https://Stackoverflow.com/questions/11934171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1401657/" ]
I found the culprit. I was sending my input to a sanitizer method, which replaced all ampersands by `&amp;`.
Maybe try "risky string".html\_safe
49,615,384
Originally, I put all of my javascript in the head, but then I noticed that the page load time was very slow - not surprising. So, I moved all of my scripts to the bottom to eliminate the DOM render blocking effects. On Google's PageInsights page, they say that's no longer the best practice and they recommend putting...
2018/04/02
[ "https://Stackoverflow.com/questions/49615384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9269719/" ]
> > Note that asynchronous scripts are not guaranteed to execute in specified order and should not use document.write. Scripts that depend on execution order or need to access or modify the DOM or CSSOM of the page may need to be rewritten to account for these constraints. > > > Simple suggestion: just place your...
You are still downloading your jquery script with async, change it to also be defer. *Some extra detail on async and defer that you might already know:* async: downloads your script while browser is rendering, then stops the rendering once download of that one script is finished and executes it, then continues render...
39,982,373
Does anybody know of any compatibility issues or quirks with MySQL Community Server/Workbench on macOS Sierra? I recently did an installation on a Mac that had never held MySQL before and it doesn't seem to be working correctly. (Now maybe I just set it up wrong, but the since the installer offers no advanced options t...
2016/10/11
[ "https://Stackoverflow.com/questions/39982373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7002533/" ]
> > **UPDATE!** > ----------- > > > macOS High Sierra ***needs*** MySQL Workbench [6.3.10](https://dev.mysql.com/downloads/workbench/) > -------------------------------------------------------------------------------------------------- > > > See [*changelog*](https://dev.mysql.com/doc/relnotes/workbench/en/wb-news...
I had same problem and I digged all internet but dont resolved problem and then I decided use another workbench. I found "DBeaver - Universal Database Manager" official site : <http://dbeaver.jkiss.org/> and free and its tolerable.
23,539,184
In Python, I start a new process via `Popen()`, which works fine. Now in the child process I want to find the parent's process ID. What is the best way to achieve this, maybe I can pass the PID via the `Popen` constructor, but how? Or is there a better way to do so? PS: If possible I would prefere a solution using on...
2014/05/08
[ "https://Stackoverflow.com/questions/23539184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2729841/" ]
You can use [`os.getppid()`](https://docs.python.org/2/library/os.html#os.getppid): > > `os.getppid()` > > > > ``` > Return the parent’s process id. > > ``` > > Note: this works only on Unix, not on Windows. On Windows you can use [`os.getpid()`](https://docs.python.org/2/library/os.html#os.getpid) in the pare...
Use `psutil` ([here](https://github.com/giampaolo/psutil)) ``` import psutil, os psutil.Process(os.getpid()).ppid() ``` works both for Unix & Windows (even if `os.getppid()` doesn't exist on this platform)
204,196
I used the following link (<https://webkul.com/blog/how-to-create-a-custom-button-on-record-page-in-lightning-experience/>) to create a Quick Action which opens a box. I am trying to update the Lightning Component to actually open the Log a Call page. I need the button to exist on the Contact record rather than the a...
2018/01/10
[ "https://salesforce.stackexchange.com/questions/204196", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/30602/" ]
If I understand you correctly - you want to open the `Log A Call` as a dialog - from an action button. Although you can add a custom Quick action and set it's type as `Log A Call`: [![enter image description here](https://i.stack.imgur.com/XTuqA.png)](https://i.stack.imgur.com/XTuqA.png) But if you do that - the `L...
There is a log a call action specific to the Contact page you are on. Screenshot below demonstrate that [![enter image description here](https://i.stack.imgur.com/A6Z3X.png)](https://i.stack.imgur.com/A6Z3X.png) Since, [`Call Logging`](https://help.salesforce.com/articleView?id=activitytimeline_configure_call_task_ev...
520,160
In this image taken from the [manual](http://nadascientific.com/pub/media/PDF/Catalog/N99-B10-7355_Manual.pdf) of the NaRiKa/Nada Scientific EM-4N e/m apparatus, you can see that the positively-charged electrode (the one electrons are attracted to) is labeled "anode." [![e/m apparatus circuit diagram](https://i.stack.i...
2019/12/17
[ "https://physics.stackexchange.com/questions/520160", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/155821/" ]
This is a volume obtained by revolving $z= f(\sqrt{x^2+y^2}) = f(r) $ around z-axis. The x coordinate of the center of mass is given by $$ { \bar x } =\dfrac{\int\int \int(\rho\cdot r\sin \theta\, r\, d\theta \,dr\, dz)}{\int\int\int(\rho\, r\, d\theta \,dr\, dz)} $$ The numerator can be expressed as $$ {\int\_0^{2 \p...
I will only show the case for center of mass because the case for moment of inertia is analogous. We have for the $x$ component of the center of mass: $$ x\_\text{com} = \frac 1M \int \rho(x,y,z) \cdot x\, \mathrm d^3 x$$ for simplicity I'm going to take $M=1$ in some units as the mass will not play a role in the arg...
67,468,510
I have Eclipse recently installed and the version is Eclipse IDE for Enterprise Java and Web Developers (includes Incubating components) Version: 2021-03 (4.19.0) Build id: 20210312-0638 OS: Windows 10, v.10.0, x86\_64 / win32 Java version: 16 Windows Builder is also installed version 1.9.5 and updated I created new ...
2021/05/10
[ "https://Stackoverflow.com/questions/67468510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15785120/" ]
For anyone looking for answer I just realized how to fix this. Go to window builder site and install version 1.9.4. When opening new project please open in Java 11 only. Will not work in newest jdk So project in jdk 11 and only 1.9.4 window builder version
version 1.9.5 has completely removed from <https://www.eclipse.org/windowbuilder/download.php>. Downloaded and installed the latest version **Current(1.9.7)**. Worked for me.
68,506,567
In [bootstrap-vue](https://bootstrap-vue.org/docs/components/pagination#pagination) pagination there is no slot for change main color of pagination. [![enter image description here](https://i.stack.imgur.com/s0APj.png)](https://i.stack.imgur.com/s0APj.png) you see there is only blue color for it. is there any way to...
2021/07/24
[ "https://Stackoverflow.com/questions/68506567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7693832/" ]
When you do a bitwise operation on Series objects or arrays, you get an array of booleans, each of whose elements is True or False. Those are basically 0 or 1, and in fact more convenient in most cases: ``` df['col6'] = (df['col4'] > 1) & (df['col5'] > 1) df['col7'] = df['col6'] ``` That last one is not a clever tri...
try: ``` c1=df['col4'].gt(1) & df['col5'].gt(1) #your 1st condition c2=c1 & df['col4'].add(df['col5']).gt(2) #your 2nd condition ``` Finally: ``` df['col6']=c1.astype(int) df['col7']=c2.astype(int) ``` OR via numpy's `where()` method: ``` c1=df['col4'].gt(1) & df['col5'].gt(1) c2=c1 & df['col4'].add(df['col5'])...
243,031
I have read somewhere that the gate capacitance (Cgs, Cgd) of a MOSFET is calculated as below: *Strong inversion:* > > Cgs=(2/3)Cox.W.L + Cov > > > *Non-saturated:* > > Cgs=Cgd=(1/2)Cox.W.L + Cov > > > where Cov is overlap capacitance. Could anyone explain where the formulas come from?
2016/06/27
[ "https://electronics.stackexchange.com/questions/243031", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/91853/" ]
Reading in the tea leaves here, I'd surmise that for the case of: > > your equation 2)\$C\_{gs}=C\_{gd}=\frac{1}{2}C\_{ox}WL + C\_{ov}\$ > > > They are taking the gate to channel capacitance and dividing equally between the S & D. In the case of: > > your equation 1)\$C\_{gs}=\frac{2}{3}C\_{ox}WL + C\_{ov}\$ >...
This might help you out. [![enter image description here](https://i.stack.imgur.com/FpEeX.png)](https://i.stack.imgur.com/FpEeX.png) **Reference:** B. Razavi, *Design of Analog CMOS Integrated Circuits*, McGraw-Hill, Boston, 2001
67,712,252
My data is dataset diamond: ``` +-----+-------+-----+-------+-----+-----+-----+----+----+----+ |carat| cut|color|clarity|depth|table|price| x| y| z| +-----+-------+-----+-------+-----+-----+-----+----+----+----+ | 0.23| Ideal| E| SI2| 61.5| 55.0| 326|3.95|3.98|2.43| | 0.21|Premium| E| SI1| 59.8|...
2021/05/26
[ "https://Stackoverflow.com/questions/67712252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1997567/" ]
I would not recommend generating the attributes independently from each other (Green Cloak Guy has provided an instructive answer on how this can be done better). That said, if for some reason you want to do it nonetheless, you can distribute the differences across the attributes as follows: ``` import random streng...
I would just generate the seven stats, and depending on the sum total, add or subtract randomly until the sum equals 40... ``` import random stats = [] ## Generate the stats for x in range(7): stats.append(random.randint(1,10)) ## If the sum total is 40, leave em. if sum(stats) == 40: pass ## If it is less ...
23,040,120
i have a java multi-threaded program that is running. i am running it on a tomcat server. when the threads are still running, some executing tasks, some still waiting for some thing to return and all kinds of things, assume i stop the server all of a sudden in this scenario.. when i do i get a warning on the tomcat ter...
2014/04/13
[ "https://Stackoverflow.com/questions/23040120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2781031/" ]
> > when i do i get a warning on the tomcat terminal saying a thread named x is still running and the server is being stopped so this might lead to a memory leakage. what is the OS actually trying to tell me here? > > > Tomcat (not the OS) is surmising from this extra thread that some part of your code forked a th...
It sounds like your web server is forking processes which are not terminated when you stop the server. Those could lead to a memory leak because they represent processes that will never die unless you reboot or manually terminate them with the `kill` command. I doubt that you will permanently damage your system, unle...
149,396
I was reading the [XML Encryption standard](https://www.w3.org/TR/xmlenc-core/#sec-EncryptedKey) and I have some trouble understanding the purpose of encrypting some plain text with a symmetric generated AES or 3DES key that in turn gets encrypted with the public RSA key of the recipient. If an attacker gets the priva...
2017/01/25
[ "https://security.stackexchange.com/questions/149396", "https://security.stackexchange.com", "https://security.stackexchange.com/users/45141/" ]
> > Why should I encrypt the symmetric key with the asymmetric one? Does increase confidentiality or performance? When should I use this double encryption? > > > You need to do the symmetric encryption because the [maximum size of data RSA can encrypt](https://stackoverflow.com/questions/5583379/what-is-the-limit-...
The main idea behind this double encryption is to allow deciphering of the content by many people while controlling who can decipher the content. If you send the symmetric key, anyone with the key will be able to read the final content. If you send an encrypted key, which only the recipient can decipher, then the key...
40,662
I’m reading *Alice in Wonderland*, and found the following dialogue: > > “The master was an old Turtle — we used to call him Tortoise—” > > > “Why did you call him Tortoise, if he wasn’t one?” Alice asked. > > > “We called him a Tortoise because he taught us.” > > > What is the relationship between “he taught...
2011/09/05
[ "https://english.stackexchange.com/questions/40662", "https://english.stackexchange.com", "https://english.stackexchange.com/users/11894/" ]
This is a pun that needs to be understood in its context. Although he was a Turtle, [his pupils called him a Tortoise, because:](http://books.google.com/books?id=ID5P7xbmcO8C&printsec=frontcover&dq=alice+in+wonderland&hl=en&ei=NllkTpnNFoj5mAXysNC6Cg&sa=X&oi=book_result&ct=result&resnum=1&ved=0CCsQ6AEwAA#v=onepage&q=tor...
> > What is the relationship between "he taught us" and "Tortoise"? > > > It has to do with the pronunciation of the *au* and *or* sounds. The literally English pronunciation (the pronunciation in the English used in England) of the letter r, is not normally rhotic. If you learn of the non-rhotic pronunciation of ...
72,938,062
I am trying to recreate the snake game, however when I call the function which is supposed to create the initial body of the snake nothing appears on the screen. The same problem happens if I simply create a turtle object in the main file. Snake: ``` from turtle import Turtle STARTING_POSITIONS = [(0, 0), (-20, 0)...
2022/07/11
[ "https://Stackoverflow.com/questions/72938062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19186838/" ]
You can actually use `|` for Python 3.9+ to combine all the dictionaries then send unpacked version. ```py def fun(**kwargs): print(kwargs) >>> fun(**a_F| b_100| hello| bye) {'API parameter a': False, 'API parameter b': 100, 'API parameter c': 'hello', 'API parameter d': 'goodbye'} ``` Or just use `*args` and p...
To unpack a series of dicts, use `dict.update`, or a nested comprehension: ``` def myf(*dicts): merged = {k: v for d in dicts for k, v in d.items()} # do stuff to merged ``` OR ``` def myf(*dicts): merged = {} for d in dicts: merged.update(d) ```
63,239,291
I have some D3 code that works fine. It includes a call like this to fill an area with grey: ``` ... .attr("fill", "rgba(0,0,0,.18)") ... ``` However, if I change that line to the following (where fillSmoke() returns the same string `"rgba(0,0,0,.18)"`), the chart is filled with black, not the desired grey. ``` .at...
2020/08/04
[ "https://Stackoverflow.com/questions/63239291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1827982/" ]
The second parameter of the `.attr` method can be a function, but it must return the color value you want to use. Right now your function just calls fillSmoke, but returns no value. Fix this by changing the line to: ``` .attr("fill", function(d, i) { return fillSmoke(d,i); }) ``` The return statement is needed to re...
This was a silly mistake - the function should have been defined to *return* the fillSmoke() results, like this: `function(d, i) {return fillSmoke(d,i)}` Thanks, all.
1,197,444
I have tried to do this in many different ways but the most obvious was this: ``` var map2 = new GMap2(document.getElementById("map2"), {size:"100%"}); ``` That does not work.
2009/07/29
[ "https://Stackoverflow.com/questions/1197444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/146758/" ]
Just specifying width:100%; height:100% wasn't enough for me... But I got it working by using the following BODY code: ``` <body onload="initialize()" style="margin:0px; padding:0px;"> ``` And using the following map code: ``` <div id="map" style="width: 100%; height: 100%; position: relative; background-color: rg...
``` <div class="some-pannel"> <div class="map-wrapper"> <div id="googleMap" style="width:100%;height:100%;"></div> </div> </div> .some-pannel{ position: relative; width: 123px; height 321px; } .map-wrapper{ position: absolute; top: 0; left: 0; width: 100%; height: 100%...
29,715,598
because a provider I use, has a quite unreliable MySQL servers, which are down at leas 1 time pr week :-/ impacting one of the sites I made, I want to prevent its outeges in the following way: * dump the MySQL table to a file In case the connection with the SQL server is failed, * then read the file instead of the Ser...
2015/04/18
[ "https://Stackoverflow.com/questions/29715598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2942741/" ]
If you have your data layer well decoupled you can consider using SQLite as a fallback storage. It's just a matter of adding one abstraction more, with the same code accessing the storage and changing the storage target in case of unavailability of the primary one. -----EDIT----- You could also try to think about s...
Have you thought about caching your queries into a cache like APC ? Also, you may want to use `mysqli` or `pdo` instead of mysql (Mysql is deprecated in the latest versions of PHP). To answer your question, this is one way of doing it. * `var_export` will export the variable as valid PHP code * `require` will put the...
29,454,849
While using Rails 4.1 with Devise 3.3.0 I noticed the following: When using routes.rb such as ``` devise_scope :user do get '/login', :to => "devise/sessions#new" get '/logout', :to => "devise/sessions#destroy" get '/sign_up', :to => "devise/registrations#new" end ``` And then on the view of one of ...
2015/04/05
[ "https://Stackoverflow.com/questions/29454849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1373836/" ]
For those who are looking for a way to get timestamp, just do it: > > moment().[valueOf](https://momentjs.com/docs/#/parsing/utc/)() > > >
You can directly call function **momentInstance.valueOf()**, it will return numeric value of time similar to **date.getTime()** in native java script.
59,993,305
Given an array of objects `arr1` how can I filter out to a new array the objects that do not have a property equal to any value in the array of numbers `arr2` ``` const arr1 = [ { key: 1, name: 'Al' }, { key: 2, name: 'Lo' }, { key: 3, name: 'Ye' } ]; const arr2 = [2, 3] // Failed...
2020/01/30
[ "https://Stackoverflow.com/questions/59993305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7435567/" ]
For situations like this Set is also very cool (and for big arrays more performant): ``` const arr1 = [ { key: 1, name: 'Al' }, { key: 2, name: 'Lo' }, { key: 3, name: 'Ye' } ]; const arr2 = [2, 3] const arr2Set = new Set(arr2); const newArr = arr1.filter(obj1 => !arr2Set.has(obj1...
You can use `indexOf` like this: ``` const newArr = arr1.filter(obj => arr2.indexOf(obj.key) > -1); ```
102,267
I'm migrating a WordPress site from one server to another, and the entire migration seems fine, except the sidebars aren't moving over properly. The obvious thing that comes to mind is a serialization issue with the MySQL migration, but I'm not making any changes to the database because the domain name isn't changing (...
2013/06/07
[ "https://wordpress.stackexchange.com/questions/102267", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10034/" ]
Really everything you need to know is in the docs. See [Moving WordPress « WordPress Codex.](http://codex.wordpress.org/Moving_WordPress) They cover exporting/importing databases, moving uploads and other content, themes, etc. For particular issues with moving WP installs, search this site; many have already been ans...
theres a nice plugin called "Duplicator" which does all the stuff for you. <http://wordpress.org/plugins/duplicator/> Theres also one called BackupBuddy but it's not free. <http://ithemes.com/purchase/backupbuddy/>
7,892,729
I would have to display in my console log, the duration of each Hibernate query. Is it possible ?
2011/10/25
[ "https://Stackoverflow.com/questions/7892729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/284237/" ]
Take a look on this article. <http://www.basilv.com/psd/blog/2008/hibernate-and-logging> It seems it describes exactly what you need. I hope it is still relevant fore newer versions of Hibernate since hibernate moved to SLF4J. In this case you should perform appropriate configuration of SLF4J instead of Log4j
[log4jdbc](http://code.google.com/p/log4jdbc/) and [log4jdbc-remix](http://code.google.com/p/log4jdbc-remix/) provide extensive logging for JDBC connections, statements, and result sets. These projects provide wrappers around your JDBC driver to do the logging.
9,751
I come from Christianity.SE, where I asked [almost the same question](https://christianity.stackexchange.com/q/1630/60). [Isaac Moses](https://judaism.stackexchange.com/users/2/isaac-moses) assured me that the question would not be disrespectful and could be asked here. --- God's name is written as the Tetragrammaton...
2011/09/02
[ "https://judaism.stackexchange.com/questions/9751", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/853/" ]
In [this recent blog post](http://torahmusings.com/2011/09/jehovahs-witnesses/), Rabbi Ari Enkin paraphrases Israel Rubin in "The How & Why of Jewish Prayer" explaining that the correct pronunciation of the Tetragrammaton was lost during the Second Temple Period.
Once I read an article that suggested a word that sounded like it only consisted of vowels. I'm not familiar with the standard pronunciation notation, so I can only write it in "pseudo code" based on English: ee[eagle]-aa[artist]-uu[without first j sound]-ehh[enter]. Unfortunately I can't remember the author and the t...
51,485,787
I would like to add an ascending number to every 6th item of an array. So far I have this but at the moment it adds an ascending number to every line, not every 6th line. Can someone say how to fix that? Thanks ``` for(var i=0;i<newlist.length;i++){ newlist[i]=counter + "." + " " + newlist[i]; counter++; } ``...
2018/07/23
[ "https://Stackoverflow.com/questions/51485787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4228956/" ]
`i++` increments the index by one, `i += 6` increments the index by 6.
Arrays in javascript are 0 based so assuming that you want every 6th element to contain the prefix - ``` for(var i=0;i<newlist.length;i++) { if ( (i+1) % 6 === 0) { newlist[i] = ((i+1)/6) + "." + " " + newlist[i]; } } ```
68,441,088
I am building a personal website and I am getting an error whenever I click on the the redirect link and I am quite puzzled how to proceed. I am also including my *url.py*, *views.py* and *navbar.html* files (HTML file where the redirect code is) code: ### File *views.py* ``` def product(request): return render(...
2021/07/19
[ "https://Stackoverflow.com/questions/68441088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13870072/" ]
Go to Firebase console, then navigate to the storage tab. You should see something like this: [![Firebase console storage tab](https://i.stack.imgur.com/QNgkc.png)](https://i.stack.imgur.com/QNgkc.png) Click "Configure App Check" and there will be a config page. Ensure that your Firebase Storage is not set to enforce...
In my case I solved the problem by using the await typecasting. You are not getting the error related to app check token request. You are getting the error for not waiting for the completion of download. Just add the line after await which is required for the UploadTask finished and it works. ``` final Reference stora...
44,802,363
I am currently overseas and I am trying to connect to my EC2 instance through ssh but I am getting the error `ssh: connect to host ec2-34-207-64-42.compute-1.amazonaws.com port 22: Connection refused` I turned on my vpn to New York but still nothing changes. What reasons could there be for not being able to connect to...
2017/06/28
[ "https://Stackoverflow.com/questions/44802363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1851782/" ]
My debugging steps to EC2 connection time out 1. Double check the security group access for port 22 2. Make sure you have your current IP on there and update to be sure it hasn't changed 3. Make sure the key pair you're attempting to use corresponds to the one attached to your EC2 4. Make sure your key pair on your lo...
1. In AWS, navigate to Services > EC2. 2. Under Resources, select Running Instances. 3. Highlight your instance and click Connect. 4. In Terminal, `cd` into the directory containing your key and copy the command in step 3 under "To access your instance." 5. In Terminal, run: `ssh -vvv -i [MyEC2Key].pem ec2-user@xx.xx.x...
6,189,708
I come from C++ and normally `this` is rarely used compared to C#. In my experience, the usage of `this` is strictly limited to scope and/or name resolution. I have coworkers that insist that using `this` everywhere makes code "more clear". They essentially depend on it for documentation purposes. I disagree with this...
2011/05/31
[ "https://Stackoverflow.com/questions/6189708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/157971/" ]
Check here if you are working on emulator: [essentials for creating system apk](https://stackoverflow.com/questions/25532260/building-an-android-apk-with-same-certificate-as-the-system/32135870#32135870) If you are working on a real device: 1. What you need is the vendor signature that's used to sign all the modified...
Building a APK that should be signed with the platform key ``` LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # Build all java files in the java subdirectory LOCAL_SRC_FILES := $(call all-subdir-java-files) # Name of the APK to build LOCAL_PACKAGE_NAME := LocalPackage LOCAL_CERTIFICATE := platform...
63,459,377
I am extremely confused on how to access this data, and get it into MySQL I have this JSON Data: ``` { "serial_number": "70-b3-d5-1a-00-be", "dateTime": "2020-08-14 20:58", "passReport": [ { "id": 1, "passList": [ { "passType": 1, "time": "2...
2020/08/17
[ "https://Stackoverflow.com/questions/63459377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12481660/" ]
Tested your code with just Image("some\_image") as below and it works (Xcode 12 / iOS 14), so the issue is either in `AnimatedImage` or in some other code. ``` VStack{ Image("some_image") .resizable() .aspectRatio(contentMode: .fit) .frame(width: UIScreen.main.bounds.width - 40) } .padding(...
I think this change will help you: ``` VStack { AnimatedImage(url: URL(string: self.mediaLink)) .resizable() .scaledToFit() } .frame(width: UIScreen.main.bounds.width - 40) ```
7,057,080
I'm aware a single workflow instance run in a single thread at a time. I've a workflow with two receive activities inside a pick activity. Message correlation is implemented to make sure the requests to both the activities should be routed to the same instance. In the first receive branch I've a parallel activity wit...
2011/08/14
[ "https://Stackoverflow.com/questions/7057080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/741616/" ]
[ImageMagick](http://www.imagemagick.org/) can construct [animations](http://www.imagemagick.org/Usage/anim_basics/) by assembling several bitmaps into one: ``` convert -delay 100 \ -page first.gif \ -page second.gif \ -page third.gif \ -loop 0 animation.gif ```
It is also possible to generate animated gifs with [Gimp](http://www.gimp.org/) if you prefer a GUI tool. Plenty of how-to's if you [google it](http://www.google.com/search?rlz=1C1GGGE_elGR409GR415&sourceid=chrome&ie=UTF-8&q=create%20animated%20gif%20with%20gimp#sclient=psy&hl=el&rlz=1C1GGGE_elGR409GR415&source=hp&q=cr...
12,018,861
I have a `DropDownList`, using which I have to store some values from the `CheckBoxList` in the database. Before I select another index from the `DropDownList`, the values in the `CheckBoxList` has to be stored, prompting the user with an alert "Save before proceeding". I am able to display the above mention alert me...
2012/08/18
[ "https://Stackoverflow.com/questions/12018861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1597829/" ]
With the use of Global variables. Using the code below. `PreviousIndex` will hold the previous, and `CurrentIndex` will hold current. ``` int PreviousIndex = -1; int CurrentIndex = -1; protected void LOC_LIST2_SelectedIndexChanged(object sender, EventArgs e) { PreviousIndex = CurrentIndex; CurrentIndex = myD...
So here's what finally worked for me. A combination of the answers above. You have to track both previous and current selected index/value in the OnLoad handler of the page/control. ``` private int PreviousSelectedIndex { get { return (Page.ViewSate["prevIdx"] == null) ? -1 : (int)ViewSate["prevIdx"]; } set {...
2,634,973
Can we use DDMS to take a screen capture with a device skin? Right now I'm just getting the exact screen rect area in my screen captures, Thanks
2010/04/14
[ "https://Stackoverflow.com/questions/2634973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/246114/" ]
I don't think DDMS tool has any such option; it captures only the display: the screen area(therefore the name screen capture).
If you are using windows, assuming you have an emulator open with the skin you want, ensure that you have focus on the emulator. Press Alt-PrtScn to screen capture just the focused window, open up MS Paint and past the clipboard contents, you will have the screen shot + skin + window frame. It's up to you to crop that ...
38,555,618
In case the ajax take a while to load the dialog and user double clicking the button, two identical dialog will popup on the screen. I want to prevent it from happening. ``` $("#ShowUpCallTag").on('click', function (e) { $.ajax({ url: '/Ship/CallTags/Dialog/' + $(e.target).data('calltagid'), ...
2016/07/24
[ "https://Stackoverflow.com/questions/38555618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2124062/" ]
You can use `itertool.islice` for this, eg: ``` from itertools import islice with open('filename') as fin: wanted = islice(fin, 1, None) # change 1 to lines to skip data = [line.split() for line in wanted] ```
You cannot jump directly to a specific line. You have to read the first n lines: ``` n = 1 with open('data.txt', 'r') as data: for idx, _ in enumerate(data): if idx == n: break for line in data: print line.split() ```
33,779
Does anyone know of a powershell cmdlet out there for automating task scheduler in XP/2003? If you've ever tried to work w/ schtasks you know it's pretty painful.
2008/08/29
[ "https://Stackoverflow.com/questions/33779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1635/" ]
[This](http://myitforum.com/cs2/blogs/yli628/archive/2008/07/28/powershell-script-to-retrieve-scheduled-tasks-on-a-remote-machine-task-scheduler-api.aspx) is a good article (be sure to read the other linked article in it) that discusses looking at th scheduled tasks on remote machines. It is not exactly what you were a...
Not "native" PowerShell, but if you're running powershell.exe as an administrator then you should have access to the "at" command, which you can use to schedule tasks.
8,944,097
Within my index.php file I have an AJAX function that will call a function within another php file which should increment a number and return it whenever i call the AJAX function. The problem is that the number never changes. I have tried lots of different things. Too many to list them all unfortunately. My index.php...
2012/01/20
[ "https://Stackoverflow.com/questions/8944097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1085819/" ]
Add `session_start();` to blogFunction.php
Here's the properly working code... index.php ``` <?php session_start(); $_SESSION['views'] = 0; ?> <!doctype html> <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js" /> <body> <div class ="blog" id = "blog"></div> <input type="button" valu...
38,441,851
I have done research on this, and I know that RXJava is using the observable pattern, and Bolts is relying on an executor. What framework would be good for handling tasks that need to be done in sequences? I've heard of using singleExecutors, queues, chaining asynctasks, and these two frameworks. I've seen more peopl...
2016/07/18
[ "https://Stackoverflow.com/questions/38441851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2030899/" ]
I've used both in different projects and have done a migration from Bolts to RxJava. The simple answer to your question > > What framework would be good for handling tasks that need to be done in sequences? > > > Is that you could easily use either framework to do this. They both: * Allow tasks to be chained one...
These two libraries solve two different problems. **Bolts** Bolts simplifies asynchronous programming by transparently pushing code to a background thread. Bolts also spends a good deal of effort attempting to reduce unsightly code nesting that produces a nested pyramid like format. Therefore, if you are specifical...
37,409,811
How to smooth the edges of this binary image of blood vessels obtained after thresholding. [![enter image description here](https://i.stack.imgur.com/YyNQV.png)](https://i.stack.imgur.com/YyNQV.png) I tried a method somewhat similar to [this method](https://stackoverflow.com/questions/21795643/image-edge-smoothing-w...
2016/05/24
[ "https://Stackoverflow.com/questions/37409811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2605733/" ]
You can dilate then erode the areas <http://docs.opencv.org/2.4/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.html>. ``` import cv2 import numpy as np blur=((3,3),1) erode_=(5,5) dilate_=(3, 3) cv2.imwrite('imgBool_erode_dilated_blured.png',cv2.dilate(cv2.erode(cv2.GaussianBlur(cv2.imread('so-br-in.png',...
This is algorithm from **sturkmen**'s post above converted to Python ``` import numpy as np import cv2 as cv def smooth_raster_lines(im, filterRadius, filterSize, sigma): smoothed = np.zeros_like(im) contours, hierarchy = cv.findContours(im, cv.RETR_CCOMP, cv.CHAIN_APPROX_NONE) hierarchy = hierarchy[0] ...
182,988
> > Let $a$ and $b$ be positive integers. Prove that: If $a^2$ divides $b^2$, then $a$ divides $b$. > > > Context: the lecturer wrote this up in my notes without proving it, but I can't seem to figure out why it's true. Would appreciate a solution.
2012/08/15
[ "https://math.stackexchange.com/questions/182988", "https://math.stackexchange.com", "https://math.stackexchange.com/users/38003/" ]
The proofs given use the Unique Factorization Theorem, or the existence of GCDs, or some equivalent, but the result is true even in places where there aren't any GCDs, so there must be a proof that doesn't rely on these properties. Here's one that works in the ring $O\_K$ of integers in a number field $K$, whether ther...
$a^2 \mid b^2 \Rightarrow \frac{a}{d}\cdot\frac{a}{d} \mid \frac{b}{d}\cdot\frac{b}{d}$ with $d = gcd(a,b)$. From $gcd(\frac{a}{d},\frac{b}{d})=1$ follows $\frac{a}{d}=1$ or $a=d \mid b$. This can easily be extended to $a^m \mid b^n$ where $2 \le n \le m$.
290,758
You know how when you get to 10+ tabs open in your browser (in this case Chrome) and you can't tell which tab is which anymore? I'm sure there are some good extension or something - what's the best solution to this problem? ![enter image description here](https://i.stack.imgur.com/iIaVj.png)
2011/05/30
[ "https://superuser.com/questions/290758", "https://superuser.com", "https://superuser.com/users/3812/" ]
Install [TabsOutliner](https://chrome.google.com/webstore/detail/tabs-outliner/eggkanocgddhmamlbiijnphhppkpkmkl?hl=en) extension - The ultimate windows & tabs manager for Chrome: ![enter image description here](https://i.stack.imgur.com/xPFti.jpg) Not only it is show all the tabs and windows, it allow to add notes t...
The Chrome extension called [Vimium](https://chrome.google.com/webstore/detail/vimium/dbepggeogbaibhgnhhndojpepiihcmeb/details?hl=en) will let you search and go to any of your open tabs if you press `T`, amongst many other things that it can do. <http://vimium.github.io>
681,838
**What I have**: freeradius 2.1.10 on debian, configured to use a database. **How it works now**: There are many devices on the network and users, the users log on devices to configure them and so on. The users can log on to anything. For example some devices (ciscos) the user account on radius comes along with priv...
2015/04/10
[ "https://serverfault.com/questions/681838", "https://serverfault.com", "https://serverfault.com/users/116435/" ]
You should put it in `raddb/policy.conf` inside the `policy {}` stanza. Then they can be referenced (by their name) as you would a normal module, in authorize, authenticate, post-auth etc... Policies in FreeRADIUS are essentially macros, they're not functions, they don't take arguments. Defining a special attribute t...
Thanks to some info I found on <http://linotp.org/doc/2.6/part-installation/integration/index.html> you can use the following configuration if you use the nas table in the MySQL database. in the `nas` table you have IP ranges per device group, so if you device is in the specific IP range, the policy will be used: ```...
55,402,810
I have a UIViewController, inside which there is a tableView. I added a RefreshControl. But when I pull, it always jumps for some times, which is not smooth and continuous at all. I'm using Swift 4 and Xcode 10.1. ``` class ItemsController: UIViewController, UITableViewDelegate, UITableViewDataSource, UITextViewDeleg...
2019/03/28
[ "https://Stackoverflow.com/questions/55402810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I also faced that kind of problem. You can use this approach below: 1. Change your **handleRefresh** method like this: ``` @objc func handleRefresh(_ refreshControl: UIRefreshControl) { if !tableView.isDragging { refresh() // refresh is another method for your reloading jobs } } ``` 2. Add **refresh** met...
try ``` @objc func handleRefresh(_ refreshControl: UIRefreshControl) { loadData() self.tableView.reloadData() DispatchQueue.main.async { //DispatchQueue.main.asyncAfter(deadline: .now + 0.2) { // or this one with //short delay refreshControl.endRefreshing() } } ```
2,609,552
Given the following command, ``` echo "1: " | awk '/1/ -F ":" {print $1}' ``` why does AWK output: ``` 1: ``` ?
2010/04/09
[ "https://Stackoverflow.com/questions/2609552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/173446/" ]
`-F` is a command line argument, not AWK syntax. Try: ```bash echo '1: ' | awk -F ':' '/1/ {print $1}' ```
You can also use a regular expression as a field separator. The following will print "bar" by using a regular expression to set the number "10" as a separator. ``` echo "foo 10 bar" | awk -F'[0-9][0-9]' '{print $2}' ```
6,274
Mi ludas [ĉi tiun ludon](https://eo.wikipedia.org/wiki/Aventuro_(tekstaventuro)) kaj ofte estas frazoj kun *se* kiujn mi trovas strangaj. Ekzemple: > > Se vi trinkas la kokakolaon, la gusto ne plaĉas al vi. Sed vi soifas do eltrinkas la tutan boteleton. > > > > > Se vi proksimiĝas la vilaĝon, kelkaj vilaĝanoj ir...
2021/07/06
[ "https://esperanto.stackexchange.com/questions/6274", "https://esperanto.stackexchange.com", "https://esperanto.stackexchange.com/users/13/" ]
Ŝajnas al mi ke tio estas mistraduko, ĉar vi ĵus tajpis vian agon, do la ĝusta vorto estas **kiam** (when). Probable la gepatra lingvo de la tradukisto uzas la saman vorton por *se* kaj *kiam*. Iam mi legis ke la germana lingvo estas tia, kaj Joop Eggen informis nin en alia respondo ke la nederlanda ankaŭ havas vorton...
Post via enigo de frazo, la respondo de la komputilo ne vere certas pri tio, kio okazas nun. Do ne eblas tute certe diri: > > Kiam vi trinkas la kokakolaon, la gusto ne plaĉas al vi. > > > Fuŝus la etoson diri ion similan al: > > Tiuokaze ke vi trinkas/trinkus la kokakolaon, la gusto ne plaĉas al vi. > > > ...
40,112,752
I have an issue with this code, the full Ajax code runs to the end, and fades out the parent of the deletebtn, here is the code of the deletebtn, post and ajax: ``` <?php include('php/connect.php'); $roomQuery = "SELECT * FROM rooms"; $roomResult = mysqli_query($conn, $roomQuery); while($roomRow =...
2016/10/18
[ "https://Stackoverflow.com/questions/40112752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6058159/" ]
Keeping the same structure, you could do a `$this->Topic->saveAssociated($this->request->data);` and it will add any new (`'id' => NULL` or unset) items in the data array. About the delete, the only case I know would delete at the same time, would be a HABTM when it's marked as `'unique' => true`. Otherwise, you need ...
**From CakePHP 2 Book** ``` delete(integer $id = null, boolean $cascade = true); ``` > > Deletes the record identified by $id. By default, also deletes records > dependent on the record specified to be deleted. > > > For example, when deleting a User record that is tied to many Recipe > records (User ‘hasMany’ ...
3,474,805
Suppose $f:R \to R$ is a continuous function such that $$f(x)=\frac{1}{t}\int^t \_0f(x+y)-f(y)dy$$ for every $x$ and for all $t>0$. Prove that there exists a constant $c$ such that $f(x)=cx$ for every $x$
2019/12/13
[ "https://math.stackexchange.com/questions/3474805", "https://math.stackexchange.com", "https://math.stackexchange.com/users/728159/" ]
First note that $$f(0) = \frac{1}{t}\int\_0^t f(0+y) - f(y) \: dy = 0$$ Take the derivative of $f$ w.r.t. $x$ $$f'(x) = \frac{1}{t}\int\_0^t f'(x+y)\:dy = \frac{f(x+t)-f(x)}{t}$$ From here we can deduce that $$f'(0) = \frac{f(0+t)-f(0)}{t} = \frac{f(t)}{t}$$ $$\implies f(t) = f'(0)\cdot t$$ for all $t>0$. If we ...
The equation can be written as $\int\_0^{t} [f(x+y)-f(y)-f(x)]dt=0$. Since this holds for all $t >0$ we get $f(x+y)-f(y)-f(x)=0$ whenever $y>0$. Since $f(0)=0$ (letting $t \to 0$ in the given equation we get $f(x)=f(x)-f(0)$ so $f(0)=0$) this holds for $y \geq 0$. Now a standard argument shows that $f(x)=cx$ for all $x...
4,698,220
I am working on a Django / Python website. I have a page where I want to display a table of search results. The list of results is passed in to the template as normal. I also want to make this list of objects accessible to the JavaScript code. My first solution was just create another view that returned [JSON](http:/...
2011/01/15
[ "https://Stackoverflow.com/questions/4698220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/576498/" ]
**Solution** I created a custom template filter, see *[custom template tags and filters](http://docs.djangoproject.com/en/dev/howto/custom-template-tags/)*. ``` from django.core.serializers import serialize from django.db.models.query import QuerySet from django.utils import simplejson from django.utils.safestring im...
Look [this answer](https://stackoverflow.com/a/15592905/1981384) too. But it isn't highload way. You must: a) Create JSON files, place to disk or S3. In case is JSON static b) If JSON is dynamic. Generate JSON on separately url (like API) in your app. And, load by JS directly in any case. For example: `$.ajax('/g...
258,336
Some notes before main question: * My Steam games library is on separate location (**another drive**), and removing games is **not** a solution to this question. * I have already tried out TikiOne Steam Cleaner, it didn't detect anything to delete in my Steam installation folder. * I would rather not install Steam on...
2016/03/10
[ "https://gaming.stackexchange.com/questions/258336", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/86943/" ]
In addition to deleting your appcache folder, you can try a few other things. One is running `steam://flushconfig` as described in [this Steam knowledgebase article.](https://support.steampowered.com/kb_article.php?ref=3134-TIAL-4638) If there's any cruft lying around in your steam install, this ought to clean it up. ...
Your statement **`I would rather not install Steam on my second drive.`** is precisely what you should do to be honest. There is no particular benefit of having Steam on your SSD `C:\` drive. If you disagree, please tell me why.
188,821
I'm building a couple industrial style tables, using black pipe from Home Depot for the legs. The fittings and smaller nipples are all a faded gray color that perfectly complements the black cherry stain I used on the wood. But the longer segments of pipe come in a black color that is too dark and very patchy and uneve...
2020/04/01
[ "https://diy.stackexchange.com/questions/188821", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/113341/" ]
Simple answer, use PVC pipe cleaner and plenty of cloth rags. The pipe cleaner is basically acetone (don't use the purple primer!) but comes with the convenient applicator. Dissolves the black coating gunk instantly and you can wipe it away quickly with a rag, but act fast. The acetone evaporates quickly and the gunk s...
Pure turpentine worked fast and easy. Just saturate a rag and wipe a few times. ![enter image description here](https://i.stack.imgur.com/IUyxs.jpg)![enter image description here](https://i.stack.imgur.com/U4GTz.jpg)
68,654,502
In a web application I'm running, I suddenly started getting these odd tokens containing a huge string of periods at the end. This happens even when I bypass my application code and call the function from the Google OAuth library directly. Here's an example token: ``` ya29.c.Kp8BCgi0lxWtUt-_[Normal JWT stuff, redact...
2021/08/04
[ "https://Stackoverflow.com/questions/68654502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9694049/" ]
I found the problem is on the Google server-side. It's actually returning the JWT with the trailing "." chars. I'm updating Chilkat to automatically trim the trailing "." chars if found before returning the JWT.
In fact the dots make no difference. You can still use the access\_token to call apis. If you get an error response, you'd better check a further reason. Do you set the correct scope (<https://developers.google.com/identity/protocols/oauth2/scopes>)? Does the permission of the service account is right?
12,375,599
I created a form, and I want to use jquery to store the labels and the user inputted input value into an array. At the bottom of the form, there is a next button instead of submit. When the user presses next, they should see a summary of all of the labels and their input. The HTML is like this: ``` <div class="form-it...
2012/09/11
[ "https://Stackoverflow.com/questions/12375599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121630/" ]
You have to initialize the vector of vectors to the appropriate size before accessing any elements. You can do it like this: ``` // assumes using std::vector for brevity vector<vector<int>> matrix(RR, vector<int>(CC)); ``` This creates a vector of `RR` size `CC` vectors, filled with `0`.
What you have initialized is a *vector of vectors*, so you **definitely have to include a vector to be inserted**("Pushed" in the terminology of vectors) **in the original vector** you have named matrix in your example. One more thing, you cannot directly insert values in the vector using the operator "cin". Use a var...
64,289,464
I'm currently trying to learn how to use Tweepy. I keep getting an 'SyntaxError: invalid syntax' on the print line, and I'm not sure why. Relevant Code ``` for tweet in api.search(q = 'python', lang="en", rpp=10): print(f"{tweet.user.name}:{tweet.text}") ```
2020/10/10
[ "https://Stackoverflow.com/questions/64289464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13895583/" ]
If I'm correct you want to run some job at a specific time of day or week on a NodeJS server. These jobs are called `Cron Jobs`. there are npm modules for Cron Jobs. 1. [cron](https://www.npmjs.com/package/cron) 2. [node-cron](https://www.npmjs.com/package/node-cron) you can use these modules to run your jobs then fe...
You can create a function which will fetch data from firebase and also send the email. To send the email, you will need to install `nodemailer` and also turn ON "Less Secure App Access" for the sender email address. Searching those keywords on google will lead you there. You could do something like ``` async function...
17,078,280
I'm attempting to use DOCX4J to parse and insert content into a template. As part of this template I have loops which I need to copy everything inbetween two markers, and repeat all that content X times. The relavant code is as follows: ``` public List<Object> getBetweenLoop(String name){ String startTag = th...
2013/06/13
[ "https://Stackoverflow.com/questions/17078280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/543770/" ]
If you're looking to insert all the objects you have stored in your `loop` collection, you simply need to do something like this (in the conditional you've commented): ``` item.getContent().addAll(loop); ``` `item` represents the `end_loop` object (a paragraph or whatever), and inserts all the objects you've collect...
@Ben, thank-you! If you know of any instances where below wouldn't work, please let me know. I had actually just figured out something very similar, but ended up changing a lot more code. Below is what I put together. ``` public void repeatLoop(String startTag, String endTag, Integer iterations){ P begin_...
145,327
I have two servers that have a nearly identical (software) configuration. We are upgrading the web servers to run windows server 2008 R2, one already is however the main one (that currently has sites) is on WS2008. Now, the old server is ns.mydomain.com and the new server is ns1.mydomain.com. Since dns automatically f...
2010/05/26
[ "https://serverfault.com/questions/145327", "https://serverfault.com", "https://serverfault.com/users/14367/" ]
Check out the [IIS Web Deployment tool](http://www.iis.net/download/webdeploy), that should get you started with migrating the IIS sites and settings.
why don't you just clone the server by using tool like clonezilla, which makes it much easier to do
24,031,064
I have an input textfield for which some validations are applied. the user cannot enter numbers and special characters in the field. everything is fine but i want to allow space in between the words. how to do it. Here is the code... ``` <input type="text" id="text1" onKeyPress="return IsAlpha(event);"/> var...
2014/06/04
[ "https://Stackoverflow.com/questions/24031064", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2446535/" ]
Answering my own question, I found a workaround thanks to this guy : <http://www.doctrine-project.org/jira/browse/DDC-3120> He's far better than me when it comes to explaining, but this is what I have now, and it works like a charm! :) ``` { if ($this->_prototype === null) { $this->_prototype = ...
1. Check your PHP version by "php -v" on command line. E.g. PHP 5.6.10 2. Edit the file /vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php::newInstance() Add your PHP\_VERSION\_ID here ``` if (PHP_VERSION_ID === 50610 ) { . } ``` It's a temporary solution, since we don't edit `vendor` directory.
28,265,613
I have a problem with VHDL ALU code. I have to make simple ALU with 4 operations with 4-bit operands. I implemented these operations correctly and they work well. For executing I use E2LP board. For choosing the operation I selected 4 JOY buttons,one for each operation. Problem is that when I press button to execute op...
2015/02/01
[ "https://Stackoverflow.com/questions/28265613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4517445/" ]
Change `special rates` to `special_rates`.
Add an `_` to special rates to bring it in line with your multiple word naming convention e.g.`(member_type_name)`. Also numbers don't need single quotes ``` INSERT INTO membership_type(member_type_name,benefits,special_rates) VALUES ('silver', 'Free WI-fi', 0.9) ```
41,714,415
Can I get list of my app push notifications from native Notification Center app? When the my app starts, I want to show notifications which were received while my app is not running.
2017/01/18
[ "https://Stackoverflow.com/questions/41714415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5805520/" ]
If you don't want to miss any notification. You can use Pushkit silent push notification. Once you receive pushkit payload and your app you can schedule local notification and also keep in `NSUserDefault`. Using silent push notification your app will be active in background even app is in terminated state. It will b...
as said by Tian: there is no api to get a list of notifications your app missed. **no way.** --- you only get the one the user clicked to launch your app.
28,593,542
I have a list of words in Pandas (DF) ``` Words Shirt Blouse Sweater ``` What I'm trying to do is swap out certain letters in those words with letters from my dictionary **one letter at a time**. so for example: ``` mydict = {"e":"q,w", "a":"z"} ``` would create a new list that first replaces all the "...
2015/02/18
[ "https://Stackoverflow.com/questions/28593542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3682157/" ]
This answer is very similar to Brian's [answer](https://stackoverflow.com/a/28706233/2395605), but a little bit sanitized and the output has no duplicates: ``` words = ["Words", "Shirt", "Blouse", "Sweater"] md = {"e": "q,w", "a": "z"} md = {k: v.split(',') for k, v in md.items()} newwords = [] for word in words: ...
Because you need to replace letters one at a time, this doesn't sound like a good problem to solve with pandas, since pandas is about doing everything at once (vectorized operations). I would dump out your DataFrame into a plain old list and use list operations: ``` words = DF.to_dict()["Words"].values() for find, re...
50,236,778
*My understanding on `LiveData` is that, it will trigger observer on the current state change of data, and not a series of history state change of data.* Currently, I have a `MainFragment`, which perform `Room` write operation, to change **non-trashed data**, to **trashed data**. I also another `TrashFragment`, which...
2018/05/08
[ "https://Stackoverflow.com/questions/50236778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72437/" ]
I snatched Vasiliy's fork of your fork of the fork and did some actual debugging to see what happens. > > Might be related to the way ComputableLiveData offloads onActive() computation to Executor. > > > Close. The way Room's `LiveData<List<T>>` expose works is that it creates a `ComputableLiveData`, which keeps ...
This is what happens under the hood: ``` ViewModelProviders.of(getActivity()) ``` As you are using **getActivity()** this retains your NoteViewModel while the scope of MainActivity is alive so is your trashedNotesLiveData. When you first open your TrashFragment room queries the db and your trashedNotesLiveData is p...
34,388,514
I've tried to solve my problem by googling, but every time someone has the same problem also has complicated code. I a noob and I have no idea why It keeps having an error called "TypeError: not all arguments converted during string formatting" Even though I tried converting some of the variables to int. (I'm probably ...
2015/12/21
[ "https://Stackoverflow.com/questions/34388514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
When you run docker using `-p 7180` and `-p 8888`, it will allocate a random port on your windows host. However, if you use -p 7180:7180 and -p 8888:8888, assuming those ports are free on the host, it will map them directly. Otherwise you can execute `docker ps` and it will show you which ports it mapped the 7180 and...
I was just trying to spin up the Cloudera quickstart docker myself, and it turns out this seems to do the trick: <http://127.0.0.1:8888> Note the http, not https, and that I use 127.0.0.1 (or localhost) Note that this assumes that the internal 8888 port is mapped to your 8888 port. Suppose docker inspect yields some...
13,543,998
I have been working on a rails app for a while now and want to recreate the model without going through all the migration stages (i.e. from scratch) now that I finally have a final design for how I want it to be built. How do I do this without having to have to recreate my entire project?
2012/11/24
[ "https://Stackoverflow.com/questions/13543998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1121806/" ]
If I am understanding correctly about what you want, ``` rake db:reset ``` will recreate your database from your db/schema.rb. Make sure that you have run all the migrations before running it. However, rails manage the database using the migration files in db/migrate. Everytime you make changes to the database you ...
I'm not sure if this is what you want, but you could delete all your migration files and copy everything from db/schema.rb to a new migration.
2,608,201
I'm not sure how to handle the trig functions with different arguments when computing this limit using L'Hospital's rule. $$\lim\_{x \rightarrow 0} \frac {x^2\cos(\frac {1} {x})} {\sin(x)}.$$ I have come up with the correct numerical answer via a different method, but am unsure if the logic would hold true for all c...
2018/01/16
[ "https://math.stackexchange.com/questions/2608201", "https://math.stackexchange.com", "https://math.stackexchange.com/users/332245/" ]
$$ \frac {x^2\cos\frac 1 x} {\sin x} = x\cdot \frac x {\sin x} \cdot \cos\frac 1 x $$ Now use the fact that $-1 \le \cos \frac 1 x \le 1$ and $x\to0$ and one further fact not mentioned in your question: $$ \frac x {\sin x} \to 1 \text{ as } x\to0. $$ Without that last fact or something else other than what's in your qu...
Use *asymptotic analysis*: you know $\sin x \sim\_0 x$, hence $\dfrac{x^2}{\sin x} \sim\_0 \dfrac{x^2}x=x $. Furthermore, $\Bigl\vert\cos\dfrac1x \Bigr\vert \le 1$, so $$\smash{\dfrac{x^2\cos\dfrac1x}{\sin x}} = O(x)\to 0.$$
58,336
Noise canceling headphones are quite expensive (up to 300 USD) compared to normal headphones, but can boost productivity by creating a sound isolation in noisy environments. Would it be ethically justifiable to buy those for non-research purpose (i.e., it's not needed for experiments)? On one hand, I feel like good of...
2015/11/17
[ "https://academia.stackexchange.com/questions/58336", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/386/" ]
Anything could be ethically justified in the right situation. If the only research scientist that has the ability to unlock the science that provides a way to defeat the evil empire from destroying the universe is rendered incompetent unless availed of free prostitution services to liberate his imagination through sexu...
Let me answer your question in an extreme case: Some labs purchase this type of headphones, at high prices probably. Because they can't do work without it. Their experiments require a step of long time sonication which is really harmful to human ears. Therefore, researchers in order to protect themselves have to wear ...
186,942
I have this script: ``` select name,create_date,modify_date from sys.procedures order by modify_date desc ``` I can see what procedures were modified lately. I will add a "where modify\_date >= " And I'd like to use some system stored procedure, that will generate me : drop + create scripts for the (let's say 5 matc...
2008/10/09
[ "https://Stackoverflow.com/questions/186942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26472/" ]
No cursor necessary (modify as desired for schemas, etc): ``` DECLARE @dt AS datetime SET @dt = '10/1/2008' DECLARE @sql AS varchar(max) SELECT @sql = COALESCE(@sql, '') + '-- ' + o.name + CHAR(13) + CHAR(10) + 'DROP PROCEDURE ' + o.name + CHAR(13) + CHAR(10) + 'GO' + CHAR(13) + CHAR(10) + m.definiti...
This is best done in a more suitable language than SQL. Despite its numerous extensions such as T-SQL, PL/SQL, and PL/pgSQL, SQL is not the best thing for this task. Here is a link to a similar question, and my answer, which was to use SQL-DMO or SMO, depending on whether you have SQL 2000 or 2005. [How to copy a dat...
5,790,180
I search for a word and I get the results with facet as follows: ``` <lst name="itemtype"> <int name="Internal">108</int> <int name="Users">73</int> <int name="Factory">18</int> <int name="Supply Chain Intermediaries">6</int> <int name="Company">1</int> <int name="Monitor/Auditor firm">0</int> </lst> ``` Then I wrot...
2011/04/26
[ "https://Stackoverflow.com/questions/5790180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/644882/" ]
How is your itemtype field analysed? If it is of type string , then use: ``` fq=itemtype:"Supply Chain Intermediaries" ``` Otherwise you can also try: ``` fq=itemtype:(Supply Chain Intermediaries) ``` Assuming `OR` is the default operator in your config and `text` is the default search field, your query will get...
I have tried different solutions mentioned here, but none of them worked. However I solved it like this: ``` fq=itemtype: *Supply\ Chain\ Intermediaries* ``` Here space will be escaped with `\` The above string will match with the strings `Lorem Supply Chain Intermediaries Ipsum` If you are having a word starts w...
60,170,262
I am solving this problem: > > Given a string str containing alphanumeric characters, calculate sum > of all numbers present in the string. > > > **Input:** The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains a string containing alpha...
2020/02/11
[ "https://Stackoverflow.com/questions/60170262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11820554/" ]
I would loop backwards over the string. No nested loops. Just take the 10s exponent as you move left You have the length of the string, so there should be no reason to check for NUL char yourself (untested code, but shows the general idea) ``` #include <math.h> l=strlen(a); int exp; exp = 0; for(i = l-1; i >= 0...
You will have to change the logic in your while loop as well if you wish to change that in your for loop condition because it's quite possible number exists at the end of the string as well, like in one of your inputs `1abc2x30yz67`. So, correct code would look like: **Snippet:** ``` for(i=0;a[i]!='\0';i++) { ...
4,729
I'm a young member (as of April 15, 2015 I've been here for 45 days) and I've noticed a lot of questions that get closed for being opinion based or off topic. This is especially true with [shopping questions](http://blog.stackoverflow.com/2010/11/qa-is-hard-lets-go-shopping/). Looking at the newest 30 questions, 10 o...
2015/04/15
[ "https://photo.meta.stackexchange.com/questions/4729", "https://photo.meta.stackexchange.com", "https://photo.meta.stackexchange.com/users/38156/" ]
For what it's worth, I'm probably what you'd call a new member and a relative newcomer to serious photography. I've asked a few questions and got valuable actionable answers on a level that I could understand. I've also learned a great deal from the other questions and answers addressing things that I wanted to learn a...
> > This makes me think that we may be scaring off new users from ever joining or contributing because they don't want to have their question rejected. > > > An alternative interpretation is that the people who come here to ask shopping questions are coming for the wrong reason in the first place. Finding that thi...
288,388
I know that 1.11 /fill and /setblock use block data instead of block data. However, when I try to fill an area with sticky pistons facing up, it days that my data values are incorrect. I've tried the following with various capitalizations: ``` /fill x1 y1 z1 x2 y2 z2 sticky_piston {facing:up} /fill x1 y1 z1 x2 y2 z2 s...
2016/10/17
[ "https://gaming.stackexchange.com/questions/288388", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/161585/" ]
Block states should be in the format `variable=value`: ``` /fill x1 y1 z1 x2 y2 z2 sticky_piston facing=up ``` Block states are also still just an alternative to numeric data values. You can use data values if you wish: ``` /fill x1 y1 z1 x2 y2 z2 sticky_piston 1 ``` From the curly brackets (`{`,`}`) and colon (...
The way that you would do this would be /fill x1 y1 z1 x2 y2 z2 sticky\_piston[facing=up]. Curly brackets and colons aren't for NBT data these days. If you want to learn more about /fill, here is a video that might help you:
10,357,266
I am displaying information as a checkbox with `ThreeState` enabled, and want to use a nullable boolean in simplest way possible. Currently I am using a nested ternary expression; but is there a clearer way? ``` bool? foo = null; checkBox1.CheckState = foo.HasValue ? (foo == true ? CheckState.Checked : CheckState...
2012/04/27
[ "https://Stackoverflow.com/questions/10357266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161052/" ]
That's how I would do it. I would add an extension method to clean it up a bit. ``` public static CheckState ToCheckboxState(this bool booleanValue) { return booleanValue.ToCheckboxState(); } public static CheckState ToCheckboxState(this bool? booleanValue) { return booleanValue.H...
More clear is an arguable statement. For example I could say that this is more clear. ``` if(foo.HasValue) { if(foo == true) checkBox1.CheckState = CheckState.Checked; else checkBox1.CheckState = CheckState.Unchecked; } else checkBox1.CheckState = CheckState.Indeterminate; ``` Another opt...
68,820,920
I am trying to use participant record IDs on the y axis in my ggplot. The record IDs skip around (e.g. 1, 3, 10, 100). My question is three-fold: 1. I'd like to display each ID on the y axis, but when I convert to `as.numeric(as.character(record_id)))`, the axis is ordered but doesn't take into account that the record...
2021/08/17
[ "https://Stackoverflow.com/questions/68820920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16368087/" ]
You could try converting the numbers to factors: ```r library(ggplot2) df$record_id <- factor(df$record_id, levels = df$record_id) ggplot(df, aes(x = value, y = record_id)) + geom_col() ``` ![](https://i.imgur.com/eCAzIXG.png) Created on 2021-08-17 by the [reprex package](https://reprex.tidyverse.org) (v2.0.0)...
One option in the spirit of your first proposal might be to assign your nonconsecutive numeric IDs a rank based on their value, e.g.: ``` df$record_id_rank <- rank(df$record_id) ``` Note that rank will generate float values in the case of duplicate IDs, which it sounds like you may have in your long data. In that ca...
64,872
I can't figure out how can I get event. I was trying with "contract.NewVoting().watch{}" but it says that watch is not a function. I found out that watch has been removed and there is EventEmitter instead. Here is a part of my not working yet code: Solidity: ``` contract AddNewVotingBuilder is BaseBuilder { f...
2019/01/01
[ "https://ethereum.stackexchange.com/questions/64872", "https://ethereum.stackexchange.com", "https://ethereum.stackexchange.com/users/47855/" ]
If you're on version 5 of Truffle you can use `getPastEvents()` from Web3js : for example something like: `await builder.getPastEvents( 'NewVoting', { fromBlock: 0, toBlock: 'latest' } )` ref: <https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#getpastevents>
Listening for events is something you do in the background, so you should make sure you are watching for the events before calling the function that emits the event. Change the code to: ```js console.log("building add voting contract..."); await deployer.deploy(AddNewVotingBuilder); let builder = await BaseBuilder....
11,253,329
I'm trying to compile a *very* big, multi-project Android project using command line Ant. I was originally using Ant 1.8.3, but have since upgraded to 1.8.4 (in vain, it turns out). While I do have Eclipse installed (Indigo, updated today), the nature of this project precludes using Ant from within Eclipse for this. T...
2012/06/28
[ "https://Stackoverflow.com/questions/11253329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/584746/" ]
A partial answer to this one. Thanks goes to the current respondents, who helped me track this down. There are, apparently, *two* (possibly three?) different places where the Java VM opts need to be changed, depending on exactly where the error occurs. In this case, the `ANT_OPTS` are *not* getting passed to Dex. I w...
Watch out for wrong directories, invalid symbolic links, or missed files. For example, if your build.xml relies on a symbolic link that points to a folder that does not exist, the “GC Overhead Limit Exceeded” error may be triggered when in reality it doesn't has nothing to do with memory or garbage collection issue.
67,154,325
I have a YAML file that I need to iterate and return a specific value for a variable, I am unable to use jq so the only available tool I have is bash. The YAML file looks like this: ``` abc: NAME: Bob OCCUPATION: Technician def: NAME: Jane OCCUPATION: Engineer ``` YAML keys are known and will be iterated ove...
2021/04/18
[ "https://Stackoverflow.com/questions/67154325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3674993/" ]
This answer is also a bit convoluted, but I can't think of anything simpler. With GNU sed: ``` sed -n '/abc/,/^.*OCCUPATION/{s/.*OCCUPATION\(.*\):\ \(.*\)/\2/p}' test.yaml ``` Explanation: Find the lines between "abc" and "OCCUPATION" (lines 1 to 3) then from the OCCUPATION line, print the second captured group (the...
With `awk` you can try this: ``` awk -F'[[:blank:]]+' '$1 == "" {if (s == "abc:" && $2 == "OCCUPATION:") print $3; next} {s=$1}' file Technician ``` or the two values: ``` awk -F'[[:blank:]]+' '$1 == "" {if (s ~ /^(abc:|def:)$/ && $2 == "OCCUPATION:") print $3; next} {s=$1}' file Technician Engineer ```
26,728,022
Given an array of objects, what is the best way to find the object with a particular key in JS? Using jQuery and underscoreJS is fine. I'm just looking for the easiest / least code answer. **Example:** An array of objects, where each object has a "name". Find the object with a particular "name". `var people = [{name...
2014/11/04
[ "https://Stackoverflow.com/questions/26728022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1001938/" ]
You should go with [grep](http://api.jquery.com/jquery.grep/) of jQuery ``` var people = [{name: "A"}, {name: "B"}, {name: "C"}]; var obj1= jQuery.grep(people,function(n,i){return (n.name=='A')}) ```
I'm surprised not to find the obvious answer here, so: To do that with Underscore, you'd use [`_.find`](https://underscorejs.org/#find): ``` function getObject(myArray, searchKey, searchValue) { return _.find(myArray, function(entry) { return entry[seachKey] === searchValue; }); } ``` You don't need Underscore f...
70,318
> > Now faith is **the substance** of things hoped for, the evidence of > things not seen. (Hebrews 11:1, KJV) > > > ἕστιν δὲ πίστις ἐλπιζομένων **ὑπόστασις** πραγμάτων ἔλεγχος οὐ > βλεπομένων (TR) > > > What is this "substance" (ὑπόστασις) of things hoped for? If something is "hoped for," it seems it would be s...
2021/10/22
[ "https://hermeneutics.stackexchange.com/questions/70318", "https://hermeneutics.stackexchange.com", "https://hermeneutics.stackexchange.com/users/42955/" ]
I agree that the Latin meaning of "substance" is closest to the Greek ὑπόστασις, but the English word has a somewhat different meaning from the Latin. BDAG might be helpful here. That lexicon gives this meaning and comment: > > (1) **the essential or basic structure/nature of an entity, > *substantial nature, essenc...
Elisha's servant had an interesting experience in 2 Kings 6: > > 15 When the servant of the man of God got up and went out early the next morning, an army with horses and chariots had surrounded the city. “Oh no, my lord! What shall we do?” the servant asked. > > > The servant saw the physical army of the king of...
23,345,355
i have this multiple checkbox. ``` <div ng-repeat="setting in settings"> <input type="checkbox" name="setting.name" ng-model="setting.value">{{setting.name}} ``` and in the controller ``` $scope.settings = [{ name: 'OrderNr', value: '' }, { name: 'CustomerNr', ...
2014/04/28
[ "https://Stackoverflow.com/questions/23345355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3374467/" ]
What about using $cookies. Have a look at [angularjs docs](https://docs.angularjs.org/api/ngCookies/service/%24cookies) Basically all you need to do is inject the service in the controller as a dependency and use it as an object. In your controller: ``` $scope.saveSetting = function() { $cookies.settings = $sco...
I would use ngStorage directive. I use it in my app. You would simply set the settings to your storage using ngStorage and then also set the initial value for your settings via ngStorage when the controller loads. <https://github.com/gsklee/ngStorage>
27,522,555
According to <http://developer.android.com/training/basics/activity-lifecycle/recreating.html> > > The system may also destroy your activity if it's currently stopped and hasn't been used in a long time. > > > Exactly how long is this time? For example, when the user pressed the home button.
2014/12/17
[ "https://Stackoverflow.com/questions/27522555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2986001/" ]
There is no way of knowing how long that will be. When use presses home button activity is stopped and at that moment on it can be destroyed at any time. From Android Activity documentation: If an activity is completely obscured by another activity, it is stopped. It still retains all state and member information, ho...
If you want to carry out an experiment, you can create a weak reference to the activity and pull it, say, from a separate thread. When the activity is garbage-collected, the reference will become null.
2,562,250
We have a javascript function we use to track page stats internally. However, the URLs it reports many times include the page numbers for search results pages which we would rather not be reported. The pages that are reports are of the form: ``` http://www.test.com/directory1/2 http://www.test.com/directory1/subdirect...
2010/04/01
[ "https://Stackoverflow.com/questions/2562250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191205/" ]
You can use a regex for this: ``` document.location.pathname.replace(/\/\d+$/, ""); ``` Unlike `substring` and `lastIndexOf` solutions, this will strip off the end of the path if it consists of digits only.
What you can do is find the last index of "/" and then use the substring function.
30,665,416
I'm trying to understand why the following doesn't work. As far as I understand it shouldn't give me a box shadow if the `form__group` element is a child of `.modal` yet it does. ``` div:not(.modal) .form__group:hover { box-shadow: inset 10px 0 0 #ccc; } ``` <http://codepen.io/anon/pen/mJmddj>
2015/06/05
[ "https://Stackoverflow.com/questions/30665416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1461864/" ]
Your HTML is: ``` <div class="modal"> <div class="modal__body"> <div class="form__group"> Hover on me for the box shadow - it shouldn't be there </div> </div> </div> ``` When you remove the modal div, you get: ``` <div class="modal__body"> <!-- fits the "div:not(.modal)" --> <div class="form...
"Selector form\_\_group is never used This inspection detects unused CSS classes or IDs within a file. "
4,336,687
In [SQL and Relational Theory](http://oreilly.com/catalog/9780596523084) (C.J. Date, 2009) chapter 4 advocates avoiding duplicate rows, and also to avoid `NULL` attributes in the data we store. While I have no troubles avoiding duplicate rows, I am struggling to see how I can model data without making use of `NULL`. Ta...
2010/12/02
[ "https://Stackoverflow.com/questions/4336687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74497/" ]
**NULLs are required - theres no need to replace them** The enitre definition of NULL is that its unknown - simply replacing this with arbitrary type is doing the same thing, so why? For the comments below: Just tried this - neither is true: ``` declare @x char set @x = null if @x = @x begin select 'true' end if ...
I disagree with the author and would claim that NULL is actually the CORRECT way to handle missing data for optional fields. In fact, it's the reason that NULL exists at all... For your specific problem regarding gender: * Are you sure you want a gender table and incur the cost of an extra join for every query? For s...
31,002,979
Edit: I added some Information I thought to be unnecessary, but is not. I have two branches, A and B. After making three commits in A that changes file.c I want to cherry-pick them into B, there is also a file.h which was changed in A~1 ``` > git cherry-pick A~2 Success > git cherry-pick A~1 error: could not apply 81e...
2015/06/23
[ "https://Stackoverflow.com/questions/31002979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3037258/" ]
It's possible the cherry-pick is changing a function that had also been changed earlier in `B`'s history, so the changes specifically in `A~1` are to lines that already looked different from what's in the `B` version and git can't see where in `B` the cherry-pick's changes apply. It's also possible that the context gi...
Cherry picking is no different than applying a set of patches in order (with the benefit of getting previous commit messages). This necessarily results in new blobs--which you can verify by noting that he commit sha's are different. When merge time comes, `git` now thinks it's looking at a different history, because ...
132,606
Let $x$ and $y$ be defined such that ``` x=(((-3 + r) r^2 + a^2 (1 + r)) Csc[θ])/(a (-1 + r)) y=Sqrt[(a^2 (a^2 (1 + r)^2 + 2 r^2 (-3 + r^2)) + a^4 (-1 + r)^2 Cos[θ]^2 - ((-3 + r) r^2 + a^2 (1 + r))^2 Csc[θ]^2)/(a^2 (-1 + r)^2)] ``` Where for each value of $0<a<1$ and $0<\theta<\frac{\pi}{2}$ we can plot a *...
2016/12/02
[ "https://mathematica.stackexchange.com/questions/132606", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/38538/" ]
``` x[a_, r_, t_] := (((-3 + r) r^2 + a^2 (1 + r)) Csc[t])/(a (-1 + r)) y[a_, r_, t_] := Sqrt[(a^2 (a^2 (1 + r)^2 + 2 r^2 (-3 + r^2)) + a^4 (-1 + r)^2 Cos[t]^2 - ((-3 + r) r^2 + a^2 (1 + r))^2 Csc[ t]^2)/(a^2 (-1 + r)^2)] tp[a_, t_] := Module[{ cs, c, ra, top = u /. Solve[D[y[a, u, t], u] == 0, u...
ok, so you have the parametric plot: ``` pp = ParametricPlot[{{x, y}, {x, -y}}, {r, -10, 10}] ``` ![Mathematica graphics](https://i.stack.imgur.com/qV4Df.png) We can get the desired points from this plot: ``` pts = Flatten[Cases[pp, Line[pts__] :> pts, Infinity], 1]; xmax = First@MaximalBy[pts, First]; ymax = Firs...
106,111
I've got one year of University left and luckily I've managed to stash around **~$18k** in savings that my expenses never cut into. My tuition for my last year will probably be around **$13k**. I hate the idea of being in debt - but aside from emptying my savings account, the alternative is that **I take OSAP to cove...
2019/03/06
[ "https://money.stackexchange.com/questions/106111", "https://money.stackexchange.com", "https://money.stackexchange.com/users/83134/" ]
The core of the answer here is independent of the specifics of the Canadian education funding system, IMO. You are approaching the transition to *earning your own living,* and having to operate within the financial constraints which that imposes on you. Keeping a cash "emergency fund" of a couple of thousand dollars ...
The endowment effect is a psychological theory that people value things they already have more than the same things if they were thinking of obtaining them. <https://en.wikipedia.org/wiki/Endowment_effect> To try and verify you aren't suffering from this think about your situation like this. You are 13k in debt and yo...
212,439
I recently experienced a roof leak on a heavy raining day in the east coast. Picture 1: This is the interior ceiling. I tore open the ceiling sheetrock and could see that water was dripping from the horizontal wood beams. When I checked with a flashlight between the horizontal beams I can see a tiny hole on the black ...
2020/12/29
[ "https://diy.stackexchange.com/questions/212439", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/127625/" ]
Your problem is going to be finding where the leak is coming from. I have found leaks that came in more than 10’ from the entry point. The water can travel under the rolled roofing and drip down at a seam then run on the rafters especially double plates prior to finally coming down. Today I use a FLIR camera I can see...
I would ask a few more questions, like, is this a home you plan on living in for years or just a long term Airbnb that you want to patch ? Maybe I'm misunderstanding your comment about the hole, but couldn't you just insert a stiff wire at that point and have someone up on the roof look for it?. If not measure the dis...
20,006,871
I have a basic PHP script that creates a csv file from an array. Here is an example of the code: ``` $array = [ [1,2,3], [4,5,6] ]; $handle = fopen('test.csv', 'w'); foreach($array as $v) fputcsv($handle, $v); fclose($handle); ``` The resulting file always has a blank line at the end of the file, beca...
2013/11/15
[ "https://Stackoverflow.com/questions/20006871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1564018/" ]
I found this solution on another question: <https://stackoverflow.com/a/8354413/1564018> ``` $stat = fstat($handle); ftruncate($handle, $stat['size']-1); ``` I added these two lines after fputcsv() and they removed the last new line character, removing the blank line at the end of the file.
Add exit(); at the end, after fclose(handle);
5,253,703
I'm trying to overflow a buffer in C++ that is a private variable. Where does it live on the stack? Is this possible? Something like ``` class aClass{ private: char buffer[SIZE]; public: } ```
2011/03/09
[ "https://Stackoverflow.com/questions/5253703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Public and private variables are not treated any differently in terms of layout. A class allocated on the stack has it's internal data members allocated on the stack- that's regardless of being private or public. ``` class MyClass { public: int PublicInt; private: int PrivateInt; }; int main() { MyClass i...
Writing past the array can be considered as an example of buffer overflow. You can do this how ever, but I don't know what you are trying to achieve by doing so. ``` void aClass:: bufferOverflow() // Assuming this a member of aClass { for( int i=0; i<(SIZE+2), ++i ) buffer[i] = 'a'; // Writing past t...
43,147,546
For Example :- I have saved date in my table in the format of **ddmmyyyy** Now I need to fetch rows of month **03** So my query can be ``` Select * from orders where date = "%03%" ``` But it will bring values of date 03 and year 2003 too. Is there anyway to fetch the values where the **03** is in the position...
2017/03/31
[ "https://Stackoverflow.com/questions/43147546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6608983/" ]
``` Select * from orders where month(str_to_date(date,'%d%m%Y')) = 03 ```
date is stored in "Y-m-d" format in MySQL, if you have stored your date as a text then you can try ``` SELECT * FROM `orders` WHERE `date` LIKE "__03____";; ```
38,233,157
(With static and dynamic I mean the distinction whether code is susceptible to change) I have a bit of a weird problem I'm currently stuck on. I'm writing an application which involves some complex interactions between components in which it becomes hard to keep track of the code flow. To simplify this, I'm trying to ...
2016/07/06
[ "https://Stackoverflow.com/questions/38233157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443647/" ]
Final Code: ``` Public Sub replacewordwithline(ByVal input As RichTextBox, ByVal sep As Char, Optional ByVal output As RichTextBox = Nothing) Dim tb As New TextBox 'Create a new textbox Dim orgstr As String = input.Text 'Make a backup of the input text tb.Multiline = True tb.Text = My.Computer.FileSyst...
``` Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click Dim LSOS As Integer = Nothing Dim linelentgh As Integer = File.ReadAllLines(Application.StartupPath + "\test.txt").Length Do Until LSOS >= linelentgh Dim line As String = File.ReadLines(Application.StartupPath +...
32,225,604
I use this git repo: <https://github.com/kudago/smart-app-banner> I downloaded it with `git clone https://github.com/kudago/smart-app-banner`. Then I tried to install it from its parent dir with: ``` npm install --save smart-app-banner ``` This always installs the source from the github repo instead of from the l...
2015/08/26
[ "https://Stackoverflow.com/questions/32225604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1055664/" ]
npm install /path it is as simple as that
If you run npm install without any arguments, it tries to install the current folder. Go to that folder and type npm Install or Just put that downloaded File in Node\_modules folder of your project.